RE: Define LEDs with mixed colors
From: hamza.farooq@siemens.com <hidden>
Date: 2021-09-01 11:24:20
Also in:
lkml, platform-driver-x86
-----Original Message----- From: Pavel Machek <redacted> Sent: Wednesday, September 1, 2021 1:09 PM To: Farooq, Muhammad Hamza (DI FA CTR IPC PRC2) [off-list ref] Cc: Andy Shevchenko <redacted>; Linux Kernel Mailing List [off-list ref]; Linux LED Subsystem <linux- leds@vger.kernel.org>; Platform Driver <platform-driver- x86@vger.kernel.org>; Schild, Henning (T RDA IOT SES-DE) [off-list ref]; Kiszka, Jan (T RDA IOT) [off-list ref]; Haeussler, Gerd (ext) (DI FA CTR IPC PRC2) [off-list ref] Subject: Re: Define LEDs with mixed colors Hi!quoted
I am toying with the idea of writing a multicolor LED GPIO driver. Whatwould be the right way to define mixed color LEDs (for leds-gpio), in device tree or ACPI?quoted
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-ledsdriver code, but what can I do to achieve something similar?quoted
It is important to define this LED in DT/ACPI in order for the user app to seeit in the /sys/class/led folder, without having to write platform-specific driver.quoted
So you have one package with red and green LED, each connected to one GPIO?
Right. It is possible to create orange color, and I want to use DT/ACPI to present this info to the userland.
Can you take a look at Documentation/leds/leds-class-multicolor.rst?
Couldn't find a hint there therefore this email thread. I might eventually write a multicolor led-gpio driver so want to know how to handle mixed LED.
Best regards, Pavel -- http://www.livejournal.com/~pavelmachek