On Mon, Aug 27, 2012 at 10:24 AM, Marek Vasut <marek.vasut@xxxxxxxxx> wrote: > Dear Bryan Wu, > >> On Sun, Aug 26, 2012 at 5:12 PM, Marek Vasut <marex@xxxxxxx> wrote: >> > Dear Bryan Wu, >> > >> >> On Sun, Aug 26, 2012 at 3:30 AM, Marek Vasut <marex@xxxxxxx> wrote: >> >> > Add call to pinctrl, so the gpio-leds driver can configure the >> >> > pin multiplexing of GPIOs driving the LEDs connected to them. >> >> >> >> You just introduce a new instant 'pinctrl', but there is no code use >> >> it in this driver? Did I miss something? >> > >> > I just need this gpio-leds driver to configure the pins for me, did I go >> > wrong about it? Please advise. >> >> Maybe I don't understand how to use this 'pinctrl' in this patch, >> since I didn't see any code to use that. >> Could you please post code to configure the pins in gpio-leds driver? > > It's not code that uses this, it's a DT property. But then, if the DT property > is not present, this fails ... so this patch is wrong. The pinctrl is used by > simply specifying the "pinctrl-names" and "pinctrl-0" properties in the DT file. > I know this. What I don't understand of this patch is "how to use 'struct pinctrl *pinctrl;' which you get from DT tree"? So if there is no such property in DT, it will return an error, I don't think this is necessary. And if there is a property in DT, the *pinctrl will point to some instant. but there is no code to use this instant to control any pins in leds-gpio driver. And why we need this to control pins in leds-gpio driver, since we can use gpio generic API to do that? Thanks, -Bryan > But I wonder how to go about this. > >> -Bryan >> >> >> > Signed-off-by: Marek Vasut <marex@xxxxxxx> >> >> > Cc: Bryan Wu <bryan.wu@xxxxxxxxxxxxx> >> >> > Cc: Richard Purdie <rpurdie@xxxxxxxxx> >> >> > Cc: Grant Likely <grant.likely@xxxxxxxxxxxx> >> >> > Cc: Rob Herring <rob.herring@xxxxxxxxxxx> >> >> > Cc: linux-leds@xxxxxxxxxxxxxxx >> >> > --- >> >> > >> >> > drivers/leds/leds-gpio.c | 6 ++++++ >> >> > 1 file changed, 6 insertions(+) >> >> > >> >> > diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c >> >> > index cde85ba..877d69e 100644 >> >> > --- a/drivers/leds/leds-gpio.c >> >> > +++ b/drivers/leds/leds-gpio.c >> >> > @@ -20,6 +20,7 @@ >> >> > >> >> > #include <linux/slab.h> >> >> > #include <linux/workqueue.h> >> >> > #include <linux/module.h> >> >> > >> >> > +#include <linux/pinctrl/consumer.h> >> >> > >> >> > struct gpio_led_data { >> >> > >> >> > struct led_classdev cdev; >> >> > >> >> > @@ -234,8 +235,13 @@ static int __devinit gpio_led_probe(struct >> >> > platform_device *pdev) >> >> > >> >> > { >> >> > >> >> > struct gpio_led_platform_data *pdata = >> >> > pdev->dev.platform_data; struct gpio_leds_priv *priv; >> >> > >> >> > + struct pinctrl *pinctrl; >> >> > >> >> > int i, ret = 0; >> >> > >> >> > + pinctrl = devm_pinctrl_get_select_default(&pdev->dev); >> >> > + if (IS_ERR(pinctrl)) >> >> > + return PTR_ERR(pinctrl); >> >> > + >> >> > >> >> > if (pdata && pdata->num_leds) { >> >> > >> >> > priv = devm_kzalloc(&pdev->dev, >> >> > >> >> > sizeof_gpio_leds_priv(pdata->num_leds) >> >> > , >> >> > >> >> > -- >> >> > 1.7.10.4 >> > >> > Best regards, >> > Marek Vasut > > Best regards, > Marek Vasut -- Bryan Wu <bryan.wu@xxxxxxxxxxxxx> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html