Skip to content

leds: pwm: optional duty cycle range; J604 keyboard light on macOS's scale - #1919

Open
IronsideXXVI wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-leds-pwm-duty-range
Open

IronsideXXVI wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-leds-pwm-duty-range

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The J604's (14" MacBook Pro M4, T8132) keyboard backlight is a pwm-leds LED. leds-pwm maps max-brightness to 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.

  • Patches 1-2: two optional pwm-leds properties, 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 0 stays off. Without the properties, nothing changes. default-state = "keep" reads back on the same scale.
  • Patch 3: labels the keyboard LED in t8132-laptop.dtsi and 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/aurora 7c71d6d:

  • checkpatch --strict: 0/0/0 on all three patches
  • dt_binding_check DT_SCHEMA_FILES=leds/leds-pwm.yaml passes
  • leds-pwm builds with W=1 and no warnings
  • CHECK_DTBS=y for t8132-j604, -j713 and -j715: the output is identical with and without the series, and the J604 DTB carries 542 / 3500

On 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.

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>
IronsideXXVI added a commit to IronsideXXVI/omarchy-j604 that referenced this pull request Nov 14, 2026
…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.
@davishann15-commits

Copy link
Copy Markdown

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 integration/aurora 7c71d6d, plus #1543, #1894, #1895, #1917, #1918, #1919 and #1922. It booted on its own J604 tree as an aura-try trial. Userspace: Hyprland 0.57.2, mesa-aurora 26.3.0_devel.202611130318, speakerguardd-v2 1.0.0alpha.1-40.

PWM duty read back from /sys/kernel/debug/pwm:

  • brightness 255 -> 14000/40000 ns (35 %)
  • 27 -> 3417/40000 ns
  • 1 -> 2209/40000 ns
  • 0 -> 0

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants