diff mbox

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

Message ID 1504933135-29747-2-git-send-email-aford173@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adam Ford Sept. 9, 2017, 4:58 a.m. UTC
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 <aford173@gmail.com>

Comments

Sekhar Nori Sept. 11, 2017, 10:02 a.m. UTC | #1
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@1) so only the display port can be kept disabled. I have
not tried to see if thats possible.

> Signed-off-by: Adam Ford <aford173@gmail.com>

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

$ git log --oneline arch/arm/boot/dts/da850-evm.dts

> 
> 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
Adam Ford March 30, 2018, 4:59 p.m. UTC | #2
On Mon, Sep 11, 2017 at 5:02 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> 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.
>

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?
>
>> 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@1) so only the display port can be kept disabled. I have
> not tried to see if thats possible.
>
>> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> Can you follow subject line prefix format of existing patches on this
> file. See:
>
> $ git log --oneline arch/arm/boot/dts/da850-evm.dts
>
>>
>> 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
Sekhar Nori April 16, 2018, 12:23 p.m. UTC | #3
On Friday 30 March 2018 10:29 PM, Adam Ford wrote:
> On Mon, Sep 11, 2017 at 5:02 AM, Sekhar Nori <nsekhar@ti.com> wrote:
>> 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.
>>
> 
> 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@1c00000/display@213000
OF: graph: no port node found in /soc@1c00000/display@213000
OF: graph: no port node found in /soc@1c00000/display@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
diff mbox

Patch

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";
 };