All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
Cc: Jacek Anaszewski
	<jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Heiner Kallweit
	<hkallweit1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
	linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Benjamin Tissoires
	<benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	aaro.koskinen-X3B1VOXEql0@public.gmane.org,
	ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Patrik Bachan
	<patrikbachan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH v5 1/4] leds: core: add generic support for RGB Color LED's
Date: Tue, 12 Apr 2016 09:13:24 +0200	[thread overview]
Message-ID: <570CA014.7000709@samsung.com> (raw)
In-Reply-To: <20160409160142.GD19362-5NIqAleC692hcjWhqY66xCZi+YwRKgec@public.gmane.org>

On 04/09/2016 06:01 PM, Pavel Machek wrote:
> Hi!
>
>>>>> What's tricky about patterns is that you need to control 3 (or more)
>>>>> leds at a time. Problem you are trying to solve here is ... control of
>>>>> 3 leds, at the same time.
>>>>>
>>>>> So let's solve them together.
>>>>
>>>> OK, now I've got your point. So we'd need to have a means for defining
>>>> patterns. The interface could be located at /sys/class/leds/patterns.
>>>>
>>>> We'd need to have a flexible way for defining LED class devices involved
>>>> in a pattern. Since we cannot guarantee no space in a LED class device
>>>> name, then a single attribute containing space separated list is not an
>>>> option. We'd have to create a predefined set of attributes that would
>>>> contain LED class device name. Predefined implies that it would be
>>>> a fixed number, i.e. either some attributes would always remain unused
>>>> or, which is even worse, we could run out of free attributes for some
>>>> use cases.
>>>
>>> There's a better solution: make pattern behave as a trigger for leds
>>> it controls.
>>>
>>> So we'd have
>>>
>>> /sys/class/leds/patterns/lp5523
>>>
>>> then we'd have
>>>
>>> /sys/class/leds/lp5523::red/trigger = "lp5523:1"
>>> /sys/class/leds/lp5523::green/trigger = "lp5523:2"
>>> /sys/class/leds/lp5523::blue/trigger = "lp5523:3"
>>>
>>> (or something similar, I'd have to boot the n900 to see the exact
>>> names).
>>
>> How about implementing patterns as a specific typer of triggers?
>> Let's say we have ledtrig-rgb-pattern:
>
> Well, we'd need ledtrig-rgb-pattern-1, ledtrig-rgb-pattern-2, ... , as we
> can have more than one rgb led. But yes.

Triggers can have many listeners, i.e. led_trigger_event() sets
brightness on all LED class devices registered on given trigger.
We could have led_trigger_rgb_event() that would set brightness
on all groups-of-three LEDs registered on given rgb-trigger.

I agree that ledtrig-rgb-pattern-1, ledtrig-rgb-pattern-2, etc. would
be also needed to add a capability of setting different colors on
different LED devices.

>> After setting a trigger following sysfs attribute would appear
>> in a LED class device sysfs interface:
>>
>> $cat /sys/class/lp5523::red/rgb_color
>> red green blue [none]
>>
>> $echo "red" > /sys/class/leds/lp5523::red/rgb_color
>>
>> and similarly
>>
>> $echo "green" > /sys/class/leds/lp5523::green/rgb_color
>> $echo "blue" > /sys/class/leds/lp5523::blue/rgb_color
>
> Yes, that would work -- selecting channels from the pattern.
>
>> Similar approach could be applied for blink patterns:
>> There could be additional attributes provided for defining
>> the position in a blink sequence, or/and blink period.
>
> For patterns, I'd suggest array of (r g b time) values.
>
> Pattern engines can do stuff like "slowly turn LED from off to red, then switch color to
> white, then slowly turn it to yellow, then turn it off at once" with defined speeds
> for "slowly" and option of either linear on non-linear brightness ramping.
>
> The last option might be a bit too much, but I believe we should support the rest.

Yes, that's an interesting idea. It also turns out that trigger based
patterns could be also used for defining generic patterns for a group
of monochrome LEDs.

-- 
Best regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>, Greg KH <greg@kroah.com>,
	linux-leds@vger.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	pali.rohar@gmail.com, sre@kernel.org, khilman@kernel.org,
	aaro.koskinen@iki.fi, ivo.g.dimitrov.75@gmail.com,
	Patrik Bachan <patrikbachan@gmail.com>,
	serge@hallyn.com
Subject: Re: [PATCH v5 1/4] leds: core: add generic support for RGB Color LED's
Date: Tue, 12 Apr 2016 09:13:24 +0200	[thread overview]
Message-ID: <570CA014.7000709@samsung.com> (raw)
In-Reply-To: <20160409160142.GD19362@xo-6d-61-c0.localdomain>

On 04/09/2016 06:01 PM, Pavel Machek wrote:
> Hi!
>
>>>>> What's tricky about patterns is that you need to control 3 (or more)
>>>>> leds at a time. Problem you are trying to solve here is ... control of
>>>>> 3 leds, at the same time.
>>>>>
>>>>> So let's solve them together.
>>>>
>>>> OK, now I've got your point. So we'd need to have a means for defining
>>>> patterns. The interface could be located at /sys/class/leds/patterns.
>>>>
>>>> We'd need to have a flexible way for defining LED class devices involved
>>>> in a pattern. Since we cannot guarantee no space in a LED class device
>>>> name, then a single attribute containing space separated list is not an
>>>> option. We'd have to create a predefined set of attributes that would
>>>> contain LED class device name. Predefined implies that it would be
>>>> a fixed number, i.e. either some attributes would always remain unused
>>>> or, which is even worse, we could run out of free attributes for some
>>>> use cases.
>>>
>>> There's a better solution: make pattern behave as a trigger for leds
>>> it controls.
>>>
>>> So we'd have
>>>
>>> /sys/class/leds/patterns/lp5523
>>>
>>> then we'd have
>>>
>>> /sys/class/leds/lp5523::red/trigger = "lp5523:1"
>>> /sys/class/leds/lp5523::green/trigger = "lp5523:2"
>>> /sys/class/leds/lp5523::blue/trigger = "lp5523:3"
>>>
>>> (or something similar, I'd have to boot the n900 to see the exact
>>> names).
>>
>> How about implementing patterns as a specific typer of triggers?
>> Let's say we have ledtrig-rgb-pattern:
>
> Well, we'd need ledtrig-rgb-pattern-1, ledtrig-rgb-pattern-2, ... , as we
> can have more than one rgb led. But yes.

Triggers can have many listeners, i.e. led_trigger_event() sets
brightness on all LED class devices registered on given trigger.
We could have led_trigger_rgb_event() that would set brightness
on all groups-of-three LEDs registered on given rgb-trigger.

I agree that ledtrig-rgb-pattern-1, ledtrig-rgb-pattern-2, etc. would
be also needed to add a capability of setting different colors on
different LED devices.

>> After setting a trigger following sysfs attribute would appear
>> in a LED class device sysfs interface:
>>
>> $cat /sys/class/lp5523::red/rgb_color
>> red green blue [none]
>>
>> $echo "red" > /sys/class/leds/lp5523::red/rgb_color
>>
>> and similarly
>>
>> $echo "green" > /sys/class/leds/lp5523::green/rgb_color
>> $echo "blue" > /sys/class/leds/lp5523::blue/rgb_color
>
> Yes, that would work -- selecting channels from the pattern.
>
>> Similar approach could be applied for blink patterns:
>> There could be additional attributes provided for defining
>> the position in a blink sequence, or/and blink period.
>
> For patterns, I'd suggest array of (r g b time) values.
>
> Pattern engines can do stuff like "slowly turn LED from off to red, then switch color to
> white, then slowly turn it to yellow, then turn it off at once" with defined speeds
> for "slowly" and option of either linear on non-linear brightness ramping.
>
> The last option might be a bit too much, but I believe we should support the rest.

Yes, that's an interesting idea. It also turns out that trigger based
patterns could be also used for defining generic patterns for a group
of monochrome LEDs.

-- 
Best regards,
Jacek Anaszewski

  parent reply	other threads:[~2016-04-12  7:13 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 21:26 [PATCH v5 1/4] leds: core: add generic support for RGB Color LED's Heiner Kallweit
2016-03-04  9:04 ` Jacek Anaszewski
2016-03-29 10:02 ` Pavel Machek
2016-03-29 20:38   ` Heiner Kallweit
2016-03-29 21:43     ` Pavel Machek
2016-03-29 22:03       ` Pavel Machek
2016-03-29 22:03         ` Pavel Machek
2016-03-30  5:58       ` Heiner Kallweit
2016-04-01 12:52         ` Pavel Machek
2016-03-30  8:07       ` Jacek Anaszewski
2016-03-30  8:07         ` Jacek Anaszewski
2016-03-30 13:03         ` Pavel Machek
2016-03-30 13:59           ` Heiner Kallweit
2016-03-31  8:17             ` Jacek Anaszewski
2016-04-01 12:55             ` Pavel Machek
2016-04-01 13:28               ` Jacek Anaszewski
2016-04-01 14:07                 ` Pavel Machek
2016-04-01 14:27                   ` Jacek Anaszewski
2016-04-01 15:03                     ` Pavel Machek
     [not found]         ` <56FB893C.60203-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-04-01 12:53           ` Pavel Machek
2016-04-01 12:53             ` Pavel Machek
2016-03-30  7:57     ` Jacek Anaszewski
2016-04-01 13:57       ` Pavel Machek
2016-04-01 18:56         ` Jacek Anaszewski
     [not found]           ` <56FEC444.4040106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-01 21:18             ` Pavel Machek
2016-04-01 21:18               ` Pavel Machek
2016-04-04 21:34               ` Jacek Anaszewski
2016-04-05  9:01                 ` Pavel Machek
2016-04-05 19:45                   ` Jacek Anaszewski
2016-04-05 19:45                     ` Jacek Anaszewski
2016-04-05 20:43                     ` Heiner Kallweit
     [not found]                       ` <5704236D.5080805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-05 22:15                         ` Jacek Anaszewski
2016-04-05 22:15                           ` Jacek Anaszewski
     [not found]                           ` <570438EF.4080904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-06  9:16                             ` Pavel Machek
2016-04-06  9:16                               ` Pavel Machek
2016-04-06  9:12                       ` Pavel Machek
2016-04-06  8:52                     ` Pavel Machek
2016-04-06  9:53                       ` Jacek Anaszewski
2016-04-07 20:45                         ` Pavel Machek
2016-04-08 18:47                           ` Jacek Anaszewski
2016-04-09 16:01                             ` Pavel Machek
     [not found]                               ` <20160409160142.GD19362-5NIqAleC692hcjWhqY66xCZi+YwRKgec@public.gmane.org>
2016-04-12  7:13                                 ` Jacek Anaszewski [this message]
2016-04-12  7:13                                   ` Jacek Anaszewski
2016-04-15 11:53                                   ` Pavel Machek
2016-04-18  9:12                                     ` Jacek Anaszewski
2016-04-18  9:12                                       ` 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=570CA014.7000709@samsung.com \
    --to=j.anaszewski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=aaro.koskinen-X3B1VOXEql0@public.gmane.org \
    --cc=benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
    --cc=hkallweit1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=patrikbachan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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.