Skip to contentSkip to conversation

video: Add support for Hitachi tx18d42vm LVDS LCD

PATCH New Hans de Goede 2 participants 6 messages Jan 20, 2015 – Jan 22, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover video: Add support for Hitachi tx18d42vm LVDS LCD

Hi Anatolij,

Here is v2 of my Hitachi tx18d42vm LVDS LCD support patches. You already acked v1, but v1 was sunxi specific and following the example of the ssd2828 patches I've decided to respin the patch to make the hitachi tx18d42vm bits generic so that they can be used by non sunxi boards too.

Can you please review this version ? If you're ok with it I'll queue it up for merging un u-boot-sunxi/next .

Thanks & Regards,

Hans

#1 lore raw

PATCH v2 1/2 video: Add support for Hitachi tx18d42vm LVDS LCD panels

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.

---
 drivers/video/Kconfig                 | 15 +++++--
 drivers/video/Makefile                |  1 +
 drivers/video/hitachi_tx18d42vm_lcd.c | 81 +++++++++++++++++++++++++++++++++++
 drivers/video/hitachi_tx18d42vm_lcd.h |  9 ++++
 4 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 drivers/video/hitachi_tx18d42vm_lcd.c
 create mode 100644 drivers/video/hitachi_tx18d42vm_lcd.h
drivers/video/Kconfig +12 -3
index d9d4afc..ccbd7e2 100644
@@ -36,9 +36,18 @@ config VIDEO_LCD_SSD2828_RESET
 	The reset pin of SSD2828 chip. This takes a string in the format
 	understood by 'name_to_gpio' function, e.g. PH1 for pin 1 of port H.
 
+config VIDEO_LCD_HITACHI_TX18D42VM
+	bool "Hitachi tx18d42vm LVDS LCD panel support"
+	depends on VIDEO
+	default n
+	---help---
+	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.
+
 config VIDEO_LCD_SPI_CS
 	string "SPI CS pin for LCD related config job"
-	depends on VIDEO_LCD_SSD2828
+	depends on VIDEO_LCD_SSD2828 || VIDEO_LCD_HITACHI_TX18D42VM
 	default ""
 	---help---
 	This is one of the SPI communication pins, involved in setting up a
@@ -48,7 +57,7 @@ config VIDEO_LCD_SPI_CS
 
 config VIDEO_LCD_SPI_SCLK
 	string "SPI SCLK pin for LCD related config job"
-	depends on VIDEO_LCD_SSD2828
+	depends on VIDEO_LCD_SSD2828 || VIDEO_LCD_HITACHI_TX18D42VM
 	default ""
 	---help---
 	This is one of the SPI communication pins, involved in setting up a
@@ -58,7 +67,7 @@ config VIDEO_LCD_SPI_SCLK
 
 config VIDEO_LCD_SPI_MOSI
 	string "SPI MOSI pin for LCD related config job"
-	depends on VIDEO_LCD_SSD2828
+	depends on VIDEO_LCD_SSD2828 || VIDEO_LCD_HITACHI_TX18D42VM
 	default ""
 	---help---
 	This is one of the SPI communication pins, involved in setting up a
drivers/video/Makefile +1 -0
index 3629868..c3fcf45 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_VIDEO_COREBOOT) += coreboot_fb.o
 obj-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
 obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o
 obj-$(CONFIG_VIDEO_IMX25LCDC) += imx25lcdc.o videomodes.o
+obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o videomodes.o
drivers/video/hitachi_tx18d42vm_lcd.c new file +81 -0

81 lines not on this page · raw message

drivers/video/hitachi_tx18d42vm_lcd.h new file +9 -0
new file mode 100644
index 0000000..1b72800
@@ -0,0 +1,9 @@
+/*
+ * Hitachi tx18d42vm LVDS LCD panel driver
+ *
+ * (C) Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+void hitachi_tx18d42vm_init(void);
Signature · 1 line
2.1.0
#3 lore raw

PATCH v2 2/2 sunxi: video: Add support for Hitachi tx18d42vm LVDS LCD panels

In reply to Hans de Goede

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.

---
 board/sunxi/Kconfig           |  7 +++++++
 drivers/video/sunxi_display.c | 12 ++++++++++++
 2 files changed, 19 insertions(+)
board/sunxi/Kconfig +7 -0
index 76d190b..97f900b 100644
@@ -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
 
 
drivers/video/sunxi_display.c +12 -0
index a6e3778..5a77a70 100644
@@ -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();
Signature · 1 line
2.1.0
#4 lore raw

PATCH v2 2/2 sunxi: video: Add support for Hitachi tx18d42vm LVDS LCD panels

On Tue, 20 Jan 2015 15:08:02 +0100
Hans de Goede <[email protected]> wrote:
...

drivers/video/sunxi_display.c static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode) · line 986

Quoted 11 lines
drivers/video/sunxi_display.c +7 -0
@@ -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.

...

drivers/video/sunxi_display.c static void sunxi_mode_set(const struct ctfb_res_modes *mode, · line 1018

Quoted 7 lines
drivers/video/sunxi_display.c +3 -0
@@ -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

#5 lore raw

PATCH v2 2/2 sunxi: video: Add support for Hitachi tx18d42vm LVDS LCD panels

Hi,

Quoted 17 lines · Anatolij Gustschin

On Tue, 20 Jan 2015 15:08:02 +0100
Hans de Goede <[email protected]> wrote:
...

drivers/video/sunxi_display.c static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode) · line 986

Quoted 11 lines
drivers/video/sunxi_display.c +7 -0
@@ -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

Quoted 8 lines

#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().

Quoted 12 lines

...

drivers/video/sunxi_display.c static void sunxi_mode_set(const struct ctfb_res_modes *mode, · line 1018

Quoted 7 lines
drivers/video/sunxi_display.c +3 -0
@@ -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

Quoted 2 lines
	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