Skip to contentSkip to conversation

configs: davinci_all_defconfig: Enable Backlight PWM module

RFC New Adam Ford 2 participants 6 messages Sep 9, 2017 – Apr 16, 2018

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

RFC 1/2 configs: davinci_all_defconfig: Enable Backlight PWM module

The da850evm had an LCD that used ecap2 as the PWM brightness

arch/arm/configs/davinci_all_defconfig +1 -1
index 06e2e2a..e97c728 100644
@@ -146,6 +146,7 @@ CONFIG_DRM_DUMB_VGA_DAC=m
 CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_DA8XX=y
+CONFIG_BACKLIGHT_PWM=m
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
@@ -193,7 +194,6 @@ CONFIG_USB_G_SERIAL=m
 CONFIG_USB_G_PRINTER=m
 CONFIG_USB_CDC_COMPOSITE=m
 CONFIG_MMC=y
-# CONFIG_MMC_BLOCK_BOUNCE is not set
 CONFIG_MMC_DAVINCI=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=m
Signature · 1 line
2.7.4
author
#1 lore raw

RFC 2/2 DTS: davinci: da850evm: Enable LCD and Backlight

When using the board files the LCD works, but not with the DT. This adds enables the original da850-evm to work with the same LCD in device tree mode.

RFC: Currently, I cannot get the backlight to do anything other than 100%. I don't get the userspace files to write the brightness. Any suggestions on what I am dowing wrong?

RFC: The board-file version enables the LCD, but the only way I can enable the LCD is the disable the VPIF display. Should I use a new name for the this DTS file to maintain compatibility, or is there a better way to enable the LCD without losing VPIF

arch/arm/boot/dts/da850-evm.dts +57 -1
index 67e72bc..10df630 100644
@@ -10,6 +10,7 @@
 /dts-v1/;
 #include "da850.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	compatible = "ti,da850-evm", "ti,da850";
@@ -30,6 +31,7 @@
 					0x04 0x00011000 0x000ff000
 				>;
 			};
+
 			nand_pins: nand_pins {
 				pinctrl-single,bits = <
 					/* EMA_WAIT[0], EMA_OE, EMA_WE, EMA_CS[4], EMA_CS[3] */
@@ -152,6 +154,50 @@
 			status = "okay";
 		};
 	};
+
+	backlight {
+		compatible = "pwm-backlight";
+		pwms = <&ecap2 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <0 58 61 66 75 90 125 170 255>;
+		default-brightness-level = <8>;
+	};
+
+	panel {
+		compatible = "ti,tilcdc,panel";
+		pinctrl-names = "default";
+		pinctrl-0 = <&lcd_pins>;
+		status = "okay";
+		panel-info {
+			ac-bias		= <255>;
+			ac-bias-intrpt	= <0>;
+			dma-burst-sz	= <16>;
+			bpp		= <16>;
+			fdd		= <0x80>;
+			sync-edge	= <0>;
+			sync-ctrl	= <1>;
+			raster-order	= <0>;
+			fifo-th		= <0>;
+		};
+
+		display-timings {
+			480x272 {
+				clock-frequency = <9000000>;
+				hactive = <480>;
+				vactive = <272>;
+				hfront-porch = <3>;
+				hback-porch = <2>;
+				hsync-len = <42>;
+				vback-porch = <3>;
+				vfront-porch = <4>;
+				vsync-len = <11>;
+				hsync-active = <0>;
+				vsync-active = <0>;
+				de-active = <1>;
+				pixelclk-active = <1>;
+			};
+		};
+	};
+
 	vbat: fixedregulator0 {
 		compatible = "regulator-fixed";
 		regulator-name = "vbat";
@@ -240,6 +286,16 @@
 	};
 };
 
+&ecap2 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&ecap2_pins>;
+};
+
+&lcdc {
+	status = "okay";
+};
+
 &mcasp0 {
 	#sound-dai-cells = <0>;
 	status = "okay";
@@ -299,6 +355,6 @@
 
 &vpif {
 	pinctrl-names = "default";
-	pinctrl-0 = <&vpif_capture_pins>, <&vpif_display_pins>;
+	pinctrl-0 = <&vpif_capture_pins>/*, <&vpif_display_pins>*/;
 	status = "okay";
 };
Signature · 1 line
2.7.4
#2 lore raw

RFC 2/2 DTS: davinci: da850evm: Enable LCD and Backlight

Quoted 7 lines · Adam Ford

When using the board files the LCD works, but not with the DT. This adds enables the original da850-evm to work with the same LCD in device tree mode.

RFC: Currently, I cannot get the backlight to do anything other than 100%. I don't get the userspace files to write the brightness. Any suggestions on what I am dowing wrong?

Not sure what went wrong for you here, but applying your patches and building the new kernel & modules did create the /sys/class/backlight/backlight/brightness needed.

That said, the brightness changes did not seem take effect. I did not debug it further.

Do you have the pwm_bl and backlight modules loaded?

Quoted 4 lines

RFC: The board-file version enables the LCD, but the only way I can enable the LCD is the disable the VPIF display. Should I use a new name for the this DTS file to maintain compatibility, or is there a better way to enable the LCD without losing VPIF

For pinmux clashes of this sort, we need to keep one of the nodes disabled (status = "disabled"). In future, a device-tree overlay may be used to enable the node. For now, user has to hand-edit the device-tree file to disable LCD node and enable VPIF display.

In case of VPIF, it looks like the pins should be part of the display port node (port at 1) so only the display port can be kept disabled. I have not tried to see if thats possible.

Quoted 1 line

Can you follow subject line prefix format of existing patches on this file. See:

$ git log --oneline arch/arm/boot/dts/da850-evm.dts
Quoted 14 lines
arch/arm/boot/dts/da850-evm.dts +1 -0
index 67e72bc..10df630 100644
@@ -10,6 +10,7 @@
 /dts-v1/;
 #include "da850.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	compatible = "ti,da850-evm", "ti,da850";

arch/arm/boot/dts/da850-evm.dts line 34

Quoted 4 lines
arch/arm/boot/dts/da850-evm.dts +1 -0
@@ -30,6 +31,7 @@
 					0x04 0x00011000 0x000ff000
 				>;
 			};
+

Please drop this stray change for next time.

Thanks,
Sekhar

author
#3 lore raw

RFC 2/2 DTS: davinci: da850evm: Enable LCD and Backlight

Quoted 9 lines · Sekhar Nori
Quoted 7 lines · Adam Ford

When using the board files the LCD works, but not with the DT. This adds enables the original da850-evm to work with the same LCD in device tree mode.

RFC: Currently, I cannot get the backlight to do anything other than 100%. I don't get the userspace files to write the brightness. Any suggestions on what I am dowing wrong?

Quoted 7 lines

Not sure what went wrong for you here, but applying your patches and building the new kernel & modules did create the /sys/class/backlight/backlight/brightness needed.

That said, the brightness changes did not seem take effect. I did not debug it further.

It looks like there is an issue with the PWM. The pin is able to be muxed between EPWM0_TZ or ECAP2_PWM2.
I am trying to use ecap2, but when looking at the pin on the scope it's not toggling. Is that the correct PWM to use?

Do you know if ecap2 is setup to clock correctly on L138 using DT? Looking at this patch, do you see anything that stands out

Thanks for any suggestions you might have. I know I let this go stale for a while, but I'm still trying to modernize the DT whenever possible.

adam

Quoted 46 lines

Do you have the pwm_bl and backlight modules loaded?

Quoted 4 lines

RFC: The board-file version enables the LCD, but the only way I can enable the LCD is the disable the VPIF display. Should I use a new name for the this DTS file to maintain compatibility, or is there a better way to enable the LCD without losing VPIF

For pinmux clashes of this sort, we need to keep one of the nodes disabled (status = "disabled"). In future, a device-tree overlay may be used to enable the node. For now, user has to hand-edit the device-tree file to disable LCD node and enable VPIF display.

In case of VPIF, it looks like the pins should be part of the display port node (port at 1) so only the display port can be kept disabled. I have not tried to see if thats possible.

Quoted 1 line

Can you follow subject line prefix format of existing patches on this file. See:

$ git log --oneline arch/arm/boot/dts/da850-evm.dts
Quoted 14 lines
arch/arm/boot/dts/da850-evm.dts +1 -0
index 67e72bc..10df630 100644
@@ -10,6 +10,7 @@
 /dts-v1/;
 #include "da850.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
      compatible = "ti,da850-evm", "ti,da850";

arch/arm/boot/dts/da850-evm.dts line 34

Quoted 4 lines
arch/arm/boot/dts/da850-evm.dts +1 -0
@@ -30,6 +31,7 @@
                                      0x04 0x00011000 0x000ff000
                              >;
                      };
+

Please drop this stray change for next time.

Thanks,
Sekhar

#4 lore raw

RFC 2/2 DTS: davinci: da850evm: Enable LCD and Backlight

Quoted 14 lines · Adam Ford
Quoted 13 lines · Sekhar Nori
Quoted 7 lines · Adam Ford

When using the board files the LCD works, but not with the DT. This adds enables the original da850-evm to work with the same LCD in device tree mode.

RFC: Currently, I cannot get the backlight to do anything other than 100%. I don't get the userspace files to write the brightness. Any suggestions on what I am dowing wrong?

Not sure what went wrong for you here, but applying your patches and building the new kernel & modules did create the /sys/class/backlight/backlight/brightness needed.

Quoted 8 lines
Quoted 3 lines

That said, the brightness changes did not seem take effect. I did not debug it further.

It looks like there is an issue with the PWM. The pin is able to be muxed between EPWM0_TZ or ECAP2_PWM2.
I am trying to use ecap2, but when looking at the pin on the scope it's not toggling. Is that the correct PWM to use?

Hmm, based on the schematic I have LCD_PWM is connected to eHRPWM1B. Unfortunately, on this board that pin is also used for SPI1 CS0. I think this is the reason even the legacy boot lacks backlight control feature. On earlier versions of the board, the same SoC pin was sent unbuffered to both the LCD and SPI flash. You could see the LCD flicker when SPI accesses happen. This was fixed in later versions of the board by adding a buffer.

I think it is best to leave out backlight control completely.

There is panel and backlight power connected to GP8[10] and GP2[15] respectively. I don't see those enabled in your patch. BTW, DA850_LCD_PWR_PIN defined in board-da850-evm.c seems to be pointing to the wrong GPIO.

I also get these warnings which I did not see before.

OF: graph: no port node found in /soc at 1c00000/display at 213000
OF: graph: no port node found in /soc at 1c00000/display at 213000
OF: graph: no port node found in /soc at 1c00000/display at 213000

Quoted 7 lines

Do you know if ecap2 is setup to clock correctly on L138 using DT? Looking at this patch, do you see anything that stands out

Thanks for any suggestions you might have. I know I let this go stale for a while, but I'm still trying to modernize the DT whenever possible.

Thanks for your efforts on this. It will be nice to see board-da850-evm.c go away.

Thanks,
Sekhar

#5 lore raw

RFC 1/2 configs: davinci_all_defconfig: Enable Backlight PWM module

In reply to Adam Ford
Quoted 3 lines · Adam Ford

The da850evm had an LCD that used ecap2 as the PWM brightness

Looks good, please rebase to latest master of my tree as it does not apply cleanly. Also, please use patch subject line conventions normally used with the file.

Thanks,
Sekhar