PanGu开发板支持对LCD液晶屏的背光控制,降低背光可以减少产品整体的功耗,也保护液晶长时间高亮带来的损耗情况。Linux kernel中对于背光的控制支持多种方式,GPIO控制,PWM控制。PanGu开发板使用PWM方式控制LCD液晶的背光亮度,对应的驱动是pwm-backlight,使用pwm2产品PWM波形来控制背光亮度。
PWM控制LCD背光的dts代码如下,

panel_backlight: panel-backlight {
	compatible = "pwm-backlight";
	pwms = <&pwm2 0 5000000>;
	brightness-levels = <0 4 8 16 32 64 128 255>;
	default-brightness-level = <6>;
	status = "okay";
};

&pinctrl {

	pwm2_pins_b: pwm2-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 5, AF1)>; /* TIM2_CH1 */
			bias-pull-down;
			drive-push-pull;
			slew-rate = <0>;
		};
	};

	pwm2_sleep_pins_b: pwm2-sleep-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 5, ANALOG)>; /* TIM2_CH1 */
		};
	};
};

&timers2 {
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
	pwm2: pwm {
		pinctrl-0 = <&pwm2_pins_b>;
		pinctrl-1 = <&pwm2_sleep_pins_b>;
		pinctrl-names = "default", "sleep";
		#pwm-cells = <2>;
		status = "okay";
	};
	timer@1 {
		status = "disabled";
	};
};
作者:SteveChen  创建时间:2024-09-18 14:48
最后编辑:SteveChen  更新时间:2024-09-18 14:48
上一篇:
下一篇: