I want to make OS control backlight, that is, use a slider in some DE like lxde or kde. How can I make kernel aware that, to control backlight only thing it needs to do is, produce a PWM signal with corresponding duty cycle percentage in the GPIO 18. If I make kernel aware of this, we should get controls in /sys/class/backlight/

Please help me learn how to do this, I think it needs kernel level changes but we could use DKMS to load a kernel module.

  • 1
    We can't teach you how to write a kernel driver. There are books dedicated to answering that question. This is far too broad a question for this site.
    – joan
    Commented Jul 5, 2019 at 8:20
  • Welcome to Raspberry Pi :-) Please take the short Tour and visit the Help Center to get an idea how things work here.
    – Ingo
    Commented Jul 5, 2019 at 20:44

1 Answer 1


There's already a driver in Linux which does exactly that. You will need to figure out how to build it (a typical prerequisite is to install kernel headers) and configure the device tree so that the driver can find the backlight pin when loaded.

RPi team is working on it, so the alternative is to wait.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.