Re: [PATCH v2 2/2] leds: lp50xx: Add the LP50XX family of the RGB LED driver

From: Pavel Machek
Date: Tue Jan 15 2019 - 17:22:42 EST


Hi!

> >+The 24-bit RGB value passed in follows the pattern 0xXXRRGGBB
> >+XX - Do not care ignored by the driver
> >+RR - is the 8 bit Red LED value
> >+GG - is the 8 bit Green LED value
> >+BB - is the 8 bit Blue LED value
> >+
> >+Example:
> >+LED module output 4 of the LP5024 will be a yellow color:
> >+echo 0xe6de00 > /sys/class/leds/lp5024\:led4_mod/color
> >+
> >+LED module output 4 of the LP5024 will be dimmed 50%:
> >+echo 0x80 > /sys/class/leds/lp5024\:led4_mod/brightness
> >+
> >+LED banked RGBs of the LP5036 will be a white color:
> >+echo 0xffffff > /sys/class/leds/lp5036\:led_banked/color
>
> This part with example cans remain in Documentation/leds if you
> >like.

Does it actually work like that on hardware?

Is it supposed to support "normal" RGB colors as seen on monitors?

Because 100% PWM on all channels does not result in white on hardware
I have.

> >+ } else {
> >+ led_offset = (led->led_number * 3);
> >+ red_reg = priv->mix_out0_reg + led_offset;
> >+ green_reg = priv->mix_out0_reg + led_offset + 1;
> >+ blue_reg = priv->mix_out0_reg + led_offset + 2;
> >+ }
> >+
> >+ red_val = (mix_value & 0xff0000) >> 16;
> >+ green_val = (mix_value & 0xff00) >> 8;
> >+ blue_val = (mix_value & 0xff);
>
> I've been rather thinking about space separated list of decimal
> "red green blue" values, but maybe this way it will be less
> controversial. Let's if there will be other opinions.

We support maximum brightness > 255, so space separated is certainly
better option than this.

But...

I believe we should have a reasonable design before we do something
like this. There's no guarantee someone will not use lp50xx with just
the white LEDs for example. How will this work? Plus existing hardware
already uses three separate LEDs for RGB LED. Why not provide same
interface?

(Oh and don't try to say "sysfs is slow", without numbers).

Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature