From: Tom <Tom.Rix@windriver.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] TWL4030: make LEDs selectable in twl4030_led_init()
Date: Wed, 02 Dec 2009 08:55:36 -0600 [thread overview]
Message-ID: <4B167FE8.2050807@windriver.com> (raw)
In-Reply-To: <1259759326-6214-1-git-send-email-notasas@gmail.com>
Grazvydas Ignotas wrote:
> Not all boards have both LEDs hooked, so enabling both on
> boards with single LED will just waste power. Make it
> possible to choose LEDs by adding argument to
> twl4030_led_init().
>
> Using this turn on only LEDB for pandora, leave both LEDs
> on for all other boards, as it was before this patch.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> board/logicpd/zoom1/zoom1.c | 2 +-
> board/logicpd/zoom2/zoom2.c | 2 +-
> board/overo/overo.c | 2 +-
> board/pandora/pandora.c | 2 +-
> board/ti/beagle/beagle.c | 2 +-
> board/timll/devkit8000/devkit8000.c | 2 +-
> drivers/misc/twl4030_led.c | 11 +++++++----
> include/twl4030.h | 5 ++++-
> 8 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
> index f4d3754..9b308da 100644
> --- a/board/logicpd/zoom1/zoom1.c
> +++ b/board/logicpd/zoom1/zoom1.c
> @@ -62,7 +62,7 @@ int board_init(void)
> int misc_init_r(void)
> {
> twl4030_power_init();
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDA | TWL4030_LEDON_LEDB);
> dieid_num_r();
>
> /*
> diff --git a/board/logicpd/zoom2/zoom2.c b/board/logicpd/zoom2/zoom2.c
> index dadbeb6..f40bbc6 100644
> --- a/board/logicpd/zoom2/zoom2.c
> +++ b/board/logicpd/zoom2/zoom2.c
> @@ -148,7 +148,7 @@ int misc_init_r(void)
> {
> zoom2_identify();
> twl4030_power_init();
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDA | TWL4030_LEDON_LEDB);
> dieid_num_r();
>
> /*
> diff --git a/board/overo/overo.c b/board/overo/overo.c
> index d42dc13..a2942ce 100644
> --- a/board/overo/overo.c
> +++ b/board/overo/overo.c
> @@ -67,7 +67,7 @@ int board_init(void)
> int misc_init_r(void)
> {
> twl4030_power_init();
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDA | TWL4030_LEDON_LEDB);
>
> #if defined(CONFIG_CMD_NET)
> setup_net_chip();
> diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
> index 460ed12..df2c71a 100644
> --- a/board/pandora/pandora.c
> +++ b/board/pandora/pandora.c
> @@ -66,7 +66,7 @@ int misc_init_r(void)
> struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
>
> twl4030_power_init();
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDB);
>
> /* Configure GPIOs to output */
> writel(~(GPIO14 | GPIO15 | GPIO16 | GPIO23), &gpio1_base->oe);
> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
> index 32d501e..e23f7ee 100644
> --- a/board/ti/beagle/beagle.c
> +++ b/board/ti/beagle/beagle.c
> @@ -107,7 +107,7 @@ int misc_init_r(void)
> struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
>
> twl4030_power_init();
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDA | TWL4030_LEDON_LEDB);
>
> /* Configure GPIOs to output */
> writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
> diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
> index db7d2e2..997a7cf 100644
> --- a/board/timll/devkit8000/devkit8000.c
> +++ b/board/timll/devkit8000/devkit8000.c
> @@ -76,7 +76,7 @@ int misc_init_r(void)
>
> twl4030_power_init();
> #ifdef CONFIG_TWL4030_LED
> - twl4030_led_init();
> + twl4030_led_init(TWL4030_LEDON_LEDA | TWL4030_LEDON_LEDB);
> #endif
>
> #ifdef CONFIG_DRIVER_DM9000
> diff --git a/drivers/misc/twl4030_led.c b/drivers/misc/twl4030_led.c
> index bfdafef..d2cc3c8 100644
> --- 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(unsigned int ledon_mask)
> {
> - unsigned char byte;
> + unsigned char byte = 0;
>
> - /* enable LED */
> - byte = LEDBPWM | LEDAPWM | LEDBON | LEDAON;
> + /* enable LEDs */
> + if (ledon_mask & TWL4030_LEDON_LEDA)
> + byte |= LEDAPWM | LEDAON;
TWL4030_LEDON_LEDA and LEDAON are the same.
You can move all the #defined twl4030 bits to twl4030.
So there there should be
#define TWL4030_LED_LEDEN_LEDAON (0x1 << 0)
#define TWL4030_LED_LEDEN_LEDBON (0x1 << 1)
#define TWL4030_LED_LEDEN_LEDAPWM (0x1 << 4)
#define TWL4030_LED_LEDEN_LEDBPWM (0x1 << 5)
These should be listed under the LED define
/* LED */
#define TWL4030_LED_LEDEN 0xEE
> + if (ledon_mask & TWL4030_LEDON_LEDB)
> + 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..d0c62c3 100644
> --- a/include/twl4030.h
> +++ b/include/twl4030.h
> @@ -396,6 +396,9 @@ void twl4030_power_mmc_init(void);
> /*
> * LED
> */
> -void twl4030_led_init(void);
> +#define TWL4030_LEDON_LEDA (1 << 0)
> +#define TWL4030_LEDON_LEDB (1 << 1)
> +
> +void twl4030_led_init(unsigned int ledon_mask);
>
> #endif /* TWL4030_H */
next prev parent reply other threads:[~2009-12-02 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 13:08 [U-Boot] [PATCH] TWL4030: make LEDs selectable in twl4030_led_init() Grazvydas Ignotas
2009-12-02 14:55 ` Tom [this message]
2009-12-02 15:44 ` Grazvydas Ignotas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B167FE8.2050807@windriver.com \
--to=tom.rix@windriver.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.