Skip to contentSkip to conversation

sunxi: Enable VGA output on Hummingbird A31

PATCH New Chen-Yu Tsai 2 participants 9 messages Jan 12, 2015 – Jan 13, 2015

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

cover sunxi: Enable VGA output on Hummingbird A31

Hi Hans, Ian,

This series enables the VGA output on the Hummingbird A31. The VGA output is driven from LCD0, through an external DAC that's powered up by toggling pin PH25.

Patch 1 allows selecting CONFIG_VIDEO_VGA_VIA_LCD on sun6i and sun8i. These 2 platforms do not have builtin TV encoders, and some vendor may use an external DAC to support VGA.

Patch 2 adds support for toggling a GPIO pin as part of the video init sequence to power up the DAC

Patch 3 updates the Hummingbird A31 defconfig to enable VGA output.

I have one question about the VGA_VIA_LCD code in general. The color depth is forced to 18. Is this necessary? Can we make it configurable? I haven't tried displaying pictures so I don't know if it makes a visible difference.

Also with the VGA output on my Hummingbird A31, I get greenish flashing pixels where it should be black, like in and between characters. Once booted in to the kernel this disappears, and I get a nice console with simplefb. Kind of weird.

Cheers
ChenYu

Chen-Yu Tsai (3):
sunxi: video: Allow external DACs for VGA on platforms without TV
encoders
sunxi: video: Add support for external DAC enable pin
sunxi: Hummingbird_A31_defconfig: Enable VGA output through external
DAC

 board/sunxi/Kconfig               | 10 +++++++++-
 configs/Hummingbird_A31_defconfig |  2 ++
 drivers/video/sunxi_display.c     | 18 ++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/3 sunxi: video: Allow external DACs for VGA on platforms without TV encoders

Using an external DAC for VGA output was available on sun5i. Since some other SoCs don't have a builtin TV encoder, but might have use for a VGA output, enable the option for the platforms that don't have TV encoders.

---
 board/sunxi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/sunxi/Kconfig +1 -1
index 882db33..bce270e 100644
@@ -308,7 +308,7 @@ config VIDEO_VGA
 
 config VIDEO_VGA_VIA_LCD
 	boolean "VGA via LCD controller support"
-	depends on VIDEO && MACH_SUN5I
+	depends on VIDEO && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I)
 	default n
 	---help---
 	Say Y here to add support for external DACs connected to the parallel
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/3 sunxi: video: Add support for external DAC enable pin

In reply to Chen-Yu Tsai

The external DAC for VGA output might have either a power or reset control pin that needs to be pulled up, as is the case on the Hummingbird A31.

---
 board/sunxi/Kconfig           |  8 ++++++++
 drivers/video/sunxi_display.c | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)
board/sunxi/Kconfig +8 -0
index bce270e..e9a6b3c 100644
@@ -315,6 +315,14 @@ config VIDEO_VGA_VIA_LCD
 	LCD interface driving a VGA connector, such as found on the
 	Olimex A13 boards.
 
+config VIDEO_VGA_EXTERNAL_DAC_EN
+	string "LCD panel power enable pin"
+	depends on VIDEO_VGA_VIA_LCD
+	default ""
+	---help---
+	Set the enable pin for the external VGA DAC. This takes a string in the
+	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
+
 config VIDEO_LCD_MODE
 	string "LCD panel timing details"
 	depends on VIDEO
drivers/video/sunxi_display.c +18 -0
index 47d820d..1052af2 100644
@@ -813,6 +813,23 @@ static void sunxi_drc_init(void)
 #endif
 }
 
+#ifdef CONFIG_VIDEO_VGA_VIA_LCD
+static void sunxi_vga_external_dac_enable(void)
+{
+	int pin;
+
+	/*
+	 * Start with backlight disabled to avoid the screen flashing to
+	 * white while the lcd inits.
+	 */
+	pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
+	if (pin != -1) {
+		gpio_request(pin, "vga_enable");
+		gpio_direction_output(pin, 1);
+	}
+}
+#endif /* CONFIG_VIDEO_VGA_VIA_LCD */
+
 static void sunxi_engines_init(void)
 {
 	sunxi_composer_init();
@@ -860,6 +877,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 		sunxi_lcdc_tcon0_mode_set(mode);
 		sunxi_composer_enable();
 		sunxi_lcdc_enable();
+		sunxi_vga_external_dac_enable();
 #endif
 		break;
 	}
Signature · 1 line
2.1.4
#3 lore raw

PATCH 2/3 sunxi: video: Add support for external DAC enable pin

Hi,

Quoted 36 lines · Chen-Yu Tsai

The external DAC for VGA output might have either a power or reset control pin that needs to be pulled up, as is the case on the Hummingbird A31.

---
  board/sunxi/Kconfig           |  8 ++++++++
  drivers/video/sunxi_display.c | 18 ++++++++++++++++++
  2 files changed, 26 insertions(+)
board/sunxi/Kconfig +8 -0
index bce270e..e9a6b3c 100644
@@ -315,6 +315,14 @@ config VIDEO_VGA_VIA_LCD
  	LCD interface driving a VGA connector, such as found on the
  	Olimex A13 boards.
 
+config VIDEO_VGA_EXTERNAL_DAC_EN
+	string "LCD panel power enable pin"
+	depends on VIDEO_VGA_VIA_LCD
+	default ""
+	---help---
+	Set the enable pin for the external VGA DAC. This takes a string in the
+	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
+
  config VIDEO_LCD_MODE
  	string "LCD panel timing details"
  	depends on VIDEO
drivers/video/sunxi_display.c +0 -0
index 47d820d..1052af2 100644
@@ -813,6 +813,23 @@ static void sunxi_drc_init(void)
  #endif
  }

drivers/video/sunxi_display.c static void sunxi_drc_init(void) · line 824

Quoted 10 lines
drivers/video/sunxi_display.c +9 -0
 
+#ifdef CONFIG_VIDEO_VGA_VIA_LCD
+static void sunxi_vga_external_dac_enable(void)
+{
+	int pin;
+
+	/*
+	 * Start with backlight disabled to avoid the screen flashing to
+	 * white while the lcd inits.
+	 */

This comment seems wrong, copy & paste error ?

Let me know if you agree that it is wrong, then I'll drop it before applying the series, not need to resend.

Regards,

Hans

Quoted 20 lines
drivers/video/sunxi_display.c +9 -0
+	pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
+	if (pin != -1) {
+		gpio_request(pin, "vga_enable");
+		gpio_direction_output(pin, 1);
+	}
+}
+#endif /* CONFIG_VIDEO_VGA_VIA_LCD */
+
  static void sunxi_engines_init(void)
  {
  	sunxi_composer_init();
@@ -860,6 +877,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
  		sunxi_lcdc_tcon0_mode_set(mode);
  		sunxi_composer_enable();
  		sunxi_lcdc_enable();
+		sunxi_vga_external_dac_enable();
  #endif
  		break;
  	}
#4 lore raw

PATCH 2/3 sunxi: video: Add support for external DAC enable pin

Quoted 57 lines · Hans de Goede

Hi,

Quoted 39 lines · Chen-Yu Tsai

The external DAC for VGA output might have either a power or reset control pin that needs to be pulled up, as is the case on the Hummingbird A31.

---
  board/sunxi/Kconfig           |  8 ++++++++
  drivers/video/sunxi_display.c | 18 ++++++++++++++++++
  2 files changed, 26 insertions(+)
board/sunxi/Kconfig +6 -0
index bce270e..e9a6b3c 100644
@@ -315,6 +315,14 @@ config VIDEO_VGA_VIA_LCD
        LCD interface driving a VGA connector, such as found on the
        Olimex A13 boards.
 
+config VIDEO_VGA_EXTERNAL_DAC_EN
+       string "LCD panel power enable pin"
+       depends on VIDEO_VGA_VIA_LCD
+       default ""
+       ---help---
+       Set the enable pin for the external VGA DAC. This takes a string

in the
+ format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of
port H.

board/sunxi/Kconfig +1 -0
+
  config VIDEO_LCD_MODE
        string "LCD panel timing details"
        depends on VIDEO
drivers/video/sunxi_display.c +0 -0
index 47d820d..1052af2 100644
@@ -813,6 +813,23 @@ static void sunxi_drc_init(void)
  #endif
  }

drivers/video/sunxi_display.c static void sunxi_drc_init(void) · line 824

Quoted 10 lines
drivers/video/sunxi_display.c +9 -0
 
+#ifdef CONFIG_VIDEO_VGA_VIA_LCD
+static void sunxi_vga_external_dac_enable(void)
+{
+       int pin;
+
+       /*
+        * Start with backlight disabled to avoid the screen flashing to
+        * white while the lcd inits.
+        */

This comment seems wrong, copy & paste error ?

Quoted 2 lines

Let me know if you agree that it is wrong, then I'll drop it before applying the series, not need to resend.

Yes it's a copy & paste error. Please drop it.

Thanks!

ChenYu

Quoted 28 lines

Regards,

Hans

Quoted 21 lines
drivers/video/sunxi_display.c +9 -0
+       pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
+       if (pin != -1) {
+               gpio_request(pin, "vga_enable");
+               gpio_direction_output(pin, 1);
+       }
+}
+#endif /* CONFIG_VIDEO_VGA_VIA_LCD */
+
  static void sunxi_engines_init(void)
  {
        sunxi_composer_init();
@@ -860,6 +877,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes
 *mode,
                sunxi_lcdc_tcon0_mode_set(mode);
                sunxi_composer_enable();
                sunxi_lcdc_enable();
+               sunxi_vga_external_dac_enable();
  #endif
                break;
        }
#5 lore raw

PATCH 3/3 sunxi: Hummingbird_A31_defconfig: Enable VGA output through external DAC

In reply to Chen-Yu Tsai

The Hummingbird A31 uses an external DAC connected to the LCD0 outputs for the on board VGA output. The DAC has a power control that's toggled by GPIO.

---
 configs/Hummingbird_A31_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/Hummingbird_A31_defconfig +2 -0
index 93820ab..8896999 100644
@@ -1,6 +1,8 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
 CONFIG_FDTFILE="sun6i-a31-hummingbird.dtb"
+CONFIG_VIDEO_VGA_VIA_LCD=y
+CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN6I=y
Signature · 1 line
2.1.4
#6 lore raw

cover sunxi: Enable VGA output on Hummingbird A31

In reply to Chen-Yu Tsai

Hi,

Quoted 5 lines · Chen-Yu Tsai

Hi Hans, Ian,

This series enables the VGA output on the Hummingbird A31. The VGA output is driven from LCD0, through an external DAC that's powered up by toggling pin PH25.

Thanks for working on this!

Quoted 11 lines

Patch 1 allows selecting CONFIG_VIDEO_VGA_VIA_LCD on sun6i and sun8i. These 2 platforms do not have builtin TV encoders, and some vendor may use an external DAC to support VGA.

Patch 2 adds support for toggling a GPIO pin as part of the video init sequence to power up the DAC

Patch 3 updates the Hummingbird A31 defconfig to enable VGA output.

I have one question about the VGA_VIA_LCD code in general. The color depth is forced to 18. Is this necessary?

Depends on the DAC-s you're using, so far this was only used with Olinuxino boards which use 6 bits dacs. If your board has 8 bit dacs then we should make this configurable. Note that all this does is enable dithering to avoid color gradients becoming ugly with 6 bits dacs, but with 8 bit dacs we should disable the dithering (which is done when depth == 24).

Quoted 7 lines

Can we make it configurable? I haven't
tried displaying pictures so I don't know if it makes a visible difference.

Also with the VGA output on my Hummingbird A31, I get greenish flashing pixels where it should be black, like in and between characters. Once booted in to the kernel this disappears, and I get a nice console with simplefb. Kind of weird.

Weird indeed, could it be that the DAC-s need some power-supply setup which u-boot does not set up, but your axp221 kernel code does setup ?

Regards,

Hans

#7 lore raw

cover sunxi: Enable VGA output on Hummingbird A31

Hi,

Quoted 26 lines · Hans de Goede

Hi,

Quoted 6 lines · Chen-Yu Tsai

Hi Hans, Ian,

This series enables the VGA output on the Hummingbird A31. The VGA output is driven from LCD0, through an external DAC that's powered up by toggling pin PH25.

Thanks for working on this!

Quoted 11 lines

Patch 1 allows selecting CONFIG_VIDEO_VGA_VIA_LCD on sun6i and sun8i. These 2 platforms do not have builtin TV encoders, and some vendor may use an external DAC to support VGA.

Patch 2 adds support for toggling a GPIO pin as part of the video init sequence to power up the DAC

Patch 3 updates the Hummingbird A31 defconfig to enable VGA output.

I have one question about the VGA_VIA_LCD code in general. The color depth is forced to 18. Is this necessary?

Quoted 6 lines

Depends on the DAC-s you're using, so far this was only used with Olinuxino boards which use 6 bits dacs. If your board has 8 bit dacs then we should make this configurable. Note that all this does is enable dithering to avoid color gradients becoming ugly with 6 bits dacs, but with 8 bit dacs we should
disable the dithering (which is done when depth == 24).

OK. The Hummingbird uses all 24 bits. The DAC is actually 30 bits. First I need to get some sort of full color display setup running. Then I'll do the config options.

Quoted 4 lines
Quoted 4 lines

Can we make it configurable? I haven't
tried displaying pictures so I don't know if it makes a visible difference.

Quoted 8 lines
Quoted 4 lines

Also with the VGA output on my Hummingbird A31, I get greenish flashing pixels where it should be black, like in and between characters. Once booted in to the kernel this disappears, and I get a nice console with simplefb. Kind of weird.

Weird indeed, could it be that the DAC-s need some power-supply setup which u-boot does not set up, but your axp221 kernel code does setup ?

There's just the regulator that's enabled in u-boot. And I'm not running an AXP221 enabled kernel either. Hence the weirdness. :|

Regards
ChenYu

#8 lore raw

cover sunxi: Enable VGA output on Hummingbird A31

In reply to Chen-Yu Tsai

Hi,

Quoted 19 lines · Chen-Yu Tsai

Hi Hans, Ian,

This series enables the VGA output on the Hummingbird A31. The VGA output is driven from LCD0, through an external DAC that's powered up by toggling pin PH25.

Patch 1 allows selecting CONFIG_VIDEO_VGA_VIA_LCD on sun6i and sun8i. These 2 platforms do not have builtin TV encoders, and some vendor may use an external DAC to support VGA.

Patch 2 adds support for toggling a GPIO pin as part of the video init sequence to power up the DAC

Patch 3 updates the Hummingbird A31 defconfig to enable VGA output.

I have one question about the VGA_VIA_LCD code in general. The color depth is forced to 18. Is this necessary? Can we make it configurable? I haven't tried displaying pictures so I don't know if it makes a visible difference.

Quoted 8 lines

Also with the VGA output on my Hummingbird A31, I get greenish flashing pixels where it should be black, like in and between characters. Once booted in to the kernel this disappears, and I get a nice console with simplefb. Kind of weird.

Cheers
ChenYu

Thanks, applied to u-boot-sunxi/next (with the discussed fix), while at it I've also fixed the whitespace errors you pointed out in <CAGb2v65Y26fTjcoOcWUZLG0+BR+UrWJ4HCL5d1V7ovn6TA6WTw@mail.gmail.com>

Regards,

Hans

Quoted 14 lines

Chen-Yu Tsai (3):
sunxi: video: Allow external DACs for VGA on platforms without TV
encoders
sunxi: video: Add support for external DAC enable pin
sunxi: Hummingbird_A31_defconfig: Enable VGA output through external
DAC

  board/sunxi/Kconfig               | 10 +++++++++-
  configs/Hummingbird_A31_defconfig |  2 ++
  drivers/video/sunxi_display.c     | 18 ++++++++++++++++++
  3 files changed, 29 insertions(+), 1 deletion(-)