From: Ian Pilcher <arequipeno@gmail.com>
To: "Kim, Milo" <Milo.Kim@ti.com>
Cc: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: Registering GPIO LEDs
Date: Thu, 08 Aug 2013 22:51:49 -0500 [thread overview]
Message-ID: <52046755.7010602@gmail.com> (raw)
In-Reply-To: <A874F61F95741C4A9BA573A70FE3998F82E868B9@DQHE06.ent.ti.com>
On 08/08/2013 09:08 PM, Kim, Milo wrote:
> From the viewpoint of a GPIO consumer, we don't care the base GPIO number.
> That is required when a GPIO controller is added.
> Just check '/sys/kernel/debug/gpio' and use available GPIOs for LEDs.
Hmm. I'm using leds-gpio, and it certainly does seem to care about GPIO
numbers. As a point of reference, here's what I'm doing to set up my
drive activity LEDs:
#define N5550_ICH_GPIO_BASE 195
#define N5550_DISK_ACT_0_GPIO (N5550_ICH_GPIO_BASE + 0)
#define N5550_DISK_ACT_1_GPIO (N5550_ICH_GPIO_BASE + 2)
#define N5550_DISK_ACT_2_GPIO (N5550_ICH_GPIO_BASE + 3)
#define N5550_DISK_ACT_3_GPIO (N5550_ICH_GPIO_BASE + 4)
#define N5550_DISK_ACT_4_GPIO (N5550_ICH_GPIO_BASE + 5)
static struct gpio_led n5550_disk_act_leds[5] = {
{
.name = "n5550:green:disk-act-0",
.default_trigger = "thecus-ahci-0",
.gpio = N5550_DISK_ACT_0_GPIO,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
{
.name = "n5550:green:disk-act-1",
.default_trigger = "thecus-ahci-1",
.gpio = N5550_DISK_ACT_1_GPIO,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
{
.name = "n5550:green:disk-act-2",
.default_trigger = "thecus-ahci-2",
.gpio = N5550_DISK_ACT_2_GPIO,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
{
.name = "n5550:green:disk-act-3",
.default_trigger = "thecus-ahci-3",
.gpio = N5550_DISK_ACT_3_GPIO,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
{
.name = "n5550:green:disk-act-4",
.default_trigger = "thecus-ahci-4",
.gpio = N5550_DISK_ACT_4_GPIO,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
};
As you can see, every LED has a GPIO number (.gpio), which comes from
the chip's GPIO base, and that number gets hardcoded into the setup
code. If the ich_gpio driver ever "dynamically" selects a base other
than 195, the LEDs won't work.
I just seems very fragile, and I can't help thinking that there must be
a better way. Maybe a module parameter ...
Thanks!
--
========================================================================
Ian Pilcher arequipeno@gmail.com
Sometimes there's nothing left to do but crash and burn...or die trying.
========================================================================
next prev parent reply other threads:[~2013-08-09 3:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 22:51 Registering GPIO LEDs Ian Pilcher
2013-08-09 2:08 ` Kim, Milo
2013-08-09 3:51 ` Ian Pilcher [this message]
2013-08-09 5:26 ` Kim, Milo
2013-08-13 23:35 ` Ian Pilcher
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=52046755.7010602@gmail.com \
--to=arequipeno@gmail.com \
--cc=Milo.Kim@ti.com \
--cc=linux-leds@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).