linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Yauhen Kharuzhy <jekhor@gmail.com>,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org
Subject: Re: [PATCH v2 1/2] leds: Add Intel Cherry Trail Whiskey Cove PMIC LEDs
Date: Thu, 14 Feb 2019 12:14:23 +0100	[thread overview]
Message-ID: <20190214111423.GE6132@amd> (raw)
In-Reply-To: <562e2acd-a60a-2aea-4050-6d9414d23a4e@redhat.com>

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

Hi!

> >>Basically the charge led has 3 states:
> >>
> >>1) Off
> >>2) On
> >>3) On when charging
> >>
> >>And then when on it has 4 patterns:
> >>
> >>1) Permanently off (so still not really on)
> >>2) Permanently on
> >>3) Blinking
> >>4) Breathing
> >
> >Ok, so you don't really need to support _both_ off methods.
> >
> >Still sounds like a normal LED, with special "yoga-charging" and
> >"yoga-breathing" triggers. (All the normal triggers should still work,
> >too.)
> 
> Except that when in yoga-charging mode, the user should
> still be able to select if the LED is simply on when charging,
> blinking when charging, or breathing when charging.
> 
> Given that there are 2 independent settings model-ing this
> as a trigger does not work well. Also the trigger names should
> not contain yoga as the PMIC in question is used in other
> devices too.
> 
> I really think we should not try to shoe-horn special cases
> like this into the generic API and just use custom sysfs
> attributes for this. Like for example how the kbd-backlight

This is not really that much of a special case. I have LEDs on
thinkpads that can be either hardware controlled or sw controlled with
various functions. Both Droid 4 and N900 have hardware support for
showing charging state on the notification LED. N900 additionaly has
debug functionality for keyboard backlight...

> led classdev from the dell-laptop has custom attributes to
> select if the timeout for going off on keyboard/mouse activity
> and another custom attribute to select if only the keyboard or
> both the keyboard and mouse count as relevant activity.

Yeah well more stuff to fix :-(.

> Triggers are great for when we actually want to add a link
> between an event coming from some part of code in the kernel,
> to a LED classdevice, so that that event can control the LED.

Well, triggers are also useful because userspace should already know
about them.... and because your hardware already behaves as if it had
"trigger" implemented in hardware...

> >Anyway, in such case I'd propose having rmmod/reboot/poweroff hook
> >that just sets it to breathing. No need to expose it to userspace.
> 
> That assumes that breathing is the default setting on all hardware
> and again I don't see why not to export this functionality to

Save the status on boot, then restore it on rmmod/reboot/poweroff? :-).

> userspace. Just because something does not fit in the existing
> API is IMHO not a good reason to not expose it to userspace.
> 
> I suggest that we deal with this special case by adding 3 custom
> sysfs attributes:
> 
> 1) "mode" which when read, prints, e.g. :
> manual [on-when-charging]

While this allows _user on console_ to control everything using echo,
it is not suitable for applications trying to control LEDs.

As there's nothing special about the case here, I believe we should
have generic solution here.

My preffered solution would be "hardware" trigger that leaves the LED
in hardware control.

Alternatively I could imagine "hardware" sysfs attribute, containing
0/1, with 0==software controlled, 1==hardware controlled.

The rest of attributes would have to be Cove-specific, yes (but still
should fit with the rest of LED subsystem).

									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:[~2019-02-14 11:14 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 20:58 [PATCH v2 0/2] Intel Cherry Trail Whiskey Cove LEDs support Yauhen Kharuzhy
2019-02-12 20:59 ` [PATCH v2 1/2] leds: Add Intel Cherry Trail Whiskey Cove PMIC LEDs Yauhen Kharuzhy
2019-02-13 22:43   ` Hans de Goede
2019-02-13 23:07     ` Pavel Machek
2019-02-13 23:25       ` Hans de Goede
2019-02-13 23:38         ` Pavel Machek
2019-02-14  9:57           ` Hans de Goede
2019-02-14 11:14             ` Pavel Machek [this message]
2019-02-14 11:31               ` Hans de Goede
2019-02-14 12:28                 ` Pavel Machek
2019-02-15 21:41                   ` Jacek Anaszewski
2019-02-15 23:26                     ` Pavel Machek
2019-02-14 21:46                 ` Jacek Anaszewski
2019-02-14 23:03                   ` Pavel Machek
2019-02-15  7:27                     ` Yauhen Kharuzhy
2019-02-15 21:43                       ` Jacek Anaszewski
2019-02-16 11:26                         ` Yauhen Kharuzhy
2019-02-15 11:27                     ` Hans de Goede
2019-02-15 13:02                       ` Pavel Machek
2019-02-15 21:42                       ` Jacek Anaszewski
2019-02-15 22:26                         ` Hans de Goede
2019-02-15 22:31                           ` Jacek Anaszewski
2019-02-15 23:14                             ` Hans de Goede
2019-02-16 17:02                               ` Jacek Anaszewski
2019-02-16 19:01                                 ` Hans de Goede
2019-02-16 19:37                                   ` Pavel Machek
2019-02-16 20:55                                     ` Hans de Goede
2019-02-17  0:08                                       ` Pavel Machek
2019-02-17 14:10                                         ` Hans de Goede
2019-02-17 17:45                                           ` Pavel Machek
2019-02-18 11:12                                             ` Hans de Goede
2019-02-18 21:59                                               ` Jacek Anaszewski
2019-02-16 21:54                                     ` Jacek Anaszewski
2019-02-16 22:03                                       ` Hans de Goede
2019-02-17 12:40                                         ` Jacek Anaszewski
2019-02-14 11:28             ` Pavel Machek
2019-02-14 21:34             ` Yauhen Kharuzhy
2019-02-14  6:55     ` Yauhen Kharuzhy
2019-02-14 10:04     ` Hans de Goede
2019-02-12 20:59 ` [PATCH v2 2/2] mfd: Add leds MFD cell for intel_soc_pmic_chtwc Yauhen Kharuzhy
2019-02-13 21:24   ` Jacek Anaszewski
2019-03-20  9:56   ` Lee Jones
2019-03-20  9:57     ` Lee Jones
2019-04-21 19:28 ` [PATCH v2 0/2] Intel Cherry Trail Whiskey Cove LEDs support Hans de Goede
2019-04-24 18:32   ` Yauhen Kharuzhy

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=20190214111423.GE6132@amd \
    --to=pavel@ucw.cz \
    --cc=hdegoede@redhat.com \
    --cc=jekhor@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@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 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).