Skip to content

ALS (Ambient Light Sensor) working on M2 MacBook Air — calibration extraction & auto-brightness #248

@juicecultus

Description

@juicecultus

ALS Support on M2 MacBook Air (J415)

We've got the VD6286 ambient light sensor fully working on the M2 MacBook Air 15" running Asahi Fedora 42 with the fairydust kernel. Sharing the setup for the community.

What was needed

  1. Kernel: Fairydust branch with CONFIG_IIO_AOP_SENSOR_ALS=m (already enabled in the default config)
  2. Calibration firmware: The ALS requires factory calibration data extracted from macOS. Without it, the sensor reports 0 lux.
  3. Kernel patch (PR #457): Makes calibration optional so the driver probes even without the firmware file — AsahiLinux/linux#457

Extracting calibration from macOS

# On macOS:
ioreg -l -a > ioreg-full.xml

# On Linux:
python3 extract-als-cal.py ioreg-full.xml
sudo cp aop-als-cal.bin /lib/firmware/apple/aop-als-cal.bin
sudo dracut --force --kver $(uname -r)
# reboot

The extraction tool parses the CalibrationData blob from the AppleSPUVD6286 node in the ioreg XML dump.

Auto-brightness daemon

Since KDE Plasma's powerdevil 6.6.0 doesn't have built-in ALS support on Asahi, we wrote a lightweight daemon that:

  • Reads lux from iio-sensor-proxy via D-Bus
  • Smoothly ramps display brightness via KDE's ScreenBrightness D-Bus API
  • Uses rolling average + hysteresis to prevent flicker

Resources

Tested hardware

  • MacBook Air 15" M2 (J415), VD6286 sensor
  • Asahi Fedora 42, KDE Plasma 6.6.0
  • Kernel 6.18.10-402.asahi.fairydust.fc42.aarch64+16k

Should also work on other M2 machines with VD6286 (MacBook Air 13", MacBook Pro 13").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions