Messages in this thread | | | Date | Wed, 24 Mar 2021 11:40:16 +0100 | From | Pavel Machek <> | Subject | Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver |
| |
Hi!
> > From: Hermes Zhang <chenhuiz@axis.com> > > > > Introduce a new multiple GPIOs LED driver. This LED will made of > > multiple GPIOs (up to 8) and will map different brightness to different > > GPIOs states which defined in dts file. > > I wonder how many boards have such LEDs. > > Also if it wouldn't be better to expand the original leds-gpio driver. > Probably depends on how much larger would such expansion make the > leds-gpio driver.
Let's start with separate.
> Use flexible array members. Allocate with > devm_kzalloc(dev, struct_size(priv, states, priv->nr_states), > GFP_KERNEL)
Better yet, assume the brightness is 0..2^(num leds) and avoid this complexity.
> Again LED_FULL and LED_OFF... > What about default-state = "keep" ? > > Hermes, do you actually have a device that controls LEDs this way? How > many brightness options do they have?
He has two bits.
> Also I think this functionality could be easily incorporated into the > existing leds-gpio driver, instead of creating new driver.
> Moreover your driver can control only one LED, so it needs to be > probed multiple times for multiple LEDs. Meanwhile the leds-gpio driver > can register multiple LEDs in one probe...
The current version is mostly fine. Let's not overcomplicate it.
Best regards, Pavel -- http://www.livejournal.com/~pavelmachek [unhandled content-type:application/pgp-signature] | |