mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Rong Zhang <i@rong.moe>
Cc: "Lee Jones" <lee@kernel.org>, "Pavel Machek" <pavel@kernel.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Benson Leung" <bleung@chromium.org>,
	"Guenter Roeck" <groeck@chromium.org>,
	"Marek Behún" <kabel@kernel.org>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Derek J. Clark" <derekjohn.clark@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Ike Panhc" <ikepanhc@gmail.com>,
	"Vishnu Sankar" <vishnuocv@gmail.com>,
	vsankar@lenovo.com, linux-kernel@vger.kernel.org,
	linux-leds@vger.kernel.org, chrome-platform@lists.linux.dev,
	platform-driver-x86@vger.kernel.org
Subject: Re: [RFC PATCH 0/9] leds: Add support for hw initiated hw control trigger transition
Date: Tue, 10 Mar 2026 20:57:00 +0100	[thread overview]
Message-ID: <c61a58df-8211-4f6a-8f60-b66b565123e4@lunn.ch> (raw)
In-Reply-To: <20260227190617.271388-1-i@rong.moe>

On Sat, Feb 28, 2026 at 03:05:57AM +0800, Rong Zhang wrote:
> Hi all,
> 
> Some laptops can tune their keyboard backlight according to ambient
> light sensors (auto mode). This capability is essentially a hw control
> trigger. Meanwhile, such laptops also offer a shrotcut for cycling
> through brightness levels and auto mode. For example, on ThinkBook,
> pressing Fn+Space cycles keyboard backlight levels in the following
> sequence:
> 
>   1 => 2 => 0 => auto => 1 ...
> 
> Recent ThinkPad models should have similar sequence too.

With networking, we consider the hardware as an accelerator for what
the Linux network stack can already do in software. We let the user
configure the network stack however they want it, and then we ask the
hardware, can you accelerate this, so we don't need to do it in
software? It might say -EOPNOTSUPP, so it is left in software. It
might say 0, and we never see the packets, because the hardware is
doing the work. The user is not really aware acceleration is
happening, because they just configure the network stack how they
want, independent of acceleration or not.

For PHY and MAC LEDs it is exactly the same. Generally, the LEDs in
RJ45 connectors, or on the front panel can be turned on/off. The
netdev LED trigger knows if the link is 10M, 100M, 1G etc. It knows if
packets are being transmitted or received. It can make the LEDs show
the link speed, or blink for packet activity, in software, using
simple set_brightness calls. It will also ask the LED, can you
accelerate this? Can you get the state directly from the PHY/MAC? The
LED in my keyboard shift lock will say -EOPNOTSUPP, and the netdev
trigger will keep blinking it in software. The LED driver by the PHY
might say 0, and blink the LED itself. Or it might say -EOPNOTSUPP,
because the vendor decided to only support RX+TX, not only RX.

My preference is this model of accelerating what Linux can already do
should be used everywhere.

You know how many levels the LED supports, so the trigger can easily
implement the steps, 0, 1, 2, 0, 1, 2, based on receiving some event
from somewhere.  You can also accelerate this, you can ask the LED,
can you directly receive the event? -EOPNOTSUPP, keep controlling it
from software. 0, stop driving it from software, the hardware will
accelerate it.

If the system has access to a light sensor, the trigger can also
decide on 0, 1, or 2, based on polling the light sensor every
second. It can then ask the LED, do you have direct access to the
light sensor, can you accelerate this?

The experience from networking is, once you get into the mindset of
the hardware is there to accelerate what Linux can already do, a lot
of problems just disappear. It might you first need to implement the
software version, but once you have that, acceleration is easy.

Does Linux already have a software version of what you want? Can you
accelerate it?

	Andrew

  parent reply	other threads:[~2026-03-10 19:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 19:05 Rong Zhang
2026-02-27 19:05 ` [RFC PATCH 1/9] leds: Load trigger modules on-demand if used as hw control trigger Rong Zhang
2026-03-10 12:01   ` Lee Jones
2026-03-11 16:18     ` Rong Zhang
2026-03-10 19:22   ` Andrew Lunn
2026-03-11 18:17     ` Rong Zhang
2026-03-11 18:44       ` Andrew Lunn
2026-03-11 19:39         ` Rong Zhang
2026-03-11 21:29           ` Andrew Lunn
2026-03-12 18:01             ` Rong Zhang
2026-03-12 21:46               ` Mark Pearson
2026-03-13 14:01                 ` Rong Zhang
2026-03-14 19:02                   ` Mark Pearson
2026-04-11 15:31                     ` Mark Pearson
2026-04-11 20:42                       ` Andrew Lunn
2026-04-11 22:32                         ` Rong Zhang
2026-04-18 11:52                         ` Rong Zhang
2026-02-27 19:05 ` [RFC PATCH 2/9] leds: Add callback offloaded() to query the state of " Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 3/9] leds: cros_ec: Implement offloaded() callback for trigger Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 4/9] leds: turris-omnia: " Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 5/9] leds: trigger: netdev: Implement offloaded() callback Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 6/9] leds: Add trigger_may_offload attribute Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 7/9] leds: trigger: Add led_trigger_notify_hw_control_changed() interface Rong Zhang
2026-02-27 21:01   ` Randy Dunlap
2026-02-27 19:06 ` [RFC PATCH 8/9] platform/x86: ideapad-laptop: Decouple HW & cdev brightness for kbd backlight Rong Zhang
2026-02-27 19:06 ` [RFC PATCH 9/9] platform/x86: ideapad-laptop: Fully support auto " Rong Zhang
2026-03-04 20:05 ` [RFC PATCH 0/9] leds: Add support for hw initiated hw control trigger transition Mark Pearson
2026-03-05 12:00   ` Vishnu Sankar
2026-03-05 12:37   ` Rong Zhang
2026-03-08 17:44     ` Mark Pearson
2026-03-10 20:03   ` Andrew Lunn
2026-03-10 12:10 ` Lee Jones
2026-03-10 19:04   ` Andrew Lunn
2026-03-11 18:18     ` Rong Zhang
2026-03-10 19:57 ` Andrew Lunn [this message]
2026-03-11 19:03   ` Rong Zhang

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=c61a58df-8211-4f6a-8f60-b66b565123e4@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=derekjohn.clark@gmail.com \
    --cc=groeck@chromium.org \
    --cc=hansg@kernel.org \
    --cc=i@rong.moe \
    --cc=ikepanhc@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kabel@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=pavel@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vishnuocv@gmail.com \
    --cc=vsankar@lenovo.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

all inboxes | Powered by JetHome®