linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: bjorn.andersson@linaro.org, Baolin Wang <baolin.wang@linaro.org>,
	rteysseyre@gmail.com, broonie@kernel.org,
	linus.walleij@linaro.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/2] leds: core: Introduce LED pattern trigger
Date: Tue, 4 Sep 2018 21:38:13 +0200	[thread overview]
Message-ID: <e6cf7c2d-917a-b05f-178c-012c6b4161cf@gmail.com> (raw)
In-Reply-To: <20180903215323.GA21489@amd>

On 09/03/2018 11:53 PM, Pavel Machek wrote:
> Hi!
> 
>>> +static int pattern_trig_start_pattern(struct led_classdev *led_cdev)
>>> +{
>>> +	struct pattern_trig_data *data = led_cdev->trigger_data;
>>> +
>>> +	if (!data->npatterns)
>>> +		return 0;
>>> +
>>> +	if (data->is_hw_pattern) {
>>> +		return led_cdev->pattern_set(led_cdev, data->patterns,
>>> +					     data->npatterns, data->repeat);
>>> +	}
>>
>> I have doubts here if it is a good idea to enforce array of tuples
>> as a generic interface for all hw_patterns. It may not fit well for
>> every hw pattern engine. It seems that the only feasible solution will
>> be allowing drivers to come up with their own interfaces, i.e. the
>> approach you proposed at first for your driver. It seems that the
>> ledtrig-pattern with software pattern mechanism will be just
>> a nice side effect of this series :-)
>>
>> Unless someone will propose a better solution.
> 
> I believe array of tuples will work for everyone. It is just a LED, it
> can change intensity over time.

We have an example of different semantics in case of hw pattern
for leds-sc27xx-bltc.c, from this patch set.

Proposed hw_pattern ABI documentation:

+What:		/sys/class/leds/<led>/hw_pattern
+Date:		September 2018
+KernelVersion:	4.20
+Description:
+		Specify a hardware pattern for the SC27XX LED. For the SC27XX
+		LED controller, it only supports 4 hardware patterns to configure
+		the low time, rise time, high time and fall time for the breathing
+		mode, and each stage duration unit is 125ms. So the format of
+		the hardware pattern values should be:
+		"brightness_1 duration_1 brightness_2 duration_2 brightness_3
+		duration_3 brightness_4 duration_4".

In this case low time and high time can be easily described with
use of the proposed [brightness delta_t] tuples. It is not equally
obvious in case of rise time and fall time.

I can imagine hw pattern that would require defining blink rate
over period of time, or blink rate during rise/fall time - in the
latter case we would have odd number of pattern components. Probably
it wouldn't be a big deal, we'd need one "padding" value, but still
there's room for improvement IMHO.

>> We need a broader consensus here. I'd like to hear Pavel's opinion,
>> since he's been always in favor of common pattern interface, and
>> inspired this work.
> 
> I believe Baolin did good work here. I believe it will cover most, if
> not all, hardware engines out there. I think we should merge it, and
> see what happens -- it should be good enough.
> 
> (Yes, there's still more work to do, but that will be stuff like RGB
> LED synchronization.)
> 
> (And yes, one of the LED chip has pattern engine that can compute
> prime numbers on its own. I don't expect to support
> _that_. Fortunately, nobody but me is likely to want that pattern, so
> we are still okay :-) 
> 
> https://gitlab.com/tui/tui/blob/master/ofone/tests.notcc/primes.nc
> 
> )
> 									Pavel
> 

-- 
Best regards,
Jacek Anaszewski

  parent reply	other threads:[~2018-09-04 19:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31  7:52 [PATCH v7 1/2] leds: core: Introduce LED pattern trigger Baolin Wang
2018-08-31  7:52 ` [PATCH v7 2/2] leds: sc27xx: Add pattern_set/clear interfaces for LED controller Baolin Wang
2018-09-03 18:58 ` [PATCH v7 1/2] leds: core: Introduce LED pattern trigger Jacek Anaszewski
2018-09-03 21:53   ` Pavel Machek
2018-09-04  2:05     ` Baolin Wang
2018-09-04 19:38     ` Jacek Anaszewski [this message]
2018-09-07  7:34       ` Pavel Machek
2018-09-04  1:32   ` Baolin Wang

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=e6cf7c2d-917a-b05f-178c-012c6b4161cf@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rteysseyre@gmail.com \
    /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).