platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "hamza.farooq@siemens.com" <hamza.farooq@siemens.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	"henning.schild@siemens.com" <henning.schild@siemens.com>,
	"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>,
	"Haeussler, Gerd" <gerd.haeussler.ext@siemens.com>
Subject: Re: Define LEDs with mixed colors
Date: Wed, 1 Sep 2021 13:09:29 +0200	[thread overview]
Message-ID: <20210901110929.GA18522@duo.ucw.cz> (raw)
In-Reply-To: <DBAPR10MB42195CA4E52FDD30F0598AE98ACD9@DBAPR10MB4219.EURPRD10.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2021-09-01 11:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  8:39 Define LEDs with mixed colors hamza.farooq
2021-09-01 11:09 ` Pavel Machek [this message]
2021-09-01 11:24   ` hamza.farooq
2021-11-01 12:18     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210901110929.GA18522@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=andy.shevchenko@gmail.com \
    --cc=gerd.haeussler.ext@siemens.com \
    --cc=hamza.farooq@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).