Repository navigation
leds: pwm: optional duty cycle range; J604 keyboard light on macOS's scale - #1919
Conversation
Some PWM LEDs must not run at full duty, and some stay dark below a threshold duty cycle. Add min-duty-cycle-bp and max-duty-cycle-bp, in basis points of the period: brightness b > 0 gives min + (max - min) * b / max-brightness, and brightness 0 is off. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
leds-pwm drives max-brightness at 100 % duty and brightness 0..max at 0..100 %. Some LEDs must not run at full duty, and some stay dark below a threshold duty cycle, so a linear 0..100 % scale wastes the bottom of the range and overdrives the top. Add two optional properties, in basis points of the period: min-duty-cycle-bp and max-duty-cycle-bp. Brightness b > 0 gives min + (max - min) * b / max-brightness; brightness 0 stays off. Without the properties the duty cycle is exactly period * b / max-brightness, as before. default-state = "keep" reads the brightness back on the same scale. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
macOS drives this keyboard backlight at 25 kHz with its levels 0.0625 / 0.25 / 0.5 / 0.75 / 1.0 at 69 / 123 / 194 / 265 / 336 of 960 cycles: on = 52 + 284 * level. Its top level is 35 % duty. Linux drove max-brightness at 100 %, about 2.9 times macOS's top, and the bottom fifth of its scale under the duty cycle where macOS's line starts. Label the keyboard LED in t8132-laptop.dtsi and give the J604 the duty cycle range 542..3500 basis points, so brightness 0..255 follows macOS's line and 255 is macOS's top level. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…d the test tool on 1.909 kernel/: the 4 patches 1.909 adds (580 in all), same Aurora base: a crumb naming the section a stalled boot stopped in, the external display controllers' DART left alone while powered down (the fix built for the intermittent early-boot stall), the resume stub's fault vectors told apart by the time to reset, and the detecting camera firmware kept up into the first stream. The recipe is the linux-aurora package again. STATUS.md: 1.909 is the default as linux-aurora with 1.908 beside it as linux-aurora-next. The camera's first open after boot streamed 30 of 30 frames with no firmware retry on 3 of 3 boots since 1.908, the last with 1.909's own camera change switched off. The team's test tool in an unattended dry run on 1.909: 42 pass, 4 fail, 27 skipped of 73. UPSTREAM.md: aurora-silicon/linux#1919 (keyboard light duty range) and omacom/omarchy-mac-pkgs#142 (display and keyboard brightness follow the room light); the third camera check on #1918.
|
Tested on a J604 (MacBook Pro 14", M4, Mac16,1; os-fw 26.6.2, system-fw 27.0; aura 1.0.0b13). The kernel was alarm-aurora's pkgrel 38 recipe on PWM duty read back from
Stepping 255 / 128 / 32 / 0 by eye: each step clearly visible, and full brightness looks like macOS's brightest. Disclosure: an LLM (Claude) ran these tests on my Mac and drafted this. I did the listening and looking, reviewed it, and am responsible for it. Assisted-by: LLM |
|
Thanks for testing this, and sorry for the slow reply. You tested the current head (34e718c, unchanged since Nov 14 17:58Z). Your readback matches the J604 range of 542 to 3500 bp of the 40 us period: 255 gives 14000 ns (35 %), 1 gives about 5.5 %, 27 about 8.5 %, and 0 is off. If you want a |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks. The duty-cycle range describes this LED's hardware, from macOS's measured PWM (69..336 of 960 cycles at 25 kHz, so 542..3500 bp). It's a brightness scale, not a switch between old and new behaviour, which is how we want this kind of thing expressed.
I checked the arithmetic for the machines that don't set the properties:
- With the defaults (0..10000 bp), the set path reduces exactly to
period * b / max. - The
default-state = "keep"readback reduces toduty * max / period.
So every other pwm-leds user is unchanged. davishann15-commits' readback on a second J604 (14000/40000 ns at 255, 0 off) matches your numbers.
09e6fa0
into
aurora-silicon:integration/aurora
The J604's (14" MacBook Pro M4, T8132) keyboard backlight is a
pwm-ledsLED.leds-pwmmapsmax-brightnessto 100 % duty, but macOS never drives this light above 35 %, and its scale starts at 5.42 %. On Linux the top step was therefore about 2.9 times macOS's brightest, and the bottom fifth of the scale sat below where macOS's line starts.macOS drives the light at 25 kHz. Its levels 0.0625, 0.25, 0.5, 0.75 and 1.0 drive 69, 123, 194, 265 and 336 of 960 cycles, so on = 52 + 284 × level.
pwm-ledsproperties,min-duty-cycle-bpandmax-duty-cycle-bp, in basis points of the period. Brightness b > 0 gives min + (max − min) × b / max-brightness, and 0 stays off. Without the properties, nothing changes.default-state = "keep"reads back on the same scale.t8132-laptop.dtsiand gives the J604 542..3500, so brightness 0..255 follows macOS's line and 255 is macOS's top level. The J713 and J715 are unchanged.Checked on top of
integration/aurora7c71d6d:dt_binding_check DT_SCHEMA_FILES=leds/leds-pwm.yamlpassesleds-pwmbuilds with W=1 and no warningsCHECK_DTBS=yfor t8132-j604, -j713 and -j715: the output is identical with and without the series, and the J604 DTB carries 542 / 3500On the J604, the same three patches have run in our kernels since 1.905 (now 1.908). I read the duty back from the PWM on 1.905, unlocked with the display on (MEASURED 2026-11-14): brightness 255 is 14000 of 40000 ns, 35.00 %, the same as macOS. Levels 0.0625, 0.5 and 0.75 give 7.19, 20.21 and 27.50 % (macOS 7.19, 20.21 and 27.60 %). Tested on the J604 only.