RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-17 Thread Hermes Zhang
> > + priv = devm_kzalloc(dev, sizeof(struct gpio_dual_leds_priv), > GFP_KERNEL); > > + if (!priv) > > + return -ENOMEM; > > + > > + priv->low_gpio = devm_gpiod_get(dev, "low", GPIOD_OUT_LOW); > > + ret = PTR_ERR_OR_ZERO(priv->low_gpio); > > + if (ret) { > > +

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-12 Thread Marek Behun
On Fri, 12 Mar 2021 08:48:55 + Hermes Zhang wrote: > Hi Alexander, > > > Am Donnerstag, 11. März 2021, 14:04:08 CET schrieb Hermes Zhang: > > > From: Hermes Zhang > > > > > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > > > one LED as normal GPIO LED but give

RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-12 Thread Hermes Zhang
Hi Alexander, > Am Donnerstag, 11. März 2021, 14:04:08 CET schrieb Hermes Zhang: > > From: Hermes Zhang > > > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > > one LED as normal GPIO LED but give the possibility to change the > > intensity in four levels: OFF, LOW,

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-12 Thread Alexander Dahl
Hallo Hermes, thanks for your effort. Am Donnerstag, 11. März 2021, 14:04:08 CET schrieb Hermes Zhang: > From: Hermes Zhang > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > one LED as normal GPIO LED but give the possibility to change the > intensity in four levels:

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Marek Behun
On Fri, 12 Mar 2021 04:48:52 + Hermes Zhang wrote: > > > > Sorry, leds-regulator has only a binary state LED. > > > > Maybe you could extend leds-regulator to be able to use all regulator > > states? > > > > Or you can extend leds-gpio driver to support N states via log N gpios, > >

RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Hermes Zhang
> > Sorry, leds-regulator has only a binary state LED. > > Maybe you could extend leds-regulator to be able to use all regulator states? > > Or you can extend leds-gpio driver to support N states via log N gpios, > instead of adding new driver. It seems a good idea to extend leds-gpio, so in

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Pavel Machek
Hi! > + priv = devm_kzalloc(dev, sizeof(struct gpio_dual_leds_priv), > GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + priv->low_gpio = devm_gpiod_get(dev, "low", GPIOD_OUT_LOW); > + ret = PTR_ERR_OR_ZERO(priv->low_gpio); > + if (ret) { > +

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Pavel Machek
Hi! > From: Hermes Zhang > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > one LED as normal GPIO LED but give the possibility to change the > intensity in four levels: OFF, LOW, MIDDLE and HIGH. Do you have hardware that uses it? Seems reasonably sane, but: >

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Marek Behun
On Thu, 11 Mar 2021 16:38:14 +0100 Marek Behun wrote: > LED_FULL, LED_HALF, LED_OFF are deprecated. > > And this driver is redundant. This can be done with leds-regulator, > with a gpio-regulator. > > Marek Sorry, leds-regulator has only a binary state LED. Maybe you could extend

Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Marek Behun
LED_FULL, LED_HALF, LED_OFF are deprecated. And this driver is redundant. This can be done with leds-regulator, with a gpio-regulator. Marek