[U-Boot] [RFC PATCH] TWL4030: make LEDs selectable in twl4030_led_init()

Grazvydas Ignotas notasas at gmail.com
Tue Dec 1 15:49:09 CET 2009


On Tue, Dec 1, 2009 at 4:24 PM, Tom <Tom.Rix at windriver.com> wrote:
> Grazvydas Ignotas wrote:
>>
>> Not all boards have both LEDs hooked, so enabling both on
>> boards with single LED will just waste power.
>>
>
> This looks like a pandora specific change.
> Please say something like, "For Pandora, only 1 led is required.. "

ok

> In some cases, the twl4030 led is the only led for the board.
> In this case, it would be good if the twl4030 led was hooked into
> the status led functionality.  There is already an interface to
> turning led's on and off.

Yes, but that code would have to be duplicated for all such boards (as
LEDs are board specific), and it would make more difficult to add
additional non-TWL4030 controlled LEDs later (for example pandora has
some but doesn't expose them to u-boot).

<snip>

>> --- a/drivers/misc/twl4030_led.c
>> +++ b/drivers/misc/twl4030_led.c
>> @@ -39,12 +39,15 @@
>>  #define LEDAPWM                        (0x1 << 4)
>>  #define LEDBPWM                        (0x1 << 5)
>>  -void twl4030_led_init(void)
>> +void twl4030_led_init(int leda_on, int ledb_on)
>>  {
>
> This must change to passing in a #defin-ed parameters.
> This can be something like
>
> void twl4030_led_init(unsigned char ledon)
>
> where ledon can be
>
> at most (LEDAON | LEDBON)
>
> Export LEDAON and LEDBON so the namespace is ok.
> Something like TWL4030_LED_LEDEN_LEDAON etc should be added to
> twl4030.h

ok, will do this then.

>
>> -       unsigned char byte;
>> +       unsigned char byte = 0;
>>  -       /* enable LED */
>> -       byte = LEDBPWM | LEDAPWM | LEDBON | LEDAON;
>> +       /* enable LEDs */
>> +       if (leda_on)
>> +               byte |= LEDAPWM | LEDAON;
>> +       if (ledb_on)
>> +               byte |= LEDBPWM | LEDBON;
>>          twl4030_i2c_write_u8(TWL4030_CHIP_LED, byte,
>>                             TWL4030_LED_LEDEN);
>> diff --git a/include/twl4030.h b/include/twl4030.h
>> index f260ecb..82b3682 100644
>> --- a/include/twl4030.h
>> +++ b/include/twl4030.h
>> @@ -396,6 +396,6 @@ void twl4030_power_mmc_init(void);
>>  /*
>>  * LED
>>  */
>> -void twl4030_led_init(void);
>> +void twl4030_led_init(int leda_on, int ledb_on);
>>   #endif /* TWL4030_H */
>
>


More information about the U-Boot mailing list