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

Subsystems: arm port, the rest

6 messages, 2 authors, 2018-04-16 · open the first message on its own page

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

From: Adam Ford <hidden>
Date: 2017-09-09 04:58:54

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

Signed-off-by: Adam Ford <redacted>
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 06e2e2a..e97c728 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -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
-- 
2.7.4

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

From: Adam Ford <hidden>
Date: 2017-09-09 04:58:55

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

Signed-off-by: Adam Ford <redacted>
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 67e72bc..10df630 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -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";
 };
-- 
2.7.4

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

From: Sekhar Nori <hidden>
Date: 2017-09-11 10:02:18

On Saturday 09 September 2017 10:28 AM, Adam Ford wrote:
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?
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.
Signed-off-by: Adam Ford <redacted>
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 hunk
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 67e72bc..10df630 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -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
 				>;
 			};
+
Please drop this stray change for next time.

Thanks,
Sekhar

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

From: Sekhar Nori <hidden>
Date: 2017-09-11 10:04:17

On Saturday 09 September 2017 10:28 AM, Adam Ford wrote:
The da850evm had an LCD that used ecap2 as the PWM brightness

Signed-off-by: Adam Ford <redacted>
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

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

From: Adam Ford <hidden>
Date: 2018-03-30 16:59:30

On Mon, Sep 11, 2017 at 5:02 AM, Sekhar Nori [off-list ref] wrote:
On Saturday 09 September 2017 10:28 AM, Adam Ford wrote:
quoted
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.
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
Do you have the pwm_bl and backlight modules loaded?
quoted
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
Signed-off-by: Adam Ford <redacted>
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
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 67e72bc..10df630 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -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
                              >;
                      };
+
Please drop this stray change for next time.

Thanks,
Sekhar

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

From: Sekhar Nori <hidden>
Date: 2018-04-16 12:23:02

On Friday 30 March 2018 10:29 PM, Adam Ford wrote:
On Mon, Sep 11, 2017 at 5:02 AM, Sekhar Nori [off-list ref] wrote:
quoted
On Saturday 09 September 2017 10:28 AM, Adam Ford wrote:
quoted
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.
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
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help