linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Jacek Anaszewski <j.anaszewski@samsung.com>,
	linux-leds@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Darren Hart <dvhart@infradead.org>
Subject: Three different LED brightnesses (was Re: PM regression with LED changes in next-20161109)
Date: Sun, 13 Nov 2016 10:10:54 +0100	[thread overview]
Message-ID: <20161113091054.GA17790@amd> (raw)
In-Reply-To: <3ca04742-6376-5a88-8d10-5b88fcd8f5e5@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4433 bytes --]

On Sat 2016-11-12 09:03:42, Hans de Goede wrote:
> Hi,
> 
> On 11-11-16 23:12, Pavel Machek wrote:
> >Hi!
> >
> >Reason #1:
> >
> >>>>Hmm. So userland can read the LED state, and it can get _some_ value
> >>>>back, but it can not know if it is current state or not.
> 
> That is not correct, the current behavior for eading the brightness
> atrribute is to always return the current state.

No. (Because some hardware can't get back current state of
hardware-controlled leds, and because of blinking).

> >>Why a dedicated file? Are we going to mirror brightness here
> >>wrt r/w (show/store) behavior ? If not userspace now needs
> >>2 open fds which is not really nice. If we are and we are
> >>not going to use poll for something else on brightness itself
> >>then why not just poll directly on brightness ?
> >
> >Reason #1 is above.
> 
> See my reply above.
> 
> >Reason #2 is "if userspace sees brightness file, it can not know if
> >the notifications on change actually work or not".
> 
> If it needs to know that it can simply check the kernel version.

No. Because in case of hardware blinking we can't provide poll()
functionality.

Plus, saying "simply check the kernel version" simply means you should
not be submitting patches to kernel... at all. (Hint... it also does
not work.)

> >Reason #3 is that you broke Tony's system. Polling does not make sense
> >when trigger such as "CPU in use" is active.
> 
> Have you seen v4 of my patch? It fixes this while keeping the
> polling on the brightness attribute itself, it basically goes
> back (more or less) to v1 of my patch which did not have this
> problem. I never wanted notification of trigger / blinking
> changes because I already feared Tony's problem would happen.

Have you seen v67123 of my latest facebook post? It explains why you
are completely wrong.

> >Reason #4 is that there are really two brightnesses:
> >
> >1) maximum brightness trigger is going to use
> >
> >2) current brightness
> >
> >Currently writing to "brightness" file changes 1), but reading returns
> >2) when available.
> 
> Right and Jacek has already said that we cannot change the
> reading behavior on the brightness file because of ABI concerns.

Until there's user that actually reads that, ABI can be fixed. Given
that it basically returns random value,

> >So, feel free to propose better interface. One that solves #1..#4
> >above.
> 
> Proposal 1:
> 
> v4 of my patch, see the list. It solves all but #4, which
> is out of scope for my patch, feel free to submit a patch to
> solve #4 (with a new sysfs attr).

NAK on that. (And it does not solve #1 and #2 at least.)

> Proposal 2:
> 
> Add a new "user_brightness" file, which shows the last brightness
> as set by the user, this would show the read behavior we really
> want of brightness: show the real brightness when not blinking /
> triggers are active, show the brightness used when on when
> blinking / triggers are active.

No, that's just adding more mess on the system.

Here's better proposal:

brightness (write): what we do today. (Mess, but too late to change it)
	   (read): -Esomething or what we do today (if someone
	   	   	       	       	  	   acutally uses it)
           (poll): -Esomething

current_brightness (write): -Esomething, or maybe change brightness
		   for triggers that can work with that
              (read, poll): if the current trigger can get current
	             state of led, do it, otherwise -Esomething...
		     or maybe file should be simply hidden from sysfs.

trigger_max_brightness (read,write): change the maximum brightness for
		       a trigger.
	       (poll): -Esomething

If you have hardware changing the brightness behind kernel's back,
that should be modelled as a trigger. Userspace should know
there's hardware changing it autonomously ... there should be
"hardware-keylight-brightness" trigger, probably impossible to change
(depends on hardware behaviour).

On thinkpad, for example, for many LEDs kernel can select either
"hardware drives the LED", but then current_brightness is unavailable,
or "kernel drives the LED", but then hardware does not touch the led
at all.

Best regards,

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2016-11-13  9:10 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 19:23 PM regression with LED changes in next-20161109 Tony Lindgren
2016-11-09 20:45 ` Jacek Anaszewski
2016-11-10  8:49   ` Hans de Goede
2016-11-10 12:56     ` Jacek Anaszewski
2016-11-10 13:04       ` Hans de Goede
2016-11-10 13:55         ` Jacek Anaszewski
2016-11-10 16:36           ` Pavel Machek
2016-11-10 16:29       ` Pavel Machek
2016-11-10 16:44         ` Hans de Goede
2016-11-10 20:48           ` Pavel Machek
2016-11-11  8:25             ` Hans de Goede
2016-11-10 17:55         ` Tony Lindgren
2016-11-10 20:29           ` Pavel Machek
2016-11-10 21:34             ` Jacek Anaszewski
2016-11-11 12:01               ` Pavel Machek
2016-11-11 17:03                 ` Jacek Anaszewski
2016-11-11 19:28                   ` Hans de Goede
2016-11-11 22:12                     ` Pavel Machek
2016-11-12  8:03                       ` Hans de Goede
2016-11-13  9:10                         ` Pavel Machek [this message]
2016-11-13  9:44                           ` Three different LED brightnesses (was Re: PM regression with LED changes in next-20161109) Hans de Goede
2016-11-13 20:45                             ` Pavel Machek
2016-11-12 10:24                     ` PM regression with LED changes in next-20161109 Jacek Anaszewski
2016-11-12 10:33                       ` Hans de Goede
2016-11-12 19:14                         ` Jacek Anaszewski
2016-11-12 21:14                           ` Hans de Goede
2016-11-13 11:44                             ` Jacek Anaszewski
2016-11-13 13:52                               ` Hans de Goede
2016-11-14  9:12                                 ` Jacek Anaszewski
2016-11-14 12:51                                   ` Hans de Goede
2016-11-15 10:01                                     ` Jacek Anaszewski
2016-11-15 10:09                                       ` Hans de Goede
2016-11-15 10:31                                     ` LEDs that change brightness "itself" -- that's a trigger. " Pavel Machek
2016-11-15 10:58                                       ` Jacek Anaszewski
2016-11-15 11:11                                         ` Pavel Machek
2016-11-15 11:21                                           ` Hans de Goede
2016-11-15 11:48                                             ` Pavel Machek
2016-11-15 12:06                                               ` Hans de Goede
2016-11-15 12:11                                                 ` Pavel Machek
2016-11-15 13:28                                                 ` Jacek Anaszewski
2016-11-15 13:48                                                   ` Hans de Goede
2016-11-15 14:04                                                     ` Jacek Anaszewski
2016-11-15 14:30                                                       ` Hans de Goede
2016-11-15 14:41                                                         ` Jacek Anaszewski
2016-11-17 22:12                                                 ` Hans de Goede
2016-11-15 11:17                                         ` Hans de Goede
2016-11-14  8:31                             ` Pavel Machek
2016-11-11 22:06                   ` Pavel Machek
2016-11-10  8:34 ` Hans de Goede
2016-11-10 15:11   ` Tony Lindgren

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=20161113091054.GA17790@amd \
    --to=pavel@ucw.cz \
    --cc=dvhart@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=j.anaszewski@samsung.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.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).