All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Phil Sutter <phil@nwl.cc>
Cc: linux-leds@vger.kernel.org
Subject: Re: [PATCH] leds: trigger: Add invert attribute to ledtrig-audio
Date: Tue, 10 Aug 2021 15:52:43 +0200	[thread overview]
Message-ID: <20210810135243.GB28089@amd> (raw)
In-Reply-To: <20210810092246.GB3673@orbyte.nwl.cc>

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

Hi!

> 
> On Mon, Aug 09, 2021 at 08:11:18PM +0200, Pavel Machek wrote:
> > > Inverting micmute LED used to be possible via a mixer setting, but
> > > conversion to LEDs class (probably) killed it. Re-establish the old
> > > functionality via sysfs attribute in audio LED triggers.
> > 
> > So we have both invert and inverted attributes. Fun :-).
> 
> Hmm! :)
> 
> Are you talking about LED_BLINK_INVERT flag? I see a few triggers allow
> inversion but didn't find LED drivers exporting such a property.
> 
> > See sysfs-class-led and sysfs-class-led-trigger-oneshot.
> 
> I think I "copied" from oneshot trigger when writing this patch.
> 
> > We definitely want this documented. We probably want this for most
> > triggers, maybe it should get one implementation in library somewhere?
> 
> Should this be an implicit attribute of simple triggers only or all? In
> the latter case (which could simplify some triggers) I guess the value
> inversion has to take place in led_set_brightness_nopm(), the lowest
> level function triggers may use.

Actual inversion is trivial (so it may not make sense to share), but
sysfs interface is not. Sharing that would be good.

> How does inversion work, actually? LED_OFF <-> LED_ON is trivial, but
> what about LED_HALF and LED_FULL? Leaving LED_HALF as-is seems logical,
> but the opposite of LED_OFF might be LED_ON or LED_FULL. Does
> max_brightness determine that?

max_brightness determines that, and it would be simply

if (->inverted)
   b = ->max_brighntess-b;
   
Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

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

      reply	other threads:[~2021-08-10 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09 12:29 [PATCH] leds: trigger: Add invert attribute to ledtrig-audio Phil Sutter
2021-08-09 18:11 ` Pavel Machek
2021-08-10  9:22   ` Phil Sutter
2021-08-10 13:52     ` Pavel Machek [this message]

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=20210810135243.GB28089@amd \
    --to=pavel@ucw.cz \
    --cc=linux-leds@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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.