public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight
@ 2015-06-11 10:25 Hannes Schmelzer
  2015-06-11 20:07 ` Simon Glass
  2015-06-18 22:46 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Schmelzer @ 2015-06-11 10:25 UTC (permalink / raw)
  To: u-boot

in future we support yet another b&r am335x based board, where Timer 5 is
wired to backlight-driver.

So we introduce a new driver-type '2' to setup timer5 instead timer6.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

---

 board/BuR/common/common.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 7830d1a..441465c 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -64,8 +64,7 @@ void lcdbacklight(int on)
 	unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
 #endif
 	unsigned int tmp;
-
-	struct gptimer *const timerhw = (struct gptimer *)DM_TIMER6_BASE;
+	struct gptimer *timerhw;
 
 	if (on)
 		bright = bright != ~0UL ? bright : 50;
@@ -73,6 +72,14 @@ void lcdbacklight(int on)
 		bright = 0;
 
 	switch (driver) {
+	case 2:
+		timerhw = (struct gptimer *)DM_TIMER5_BASE;
+		break;
+	default:
+		timerhw = (struct gptimer *)DM_TIMER6_BASE;
+	}
+
+	switch (driver) {
 	case 0:	/* PMIC LED-Driver */
 		/* brightness level */
 		tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
@@ -83,7 +90,8 @@ void lcdbacklight(int on)
 				   bright != 0 ? 0x0A : 0x02,
 				   0xFF);
 		break;
-	case 1: /* PWM using timer6 */
+	case 1:
+	case 2: /* PWM using timer */
 		if (pwmfrq != ~0UL) {
 			timerhw->tiocp_cfg = TCFG_RESET;
 			udelay(10);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight
  2015-06-11 10:25 [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight Hannes Schmelzer
@ 2015-06-11 20:07 ` Simon Glass
  2015-06-12  5:25   ` Hannes Schmelzer
  2015-06-18 22:46 ` [U-Boot] " Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2015-06-11 20:07 UTC (permalink / raw)
  To: u-boot

Hi,

On 11 June 2015 at 04:25, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
>
> in future we support yet another b&r am335x based board, where Timer 5 is
> wired to backlight-driver.
>
> So we introduce a new driver-type '2' to setup timer5 instead timer6.
>
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
>

Reviewed-by: Simon Glass <sjg@chromium.org>

You might consider using an enum for the board type.

> ---
>
>  board/BuR/common/common.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
> index 7830d1a..441465c 100644
> --- a/board/BuR/common/common.c
> +++ b/board/BuR/common/common.c
> @@ -64,8 +64,7 @@ void lcdbacklight(int on)
>         unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
>  #endif
>         unsigned int tmp;
> -
> -       struct gptimer *const timerhw = (struct gptimer *)DM_TIMER6_BASE;
> +       struct gptimer *timerhw;
>
>         if (on)
>                 bright = bright != ~0UL ? bright : 50;
> @@ -73,6 +72,14 @@ void lcdbacklight(int on)
>                 bright = 0;
>
>         switch (driver) {
> +       case 2:
> +               timerhw = (struct gptimer *)DM_TIMER5_BASE;
> +               break;
> +       default:
> +               timerhw = (struct gptimer *)DM_TIMER6_BASE;
> +       }
> +
> +       switch (driver) {
>         case 0: /* PMIC LED-Driver */
>                 /* brightness level */
>                 tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
> @@ -83,7 +90,8 @@ void lcdbacklight(int on)
>                                    bright != 0 ? 0x0A : 0x02,
>                                    0xFF);
>                 break;
> -       case 1: /* PWM using timer6 */
> +       case 1:
> +       case 2: /* PWM using timer */
>                 if (pwmfrq != ~0UL) {
>                         timerhw->tiocp_cfg = TCFG_RESET;
>                         udelay(10);
> --
> 2.1.4
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight
  2015-06-11 20:07 ` Simon Glass
@ 2015-06-12  5:25   ` Hannes Schmelzer
  0 siblings, 0 replies; 4+ messages in thread
From: Hannes Schmelzer @ 2015-06-12  5:25 UTC (permalink / raw)
  To: u-boot

Hi Simon,

board_type doesn't apply here.

The board can be used in

Device-Type A
Device-Type B
Device-Type C

all of them may have different backlights.
So it comes, that device-type A has different variants where one has 
backlight using PMIC, the other one has backlight using PWM.

For this we have an entry within the device-tree (brightdrv) on linux 
devices, and on vxworks-devices (where we don't have a device-tree) we 
have same as variable in environment.

The board_type variable is used to separate "Device-Type A, Device-Type 
B, ..."

At this time only one of my boards (brxre2, not committed yet) has this 
variable in use.

best regards,
Hannes

On 2015-06-11 22:07, Simon Glass wrote:
> Hi,
>
> On 11 June 2015 at 04:25, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
>> in future we support yet another b&r am335x based board, where Timer 5 is
>> wired to backlight-driver.
>>
>> So we introduce a new driver-type '2' to setup timer5 instead timer6.
>>
>> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
>>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> You might consider using an enum for the board type.
>
>> ---
>>
>>   board/BuR/common/common.c | 14 +++++++++++---
>>   1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
>> index 7830d1a..441465c 100644
>> --- a/board/BuR/common/common.c
>> +++ b/board/BuR/common/common.c
>> @@ -64,8 +64,7 @@ void lcdbacklight(int on)
>>          unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
>>   #endif
>>          unsigned int tmp;
>> -
>> -       struct gptimer *const timerhw = (struct gptimer *)DM_TIMER6_BASE;
>> +       struct gptimer *timerhw;
>>
>>          if (on)
>>                  bright = bright != ~0UL ? bright : 50;
>> @@ -73,6 +72,14 @@ void lcdbacklight(int on)
>>                  bright = 0;
>>
>>          switch (driver) {
>> +       case 2:
>> +               timerhw = (struct gptimer *)DM_TIMER5_BASE;
>> +               break;
>> +       default:
>> +               timerhw = (struct gptimer *)DM_TIMER6_BASE;
>> +       }
>> +
>> +       switch (driver) {
>>          case 0: /* PMIC LED-Driver */
>>                  /* brightness level */
>>                  tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
>> @@ -83,7 +90,8 @@ void lcdbacklight(int on)
>>                                     bright != 0 ? 0x0A : 0x02,
>>                                     0xFF);
>>                  break;
>> -       case 1: /* PWM using timer6 */
>> +       case 1:
>> +       case 2: /* PWM using timer */
>>                  if (pwmfrq != ~0UL) {
>>                          timerhw->tiocp_cfg = TCFG_RESET;
>>                          udelay(10);
>> --
>> 2.1.4
>>
> Regards,
> Simon
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] board/BuR/common: support timer5 for pwm-backlight
  2015-06-11 10:25 [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight Hannes Schmelzer
  2015-06-11 20:07 ` Simon Glass
@ 2015-06-18 22:46 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2015-06-18 22:46 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 11, 2015 at 12:25:43PM +0200, Hannes Petermaier wrote:

> in future we support yet another b&r am335x based board, where Timer 5 is
> wired to backlight-driver.
> 
> So we introduce a new driver-type '2' to setup timer5 instead timer6.
> 
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150618/55700bad/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-18 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 10:25 [U-Boot] [PATCH] board/BuR/common: support timer5 for pwm-backlight Hannes Schmelzer
2015-06-11 20:07 ` Simon Glass
2015-06-12  5:25   ` Hannes Schmelzer
2015-06-18 22:46 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox