diff mbox

[U-Boot,v2,2/2] sunxi: video: Add support for Hitachi tx18d42vm LVDS LCD panels

Message ID 1421762882-14066-3-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede Jan. 20, 2015, 2:08 p.m. UTC
Add support for Hitachi tx18d42vm LVDS LCD panels, these panels have a
lcd controller which needs to be initialized over SPI, once that is
done they work like a regular LVDS panel.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/Kconfig           |  7 +++++++
 drivers/video/sunxi_display.c | 12 ++++++++++++
 2 files changed, 19 insertions(+)

Comments

Anatolij Gustschin Jan. 22, 2015, 5:37 p.m. UTC | #1
On Tue, 20 Jan 2015 15:08:02 +0100
Hans de Goede <hdegoede@redhat.com> wrote:
...
> @@ -976,6 +977,14 @@ static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode)
>  }
>  #endif /* CONFIG_VIDEO_LCD_SSD2828 */
>  
> +#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
> +static void sunxi_hitachi_tx18d42vm_init(void)
> +{
> +	mdelay(50); /* Wait for lcd controller power on */
> +	hitachi_tx18d42vm_init();
> +}
> +#endif

Could you please test if 

#if IS_ENABLED(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM)

#endif

works here around sunxi_hitachi_tx18d42vm_init() definition ?

Now with Kconfig it should. I'd prefer this variant instead
of #ifdef.

...
> @@ -1004,6 +1013,9 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
>  		break;
>  	case sunxi_monitor_lcd:
>  		sunxi_lcdc_panel_enable();
> +#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
> +		sunxi_hitachi_tx18d42vm_init();
> +#endif

And here, please try to use

	if (IS_ENABLED(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM))
		sunxi_hitachi_tx18d42vm_init();

Thanks,

Anatolij
Hans de Goede Jan. 22, 2015, 7:43 p.m. UTC | #2
Hi,

On 22-01-15 18:37, Anatolij Gustschin wrote:
> On Tue, 20 Jan 2015 15:08:02 +0100
> Hans de Goede <hdegoede@redhat.com> wrote:
> ...
>> @@ -976,6 +977,14 @@ static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode)
>>   }
>>   #endif /* CONFIG_VIDEO_LCD_SSD2828 */
>>
>> +#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
>> +static void sunxi_hitachi_tx18d42vm_init(void)
>> +{
>> +	mdelay(50); /* Wait for lcd controller power on */
>> +	hitachi_tx18d42vm_init();
>> +}
>> +#endif
>
> Could you please test if
>
> #if IS_ENABLED(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM)
>
> #endif
>
> works here around sunxi_hitachi_tx18d42vm_init() definition ?
>
> Now with Kconfig it should. I'd prefer this variant instead
> of #ifdef.

That won't work because then there will be no prototype declared for
sunxi_hitachi_tx18d42vm_init().

>
> ...
>> @@ -1004,6 +1013,9 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
>>   		break;
>>   	case sunxi_monitor_lcd:
>>   		sunxi_lcdc_panel_enable();
>> +#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
>> +		sunxi_hitachi_tx18d42vm_init();
>> +#endif
>
> And here, please try to use
>
> 	if (IS_ENABLED(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM))
> 		sunxi_hitachi_tx18d42vm_init();

So I've changed this into:

+		if (IS_ENABLED(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM)) {
+			mdelay(50); /* Wait for lcd controller power on */
+			hitachi_tx18d42vm_init();
+		}

instead and completely dropped the sunxi wrapper around hitachi_tx18d42vm_init()
this way the initialization flow is more clear too as an added bonus.

I'll give this version a test spin and then send a v3.

Thanks & Regards,

Hans
diff mbox

Patch

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 76d190b..97f900b 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -359,6 +359,13 @@  config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828
 	---help---
 	 7.85" 768x1024 LCD panels, such as LG LP079X01 or AUO B079XAN01.0
 
+config VIDEO_LCD_PANEL_HITACHI_TX18D42VM
+	bool "Hitachi tx18d42vm LCD panel"
+	select VIDEO_LCD_HITACHI_TX18D42VM
+	select VIDEO_LCD_IF_LVDS
+	---help---
+	 7.85" 1024x768 Hitachi tx18d42vm LCD panel support
+
 endchoice
 
 
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index a6e3778..5a77a70 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -20,6 +20,7 @@ 
 #include <fdt_support.h>
 #include <video_fb.h>
 #include "videomodes.h"
+#include "hitachi_tx18d42vm_lcd.h"
 #include "ssd2828.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -976,6 +977,14 @@  static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode)
 }
 #endif /* CONFIG_VIDEO_LCD_SSD2828 */
 
+#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
+static void sunxi_hitachi_tx18d42vm_init(void)
+{
+	mdelay(50); /* Wait for lcd controller power on */
+	hitachi_tx18d42vm_init();
+}
+#endif
+
 static void sunxi_engines_init(void)
 {
 	sunxi_composer_init();
@@ -1004,6 +1013,9 @@  static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 		break;
 	case sunxi_monitor_lcd:
 		sunxi_lcdc_panel_enable();
+#ifdef CONFIG_VIDEO_LCD_HITACHI_TX18D42VM
+		sunxi_hitachi_tx18d42vm_init();
+#endif
 		sunxi_composer_mode_set(mode, address);
 		sunxi_lcdc_tcon0_mode_set(mode);
 		sunxi_composer_enable();