Re: [PATCH 2/2] leds: sunxi: New driver for the R329/D1 LED controller

From: Maxime Ripard
Date: Thu Sep 09 2021 - 07:36:38 EST


Hi,

On Sun, Sep 05, 2021 at 11:17:19PM -0500, Samuel Holland wrote:
> Hi,
>
> On 9/3/21 5:36 AM, Maxime Ripard wrote:
> > On Thu, Sep 02, 2021 at 06:42:28PM -0500, Samuel Holland wrote:
> >> Some Allwinner sunxi SoCs, starting with the R329, contain an LED
> >> controller designed to drive RGB LED pixels. Add a driver for it using
> >> the multicolor LED framework, and with LEDs defined in the device tree.
> >>
> >> Signed-off-by: Samuel Holland <samuel@xxxxxxxxxxxx>
> >> ---
> >> drivers/leds/Kconfig | 8 +
> >> drivers/leds/Makefile | 1 +
> >> drivers/leds/leds-sunxi.c | 562 ++++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 571 insertions(+)
> >> create mode 100644 drivers/leds/leds-sunxi.c
> >>
> >> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> >> index ed800f5da7d8..559d2ca0a7f4 100644
> >> --- a/drivers/leds/Kconfig
> >> +++ b/drivers/leds/Kconfig
> >> @@ -297,6 +297,14 @@ config LEDS_SUNFIRE
> >> This option enables support for the Left, Middle, and Right
> >> LEDs on the I/O and CPU boards of SunFire UltraSPARC servers.
> >>
> >> +config LEDS_SUNXI
> >> + tristate "LED support for Allwinner sunxi LED controller"
> >> + depends on LEDS_CLASS
> >> + depends on ARCH_SUNXI || COMPILE_TEST
> >> + help
> >> + This option enables support for the LED controller provided in
> >> + some Allwinner sunxi SoCs.
> >> +
> >
> > Same comment for the name
>
> Are you concerned about the help text only, or do you also want me to rename the
> Kconfig symbol?

The driver, the driver symbols and the Kconfig symbol would be nice

> I am happy to change the help text to something like: "This option enables
> support for the LED controller provided in the Allwinner R329 and D1 SoCs."
>
> But I don't know of any satisfying way to rename the Kconfig symbol. There is no
> general category name for "R329 and D1."

Yeah, this is not ideal, but the issue is that nothing is telling us
whether or not it will support *only* the R329 and D1. Chances are it's
going to be featured in a number of other SoCs in the future, so if we
were to have the entire list of supported SoCs in the Kconfig symbol and
driver name, we'd have to always change them everytime a new SoC support
is introduced.

It would be a pain, and it's pretty much guaranteed that someone is
going to forget at some point. To mitigate this, we took the approach to
use the same semantic than the DT compatible: the driver name doesn't
really define the list of all the SoCs supported but matches every SoC
(more or less) compatible with that SoC.

If you want to have the entire list in the Kconfig help though, I don't
see anything wrong with that. Even if it goes unmaintained, it wouldn't
really be a big deal.

Maxime