Re: How are dual color LEDs best modelled in Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 2019-04-02 13:28:56, Alexander Dahl wrote:
> Hello Pavel,
> 
> Am Dienstag, 2. April 2019, 13:12:31 CEST schrieb Pavel Machek:
> > On Tue 2019-04-02 12:23:29, Alexander Dahl wrote:
> > > on my desk lies a piece of hardware with some dual color LEDs connected to
> > > some IO ports. The LEDs shine green or red depending on polarity and are
> 
> […]
> 
> > Fortunately, that is not too common setup. You still need two output
> > pins and two LEDs, AFAICT only advantage is that you save one
> > resistor. Don't do it.
> 
> Unfortunately, this hardware already exists, I have to deal with it, see 
> above.

Hammer? :-)

> > That said, driver that takes two GPIOs and exposes one LED with
> > aditional color attribute should be acceptable.
> 
> So, do I understand correctly, there's nothing to deal with such a setup in 
> Linux yet, and I need a new driver?

Correct.

> Documentation/devicetree/bindings/leds/leds-gpio.txt does not seem to document 
> such a usecase, so I guess the leds-gpio driver does not support it out of the 
> box?

Correct.

> What do you mean by "aditional color attribute"? Sorry, I'm not that deep into 
> the LED subsystem yet.

Have single led, with

static DEVICE_ATTR(color, S_IRUGO | S_IWUSR, ...

?

> Of course I could just handle those as two independent LEDs for now, but that 
> would lead to not desired states, because both colors are not independent! The 
> only thing I could try would be let userspace somehow control the brightness 
> and triggers to avoid both colors cancelling out each other?

No, don't do that.
									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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux