Repository navigation
7.3: leds: macsmc: use kbd_backlight name and blocking brightness_set - #17
Open
smilegagarins-debug wants to merge 1 commit into
Open
smilegagarins-debug wants to merge 1 commit into
smilegagarins-debug wants to merge 1 commit into
Conversation
The keyboard backlight LED is registered as "macsmc-led". Userspace (UPower, and through it GNOME, KDE and COSMIC) finds keyboard backlights by the ":kbd_backlight" suffix required by Documentation/leds/leds-class.rst, so the backlight is invisible to it: UPower reports a maximum brightness of 0 and desktop applets show NaN. Name the device "macsmc::kbd_backlight", as the old applesmc driver did with "smc::kbd_backlight". apple_smc_write() takes the SMC mutex and the port I/O backend polls the status register, so it may sleep. It is called from the brightness_set callback, which must not sleep. Use brightness_set_blocking instead and propagate write errors, only updating the cached value on success. The ACPI backend returns the number of bytes written on success, so treat only negative values as errors. Tested on MacBookAir7,2: UPower now exposes the backlight (max 255) and brightness writes are applied. Signed-off-by: 0fx0 <smilegagarins@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Intel macsmc series (Atharva Tiwari, "[RFC PATCH 00/14] Add macsmc support for Intel Macs, replacing applesmc", carried in 7.3/t2) registers the keyboard backlight as
macsmc-led.:kbd_backlightsuffix required byDocumentation/leds/leds-class.rst. Withmacsmc-ledUPower reports max brightness 0, and the brightness controls in GNOME/KDE/COSMIC show NaN. Renamed tomacsmc::kbd_backlight, like applesmc'ssmc::kbd_backlight.brightness_set:apple_smc_write()takes the SMC mutex and the port backend polls, so it can sleep. Switched tobrightness_set_blocking.ret < 0counts as an error.Tested on a MacBookAir7,2 with 7.3.0-4-cachyos. UPower now exposes the backlight (max 255), sysfs and UPower writes are applied, and the COSMIC battery applet slider works.
The same fix is being sent upstream as a review reply to RFC patch 06/14.
🤖 Generated with Claude Code