All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Stas Sergeev <stsp@list.ru>
Cc: linux-leds@vger.kernel.org,
	Linux kernel <linux-kernel@vger.kernel.org>,
	Stas Sergeev <stsp@users.sourceforge.net>,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 01/20] leds: implement LED_BRIGHTNESS_FAST flag
Date: Mon, 01 Jun 2015 16:19:22 +0200	[thread overview]
Message-ID: <556C69EA.10000@samsung.com> (raw)
In-Reply-To: <556C4851.7060900@list.ru>

On 06/01/2015 01:56 PM, Stas Sergeev wrote:
> 01.06.2015 11:31, Jacek Anaszewski пишет:
>> With this approach, the LED will remain in its current blink state, in
>> case LED_BRIGHTNESS_FAST flag is not set and delay to be set is below LED_SLOW_MIN_PERIOD. This is because timer is deleted at the beginning
>> of led_blink_set. Effectively this can result in the LED staying turned
>> on when e.g. "echo 1 > delay_on" fails.
>>
>> I propose to change this part of code as follows:
>>
>>          if (!(led_cdev->flags & LED_BRIGHTNESS_FAST)) {
>>          if (delay_on < LED_SLOW_MIN_PERIOD ||
>>              delay_off < LED_SLOW_MIN_PERIOD)
>>              led_set_brightness_async(led_cdev, LED_OFF);
>>              return -ERANGE;
>>          }
>>      }
> Sounds good.
>
>> By this occasion it turned out that we have inconsistency:
>> led_set_brightness_async calls brightness_set op, which doesn't
>> set LED brightness in an asynchronous way in case of every driver.
>>
>> Before introduction of SET_BRIGHTNESS_SYNC and SET_BRIGHTNESS_ASYNC
>> flags there was only brightness_set op. The flags and
>> brightness_set_sync op was added for flash LED controllers to avoid
>> delegating the job to work queue and assure that brightness is set
>> as quickly as possible.
>>
>> I mistakenly assumed that all drivers set the brightness with use
>> of a work queue.
> Indeed.
>
>> Now, to fix the issue all drivers that set brightness in the
>> asynchronous way need to set the SET_BRIGHTNESS_SYNC flag and rename
>> their brightness_set ops to brightness_set_sync.
>> It would be also nice to rename brightness_set op to
>> brightness_set_async.
>>
>> Also, led_set_brightness_async shouldn't be called directly
>> anywhere, but led_set_brightness should be used, as it
>> selects the appropriate op basing on the SET_BRIGHTNESS_* flag.
>>
>> I'd prefer to do these modifications before merging this patch
> Sounds good: I wonder if the new flag for FAST drivers will then
> be needed at all: maybe it would be enough for the driver to define
> a SYNC method, and we assume the SYNC methods are always fast?

Flash LED controllers also set SYNC flag, but they are not fast.
They require to implement async method (current brightness_set),
for staying compatible with triggers.

> In fact, the things are more complicated: some drivers do small
> udelay()'s but do not use a work-queue. I was not marking them as
> FAST, although perhaps they could still be marked as SYNC?

This could be handled by adding a property to struct led_classdev
for defining minimum acceptable delay. Then FAST flag should not
be needed.

>> set. I can produce the patch set within a few days. Or, maybe you
>> would like to take care of it?
> I would appreciate if you do.
> I very much hate to do any non-trivial changes to the code I can't
> even properly test (sometimes not even compile-test!).

OK, I'll do that.

> Since you are at it, I'd also suggest to kill the work-queue in
> led-core.c. Now that we fixed a scenario where it was mistakenly
> used, I again think it is not needed for what it was initially advertised.
>

OK, I'll check this.

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-06-01 14:19 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 15:17 [PATCH 0/20] leds: put hard limit on minimum blink period for slow leds Stas Sergeev
2015-05-20 15:19 ` [PATCH 01/20] leds: implement LED_BRIGHTNESS_FAST flag Stas Sergeev
2015-05-21 13:22   ` Jacek Anaszewski
2015-05-21 13:27     ` Stas Sergeev
2015-05-21 13:37       ` Jacek Anaszewski
2015-05-21 15:26         ` Stas Sergeev
2015-05-29 16:24           ` Stas Sergeev
2015-06-01  8:31   ` Jacek Anaszewski
2015-06-01 11:56     ` Stas Sergeev
2015-06-01 14:19       ` Jacek Anaszewski [this message]
2015-06-01 14:37         ` Stas Sergeev
2015-06-02  8:11           ` Jacek Anaszewski
2015-05-20 15:20 ` [PATCH 02/20] leds: mark dell-led driver with " Stas Sergeev
2015-05-20 15:21 ` [PATCH 03/20] leds: mark asic3 " Stas Sergeev
2015-05-20 15:22 ` [PATCH 04/20] leds: mark bcm6328 " Stas Sergeev
2015-05-20 15:23 ` [PATCH 05/20] leds: mark clevo-mail " Stas Sergeev
2015-05-20 15:24 ` [PATCH 06/20] leds: mark cobalt-qube " Stas Sergeev
2015-05-20 15:25 ` [PATCH 07/20] leds: mark cobalt-raq " Stas Sergeev
2015-05-20 15:26 ` [PATCH 08/20] leds: mark fsg " Stas Sergeev
2015-05-20 15:27 ` [PATCH 09/20] leds: mark gpio " Stas Sergeev
2015-05-20 15:28 ` [PATCH 10/20] leds: mark hp6xx " Stas Sergeev
2015-05-20 15:29 ` [PATCH 11/20] leds: mark locomo " Stas Sergeev
2015-05-20 15:30 ` [PATCH 12/20] leds: mark net48xx " Stas Sergeev
2015-05-20 15:31 ` [PATCH 13/20] leds: mark netxbig " Stas Sergeev
2015-05-20 15:32 ` [PATCH 14/20] leds: mark ns2 " Stas Sergeev
2015-05-20 15:33 ` [PATCH 15/20] leds: mark ot200 " Stas Sergeev
2015-05-20 15:34 ` [PATCH 16/20] leds: mark pwm " Stas Sergeev
2015-05-20 15:35 ` [PATCH 17/20] leds: mark s3c24xx " Stas Sergeev
2015-05-20 15:35 ` [PATCH 18/20] leds: mark ss4200 " Stas Sergeev
2015-05-20 15:36 ` [PATCH 19/20] leds: mark versatile " Stas Sergeev
2015-05-20 15:37 ` [PATCH 20/20] leds: mark wrap " Stas Sergeev
2015-05-21 15:11 ` [PATCH 02/20] leds: mark dell-led " Stas Sergeev
2015-05-21 15:12 ` [PATCH 03/20] leds: mark asic3 " Stas Sergeev
2015-05-21 15:13 ` [PATCH 04/20] leds: mark bcm6328 " Stas Sergeev
2015-05-21 15:14 ` [PATCH 05/20] leds: mark clevo-mail " Stas Sergeev
2015-05-21 15:15 ` [PATCH 06/20] leds: mark cobalt-qube " Stas Sergeev
2015-05-21 15:15 ` [PATCH 07/20] leds: mark cobalt-raq " Stas Sergeev
2015-05-21 15:16 ` [PATCH 08/20] leds: mark fsg " Stas Sergeev
2015-05-21 15:16 ` [PATCH 09/20] leds: mark gpio " Stas Sergeev
2015-05-21 15:17 ` [PATCH 10/20] leds: mark hp6xx " Stas Sergeev
2015-05-21 15:18 ` [PATCH 11/20] leds: mark locomo " Stas Sergeev
2015-05-21 15:19 ` [PATCH 13/20] leds: mark netxbig " Stas Sergeev
2015-05-21 15:20 ` [PATCH 14/20] leds: mark ns2 " Stas Sergeev
2015-05-21 15:21 ` [PATCH 15/20] leds: mark ot200 " Stas Sergeev
2015-05-26  9:16   ` Christian Gmeiner
2015-05-21 15:21 ` [PATCH 16/20] leds: mark pwm " Stas Sergeev
2015-05-21 15:22 ` [PATCH 17/20] leds: mark s3c24xx " Stas Sergeev
2015-05-21 15:23 ` [PATCH 18/20] leds: mark ss4200 " Stas Sergeev
2015-05-21 15:23 ` [PATCH 19/20] leds: mark versatile " Stas Sergeev
2015-05-22  7:14   ` Linus Walleij
2015-05-22 10:06     ` Stas Sergeev
2015-05-21 15:24 ` [PATCH 20/20] leds: mark wrap " Stas Sergeev

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=556C69EA.10000@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=cooloney@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=stsp@list.ru \
    --cc=stsp@users.sourceforge.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.