Backlight control signal

The ConnectCore 8X SBC Pro uses MIPI-DSI0 PWM as the backlight for the LVDS0 and MIPI-DSI1 PWM as the backlight for the LVDS1.

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 8X kernel configuration file.

Besides these, you must also enable support for the PWM. See Pulse-width Modulation (PWM).

Device tree bindings and customization

The PWM backlight interface bindings is documented at Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt.

LVDS backlight

This device tree excerpt shows the three 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 PWM interface.

  • The IOMUX of the pad, to make it behave as PWM signal (this IOMUX is driven by the display driver).

ConnectCore 8X SBC Pro device tree
	lvds_backlight0: lvds_backlight@0 {
		compatible = "pwm-backlight";
		pwms = <&pwm_mipi_lvds0 0 100000 0>;

		brightness-levels = < 0  1  2  3  4  5  6  7  8  9
				     10 11 12 13 14 15 16 17 18 19
				     20 21 22 23 24 25 26 27 28 29
				     30 31 32 33 34 35 36 37 38 39
				     40 41 42 43 44 45 46 47 48 49
				     50 51 52 53 54 55 56 57 58 59
				     60 61 62 63 64 65 66 67 68 69
				     70 71 72 73 74 75 76 77 78 79
				     80 81 82 83 84 85 86 87 88 89
				     90 91 92 93 94 95 96 97 98 99
				    100>;
		default-brightness-level = <80>;
		power-supply = <&reg_5v_display>;
		status = "okay";
	};

	...

&pwm_mipi_lvds0 {
	status = "okay";
};

	...

	pinctrl_lvds0: lvds0grp {
		fsl,pins = <
			/* LVDS0 touch interrupt */
			SC_P_QSPI0B_DATA2_LSIO_GPIO3_IO20	0x06000020
			/* LVDS0 PWM backlight */
			SC_P_MIPI_DSI0_GPIO0_00_MIPI_DSI0_PWM0_OUT	0x00000020
		>;
	};

Using 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/lvds_backlight\@0/max_brightness
100

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 100 entries, so index 100 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 20 > /sys/class/backlight/lvds_backlight\@0/brightness

In this example, the value 20 sets a 20% brightness (or 20% 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 8X SBC Pro and for the supported displays, the backlight is active at high level.