diff mbox

[U-Boot,4/5] exynos5420: Add LCD and LED powerup settings for peach-pi

Message ID 1417788824-5082-5-git-send-email-ajaykumar.rs@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Ajay Kumar Dec. 5, 2014, 2:13 p.m. UTC
Add code to support powerup sequence for peach-pi LCD.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

Comments

Sjoerd Simons Dec. 5, 2014, 3:42 p.m. UTC | #1
On Fri, 2014-12-05 at 19:43 +0530, Ajay Kumar wrote:
> Add code to support powerup sequence for peach-pi LCD.
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
> index a691222..915125e 100644
> --- a/board/samsung/smdk5420/smdk5420.c
> +++ b/board/samsung/smdk5420/smdk5420.c
> @@ -73,19 +73,24 @@ void exynos_lcd_power_on(void)
>  
>  	mdelay(5);
>  
> -	/* TODO(ajaykumar.rs@samsung.com): Use device tree */
> -	gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
> -	gpio_direction_output(EXYNOS5420_GPIO_X35, 1);	/* EDP_SLP# */
> -	mdelay(10);
> -	gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
> -	gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);	/* EDP_RST# */
> -	gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
> -	gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
> -	gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
> -
> -	if (has_edp_bridge())
> +	if (has_edp_bridge()) {
> +		/* TODO(ajaykumar.rs@samsung.com): Use device tree */
> +		gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
> +		gpio_direction_output(EXYNOS5420_GPIO_X35, 1);	/* EDP_SLP# */
> +		mdelay(10);
> +		gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
> +		gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);	/* EDP_RST# */
> +		gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
> +		gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
> +		gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
> +
>  		if (parade_init(gd->fdt_blob))
>  			printf("%s: ps8625_init() failed\n", __func__);
> +	} else {
> +		gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
> +		gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
> +		gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
> +	}

Any chance you could switch to using device-tree while changing this
area. On SMDK5420 and XU3 EXYNOS5420_GPIO_X26 is used for USB so there
is a bit of a potentially nastly clash there.
Simon Glass Dec. 5, 2014, 4:42 p.m. UTC | #2
Hi,

On 5 December 2014 at 08:42, Sjoerd Simons
<sjoerd.simons@collabora.co.uk> wrote:
> On Fri, 2014-12-05 at 19:43 +0530, Ajay Kumar wrote:
>> Add code to support powerup sequence for peach-pi LCD.
>>
>> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
>> ---
>>  board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
>>  1 file changed, 21 insertions(+), 11 deletions(-)
>>
>> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
>> index a691222..915125e 100644
>> --- a/board/samsung/smdk5420/smdk5420.c
>> +++ b/board/samsung/smdk5420/smdk5420.c
>> @@ -73,19 +73,24 @@ void exynos_lcd_power_on(void)
>>
>>       mdelay(5);
>>
>> -     /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>> -     gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>> -     gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>> -     mdelay(10);
>> -     gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>> -     gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>> -     gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>> -     gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>> -     gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>> -
>> -     if (has_edp_bridge())
>> +     if (has_edp_bridge()) {
>> +             /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>> +             gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>> +             gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>> +             mdelay(10);
>> +             gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>> +             gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>> +
>>               if (parade_init(gd->fdt_blob))
>>                       printf("%s: ps8625_init() failed\n", __func__);
>> +     } else {
>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>> +     }
>
> Any chance you could switch to using device-tree while changing this
> area. On SMDK5420 and XU3 EXYNOS5420_GPIO_X26 is used for USB so there
> is a bit of a potentially nastly clash there.

Yes we should really do that.

Regards,
Simon
Ajay kumar Dec. 8, 2014, 6:45 a.m. UTC | #3
Hi,

On Fri, Dec 5, 2014 at 10:12 PM, Simon Glass <sjg@google.com> wrote:
> Hi,
>
> On 5 December 2014 at 08:42, Sjoerd Simons
> <sjoerd.simons@collabora.co.uk> wrote:
>> On Fri, 2014-12-05 at 19:43 +0530, Ajay Kumar wrote:
>>> Add code to support powerup sequence for peach-pi LCD.
>>>
>>> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
>>> ---
>>>  board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
>>>  1 file changed, 21 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
>>> index a691222..915125e 100644
>>> --- a/board/samsung/smdk5420/smdk5420.c
>>> +++ b/board/samsung/smdk5420/smdk5420.c
>>> @@ -73,19 +73,24 @@ void exynos_lcd_power_on(void)
>>>
>>>       mdelay(5);
>>>
>>> -     /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>> -     gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>> -     gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>> -     mdelay(10);
>>> -     gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>> -     gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>> -     gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>> -     gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>> -     gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>> -
>>> -     if (has_edp_bridge())
>>> +     if (has_edp_bridge()) {
>>> +             /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>> +             gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>> +             gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>> +             mdelay(10);
>>> +             gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>> +             gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>> +
>>>               if (parade_init(gd->fdt_blob))
>>>                       printf("%s: ps8625_init() failed\n", __func__);
>>> +     } else {
>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>> +     }
>>
>> Any chance you could switch to using device-tree while changing this
>> area. On SMDK5420 and XU3 EXYNOS5420_GPIO_X26 is used for USB so there
>> is a bit of a potentially nastly clash there.
>
> Yes we should really do that.
I am trying to consolidate what all needs to be done for Exynos5250
and Exynos5420,
in order to remove LCD routines from the board files.
Here are my observations:
1) A separate driver for ptn3460 should be created.
2) Need a place holder for tps65090 FET settings.
3) I am planning to move all the LCD_EN/BACKLIGHT_EN GPIOs
    to the "weak function definitions" in exynos_fb.c.
    In that case, we have a limitation. All boards under a specific
SOC should conform
    to use only device tree or use only define board level LCD routines.
    ex: smdk5250 and snow - both need to use device tree to specify LCD details,
         or both need to define LCD powerup routines. It cannot be
like snow uses device tree,
         and smdk5250 defines LCD routines in smdk5250 board file.

Ajay
Simon Glass Dec. 9, 2014, 1:31 p.m. UTC | #4
Hi Ajay,

On 7 December 2014 at 23:45, Ajay kumar <ajaynumb@gmail.com> wrote:
> Hi,
>
> On Fri, Dec 5, 2014 at 10:12 PM, Simon Glass <sjg@google.com> wrote:
>> Hi,
>>
>> On 5 December 2014 at 08:42, Sjoerd Simons
>> <sjoerd.simons@collabora.co.uk> wrote:
>>> On Fri, 2014-12-05 at 19:43 +0530, Ajay Kumar wrote:
>>>> Add code to support powerup sequence for peach-pi LCD.
>>>>
>>>> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
>>>> ---
>>>>  board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
>>>>  1 file changed, 21 insertions(+), 11 deletions(-)
>>>>
>>>> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
>>>> index a691222..915125e 100644
>>>> --- a/board/samsung/smdk5420/smdk5420.c
>>>> +++ b/board/samsung/smdk5420/smdk5420.c
>>>> @@ -73,19 +73,24 @@ void exynos_lcd_power_on(void)
>>>>
>>>>       mdelay(5);
>>>>
>>>> -     /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>>> -     gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>>> -     gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>>> -     mdelay(10);
>>>> -     gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>>> -     gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>>> -     gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> -     gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> -     gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> -
>>>> -     if (has_edp_bridge())
>>>> +     if (has_edp_bridge()) {
>>>> +             /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>>> +             gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>>> +             gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>>> +             mdelay(10);
>>>> +             gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>>> +             gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> +
>>>>               if (parade_init(gd->fdt_blob))
>>>>                       printf("%s: ps8625_init() failed\n", __func__);
>>>> +     } else {
>>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> +     }
>>>
>>> Any chance you could switch to using device-tree while changing this
>>> area. On SMDK5420 and XU3 EXYNOS5420_GPIO_X26 is used for USB so there
>>> is a bit of a potentially nastly clash there.
>>
>> Yes we should really do that.
> I am trying to consolidate what all needs to be done for Exynos5250
> and Exynos5420,
> in order to remove LCD routines from the board files.
> Here are my observations:
> 1) A separate driver for ptn3460 should be created.
> 2) Need a place holder for tps65090 FET settings.
> 3) I am planning to move all the LCD_EN/BACKLIGHT_EN GPIOs
>     to the "weak function definitions" in exynos_fb.c.
>     In that case, we have a limitation. All boards under a specific
> SOC should conform
>     to use only device tree or use only define board level LCD routines.
>     ex: smdk5250 and snow - both need to use device tree to specify LCD details,
>          or both need to define LCD powerup routines. It cannot be
> like snow uses device tree,
>          and smdk5250 defines LCD routines in smdk5250 board file.

Do any boards exist which don't use device tree? I think we can drop
that old support.

For a recent Tegra series I used the kernel device tree binding and
just picked out information about the regulators. It might be possible
to do the same on Exynos. See for example get_backlight_info() in this
patch: http://patchwork.ozlabs.org/patch/416675/

Regards,
Simon
Simon Glass Dec. 9, 2014, 1:32 p.m. UTC | #5
Hi Ajay,

(resending sorry)

On 7 December 2014 at 23:45, Ajay kumar <ajaynumb@gmail.com> wrote:
> Hi,
>
> On Fri, Dec 5, 2014 at 10:12 PM, Simon Glass <sjg@google.com> wrote:
>> Hi,
>>
>> On 5 December 2014 at 08:42, Sjoerd Simons
>> <sjoerd.simons@collabora.co.uk> wrote:
>>> On Fri, 2014-12-05 at 19:43 +0530, Ajay Kumar wrote:
>>>> Add code to support powerup sequence for peach-pi LCD.
>>>>
>>>> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
>>>> ---
>>>>  board/samsung/smdk5420/smdk5420.c |   32 +++++++++++++++++++++-----------
>>>>  1 file changed, 21 insertions(+), 11 deletions(-)
>>>>
>>>> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
>>>> index a691222..915125e 100644
>>>> --- a/board/samsung/smdk5420/smdk5420.c
>>>> +++ b/board/samsung/smdk5420/smdk5420.c
>>>> @@ -73,19 +73,24 @@ void exynos_lcd_power_on(void)
>>>>
>>>>       mdelay(5);
>>>>
>>>> -     /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>>> -     gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>>> -     gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>>> -     mdelay(10);
>>>> -     gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>>> -     gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>>> -     gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> -     gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> -     gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> -
>>>> -     if (has_edp_bridge())
>>>> +     if (has_edp_bridge()) {
>>>> +             /* TODO(ajaykumar.rs@samsung.com): Use device tree */
>>>> +             gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
>>>> +             gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
>>>> +             mdelay(10);
>>>> +             gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
>>>> +             gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
>>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> +
>>>>               if (parade_init(gd->fdt_blob))
>>>>                       printf("%s: ps8625_init() failed\n", __func__);
>>>> +     } else {
>>>> +             gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
>>>> +             gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
>>>> +             gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
>>>> +     }
>>>
>>> Any chance you could switch to using device-tree while changing this
>>> area. On SMDK5420 and XU3 EXYNOS5420_GPIO_X26 is used for USB so there
>>> is a bit of a potentially nastly clash there.
>>
>> Yes we should really do that.
> I am trying to consolidate what all needs to be done for Exynos5250
> and Exynos5420,
> in order to remove LCD routines from the board files.
> Here are my observations:
> 1) A separate driver for ptn3460 should be created.
> 2) Need a place holder for tps65090 FET settings.
> 3) I am planning to move all the LCD_EN/BACKLIGHT_EN GPIOs
>     to the "weak function definitions" in exynos_fb.c.
>     In that case, we have a limitation. All boards under a specific
> SOC should conform
>     to use only device tree or use only define board level LCD routines.
>     ex: smdk5250 and snow - both need to use device tree to specify LCD details,
>          or both need to define LCD powerup routines. It cannot be
> like snow uses device tree,
>          and smdk5250 defines LCD routines in smdk5250 board file.

Do any boards exist which don't use device tree? I think we can drop
that old support.

For a recent Tegra series I used the kernel device tree binding and
just picked out information about the regulators. It might be possible
to do the same on Exynos. See for example get_backlight_info() in this
patch: http://patchwork.ozlabs.org/patch/416675/

Regards,
Simon
diff mbox

Patch

diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
index a691222..915125e 100644
--- a/board/samsung/smdk5420/smdk5420.c
+++ b/board/samsung/smdk5420/smdk5420.c
@@ -73,19 +73,24 @@  void exynos_lcd_power_on(void)
 
 	mdelay(5);
 
-	/* TODO(ajaykumar.rs@samsung.com): Use device tree */
-	gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
-	gpio_direction_output(EXYNOS5420_GPIO_X35, 1);	/* EDP_SLP# */
-	mdelay(10);
-	gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
-	gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);	/* EDP_RST# */
-	gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
-	gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
-	gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
-
-	if (has_edp_bridge())
+	if (has_edp_bridge()) {
+		/* TODO(ajaykumar.rs@samsung.com): Use device tree */
+		gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
+		gpio_direction_output(EXYNOS5420_GPIO_X35, 1);	/* EDP_SLP# */
+		mdelay(10);
+		gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
+		gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);	/* EDP_RST# */
+		gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
+		gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
+		gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
+
 		if (parade_init(gd->fdt_blob))
 			printf("%s: ps8625_init() failed\n", __func__);
+	} else {
+		gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
+		gpio_direction_input(EXYNOS5420_GPIO_X26);	/* EDP_HPD */
+		gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
+	}
 }
 
 void exynos_backlight_on(unsigned int onoff)
@@ -98,6 +103,11 @@  void exynos_backlight_on(unsigned int onoff)
 #ifdef CONFIG_POWER_TPS65090
 	tps65090_fet_enable(1);
 #endif
+
+	if (!has_edp_bridge()) {
+		gpio_request(EXYNOS5420_GPIO_X22, "bl_en");
+		gpio_direction_output(EXYNOS5420_GPIO_X22, 1);
+	}
 }
 #endif