linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	rteysseyre@gmail.com, Mark Brown <broonie@kernel.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v5 1/2] leds: core: Introduce LED pattern trigger
Date: Thu, 9 Aug 2018 15:21:53 +0200	[thread overview]
Message-ID: <cc29be64-47a5-2bc1-f1be-64b4ad7e1a6d@gmail.com> (raw)
In-Reply-To: <CAMz4kuJBT2m8YpsAFufiGQFOYCgBbyf9Rrhce+396pRoW802aw@mail.gmail.com>

Hi Baolin,

On 08/09/2018 07:48 AM, Baolin Wang wrote:
[...]
>>>>> +static int pattern_trig_start_pattern(struct pattern_trig_data *data,
>>>>> +                                   struct led_classdev *led_cdev)
>>>>> +{
>>>>> +     if (!data->npatterns)
>>>>> +             return 0;
>>>>> +
>>>>> +     if (led_cdev->pattern_set) {
>>>>> +             return led_cdev->pattern_set(led_cdev, data->patterns,
>>>>> +                                          data->npatterns, data->repeat);
>>>>
>>>> I think that it would be more flexible if software pattern fallback
>>>> was applied in case of pattern_set failure. Otherwise, it would
>>>> lead to the situation where LED class devices that support hardware
>>>> blinking couldn't be applied the same set of patterns as LED class
>>>> devices that don't implement pattern_set. The latter will always have to
>>>> resort to using software pattern engine which will accept far greater
>>>> amount of pattern combinations.
>>>
>>> Hmmm, I am not sure this is useful for hardware pattern, since the LED
>>> hardware can be diverse which is hard to be compatible with software
>>> pattern.
>>>
>>> For example, for our SC27XX LED, it only supports 4 hardware patterns
>>> setting (low time, rising time, high time and falling time) to make it
>>> work at breathing mode. If user provides 3 or 5 patterns values, it
>>> will failed to issue pattern_set(). But at this time, we don't want to
>>> use software pattern instead since it will be not the breathing mode
>>> expected by user. I don't know if there are other special LED
>>> hardware.
>>
>> Good point. So this is the issue we should dwell on, since the
>> requested pattern effect should look similar on all devices.
>> Of course in case of software pattern it will be often impossible
>> to achieve the same fluency. Similarly as in case of rendering graphics
>> with and without acceleration.
>>
>> In case of your device, I'd say that we'd need more complex description
>> of breathing mode pattern. More complex than just four intervals.
>> It should reflect all the intervals the hardware engine needs to perform
>> to achieve the breathing effect. Can this information be inferred from
>> the docs?
> 
>>From our docs, it only provides registers to set the low time, rising
> time, high time and falling time (value unit is 0.125s and max value
> is 63 = 7.875s) to enable breathing mode. So each interval value can
> be 1 ~ 63. But that is still hard for software pattern to simulate the
> breathing mode performed by hardware pattern.

Software fallback is not expected to show similar performance to the
hardware engine on the whole span of the supported time range.

Having min rise time value at 125ms, and given that max_brightness
is 255, then we'd have 255 / 125 = 2.04 of brightness level rise per
1ms. So, the pattern for rising edge could look like (assuming we
stop at 254):

0 1 2 1 4 1 6 1 8 1 10 1 ... 254 1

Now, I'm starting to wonder if we shouldn't have specialized trigger
for breathing patterns, that would accept brightness level change per
time period. Pattern trigger needs more flexibility and inferring if the
hardware can handle given series of pattern intervals would entail
unnecessary code complexity.

Such breathing trigger would require triplets comprised of
start brightness, end brightness and a duration of the brightness
transition.

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2018-08-09 13:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 12:05 [PATCH v5 1/2] leds: core: Introduce LED pattern trigger Baolin Wang
2018-08-06 12:06 ` [PATCH v5 2/2] leds: sc27xx: Add pattern_set/clear interfaces for LED controller Baolin Wang
2018-08-07 21:54 ` [PATCH v5 1/2] leds: core: Introduce LED pattern trigger Jacek Anaszewski
2018-08-08  6:01   ` Baolin Wang
2018-08-08 21:28     ` Jacek Anaszewski
2018-08-09  5:48       ` Baolin Wang
2018-08-09 13:21         ` Jacek Anaszewski [this message]
2018-08-10 15:26           ` Baolin Wang
2018-08-10 18:10             ` Jacek Anaszewski
2018-08-11  2:17               ` Baolin Wang
2018-08-24 10:11   ` Pavel Machek
2018-08-24 19:49     ` Jacek Anaszewski
2018-08-24 20:12       ` Pavel Machek
2018-08-24 20:44         ` Jacek Anaszewski
2018-08-25  7:51           ` Baolin Wang
2018-08-28 20:25             ` Jacek Anaszewski
2018-08-28 21:13               ` Bjorn Andersson
2018-08-29 18:55                 ` Jacek Anaszewski
2018-08-29  9:48               ` Baolin Wang
2018-08-29 19:15                 ` Jacek Anaszewski
2018-08-30  3:26                   ` Baolin Wang
2018-08-30  7:39                     ` Baolin Wang
2018-08-28 20:47             ` Bjorn Andersson

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=cc29be64-47a5-2bc1-f1be-64b4ad7e1a6d@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.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).