Re: [PATCH 17/17] auxdisplay: ht16k33: Add segment display LED support
From: Geert Uytterhoeven
Date: Wed Mar 24 2021 - 04:32:14 EST
Hi Pavel,
On Tue, Mar 23, 2021 at 9:40 PM Pavel Machek <pavel@xxxxxx> wrote:
> > CC linux-leds (which I intended, but forgot to add)
> >
> > cover letter at
> > https://lore.kernel.org/linux-devicetree/20210322144848.1065067-1-geert@xxxxxxxxxxxxxx/
>
> Still does not tell me... riscv on fpga with 4 character display. What
> is this? :-).
https://gregdavill.github.io/OrangeCrab/r0.2/
https://github.com/litex-hub/linux-on-litex-vexriscv
https://www.adafruit.com/product/3130
> > On Tue, Mar 23, 2021 at 11:08 AM Robin van der Gracht <robin@xxxxxxxxxxx> wrote:
> > > On 2021-03-22 15:48, Geert Uytterhoeven wrote:
> > > > Instantiate a single LED for a segment display. This allows the user
> > > > to
> > > > control display brightness and blinking through the LED class API and
> > > > triggers, and exposes the display color.
> > > >
> > > > Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> > > > ---
> > > > For setting display brightness, this could use the existing backlight
> > > > support for frame buffer devices instantiated for dot-matrix displays.
> > > > However, using the leds subsystem instead has the advantage that the
> > > > driver can make use of the HT16K33's hardware blinking support, and can
> > > > expose the display color.
>
> We have multicolor support now...
The color is fixed by the LED color, so there is no need for multicolor
(yet, one day someone might connect RGB 7-segment LED displays
(https://www.rgbdigit.com/rgbdigit/ ;-)
> > > > - err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
> > > > + of_property_read_u32(node, "color", &color);
> > > > + seg->led.name = devm_kasprintf(dev, GFP_KERNEL,
> > > > + DRIVER_NAME ":%s:" LED_FUNCTION_BACKLIGHT,
> > > > + color < LED_COLOR_ID_MAX ? led_colors[color] : "");
>
> And would prefer not to see driver_name as part of LED name.
OK. So what should I use instead? Or just leave the part before the
first colon empty?
> > > > + err = ht16k33_brightness_set(priv, seg->led.brightness);
> > > > if (err)
> > > > return err;
> > >
> > > The LED class can pretty much do what the backlight class can and more.
> > >
> > > Maybe we can stop registering a backlight device in the fbdev case and
> > > register a led device for both. This makes the code cleaner and drops
> > > a dependency but will break backwards compatibility.
> > >
> > > I'd prefer a single solution that covers both use cases, but I'm not
> > > sure about the 'breaking backwards compatibility' consequence...
>
> For new drivers, breaking compatibility should not be a problem.
The dot-matrix support is part of the existing driver, thus subject to
backwards compatibility.
Perhaps we can register the LED device for both, and build the backlight
device on top of the LED device, like "led-backlight" does. Would that
work? Or can't the LED no longer be controlled from sysfs (e.g.
triggers) if it is in use by a backlight driver?
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds