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

From: Hermes Zhang
Date: Wed Mar 17 2021 - 22:12:25 EST


> > + 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) {
> > + dev_err(dev, "cannot get low-gpios %d\n", ret);
> > + return ret;
> > + }
> > +
> > + priv->high_gpio = devm_gpiod_get(dev, "high", GPIOD_OUT_LOW);
> > + ret = PTR_ERR_OR_ZERO(priv->high_gpio);
> > + if (ret) {
> > + dev_err(dev, "cannot get high-gpios %d\n", ret);
> > + return ret;
> > + }
>
> Actually... I'd call it led-0 and led-1 or something. Someone may/will come
> with 4-bit GPIO LED one day, and it would be cool if this could be used with
> minimal effort.
>
> Calling it multi_led in the driver/bindings would bnot be bad, either.
>

Hi all,

I have try to use leds-regulator to implement my case, most works. But the only thing doesn't work is the enable-gpio. In my case, we don't have a real enable gpio, so when we set LED_OFF, it could not off the LED as we expected.

So I think I will back to the new multi LED driver, but make it more generic.

Best Regards,
Hermes