Repository navigation
leds: pwm: do not force the LED off when period readback is zero - #219
Conversation
chriskearney
left a comment
There was a problem hiding this comment.
Reviewed 70c122ce2677885e8ae3d44aa1fe84b7fcd55fa2. The fallback obtains period/polarity from the PWM arguments while retaining KEEP, so probe still skips the call that would apply zero duty. I found no source blocker in that change. The reported brightness can remain zero until userspace writes a value; that differs from turning the hardware output off.
Native ARM64 package build passes for this head and the base control with the same recipe/toolchain. I independently checked the as-built pin and packaged config: CONFIG_LEDS_PWM=y, so the changed driver is compiled in.
No J313 boot test yet. The remaining hardware check is output retention through probe followed by normal brightness control; suspend restoration is a separate change in #221.
|
Tested The tester reported 38 pass, 9 fail and 26 skip, with no functional regressions against the installed-kernel reference. Two additional lab-only failures are the expected installed-package/boot-chain checks for a temporary kernel. The remaining failures were already present. This verifies the brightness interface and readback; it does not measure physical light output or demonstrate a previously failing probe condition. No suspend/resume test ran. The machine returned to its installed |
|
Tested on a J313 (M1 Air): works, no regressions found.
All lab tests passed, including the device suspend phase and omarchy-m-test with no regressions against the installed kernel. The How this was tested
|
70c122c to
7cd67b0
Compare
|
Follow-up: confirmed by eye on the Mac. Watching the keyboard during boot, the backlight went dark only while the Mac was powered off. It lit early in boot and didn't go dark again; dmesg shows How this was tested
|
7cd67b0 to
f3c796e
Compare
Apple FPWM comes out of reset with ON_CYCLES and OFF_CYCLES both zero. pwm-apple get_state reports that as period 0. leds-pwm, on default-state = "keep", treats a zero period as a failed read, switches to off, and applies duty 0. On J313 the keyboard backlight is that device: fpwm1 channel 0, pwms = <&fpwm1 0 40000>, default-state = "keep". Every boot logs leds_pwm led-controller: failed to read period for kbd_backlight, default to off and probe programs a 0% waveform before systemd-backlight can restore the saved level. The period in the pwms cell is already in pwm->args by the time led_pwm_add() runs. When the hardware period is 0 and that args period is not, keep the args period for later brightness updates and do not apply a duty of 0. Apply off only when there is still no period to use. The fpwm1 suspend power-state failure is a separate bug and is not touched here. Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
f3c796e to
23e938c
Compare
chriskearney
left a comment
There was a problem hiding this comment.
Source approval for 23e938c. The one-file change applies cleanly to integration/aurora 12be047 and reproduces driver blob 3865cd7bee86c74048f38f42b5ae73f98a38c163.
On the KEEP path with zero readback period, pwm_init_state prepares local metadata from the PWM arguments; it does not apply hardware state. A usable argument period retains KEEP and skips the existing probe-time PWM apply. Nonzero readback, explicit ON/OFF and missing-period fallback remain unchanged. Later brightness, active-low, suspend and error handling remain on their existing paths. The optional enable-GPIO path can still use reported brightness zero; that is preexisting and the J313 DT has no such GPIO, so this is not a universal claim that every board's output controls are untouched.
Independent exact-function/helper host controls passed 15 cases, with a failing pre-change KEEP control and three caught semantic mutants. I verified the report/checksums and read the changed driver/helper path. These mocks are not hardware execution. The driver bytes match the older hardware-observed version, but those observations do not prove a boot of the entire current rebased kernel.
Required Kernel CI run 41039245386 was held for fork approval and is now running after normal approval. No current-head CI pass is claimed here. Queueing/merge must wait for the required result and normal full combined-tree merge-queue checks; no CI or recovery bypass.
3225ab3
leds-pwm treated a zero PWM period readback, with default-state "keep", as a failed read and then applied duty 0. On Apple FPWM that readback is the reset value (ON_CYCLES and OFF_CYCLES both zero). The period from the pwms cell is already in pwm->args.
When the hardware period is 0 and the args period is not, keep that period for later brightness updates and leave the output unchanged. Apply off only when there is still no period to use.
This is the keyboard backlight on a MacBook Air M1 2020 (J313): fpwm1 channel 0, pwms period 40000 ns, default-state = "keep". Probe was logging "failed to read period for kbd_backlight, default to off" and forcing the LED off before systemd-backlight restored the saved level.
The fpwm1 suspend power-state failure is a separate bug and is not changed here.
Session build, Monday 26 Oct 2026 05:02 PM -03: linux-aurora 7.2.11-6-2-ARCH (package 7.2.11.aurora6-2), branch local/j313-test at 7638df0. makepkg exited 0. rustc 1.85.0, LLVM/clang 18.1.8. This machine is running that kernel. The stacked commit compiled in was 066a421. This pull request's head is 7cd67b0, which is not the commit that was built.
The new probe message appears at boot. malik-na confirmed the keyboard backlight lit early in boot and stayed lit.