From: "Pali Rohár" <pali.rohar@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Darren Hart <dvhart@infradead.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>,
Richard Purdie <rpurdie@rpsys.net>,
Jacek Anaszewski <j.anaszewski@samsung.com>,
ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org,
Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v5 1/6] leds: triggers: Add current_brightness trigger parameter
Date: Sun, 20 Nov 2016 20:40:46 +0100 [thread overview]
Message-ID: <201611202040.46333@pali> (raw)
In-Reply-To: <fc7f4360-a9ae-5ec8-46f0-b078a5901d8f@redhat.com>
[-- Attachment #1: Type: Text/Plain, Size: 3433 bytes --]
On Sunday 20 November 2016 19:45:40 Hans de Goede wrote:
> Hi,
>
> On 20-11-16 15:59, Pali Rohár wrote:
> > On Thursday 17 November 2016 23:24:36 Hans de Goede wrote:
> >> In some cases it may be desirable for userspace to be notified
> >> when a trigger event happens. This commit adds support for a
> >> poll-able current_brightness trigger specific sysfs attribute
> >> which triggers may register:
> >>
> >> What: /sys/class/leds/<led>/current_brightness
> >> Date: November 2016
> >> KernelVersion: 4.10
> >>
> >> Description:
> >> Triggers which support it may register a current_brightness
> >> file. This file supports poll() to detect when the trigger
> >> modifies the brightness of the LED.
> >> Reading this file will always return the current brightness
> >> of the LED.
> >> Writing this file sets the current brightness of the LED,
> >> without influencing the trigger.
> >
> > Personally I do not like this new sysfs attribute...
> >
> > Now when somebody look at /sys/class/leds/<something>/, the first
> > thing which say would be:
> >
> > "What the hell, why there are two files (brightness and
> > current_brightness) for changing LED level? And which should I
> > use?"
> >
> > If I understood correctly we need to handle two things:
> >
> > 1) Provide poll() for userspace when LED level is changed (either
> > by HW
> >
> > or other user call)
> >
> > 2) Deal with fact that on _some_ hardware, special key is hardwired
> > to
> >
> > change LED level
> >
> > So why for 1) we cannot use existing sysfs file "brightness"? I do
> > not see any problem with it.
>
> That was our first attempt at this, but because the brightness may
> also be changed by triggers / blink-timers, we need to wakeup poll()
> in those cases too (anything else would be inconsistent) and doing
> such a wakeup in that case has turned out to cause too much overhead
> in some cases (even if userspace is not listening), specifically the
> idle power uses on some systems got multiplied by a factor of 5 or
> more.
>
> So this approach was rejected.
But approach with exporting new sysfs file with name current_brightness
with existence of old brightness sysfs file is not good and in my
opinion it is even worst as current situation (= without poll support).
What happen in next 5 years? Somebody point that sysfs file "brightness"
and sysfs file "current_brightness" is still not good and invent
"really_current_brightness" sysfs with new logic? No this is really not
a way...
I understand that extending current "brightness" sysfs is complicated,
but it is not a reason to not doing it and inventing new crippling sysfs
file which duplicate existing one (with some modifications).
Anyway, I cannot believe that power usage is increased by factor 5 with
exporting poll support. If we are going to change brightness level
(either by trigger or timer) we still need to do wakeup.
And we can do some optimizations, e.g. do not send poll event when
nobody is listening or postpone event so we do not send too many events
in 1s interval (or choose longer interval).
Polling support is not in mainline kernel yet, so we can change its
behaviour without breaking ABI. And we can define (if it help us!) that
evens can be send to userspace with some delay (e.g. 1-3s).
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2016-11-20 19:40 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 22:24 [PATCH v5 1/6] leds: triggers: Add current_brightness trigger parameter Hans de Goede
2016-11-17 22:24 ` [PATCH v5 2/6] leds: triggers: Add a keyboard backlight trigger Hans de Goede
2016-11-18 8:55 ` Jacek Anaszewski
[not found] ` <af5a6b68-310d-85ec-16db-5c9036f38ba5-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-18 9:07 ` Hans de Goede
2016-11-18 16:03 ` Jacek Anaszewski
2016-11-18 18:47 ` Hans de Goede
2016-11-19 15:44 ` Jacek Anaszewski
2016-11-20 15:05 ` Pali Rohár
2016-11-20 16:21 ` Pavel Machek
2016-11-20 18:48 ` Hans de Goede
[not found] ` <acd1691b-56be-c902-feff-7ecf38ea102a-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-20 19:45 ` Pali Rohár
2016-11-21 10:24 ` Jacek Anaszewski
2016-11-21 10:42 ` Hans de Goede
2016-11-21 11:24 ` Jacek Anaszewski
2016-11-21 11:56 ` Hans de Goede
2016-11-21 13:29 ` Jacek Anaszewski
2016-11-22 14:58 ` Pali Rohár
2016-11-22 15:20 ` [ibm-acpi-devel] " Glenn Golden
2016-11-23 11:01 ` Jacek Anaszewski
2016-11-24 9:15 ` Pali Rohár
2016-11-24 9:21 ` Hans de Goede
2016-11-24 14:21 ` Jacek Anaszewski
2016-11-24 14:26 ` Pali Rohár
2016-11-24 15:32 ` Jacek Anaszewski
[not found] ` <50225a88-b928-c61b-bf6f-6c85fb6a9082-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-24 15:36 ` Pali Rohár
2016-11-24 16:21 ` Jacek Anaszewski
2016-11-24 16:51 ` Pali Rohár
2016-11-24 21:35 ` Jacek Anaszewski
[not found] ` <5238be1f-d669-07e6-c796-5bc0126cb456-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-24 21:45 ` Pali Rohár
2016-11-25 8:33 ` Jacek Anaszewski
2016-11-25 10:01 ` Pavel Machek
2016-11-25 10:25 ` Jacek Anaszewski
[not found] ` <e32e3d6c-5d6d-c882-21d9-8028c8311b0b-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-25 11:05 ` Pavel Machek
2016-11-25 11:19 ` Jacek Anaszewski
[not found] ` <2367b9a7-68f7-2038-0d3a-a9561055b4f6-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-25 14:49 ` Pavel Machek
2016-11-25 15:55 ` Jacek Anaszewski
2016-11-25 20:40 ` Pavel Machek
2016-11-25 22:28 ` Jacek Anaszewski
2016-12-21 18:49 ` Pavel Machek
2016-12-23 21:55 ` Jacek Anaszewski
2017-01-13 19:17 ` Darren Hart
2017-01-15 10:54 ` Hans de Goede
2017-01-15 12:25 ` Henrique de Moraes Holschuh
2017-01-15 15:05 ` Hans de Goede
2017-01-24 12:32 ` Pavel Machek
2017-01-24 22:56 ` Jacek Anaszewski
2017-01-25 13:12 ` Hans de Goede
2016-11-25 11:14 ` Hans de Goede
2016-11-25 11:26 ` Pali Rohár
2016-11-25 12:05 ` Pavel Machek
2016-11-25 15:46 ` Jacek Anaszewski
2016-12-01 14:08 ` Jacek Anaszewski
2016-11-25 9:56 ` Pavel Machek
2016-11-25 9:51 ` Pavel Machek
2016-11-21 11:41 ` Pavel Machek
2016-11-21 13:29 ` Jacek Anaszewski
2016-11-25 9:29 ` Pavel Machek
2016-11-21 8:35 ` Jacek Anaszewski
2016-11-21 9:31 ` Hans de Goede
2016-11-21 10:12 ` Pali Rohár
2016-11-21 10:16 ` Hans de Goede
2016-11-25 10:07 ` Pavel Machek
2016-11-17 22:24 ` [PATCH v5 3/6] leds: triggers: Add support for read-only triggers Hans de Goede
2016-11-18 8:52 ` Jacek Anaszewski
2016-11-18 9:04 ` Hans de Goede
2016-11-18 10:49 ` Jacek Anaszewski
2016-11-18 11:01 ` Hans de Goede
2016-11-17 22:24 ` [PATCH v5 4/6] platform: x86: thinkpad: Call led kbd_backlight trigger on kbd brightness change Hans de Goede
2016-11-17 22:24 ` [PATCH v5 5/6] platform: x86: dell-laptop: Set keyboard backlight led device default trigger Hans de Goede
2016-11-17 22:24 ` [PATCH v5 6/6] platform: x86: dell-wmi: Call led kbd_backlight trigger on kbd brightness change Hans de Goede
2016-11-20 14:59 ` [PATCH v5 1/6] leds: triggers: Add current_brightness trigger parameter Pali Rohár
2016-11-20 18:45 ` Hans de Goede
2016-11-20 19:40 ` Pali Rohár [this message]
2016-11-20 22:12 ` Pavel Machek
2016-11-20 23:07 ` Pali Rohár
2016-11-20 23:48 ` Pavel Machek
2016-11-21 10:02 ` Pali Rohár
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=201611202040.46333@pali \
--to=pali.rohar@gmail.com \
--cc=dvhart@infradead.org \
--cc=hdegoede@redhat.com \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ibm-acpi@hmh.eng.br \
--cc=j.anaszewski@samsung.com \
--cc=linux-leds@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=pavel@ucw.cz \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rpurdie@rpsys.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 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).