linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>, Pavel Machek <pavel@ucw.cz>
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: Sat, 16 Feb 2019 18:02:34 +0100	[thread overview]
Message-ID: <8a263266-a41f-c916-e990-02d04de9b5d0@gmail.com> (raw)
In-Reply-To: <b15fd048-8206-4057-a354-07dc14ca15e3@redhat.com>

Hi Hans,

On 2/16/19 12:14 AM, Hans de Goede wrote:
> Hi,
> 
> On 2/15/19 11:31 PM, Jacek Anaszewski wrote:
>> On 2/15/19 11:26 PM, Hans de Goede wrote:
> 
> <snip>
> 
>>> I think that should work fine, which means that we can use the timer and
>>> pattern trigger support for the blinking and breathing modes.
>>>
>>> That still leaves the switching between user and hw-control modes,
>>> as discussed the hw-controlled mode could be modelled as a new 
>>> "hardware"
>>> trigger, but then we cannot choose between on/blink/breathing when
>>> in hw-controlled mode. As Pavel mentioned, that would require some
>>> sort of composed trigger, where we have both the hardware and
>>> timer triggers active for example.
>>>
>>> I think it might be easier to just allow turning on/off the hardware
>>> control mode through a special "hardware_control" sysfs attribute and
>>> then use the existing timer and pattern triggers for blinking / 
>>> breathing.
>>
>> Pattern trigger exposes pattern file by default and hw_pattern if
>> pattern_set/get ops are provided. Writing them enables software and
>> hardware pattern respectively.
> 
> This is not about software vs hardware pattern.
> 
> There are 2 *orthogonal*, separate problems/challenges with this LED 
> controller:
> 
> 1) It has hardware blinking and breathing, as discussed this can be
> controlled through the timer and pattern triggers, so this problem
> is solved.
> 
> 2) It has 2 operating modes:
> 
> a) Automatic/hardware controlled, in this mode the LED is turned
> off or on (where on can be continues on, blinking or breathing)
> by the hardware itself, when in this mode we / userspace is not
> in control of the LED
> 
> b) Manual/user controlled mode, in this mode we / userspace can
> control of the LED.
> 
> Currently there is no API in the ledclass to switch a LED from
> automatic controlled to user controlled and back, This is what
> the proposed hardware trigger was for, to switch to automatic
> mode. A problem with this is that we still want to be able
> to chose between continues on, blinking or breathing (when on),
> configure the max brightness, etc.

Yes, we do have the API to switch a LED from automatic (hardware
accelerated) control to software control and back. This is pattern
trigger, which exposes two files for setting pattern: pattern
and hw_pattern. Writing pattern file switches the device to software
control mode and writing hw_pattern switches it to the hardware control,
with the possibility of defining device specific ABI syntax to enable
particular pattern (blinking, breathing or event permanently on
in case of this device).

The hw_pattern is device specific, so the device specific ABI
documentation can state that when the pattern trigger is enabled
for this device in hw accelerated mode, then it will blink the
LED only when specific conditions are met - in this case it will
be activation of charging.

Since timer trigger does not allow to explicitly choose between
software and hardware timer engine, then I propose to not take
it into account for supporting hardware blinking offered by
this device. Enabling pattern trigger will just periodically
set brightness of the LED.

Since pattern trigger is a superset of timer, then it can handle
ordinary blinking as well.

> Since there cannot be more then 1 trigger active, with the
> hardware trigger solution we cannot say we want automatic
> control (hardware trigger) and blinking when the automatic
> mode says the LED should be on (timer trigger) as that
> would mean having 2 triggers active with the hardware
> trigger solution.
> 
> As such I think the switch between automatic and manual
> control would be best exported through a special "hardware_control"
> sysfs attribute and then use the existing timer and pattern
> triggers for blinking / breathing.
> 
> Regards,
> 
> Hans
> 

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2019-02-16 17:02 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
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 [this message]
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=8a263266-a41f-c916-e990-02d04de9b5d0@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jekhor@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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).