All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: David Lin <dtwlin@google.com>
Cc: rpurdie@rpsys.net, pavel@ucw.cz, robh@kernel.org,
	Rom Lemarchand <romlem@google.com>,
	Joel Fernandes <joelaf@google.com>,
	stable@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] led: ledtrig-transient: replace timer_list with hrtimer
Date: Tue, 25 Apr 2017 22:15:18 +0200	[thread overview]
Message-ID: <475626da-5fb2-c03c-cdf7-feb42ee6b672@gmail.com> (raw)
In-Reply-To: <CAPzFB+U3aLkM7Q2cubdMmtnJp-oCqGKGp2_Q-n2nkbyeh07JgA@mail.gmail.com>

Hi David,

On 04/25/2017 05:05 AM, David Lin wrote:
> Hi Jacek,
> 
> On Mon, Apr 24, 2017 at 12:59 PM, Jacek Anaszewski
> <jacek.anaszewski@gmail.com> wrote:
>>
>> Hi David,
>>
>> Thanks for the patch.
>>
>> Unfortunately we cannot switch to using hr timers just like that
>> without introducing side effects for many devices. We had similar
>> attempt of increasing timer tirgger accuracy two years ago [0].
>>
>> In short words, for drivers that can sleep while setting brightness
>> and/or are using a bus like I2C you will not be able to enforce
>> 1ms delay period.
>>
>> I recommend you to go through the thread [0] so that we had
>> a well defined ground for the discussion on how to address this
>> issue properly.
>>
> 
> I think I understand the background now, and would agree that not all
> the LED driver require hrtimer as human eye can't probably tell
> there's a 10ms variation in a blink.

The main problem are side effects occurring when an event
scheduled by hrtimer can't finish before the next one begins.
We get warnings like in the example below (copied from [0]) then,
and they have probably negative impact on the whole system performance.

echo "timer" > trigger
echo 1 > delay_on
echo 1 > delay_off
echo usec > delay_unit
[  178.584433] hrtimer: interrupt took 300747 ns

> However, there's a need to
> support hrtimer if the LED subsystem claims support the use case of
> vibrator (please see Documentation/leds/ledtrig-transient.txt) as even
> a 5ms of variation is perceivable to the user. I'm thinking if a
> better interim solution is to introduce a
> LEDS_TRIGGER_TRANSIENT_HRTIMER config to work with both timers in
> compile time. Would you agree?

I think that it would be better if LED class driver set a flag
marking itself as capable of setting brightness with high rate.
I'd limit that only to leds-gpio and devices driven through
memory mapped registers.

Having the flag e.g. LED_BRIGHTNESS_FAST, we could add support for
hr timers also to ledtrig-timer.

You can try also the other option mentioned by Pavel in [1].

[1] https://lkml.org/lkml/2017/4/24/881

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2017-04-25 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24  4:42 [PATCH] led: ledtrig-transient: replace timer_list with hrtimer David Lin
2017-04-24  7:44 ` Pavel Machek
2017-04-24 19:59 ` Jacek Anaszewski
2017-04-24 20:18   ` Pavel Machek
2017-04-25  3:05   ` David Lin
2017-04-25 20:15     ` Jacek Anaszewski [this message]
2017-04-27  3:48       ` David Lin
2017-04-27 18:37         ` Jacek Anaszewski
2017-04-25 22:34     ` Pavel Machek
2017-04-26 19:49       ` 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=475626da-5fb2-c03c-cdf7-feb42ee6b672@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dtwlin@google.com \
    --cc=joelaf@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.org \
    --cc=romlem@google.com \
    --cc=rpurdie@rpsys.net \
    --cc=stable@vger.kernel.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.