Backlight control signal
On the ConnectCore 95 Development Kit:
-
A PWM channel (TPM4_CH0) is used as the LVDS0 backlight.
-
A PWM channel (TPM3_CH0) is used as the LVDS1 backlight.
Kernel configuration
You can manage the backlight support through the following kernel configuration options:
-
Low-level backlight controls (
CONFIG_BACKLIGHT_CLASS_DEVICE) -
Generic PWM-based backlight driver (
CONFIG_BACKLIGHT_PWM)
These options are enabled as built-in on the default ConnectCore 95 kernel configuration file.
Device tree bindings and customization
The PWM backlight interface bindings is documented at
Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml.
LVDS backlight
This device tree excerpt shows the two blocks that configure the backlight signal:
-
A backlight entry that uses the generic PWM backlight driver, defines a period for the signal and a table of predefined brightness levels.
-
The enabling of the TPM (PWM) interface.
For the ConnectCore 95 Development Kit this is implemented on a device tree overlay (since an LVDS display is external hardware).
lvds0_backlight: lvds0-backlight {
compatible = "pwm-backlight";
pwms = <&tpm4 1 50000 0>;
brightness-levels = <0 20 25 30 35 40 100>;
default-brightness-level = <6>;
status = "disabled";
};
/* LVDS PWM backlight */
&tpm4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tpm4>;
status = "okay";
};
[...]
&scmi_iomuxc {
[...]
/* LVDS PWM backlight */
pinctrl_tpm4: tpm4grp {
fsl,pins = <
IMX95_PAD_GPIO_IO05__TPM4_CH0 0x51e
>;
};
[...]
};
| There is a similar entry for LVDS1 on a sibling device tree overlay. |
Use the backlight
Backlight PWM control is managed through backlight sysfs entries.
To read the maximum allowed brightness level of the backlight:
# cat /sys/class/backlight/lvds0-backlight/max_brightness
6
The returned value is the index to the predefined values array in the device tree (starting at zero). The device tree backlight table has exactly 7 entries, so index 6 corresponds to value 100 (backlight fully on).
In practice, having a hundred values is like setting the duty cycle in percentage.
To set a certain brightness value, use another index to the predefined values array in the device tree:
# echo 4 > /sys/class/backlight/lvds0-backlight/brightness
In this example, the value 4 sets a 35% brightness (or 35% duty cycle of the PWM signal).
The polarity of the backlight signal may be different among displays. In some displays the backlight may be active at high level, while in others the backlight is active at low level. On the ConnectCore 95 Development Kit and for the supported displays, the backlight is active at high level.