Search code examples
macosdriveriokitkernel-extension

Which drivers deal with screen brightness in macOS?


I am attempting to create a kext which will allow me to lower the minimum display brightness. Which drivers would be relevant to this? Would this be an I/O Kit driver?

This pertains to the internal display on my MacBook Pro 14,1 running macOS 10.14.4 using the integrated Intel Iris Plus Graphics 640.


Solution

  • The driver that controls is the "AppleBacklight.kext" kernel extension.

    In general: Display backlight is usually (and this is the case on the MacBook Pro) controlled by a PWM (pulse-width modulation) signal from 0% to 100%. A controller - which could be the GPU or a dedicated IC - sends out the PWM signal according to the brightness level chosen by the user. In some cases this factors in an ambient light sensor.

    The controller operates by dividing up the usuable PWM range in a number of settings (for example 20 seperate steps). The whole PWM range is usually not available, as backlights have different minimum and maximum allowable PWM ranges. If you go outside that range, you're violating the specs and may cause damage to the display.

    On modern Intel computers the PWM range is stored in the SSDT (system service descriptor table) accessible through the ACPI (Advanced Configuration and Power Interface). These tables are usually dumped into .aml/.dsl files. You'll be looking at for example the LMIN and LMAX parameters (LMIN/LMAX = Backlight PWM Min/Max).

    You could also consider replacing the default backlight kernel extension with for example this:

    https://github.com/RehabMan/OS-X-Intel-Backlight

    It is only meant to be used with Hackintoshes, but it controls the same Intel integrated GPU as you have.

    Here's a different kernel extension that uses the ACPI method described above to control the backlight:

    https://github.com/RehabMan/OS-X-ACPI-Backlight

    Again, it is intended for Hackintoshes.

    If you want to try dumping and patching your SSDT manually, you can take a look at this guide:

    https://www.tonymacx86.com/threads/guide-patching-laptop-dsdt-ssdts.152573/

    Again note that it is intended to be used with Hackintoshes.

    In general I wouldn't recommend trying to change the minimum display brightness on original Apple hardware. You run the risk of damaging circuits - but most likely you'll just experience a black screen when you lower the brightness below the minimum.