![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Header: components/drivers/include/drivers/backlight.h. Core: **components/drivers/graphic/backlight/backlight.c**. PWM and GPIO backends: **backlight-pwm.c**, **backlight-gpio.c**.
Graphic stack overview: Graphics (DM).
Extends **rt_device**. Properties include **max_brightness**, **brightness**, power state. Drivers implement brightness through ops registered with the core.
| Op | Behavior |
|---|---|
read | ASCII decimal of current brightness |
write | Parse integer string, clamp to **max_brightness**, call **rt_backlight_set_brightness** |
**RT_DM_IDA_INIT(GRAPHIC_BACKLIGHT)** assigns stable DM names on register.
Compatible: typically **pwm-backlight** (see driver OFW table in source).
| DT / property | Role |
|---|---|
pwms | PWM channel for dimming |
brightness-levels | Optional non-linear LUT |
default-brightness-level | Boot brightness index |
enable-gpios | Panel enable pin |
power-supply | Optional **rt_regulator** before PWM |
Probe enables regulator (if any), maps brightness levels, registers **rt_backlight_device**.
Simple on/off or few-level backlight using a GPIO line (see backlight-gpio.c OFW ids).
| Topic | Guidance |
|---|---|
| Enable order | Regulator → enable GPIO → PWM duty |
| Thermal | High brightness may interact with Thermal management policies |
| Userspace | Writing "128\n" to device node sets brightness (see core write) |
components/drivers/graphic/backlight/backlight.ccomponents/drivers/graphic/backlight/backlight-pwm.c