All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: "David Rivshin (Allworx)" <drivshin.allworx@gmail.com>
Cc: Dmitry Bondar <bond@simicon.com>,
	linux-leds@vger.kernel.org, Richard Purdie <rpurdie@rpsys.net>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH] Add LED driven by multiple gpio.
Date: Fri, 29 Apr 2016 14:42:39 +0200	[thread overview]
Message-ID: <572356BF.2040804@samsung.com> (raw)
In-Reply-To: <20160426162658.761a88e7.drivshin.allworx@gmail.com>

Hi David,

On 04/26/2016 10:26 PM, David Rivshin (Allworx) wrote:
> On Mon, 25 Apr 2016 11:14:38 +0300
> Dmitry Bondar <bond@simicon.com> wrote:
>
>> Hello, on our board we have one LED with 2 gpio connected to it:
>>   - when gpio0 is on and gpio1 on - LED is orange.
>>   - when gpio0 is on and gpio1 off - LED is green.
>>   - when gpio0 is off and gpio1 on - LED is red.
>>   - when gpio0 is off and gpio1 off - LED is off.
>> We want use led_trigger (nand-disk) on this LED.
>> Below patch which we use for get one LED on 2 gpios.
>> Can be this in mainline, or may be exist other - better way?
>>
>
> It sounds like what you have is two independent GPIO controlled LEDs:
> one green and the other red (even if they are part of the same IC).
> Given the current infrastructure, I have modeled such cases as two
> separate LEDs in the devicetree, named <device>:green:<function> and
> <device>:red:<function>. Userspace is then responsible for controlling
> them appropriately to get the desired color.
>
> Unless I'm mistaken, in your case (nand-disk) there are blinking
> combinations you wouldn't be able to achieve this way, but there
> are a number you can do:
> - off/green:  	green:nand-disk	red:off
> - off/red: 	green:off 	red:nand-disk
> - off/orange:	green:nand-disk	red:nand-disk
> - green/orange:	green:on	red:nand-disk
> - red/orange:	green:nand-disk	red:on
> The other cases (e.g. green/red) would need an inverted nand-disk
> trigger (on while inactive, off while active).
>
> I'm hoping that if the RGB LED framework comes to fruition, that there
> will be some way to combine arbitrary single-color LED devices into a
> logical RGB LED.

It turns out that rgb-pattern trigger, we were discussing some time ago,
would be useful also for LEDs of arbitrary colors. It should be given
more generic name then, e.g. three-led-composite or so. The "color"
sysfs attribute exposed by the trigger could be replaced with
"subled_id", that would accept values 0, 1 or 2.

Brightness of such a compound LED could be set with:

led_trigger_3led_event(sturct led_trigger *trig,
                        enum led_brightness led1,
                        enum led_brightness led2,
                        enum led_brightness led3)

Maybe we should think about making this scalable using
C ellipsis feature:

led_trigger_3led_event(sturct led_trigger *trig,
                        enum led_brightness led1,
                        ...)

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2016-04-29 12:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25  8:14 [PATCH] Add LED driven by multiple gpio Dmitry Bondar
2016-04-25  9:23 ` Jacek Anaszewski
2016-04-27  6:56   ` Jacek Anaszewski
2016-04-26 20:26 ` David Rivshin (Allworx)
2016-04-29 12:42   ` Jacek Anaszewski [this message]
2016-04-29 12:58     ` Pavel Machek
2016-04-29 13:07       ` Jacek Anaszewski

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=572356BF.2040804@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=bond@simicon.com \
    --cc=drivshin.allworx@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.