lkml.org 
[lkml]   [2021]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Define LEDs with mixed colors
Hi!

> I am toying with the idea of writing a multicolor LED GPIO driver. What would be the right way to define mixed color LEDs (for leds-gpio), in device tree or ACPI?
> Consider the following:
>
> leds {
> compatible = "gpio-leds";
> led0 {
> gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
> color = <LED_COLOR_ID_RED>;
> };
>
> led1 {
> gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
> color = <LED_COLOR_ID_GREEN>;
> };
> led2 {
> gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW
> &mcu_pio 1 GPIO_ACTIVE_LOW>;
> color = <LED_COLOR_ID_AMBER>;
> };
> };
>
> This probably won't work as "gpios" seem to be single object in gpio-leds driver code, but what can I do to achieve something similar?
> It is important to define this LED in DT/ACPI in order for the user app to see it in the /sys/class/led folder, without having to write platform-specific driver.
>

So you have one package with red and green LED, each connected to one
GPIO?

Can you take a look at Documentation/leds/leds-class-multicolor.rst?

Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-09-01 13:10    [W:1.356 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site