Skip to contentSkip to conversation

sunxi: video: Add support for HDMI output on H3

RFC PATCH New Jernej Skrabec 9 participants 25 messages Dec 13, 2016 – Feb 5, 2017

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

cover sunxi: video: Add support for HDMI output on H3

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?
- TCON code is currently exactly the same as in driver for older SoCs. Should I split it out into shared module? Also TV out code seems to be similar, but I didn't manage to confirm that it works as-is on H3.
- A80 SoC is mix of older display engine and newer HDMI controller, so it doesn't really work with either of sunxi video drivers. Two solutions I see here are either combine both driver into one massive display driver or, much better, split everything by components (TCON/DE/DE2/HDMI/TV) and instantiate compatible ones. I guess this is not much different than adding support for DT in drivers. Note that I don't have any A80 board, I'm just thinking ahead.

Best regards,
Jernej Skrabec

Jernej Skrabec (3):
sunxi: Add clocks for DE2/HDMI/TCON
sunxi: video: Add video driver for H3 SoC
sunxi: Enable H3 video driver in defconfigs

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |   43 +
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h   |    8 +
 arch/arm/include/asm/arch-sunxi/display2.h    |  377 +++++++++
 arch/arm/mach-sunxi/clock_sun6i.c             |   28 +
 board/sunxi/Kconfig                           |    4 +-
 configs/orangepi_2_defconfig                  |    1 +
 configs/orangepi_lite_defconfig               |    1 +
 configs/orangepi_one_defconfig                |    1 +
 configs/orangepi_pc_defconfig                 |    1 +
 configs/orangepi_pc_plus_defconfig            |    1 +
 configs/orangepi_plus2e_defconfig             |    1 +
 configs/orangepi_plus_defconfig               |    1 +
 drivers/video/Makefile                        |    1 +
 drivers/video/sunxi_display2.c                | 1037 +++++++++++++++++++++++++
 include/configs/sunxi-common.h                |   17 +-
 scripts/config_whitelist.txt                  |    1 +
 16 files changed, 1516 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/display2.h
 create mode 100644 drivers/video/sunxi_display2.c
Signature · 1 line
2.10.2
#1 lore raw

RFC PATCH 1/3 sunxi: Add clocks for DE2/HDMI/TCON

This is needed for HDMI support, which will be added later.

---

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43 +++++++++++++++++++++++++++
 arch/arm/mach-sunxi/clock_sun6i.c             | 28 +++++++++++++++++
 2 files changed, 71 insertions(+)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +43 -0
index be9fcfd..c19c200 100644
@@ -67,12 +67,20 @@ struct sunxi_ccm_reg {
 	u32 dram_pll_cfg;	/* 0xf8 PLL_DDR cfg register, A33 only */
 	u32 mbus_reset;		/* 0xfc MBUS reset control, A33 only */
 	u32 dram_clk_gate;	/* 0x100 DRAM module gating */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 de_clk_cfg;		/* 0x104 DE module clock */
+#else
 	u32 be0_clk_cfg;	/* 0x104 BE0 module clock */
+#endif
 	u32 be1_clk_cfg;	/* 0x108 BE1 module clock */
 	u32 fe0_clk_cfg;	/* 0x10c FE0 module clock */
 	u32 fe1_clk_cfg;	/* 0x110 FE1 module clock */
 	u32 mp_clk_cfg;		/* 0x114 MP module clock */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 tcon0_clk_cfg;	/* 0x118 TCON0 module clock */
+#else
 	u32 lcd0_ch0_clk_cfg;	/* 0x118 LCD0 CH0 module clock */
+#endif
 	u32 lcd1_ch0_clk_cfg;	/* 0x11c LCD1 CH0 module clock */
 	u32 reserved14[3];
 	u32 lcd0_ch1_clk_cfg;	/* 0x12c LCD0 CH1 module clock */
@@ -85,7 +93,11 @@ struct sunxi_ccm_reg {
 	u32 dmic_clk_cfg;	/* 0x148 Digital Mic module clock*/
 	u32 reserved15;
 	u32 hdmi_clk_cfg;	/* 0x150 HDMI module clock */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 hdmi_slow_clk_cfg;	/* 0x154 HDMI slow module clock */
+#else
 	u32 ps_clk_cfg;		/* 0x154 PS module clock */
+#endif
 	u32 mtc_clk_cfg;	/* 0x158 MTC module clock */
 	u32 mbus0_clk_cfg;	/* 0x15c MBUS0 module clock */
 	u32 mbus1_clk_cfg;	/* 0x160 MBUS1 module clock */
@@ -220,6 +232,15 @@ struct sunxi_ccm_reg {
 #define CCM_MIPI_PLL_CTRL_LDO_EN	(0x3 << 22)
 #define CCM_MIPI_PLL_CTRL_EN		(0x1 << 31)
 
+#define CCM_PLL10_CTRL_M_SHIFT		0
+#define CCM_PLL10_CTRL_M_MASK		(0xf << CCM_PLL10_CTRL_M_SHIFT)
+#define CCM_PLL10_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+#define CCM_PLL10_CTRL_N_SHIFT		8
+#define CCM_PLL10_CTRL_N_MASK		(0x7f << CCM_PLL10_CTRL_N_SHIFT)
+#define CCM_PLL10_CTRL_N(n)		((((n) - 1) & 0x7f) << 8)
+#define CCM_PLL10_CTRL_INTEGER_MODE	(0x1 << 24)
+#define CCM_PLL10_CTRL_EN		(0x1 << 31)
+
 #define CCM_PLL11_CTRL_N(n)		((((n) - 1) & 0x3f) << 8)
 #define CCM_PLL11_CTRL_SIGMA_DELTA_EN	(0x1 << 24)
 #define CCM_PLL11_CTRL_UPD		(0x1 << 30)
@@ -271,9 +292,12 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_DRC0		25
 #define AHB_GATE_OFFSET_DE_FE0		14
 #define AHB_GATE_OFFSET_DE_BE0		12
+#define AHB_GATE_OFFSET_DE		12
 #define AHB_GATE_OFFSET_HDMI		11
 #define AHB_GATE_OFFSET_LCD1		5
 #define AHB_GATE_OFFSET_LCD0		4
+#define AHB_GATE_OFFSET_TCON1		4
+#define AHB_GATE_OFFSET_TCON0		3
 
 #define CCM_MMC_CTRL_M(x)		((x) - 1)
 #define CCM_MMC_CTRL_OCLK_DLY(x)	((x) << 8)
@@ -346,6 +370,9 @@ struct sunxi_ccm_reg {
 #define CCM_LCD_CH0_CTRL_RST		0
 #define CCM_LCD_CH0_CTRL_GATE		(0x1 << 31)
 
+#define CCM_TCON0_CTRL_GATE		(0x1 << 31)
+#define CCM_TCON0_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+
 #define CCM_LCD_CH1_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
 #define CCM_LCD_CH1_CTRL_HALF_SCLK1	0 /* no seperate sclk1 & 2 on sun6i */
 #define CCM_LCD_CH1_CTRL_PLL3		(0 << 24)
@@ -355,6 +382,7 @@ struct sunxi_ccm_reg {
 #define CCM_LCD_CH1_CTRL_GATE		(0x1 << 31)
 
 #define CCM_HDMI_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+#define CCM_HDMI_CTRL_M_MASK		(0xf << 0)
 #define CCM_HDMI_CTRL_PLL_MASK		(3 << 24)
 #define CCM_HDMI_CTRL_PLL3		(0 << 24)
 #define CCM_HDMI_CTRL_PLL7		(1 << 24)
@@ -363,6 +391,8 @@ struct sunxi_ccm_reg {
 #define CCM_HDMI_CTRL_DDC_GATE		(0x1 << 30)
 #define CCM_HDMI_CTRL_GATE		(0x1 << 31)
 
+#define CCM_HDMI_SLOW_CTRL_DDC_GATE	(1 << 31)
+
 #if defined(CONFIG_MACH_SUN50I)
 #define MBUS_CLK_DEFAULT		0x81000002 /* PLL6x2 / 3 */
 #elif defined(CONFIG_MACH_SUN8I)
@@ -390,9 +420,13 @@ struct sunxi_ccm_reg {
 #define AHB_RESET_OFFSET_DRC0		25
 #define AHB_RESET_OFFSET_DE_FE0		14
 #define AHB_RESET_OFFSET_DE_BE0		12
+#define AHB_RESET_OFFSET_DE		12
 #define AHB_RESET_OFFSET_HDMI		11
+#define AHB_RESET_OFFSET_HDMI2		10
 #define AHB_RESET_OFFSET_LCD1		5
 #define AHB_RESET_OFFSET_LCD0		4
+#define AHB_RESET_OFFSET_TCON1		4
+#define AHB_RESET_OFFSET_TCON0		3
 
 /* ahb_reset2 offsets */
 #define AHB_RESET_OFFSET_EPHY		2
@@ -415,6 +449,13 @@ struct sunxi_ccm_reg {
 #define CCM_DE_CTRL_PLL10		(5 << 24)
 #define CCM_DE_CTRL_GATE		(1 << 31)
 
+/* CCM bits common to all Display Engine 2.0 clock ctrl regs */
+#define CCM_DE2_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+#define CCM_DE2_CTRL_PLL_MASK		(3 << 24)
+#define CCM_DE2_CTRL_PLL6_2X		(0 << 24)
+#define CCM_DE2_CTRL_PLL10		(1 << 24)
+#define CCM_DE2_CTRL_GATE		(1 << 31)
+
 /* CCU security switch, H3 only */
 #define CCM_SEC_SWITCH_MBUS_NONSEC	(1 << 2)
 #define CCM_SEC_SWITCH_BUS_NONSEC	(1 << 1)
@@ -423,7 +464,9 @@ struct sunxi_ccm_reg {
 #ifndef __ASSEMBLY__
 void clock_set_pll1(unsigned int hz);
 void clock_set_pll3(unsigned int hz);
+void clock_set_pll3_factors(int m, int n);
 void clock_set_pll5(unsigned int clk, bool sigma_delta_enable);
+void clock_set_pll10(unsigned int hz);
 void clock_set_pll11(unsigned int clk, bool sigma_delta_enable);
 void clock_set_mipi_pll(unsigned int hz);
 unsigned int clock_get_pll3(void);
arch/arm/mach-sunxi/clock_sun6i.c +28 -0
index ed8cd9b..b4ccb8d 100644
@@ -141,6 +141,17 @@ void clock_set_pll3(unsigned int clk)
 	       &ccm->pll3_cfg);
 }
 
+void clock_set_pll3_factors(int m, int n)
+{
+	struct sunxi_ccm_reg * const ccm =
+		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+	/* PLL3 rate = 24000000 * n / m */
+	writel(CCM_PLL3_CTRL_EN | CCM_PLL3_CTRL_INTEGER_MODE |
+	       CCM_PLL3_CTRL_N(n) | CCM_PLL3_CTRL_M(m),
+	       &ccm->pll3_cfg);
+}
+
 void clock_set_pll5(unsigned int clk, bool sigma_delta_enable)
 {
 	struct sunxi_ccm_reg * const ccm =
@@ -213,6 +224,23 @@ done:
 }
 #endif
 
+void clock_set_pll10(unsigned int clk)
+{
+	struct sunxi_ccm_reg * const ccm =
+		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	const int m = 2; /* 12 MHz steps */
+
+	if (clk == 0) {
+		clrbits_le32(&ccm->pll10_cfg, CCM_PLL10_CTRL_EN);
+		return;
+	}
+
+	/* PLL10 rate = 24000000 * n / m */
+	writel(CCM_PLL10_CTRL_EN | CCM_PLL10_CTRL_INTEGER_MODE |
+	       CCM_PLL10_CTRL_N(clk / (24000000 / m)) | CCM_PLL10_CTRL_M(m),
+	       &ccm->pll10_cfg);
+}
+
 #ifdef CONFIG_MACH_SUN8I_A33
 void clock_set_pll11(unsigned int clk, bool sigma_delta_enable)
 {
Signature · 1 line
2.10.2
#2 lore raw

RFC PATCH 1/3 sunxi: Add clocks for DE2/HDMI/TCON

Hi,

First off, thanks a lot for working on this.

Quoted 63 lines · Jernej Skrabec

This is needed for HDMI support, which will be added later.

---

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43 +++++++++++++++++++++++++++
 arch/arm/mach-sunxi/clock_sun6i.c             | 28 +++++++++++++++++
 2 files changed, 71 insertions(+)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +21 -0
index be9fcfd..c19c200 100644
@@ -67,12 +67,20 @@ struct sunxi_ccm_reg {
 	u32 dram_pll_cfg;	/* 0xf8 PLL_DDR cfg register, A33 only */
 	u32 mbus_reset;		/* 0xfc MBUS reset control, A33 only */
 	u32 dram_clk_gate;	/* 0x100 DRAM module gating */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 de_clk_cfg;		/* 0x104 DE module clock */
+#else
 	u32 be0_clk_cfg;	/* 0x104 BE0 module clock */
+#endif
 	u32 be1_clk_cfg;	/* 0x108 BE1 module clock */
 	u32 fe0_clk_cfg;	/* 0x10c FE0 module clock */
 	u32 fe1_clk_cfg;	/* 0x110 FE1 module clock */
 	u32 mp_clk_cfg;		/* 0x114 MP module clock */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 tcon0_clk_cfg;	/* 0x118 TCON0 module clock */
+#else
 	u32 lcd0_ch0_clk_cfg;	/* 0x118 LCD0 CH0 module clock */
+#endif
 	u32 lcd1_ch0_clk_cfg;	/* 0x11c LCD1 CH0 module clock */
 	u32 reserved14[3];
 	u32 lcd0_ch1_clk_cfg;	/* 0x12c LCD0 CH1 module clock */
@@ -85,7 +93,11 @@ struct sunxi_ccm_reg {
 	u32 dmic_clk_cfg;	/* 0x148 Digital Mic module clock*/
 	u32 reserved15;
 	u32 hdmi_clk_cfg;	/* 0x150 HDMI module clock */
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 hdmi_slow_clk_cfg;	/* 0x154 HDMI slow module clock */
+#else
 	u32 ps_clk_cfg;		/* 0x154 PS module clock */
+#endif
 	u32 mtc_clk_cfg;	/* 0x158 MTC module clock */
 	u32 mbus0_clk_cfg;	/* 0x15c MBUS0 module clock */
 	u32 mbus1_clk_cfg;	/* 0x160 MBUS1 module clock */
@@ -220,6 +232,15 @@ struct sunxi_ccm_reg {
 #define CCM_MIPI_PLL_CTRL_LDO_EN	(0x3 << 22)
 #define CCM_MIPI_PLL_CTRL_EN		(0x1 << 31)
 
+#define CCM_PLL10_CTRL_M_SHIFT		0
+#define CCM_PLL10_CTRL_M_MASK		(0xf << CCM_PLL10_CTRL_M_SHIFT)
+#define CCM_PLL10_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+#define CCM_PLL10_CTRL_N_SHIFT		8
+#define CCM_PLL10_CTRL_N_MASK		(0x7f << CCM_PLL10_CTRL_N_SHIFT)
+#define CCM_PLL10_CTRL_N(n)		((((n) - 1) & 0x7f) << 8)
+#define CCM_PLL10_CTRL_INTEGER_MODE	(0x1 << 24)
+#define CCM_PLL10_CTRL_EN		(0x1 << 31)
+
 #define CCM_PLL11_CTRL_N(n)		((((n) - 1) & 0x3f) << 8)
 #define CCM_PLL11_CTRL_SIGMA_DELTA_EN	(0x1 << 24)
 #define CCM_PLL11_CTRL_UPD		(0x1 << 30)

arch/arm/include/asm/arch-sunxi/clock_sun6i.h struct sunxi_ccm_reg { · line 300

Quoted 9 lines
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +3 -0
@@ -271,9 +292,12 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_DRC0		25
 #define AHB_GATE_OFFSET_DE_FE0		14
 #define AHB_GATE_OFFSET_DE_BE0		12
+#define AHB_GATE_OFFSET_DE		12
 #define AHB_GATE_OFFSET_HDMI		11
 #define AHB_GATE_OFFSET_LCD1		5
 #define AHB_GATE_OFFSET_LCD0		4
+#define AHB_GATE_OFFSET_TCON1		4
+#define AHB_GATE_OFFSET_TCON0		3

Maybe having some ifdef here would help, only to differentiate between the DE1 and DE2 cases that would require different defines here.

Note that it also applies to the rest of that patch.

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161213/2359f6e2/attachment.sig>
#3 lore raw

RFC PATCH 1/3 sunxi: Add clocks for DE2/HDMI/TCON

Hi,

Quoted 99 lines · Maxime Ripard

Hi,

First off, thanks a lot for working on this.

Quoted 94 lines · Jernej Skrabec

This is needed for HDMI support, which will be added later.

---

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43

+++++++++++++++++++++++++++ arch/arm/mach-sunxi/clock_sun6i.c
| 28 +++++++++++++++++ 2 files changed, 71 insertions(+)

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index be9fcfd..c19c200 100644

arch/arm/include/asm/arch-sunxi/clock_sun6i.h +21 -0
@@ -67,12 +67,20 @@ struct sunxi_ccm_reg {
 
 	u32 dram_pll_cfg;	/* 0xf8 PLL_DDR cfg register, A33 only */
 	u32 mbus_reset;		/* 0xfc MBUS reset control, A33 only */
 	u32 dram_clk_gate;	/* 0x100 DRAM module gating */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 de_clk_cfg;		/* 0x104 DE module clock */
+#else
 
 	u32 be0_clk_cfg;	/* 0x104 BE0 module clock */
 
+#endif
 
 	u32 be1_clk_cfg;	/* 0x108 BE1 module clock */
 	u32 fe0_clk_cfg;	/* 0x10c FE0 module clock */
 	u32 fe1_clk_cfg;	/* 0x110 FE1 module clock */
 	u32 mp_clk_cfg;		/* 0x114 MP module clock */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 tcon0_clk_cfg;	/* 0x118 TCON0 module clock */
+#else
 
 	u32 lcd0_ch0_clk_cfg;	/* 0x118 LCD0 CH0 module clock */
 
+#endif
 
 	u32 lcd1_ch0_clk_cfg;	/* 0x11c LCD1 CH0 module clock */
 	u32 reserved14[3];
 	u32 lcd0_ch1_clk_cfg;	/* 0x12c LCD0 CH1 module clock */
@@ -85,7 +93,11 @@ struct sunxi_ccm_reg {
 
 	u32 dmic_clk_cfg;	/* 0x148 Digital Mic module clock*/
 	u32 reserved15;
 	u32 hdmi_clk_cfg;	/* 0x150 HDMI module clock */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+	u32 hdmi_slow_clk_cfg;	/* 0x154 HDMI slow module clock */
+#else
 
 	u32 ps_clk_cfg;		/* 0x154 PS module clock */
 
+#endif
 
 	u32 mtc_clk_cfg;	/* 0x158 MTC module clock */
 	u32 mbus0_clk_cfg;	/* 0x15c MBUS0 module clock */
 	u32 mbus1_clk_cfg;	/* 0x160 MBUS1 module clock */
@@ -220,6 +232,15 @@ struct sunxi_ccm_reg {
 
 #define CCM_MIPI_PLL_CTRL_LDO_EN	(0x3 << 22)
 #define CCM_MIPI_PLL_CTRL_EN		(0x1 << 31)
 
+#define CCM_PLL10_CTRL_M_SHIFT		0
+#define CCM_PLL10_CTRL_M_MASK		(0xf << CCM_PLL10_CTRL_M_SHIFT)
+#define CCM_PLL10_CTRL_M(n)		((((n) - 1) & 0xf) << 0)
+#define CCM_PLL10_CTRL_N_SHIFT		8
+#define CCM_PLL10_CTRL_N_MASK		(0x7f << CCM_PLL10_CTRL_N_SHIFT)
+#define CCM_PLL10_CTRL_N(n)		((((n) - 1) & 0x7f) << 8)
+#define CCM_PLL10_CTRL_INTEGER_MODE	(0x1 << 24)
+#define CCM_PLL10_CTRL_EN		(0x1 << 31)
+
 
 #define CCM_PLL11_CTRL_N(n)		((((n) - 1) & 0x3f) << 8)

#define CCM_PLL11_CTRL_SIGMA_DELTA_EN (0x1 << 24)
#define CCM_PLL11_CTRL_UPD (0x1 << 30)

arch/arm/include/asm/arch-sunxi/clock_sun6i.h +1 -0
@@ -271,9 +292,12 @@ struct sunxi_ccm_reg {
 
 #define AHB_GATE_OFFSET_DRC0		25
 #define AHB_GATE_OFFSET_DE_FE0		14
 #define AHB_GATE_OFFSET_DE_BE0		12
 
+#define AHB_GATE_OFFSET_DE		12
 
 #define AHB_GATE_OFFSET_HDMI		11
 #define AHB_GATE_OFFSET_LCD1		5
 #define AHB_GATE_OFFSET_LCD0		4
Quoted 7 lines

arch/arm/include/asm/arch-sunxi/clock_sun6i.h struct sunxi_ccm_reg { · line 300

Quoted 2 lines
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +2 -0
+#define AHB_GATE_OFFSET_TCON1		4
+#define AHB_GATE_OFFSET_TCON0		3

Maybe having some ifdef here would help, only to differentiate between the DE1 and DE2 cases that would require different defines here.

Note that it also applies to the rest of that patch.

You mean something like this?

#ifdef CONFIG_SUNXI_DE2
#define AHB_GATE_OFFSET_TCON1 4
#define AHB_GATE_OFFSET_TCON0 3
#else
#define AHB_GATE_OFFSET_LCD1 5
#define AHB_GATE_OFFSET_LCD0 4
#endif

and then in include/configs/sun8i.h something like this?

#if defined(CONFIG_MACH_SUN8I_H3)
	#define CONFIG_SUNXI_DE2	1

#endif

Best regards,
Jernej Skrabec

Quoted 8 lines

Thanks,
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#4 lore raw

RFC PATCH 1/3 sunxi: Add clocks for DE2/HDMI/TCON

Quoted 112 lines · Jernej ?krabec

Hi,

Quoted 99 lines · Maxime Ripard

Hi,

First off, thanks a lot for working on this.

Quoted 94 lines · Jernej Skrabec

This is needed for HDMI support, which will be added later.

---

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43

+++++++++++++++++++++++++++ arch/arm/mach-sunxi/clock_sun6i.c
| 28 +++++++++++++++++ 2 files changed, 71 insertions(+)

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index be9fcfd..c19c200 100644

arch/arm/include/asm/arch-sunxi/clock_sun6i.h +21 -0
@@ -67,12 +67,20 @@ struct sunxi_ccm_reg {
 
    u32 dram_pll_cfg;       /* 0xf8 PLL_DDR cfg register, A33 only */
    u32 mbus_reset;         /* 0xfc MBUS reset control, A33 only */
    u32 dram_clk_gate;      /* 0x100 DRAM module gating */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+   u32 de_clk_cfg;         /* 0x104 DE module clock */
+#else
 
    u32 be0_clk_cfg;        /* 0x104 BE0 module clock */
 
+#endif
 
    u32 be1_clk_cfg;        /* 0x108 BE1 module clock */
    u32 fe0_clk_cfg;        /* 0x10c FE0 module clock */
    u32 fe1_clk_cfg;        /* 0x110 FE1 module clock */
    u32 mp_clk_cfg;         /* 0x114 MP module clock */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+   u32 tcon0_clk_cfg;      /* 0x118 TCON0 module clock */
+#else
 
    u32 lcd0_ch0_clk_cfg;   /* 0x118 LCD0 CH0 module clock */
 
+#endif
 
    u32 lcd1_ch0_clk_cfg;   /* 0x11c LCD1 CH0 module clock */
    u32 reserved14[3];
    u32 lcd0_ch1_clk_cfg;   /* 0x12c LCD0 CH1 module clock */
@@ -85,7 +93,11 @@ struct sunxi_ccm_reg {
 
    u32 dmic_clk_cfg;       /* 0x148 Digital Mic module clock*/
    u32 reserved15;
    u32 hdmi_clk_cfg;       /* 0x150 HDMI module clock */
 
+#ifdef CONFIG_MACH_SUN8I_H3
+   u32 hdmi_slow_clk_cfg;  /* 0x154 HDMI slow module clock */
+#else
 
    u32 ps_clk_cfg;         /* 0x154 PS module clock */
 
+#endif
 
    u32 mtc_clk_cfg;        /* 0x158 MTC module clock */
    u32 mbus0_clk_cfg;      /* 0x15c MBUS0 module clock */
    u32 mbus1_clk_cfg;      /* 0x160 MBUS1 module clock */
@@ -220,6 +232,15 @@ struct sunxi_ccm_reg {
 
 #define CCM_MIPI_PLL_CTRL_LDO_EN   (0x3 << 22)
 #define CCM_MIPI_PLL_CTRL_EN               (0x1 << 31)
 
+#define CCM_PLL10_CTRL_M_SHIFT             0
+#define CCM_PLL10_CTRL_M_MASK              (0xf << CCM_PLL10_CTRL_M_SHIFT)
+#define CCM_PLL10_CTRL_M(n)                ((((n) - 1) & 0xf) << 0)
+#define CCM_PLL10_CTRL_N_SHIFT             8
+#define CCM_PLL10_CTRL_N_MASK              (0x7f << CCM_PLL10_CTRL_N_SHIFT)
+#define CCM_PLL10_CTRL_N(n)                ((((n) - 1) & 0x7f) << 8)
+#define CCM_PLL10_CTRL_INTEGER_MODE        (0x1 << 24)
+#define CCM_PLL10_CTRL_EN          (0x1 << 31)
+
 
 #define CCM_PLL11_CTRL_N(n)                ((((n) - 1) & 0x3f) << 8)

#define CCM_PLL11_CTRL_SIGMA_DELTA_EN (0x1 << 24)
#define CCM_PLL11_CTRL_UPD (0x1 << 30)

arch/arm/include/asm/arch-sunxi/clock_sun6i.h +1 -0
@@ -271,9 +292,12 @@ struct sunxi_ccm_reg {
 
 #define AHB_GATE_OFFSET_DRC0               25
 #define AHB_GATE_OFFSET_DE_FE0             14
 #define AHB_GATE_OFFSET_DE_BE0             12
 
+#define AHB_GATE_OFFSET_DE         12
 
 #define AHB_GATE_OFFSET_HDMI               11
 #define AHB_GATE_OFFSET_LCD1               5
 #define AHB_GATE_OFFSET_LCD0               4
Quoted 7 lines

arch/arm/include/asm/arch-sunxi/clock_sun6i.h struct sunxi_ccm_reg { · line 300

Quoted 2 lines
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +2 -0
+#define AHB_GATE_OFFSET_TCON1              4
+#define AHB_GATE_OFFSET_TCON0              3

Maybe having some ifdef here would help, only to differentiate between the DE1 and DE2 cases that would require different defines here.

Note that it also applies to the rest of that patch.

You mean something like this?

Quoted 7 lines

#ifdef CONFIG_SUNXI_DE2
#define AHB_GATE_OFFSET_TCON1 4
#define AHB_GATE_OFFSET_TCON0 3
#else
#define AHB_GATE_OFFSET_LCD1 5
#define AHB_GATE_OFFSET_LCD0 4
#endif

LCD/TCON seems like a bad example though... They really are the same thing, and Allwinner uses LCD / TCON interchangeably in the manuals of the old SoCs.

The difference in the new SoCs is simply they moved the offsets. For this particular case, can you use the old names instead? I think this will also help with pulling the TCON code into a separate library or driver.

For the DE clocks, you should probably enclose all the DE FE/BE clock registers and defines in the DE 1.0 block, and add reserved blocks for DE 2.0.

Regards
ChenYu

Quoted 20 lines

and then in include/configs/sun8i.h something like this?

#if defined(CONFIG_MACH_SUN8I_H3)
        #define CONFIG_SUNXI_DE2        1

#endif

Best regards,
Jernej Skrabec

Quoted 8 lines

Thanks,
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#5 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

In reply to Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

---

 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h |    8 +
 arch/arm/include/asm/arch-sunxi/display2.h  |  377 ++++++++++
 board/sunxi/Kconfig                         |    4 +-
 drivers/video/Makefile                      |    1 +
 drivers/video/sunxi_display2.c              | 1037 +++++++++++++++++++++++++++
 include/configs/sunxi-common.h              |   17 +-
 scripts/config_whitelist.txt                |    1 +
 7 files changed, 1438 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/display2.h
 create mode 100644 drivers/video/sunxi_display2.c
arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +8 -0
index 7232f6d..9df6212 100644
@@ -18,6 +18,8 @@
 #define SUNXI_SRAM_D_BASE		0x00010000	/* 4 kiB */
 #define SUNXI_SRAM_B_BASE		0x00020000	/* 64 kiB (secure) */
 
+#define SUNXI_DE2_BASE			0x01000000
+
 #ifdef CONFIG_MACH_SUN8I_A83T
 #define SUNXI_CPUCFG_BASE		0x01700000
 #endif
@@ -46,7 +48,9 @@
 #define SUNXI_USB1_BASE			0x01c14000
 #endif
 #define SUNXI_SS_BASE			0x01c15000
+#ifndef CONFIG_MACH_SUN8I_H3
 #define SUNXI_HDMI_BASE			0x01c16000
+#endif
 #define SUNXI_SPI2_BASE			0x01c17000
 #define SUNXI_SATA_BASE			0x01c18000
 #ifdef CONFIG_SUNXI_GEN_SUN4I
@@ -163,6 +167,10 @@ defined(CONFIG_MACH_SUN50I)
 #define SUNXI_MP_BASE			0x01e80000
 #define SUNXI_AVG_BASE			0x01ea0000
 
+#ifdef CONFIG_MACH_SUN8I_H3
+#define SUNXI_HDMI_BASE			0x01ee0000
+#endif
+
 #define SUNXI_RTC_BASE			0x01f00000
 #define SUNXI_PRCM_BASE			0x01f01400
 
arch/arm/include/asm/arch-sunxi/display2.h new file +377 -0

377 lines not on this page · raw message

board/sunxi/Kconfig +2 -2
index e1d4ab1..1c393eb 100644
@@ -462,7 +462,7 @@ config AXP_GPIO
 
 config VIDEO
 	bool "Enable graphical uboot console on HDMI, LCD or VGA"
-	depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I
+	depends on !MACH_SUN8I_A83T && !MACH_SUN9I && !MACH_SUN50I
 	default y
 	---help---
 	Say Y here to add support for using a cfb console on the HDMI, LCD
@@ -471,7 +471,7 @@ config VIDEO
 
 config VIDEO_HDMI
 	bool "HDMI output support"
-	depends on VIDEO && !MACH_SUN8I
+	depends on VIDEO && !MACH_SUN8I_A23 && !MACH_SUN8I_A33
 	default y
 	---help---
 	Say Y here to add support for outputting video over HDMI.
drivers/video/Makefile +1 -0
index db34904..3097b82 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
 obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
 obj-$(CONFIG_VIDEO_SM501) += sm501.o
 obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o
+obj-$(CONFIG_VIDEO_SUNXI2) += sunxi_display2.o videomodes.o
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o
 obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 obj-$(CONFIG_VIDEO_VESA) += vesa.o
drivers/video/sunxi_display2.c new file +1037 -0

1,037 lines not on this page · raw message

include/configs/sunxi-common.h +12 -5
index b0bfc0d..818408f 100644
@@ -276,16 +276,23 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_SUNXI_GPIO
 
 #ifdef CONFIG_VIDEO
+/* Do we want to initialize a simple FB? */
+#define CONFIG_VIDEO_DT_SIMPLEFB
+#ifdef CONFIG_MACH_SUN8I_H3
+#define CONFIG_VIDEO_SUNXI2
+#else
+#define CONFIG_VIDEO_SUNXI
+#endif
+
 /*
  * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  * to use as framebuffer. This must be a multiple of 4096.
  */
+#ifdef CONFIG_VIDEO_SUNXI2
+#define CONFIG_SUNXI_MAX_FB_SIZE (32 << 20)
+#else
 #define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
-
-/* Do we want to initialize a simple FB? */
-#define CONFIG_VIDEO_DT_SIMPLEFB
-
-#define CONFIG_VIDEO_SUNXI
+#endif
 
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_STD_TIMINGS
scripts/config_whitelist.txt +1 -0
index 8814841..fdee9d9 100644
@@ -8165,6 +8165,7 @@ CONFIG_VIDEO_SM501_8BPP
 CONFIG_VIDEO_SM501_PCI
 CONFIG_VIDEO_STD_TIMINGS
 CONFIG_VIDEO_SUNXI
+CONFIG_VIDEO_SUNXI2
 CONFIG_VIDEO_VCXK
 CONFIG_VID_FLS_ENV
 CONFIG_VM86
Signature · 1 line
2.10.2
#6 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

Hi,

Quoted 7 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

Quoted 6 lines

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

From the linux discussion, I recall that you said that the TCON was still the same, and the HDMI was something that could be shared with the Rockchip implementation. Did you look into sharing the TCON code (for example using a small "library" to share the functions) and to reuse Rockchip's HDMI code?

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161213/85e0c50e/attachment.sig>
#7 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

Quoted 15 lines · Maxime Ripard

Hi,

Quoted 12 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

Quoted 7 lines
Quoted 1 line

From the linux discussion, I recall that you said that the TCON was still the same, and the HDMI was something that could be shared with the Rockchip implementation. Did you look into sharing the TCON code (for example using a small "library" to share the functions) and to reuse Rockchip's HDMI code?

I second the first proposal. The TCON structure has not changed since the A10. Allwinner just removed the unused channels. Channel 1 is removed from the first TCON, and channel 0 is removed from the second TCON. So Allwinner is more or less committing to a static mapping for the display pipeline outputs.

Regards
ChenYu

#8 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

In reply to Maxime Ripard

Hi,

Quoted 15 lines · Maxime Ripard

Hi,

Quoted 12 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

Quoted 7 lines
Quoted 1 line

From the linux discussion, I recall that you said that the TCON was still the same, and the HDMI was something that could be shared with the Rockchip implementation. Did you look into sharing the TCON code (for example using a small "library" to share the functions) and to reuse Rockchip's HDMI code?

For now, I only reused one TCON function and some defines. I tought that split would be better done a bit later, when the driver will get support for LCD screens (A64, for example). At that time TCON code would also be refactored to be more generic and properly tested that it can be used with both drivers. Unfortunatelly, I don't have any board with older SoC for testing.

While I took Rockchip HDMI code for reference, it can't be easily reused. First of, it uses DT nodes. I guess I could write DT binding or modify existing driver to work without it. Second issue here is same as in Linux, PHY code is tightly coupled with controller code, so it needs to be decoupled first. Thirdly, and in my opinion most annoying, Rockchip driver uses 32 bit aligned registers, but H3 does not. This also means a lot of work to make it more generic. Actually, H3 is more similar to i.MX6 HDMI in this regard, but driver's code is scattered throughout multiple files (search for mxc_hdmi.h inclusion). It is certainly doable, but it will take much more time. Basically, U-Boot already has two drivers for DWC HDMI and with this patch it will get third. Merging all three implementations into one would be very tedious, but very desirable goal. I must state that I didn't really try to understand i.MX6 HDMI code at all, so I don't now how hard it would be to pull it out.

By the way, did you get cover letter?

Best regards,
Jernej Skrabec

Quoted 8 lines

Thanks,
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#9 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

Hi,

Quoted 26 lines · Jernej ?krabec

Hi,

Quoted 15 lines · Maxime Ripard

Hi,

Quoted 12 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

Quoted 7 lines
Quoted 1 line

From the linux discussion, I recall that you said that the TCON was still the same, and the HDMI was something that could be shared with the Rockchip implementation. Did you look into sharing the TCON code (for example using a small "library" to share the functions) and to reuse Rockchip's HDMI code?

Quoted 5 lines

For now, I only reused one TCON function and some defines. I tought that split would be better done a bit later, when the driver will get support for LCD screens (A64, for example). At that time TCON code would also be refactored to be more generic and properly tested that it can be used with both drivers. Unfortunatelly, I don't have any board with older SoC for testing.

We can definitely do that. I think I have access to at least of board of each generation, so I can totally test whatever you come up with on those boards, and help you debugging whatever issue that might show up.

Quoted 3 lines

While I took Rockchip HDMI code for reference, it can't be easily reused. First of, it uses DT nodes. I guess I could write DT binding or modify existing driver to work without it.

Like we discussed in the other part of the thread, I think the latter would be easier to deal with.

Quoted 2 lines

Second issue here is same as in Linux, PHY code is tightly coupled with controller code, so it needs to be decoupled first.

But it would be easier to deal with than Linux I guess. Can't you just create a new weak function to initialise the phy? And then, every platform can just overwrite it.

Quoted 3 lines

Thirdly, and in my opinion most annoying, Rockchip driver uses 32 bit aligned registers, but H3 does not. This also means a lot of work to make it more generic.

How does Linux deal with that? Would just using some kind of accessors that would abstract that away from the driver help, or is it more complicated?

Quoted 8 lines

Actually, H3 is more similar to i.MX6 HDMI in this regard, but driver's code is scattered throughout multiple files (search for mxc_hdmi.h inclusion). It is certainly doable, but it will take much more time. Basically, U-Boot already has two drivers for DWC HDMI and with this patch it will get third. Merging all three implementations into one would be very tedious, but very desirable goal. I must state that I didn't really try to understand i.MX6 HDMI code at all, so I don't now how hard it would be to pull it out.

I'm not sure that merging a third and saying that it would be up to the fourth to do the work is reasonable. It's just hiding an issue under the carpet, but I don't see how it will be easier for the next person to work on that. Quite the opposite actually.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161214/35119fe3/attachment.sig>
#10 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

Hi,

Quoted 39 lines · Maxime Ripard

Hi,

Quoted 26 lines · Jernej ?krabec

Hi,

Quoted 15 lines · Maxime Ripard

Hi,

Quoted 12 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

First it checks if monitor is attached. If it is, recommended timings are read from EDID. After that, DE2, TCON and HDMI are configured according to this timings.

32MB of RAM is used for framebuffer. This is just enough to support 4K resolution.

SimpleFB is also supported by this driver.

Quoted 7 lines
Quoted 1 line

From the linux discussion, I recall that you said that the TCON was still the same, and the HDMI was something that could be shared with the Rockchip implementation. Did you look into sharing the TCON code (for example using a small "library" to share the functions) and to reuse Rockchip's HDMI code?

Quoted 6 lines

For now, I only reused one TCON function and some defines. I tought that split would be better done a bit later, when the driver will get support for LCD screens (A64, for example). At that time TCON code would also be refactored to be more generic and properly tested that it can be used with both drivers. Unfortunatelly, I don't have any board with older SoC for testing.

We can definitely do that. I think I have access to at least of board of each generation, so I can totally test whatever you come up with on those boards, and help you debugging whatever issue that might show up.

Quoted 6 lines
Quoted 3 lines

While I took Rockchip HDMI code for reference, it can't be easily reused. First of, it uses DT nodes. I guess I could write DT binding or modify existing driver to work without it.

Like we discussed in the other part of the thread, I think the latter would be easier to deal with.

I forgot to mention that it also uses driver model. The way I would go with this is to split out common code to dwc_hdmi.c and have platform dependant drivers for Rockchip, Allwinner, etc. Basically the same way as it is done in Linux.

Quoted 7 lines
Quoted 3 lines

Second issue here is same as in Linux, PHY code is tightly coupled with controller code, so it needs to be decoupled first.

But it would be easier to deal with than Linux I guess. Can't you just create a new weak function to initialise the phy? And then, every platform can just overwrite it.

PHY functions are relatively self contained (~3 of them). If I develop my idea with shared code further, I could make phy_init() function weak and other two functions just public. Rockchip driver will use them, H3 won't. They will come handy for A83T and A80 HDMI driver, which uses DWC HDMI PHY. Well, phy_init() function needs to be further generalized (mpll table used in phy_init() is SoC specific), but I guess we will worry about that later.

Quoted 8 lines
Quoted 4 lines

Thirdly, and in my opinion most annoying, Rockchip driver uses 32 bit aligned registers, but H3 does not. This also means a lot of work to make it more generic.

How does Linux deal with that? Would just using some kind of accessors that would abstract that away from the driver help, or is it more complicated?

Yes, Linux driver checks "reg-io-width" property and selects accessors accordingly. I suppose I could do similar, save function pointer in a driver private data. I suppose it is ok that platform specific code initializes this private data?

Quoted 10 lines
Quoted 9 lines

Actually, H3 is more similar to i.MX6 HDMI in this regard, but driver's code is scattered throughout multiple files (search for mxc_hdmi.h inclusion). It is certainly doable, but it will take much more time. Basically, U-Boot already has two drivers for DWC HDMI and with this patch it will get third. Merging all three implementations into one would be very tedious, but very desirable goal. I must state that I didn't really try to understand i.MX6 HDMI code at all, so I don't now how hard it would be to pull it out.

Quoted 4 lines

I'm not sure that merging a third and saying that it would be up to the fourth to do the work is reasonable. It's just hiding an issue under the carpet, but I don't see how it will be easier for the next person to work on that. Quite the opposite actually.

True. I wonder if Renesas already prepared U-Boot DWC HDMI driver...

Do you think it makes sense to put all files related to Allwinner video drivers to sunxi subfolder? There will be at least 4 .c files according to my plan and even more in the future (at least for TV out driver).

Best regards,
Jernej ?krabec

Quoted 7 lines

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#11 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

Hi,

Quoted 11 lines · Jernej ?krabec
Quoted 6 lines
Quoted 3 lines

While I took Rockchip HDMI code for reference, it can't be easily reused. First of, it uses DT nodes. I guess I could write DT binding or modify existing driver to work without it.

Like we discussed in the other part of the thread, I think the latter would be easier to deal with.

I forgot to mention that it also uses driver model. The way I would go with this is to split out common code to dwc_hdmi.c and have platform dependant drivers for Rockchip, Allwinner, etc. Basically the same way as it is done in Linux.

That sounds reasonable.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Thirdly, and in my opinion most annoying, Rockchip driver uses 32 bit aligned registers, but H3 does not. This also means a lot of work to make it more generic.

Quoted 8 lines
Quoted 3 lines

How does Linux deal with that? Would just using some kind of accessors that would abstract that away from the driver help, or is it more complicated?

Yes, Linux driver checks "reg-io-width" property and selects accessors accordingly. I suppose I could do similar, save function pointer in a driver private data. I suppose it is ok that platform specific code initializes this private data?

Something like passing a flag stored in the platform data (and/or read from DT for the relevant cases) to a generic accessor would also be a solution, without the need for everyone to implement its accessors.

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines

Actually, H3 is more similar to i.MX6 HDMI in this regard, but driver's code is scattered throughout multiple files (search for mxc_hdmi.h inclusion). It is certainly doable, but it will take much more time. Basically, U-Boot already has two drivers for DWC HDMI and with this patch it will get third. Merging all three implementations into one would be very tedious, but very desirable goal. I must state that I didn't really try to understand i.MX6 HDMI code at all, so I don't now how hard it would be to pull it out.

Quoted 4 lines

I'm not sure that merging a third and saying that it would be up to the fourth to do the work is reasonable. It's just hiding an issue under the carpet, but I don't see how it will be easier for the next person to work on that. Quite the opposite actually.

Quoted 6 lines

True. I wonder if Renesas already prepared U-Boot DWC HDMI driver...

Do you think it makes sense to put all files related to Allwinner video drivers to sunxi subfolder? There will be at least 4 .c files according to my plan and even more in the future (at least for TV out driver).

On principle, I don't see anything wrong with that.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161219/09aefe0a/attachment.sig>
#12 lore raw

RFC PATCH 2/3 sunxi: video: Add video driver for H3 SoC

In reply to Jernej Skrabec
Quoted 2 lines · Jernej Skrabec

This patch adds support for hdmi output. It is designed in the same way as video driver for older Allwinner SoCs.

[...]

Quoted 5 lines
drivers/video/sunxi_display2.c new file +0 -0
new file mode 100644
index 0000000..db376d9

[...]

drivers/video/sunxi_display2.c line 999

Quoted 1 line
drivers/video/sunxi_display2.c new file +1 -0
+	/* Find a prefilled simpefb node, matching out pipeline config */

s/out/our/ I guess.

Signature · 1 line
Rask Ingemann Lambertsen
#13 lore raw

RFC PATCH 3/3 sunxi: Enable H3 video driver in defconfigs

In reply to Jernej Skrabec

---

 configs/orangepi_2_defconfig       | 1 +
 configs/orangepi_lite_defconfig    | 1 +
 configs/orangepi_one_defconfig     | 1 +
 configs/orangepi_pc_defconfig      | 1 +
 configs/orangepi_pc_plus_defconfig | 1 +
 configs/orangepi_plus2e_defconfig  | 1 +
 configs/orangepi_plus_defconfig    | 1 +
 7 files changed, 7 insertions(+)
configs/orangepi_2_defconfig +1 -0
index 4727aca..dea819d 100644
@@ -16,3 +16,4 @@ CONFIG_SPL=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_lite_defconfig +1 -0
index 8545835..8801825 100644
@@ -12,3 +12,4 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_one_defconfig +1 -0
index 01b4ece..fc72a96 100644
@@ -13,3 +13,4 @@ CONFIG_SPL=y
 # CONFIG_CMD_FPGA is not set
 CONFIG_SUN8I_EMAC=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_pc_defconfig +1 -0
index 910d68e..e0b579d 100644
@@ -15,3 +15,4 @@ CONFIG_SPL=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_pc_plus_defconfig +1 -0
index f43682b..9b8d407 100644
@@ -16,3 +16,4 @@ CONFIG_SPL=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_plus2e_defconfig +1 -0
index df05d37..0eb9466 100644
@@ -17,3 +17,4 @@ CONFIG_SPL=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
configs/orangepi_plus_defconfig +1 -0
index bf88fef..c773ef2 100644
@@ -18,3 +18,4 @@ CONFIG_SPL=y
 CONFIG_SUN8I_EMAC=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_VIDEO=y
Signature · 1 line
2.10.2
#14 lore raw

cover sunxi: video: Add support for HDMI output on H3

In reply to Jernej Skrabec

Hi,

Quoted 9 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Quoted 41 lines

- TCON code is currently exactly the same as in driver for older SoCs. Should I split it out into shared module? Also TV out code seems to be similar, but I didn't manage to confirm that it works as-is on H3.
- A80 SoC is mix of older display engine and newer HDMI controller, so it doesn't really work with either of sunxi video drivers. Two solutions I see here are either combine both driver into one massive display driver or, much better, split everything by components (TCON/DE/DE2/HDMI/TV) and instantiate compatible ones. I guess this is not much different than adding support for DT in drivers. Note that I don't have any A80 board, I'm just thinking ahead.

Best regards,
Jernej Skrabec

Jernej Skrabec (3):
sunxi: Add clocks for DE2/HDMI/TCON
sunxi: video: Add video driver for H3 SoC
sunxi: Enable H3 video driver in defconfigs

 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |   43 +
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h   |    8 +
 arch/arm/include/asm/arch-sunxi/display2.h    |  377 +++++++++
 arch/arm/mach-sunxi/clock_sun6i.c             |   28 +
 board/sunxi/Kconfig                           |    4 +-
 configs/orangepi_2_defconfig                  |    1 +
 configs/orangepi_lite_defconfig               |    1 +
 configs/orangepi_one_defconfig                |    1 +
 configs/orangepi_pc_defconfig                 |    1 +
 configs/orangepi_pc_plus_defconfig            |    1 +
 configs/orangepi_plus2e_defconfig             |    1 +
 configs/orangepi_plus_defconfig               |    1 +
 drivers/video/Makefile                        |    1 +
 drivers/video/sunxi_display2.c                | 1037 +++++++++++++++++++++++++
 include/configs/sunxi-common.h                |   17 +-
 scripts/config_whitelist.txt                  |    1 +
 16 files changed, 1516 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/display2.h
 create mode 100644 drivers/video/sunxi_display2.c
Quoted 3 lines

--
2.10.2

Regards,
Simon

#15 lore raw

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 9 lines · Jernej Skrabec

?This patch series add support for HDMI output. Support for other, ?newer, SoCs, which also uses DE2 and same or similar HDMI controller ?and PHY can be easily added later (A83T/A64/H5/R40). Current driver ?can also be easily extended with TV out support, just like video ?driver for older Allwinner SoCs.

?While driver works, I would like to get few opinions first. ?- From what I understand, drivers which supports DT are preferred. ???Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

Quoted 51 lines
Quoted 41 lines

?- TCON code is currently exactly the same as in driver for older ???SoCs. Should I split it out into shared module? Also TV out code ???seems to be similar, but I didn't manage to confirm that it works ???as-is on H3.
?- A80 SoC is mix of older display engine and newer HDMI controller, ???so it doesn't really work with either of sunxi video drivers. Two ???solutions I see here are either combine both driver into one massive ???display driver or, much better, split everything by components ???(TCON/DE/DE2/HDMI/TV) and instantiate compatible ones. I guess this ???is not much different than adding support for DT in drivers. Note ???that I don't have any A80 board, I'm just thinking ahead.

?Best regards,
?Jernej Skrabec

?Jernej Skrabec (3):
???sunxi: Add clocks for DE2/HDMI/TCON
???sunxi: video: Add video driver for H3 SoC
???sunxi: Enable H3 video driver in defconfigs

??arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43 + ??arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 8 + ??arch/arm/include/asm/arch-sunxi/display2.h | 377 +++++++++ ??arch/arm/mach-sunxi/clock_sun6i.c | 28 + ??board/sunxi/Kconfig | 4 +- ??configs/orangepi_2_defconfig | 1 + ??configs/orangepi_lite_defconfig | 1 + ??configs/orangepi_one_defconfig | 1 + ??configs/orangepi_pc_defconfig | 1 + ??configs/orangepi_pc_plus_defconfig | 1 + ??configs/orangepi_plus2e_defconfig | 1 + ??configs/orangepi_plus_defconfig | 1 + ??drivers/video/Makefile | 1 + ??drivers/video/sunxi_display2.c | 1037 +++++++++++++++++++++++++ ??include/configs/sunxi-common.h | 17 +- ??scripts/config_whitelist.txt | 1 +
??16 files changed, 1516 insertions(+), 7 deletions(-) ??create mode 100644 arch/arm/include/asm/arch-sunxi/display2.h ??create mode 100644 drivers/video/sunxi_display2.c

Quoted 2 lines

?--
?2.10.2

Regards,
Simon

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.

#16 lore raw
Quoted 27 lines · Icenowy Zheng

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 9 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Quoted 6 lines

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

We're going to use EFI now? Doesn't EFI mean we have to leave another bit of firmware in memory running under the OS? What about PSCI and ATF on ARMv8?

ChenYu

Quoted 57 lines
Quoted 45 lines
Quoted 39 lines

- TCON code is currently exactly the same as in driver for older SoCs. Should I split it out into shared module? Also TV out code seems to be similar, but I didn't manage to confirm that it works as-is on H3.
- A80 SoC is mix of older display engine and newer HDMI controller, so it doesn't really work with either of sunxi video drivers. Two solutions I see here are either combine both driver into one massive display driver or, much better, split everything by components (TCON/DE/DE2/HDMI/TV) and instantiate compatible ones. I guess this is not much different than adding support for DT in drivers. Note that I don't have any A80 board, I'm just thinking ahead.

Best regards,
Jernej Skrabec

Jernej Skrabec (3):
sunxi: Add clocks for DE2/HDMI/TCON
sunxi: video: Add video driver for H3 SoC
sunxi: Enable H3 video driver in defconfigs

  arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 43 +
  arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 8 +
  arch/arm/include/asm/arch-sunxi/display2.h | 377 +++++++++
  arch/arm/mach-sunxi/clock_sun6i.c | 28 +
  board/sunxi/Kconfig | 4 +-
  configs/orangepi_2_defconfig | 1 +
  configs/orangepi_lite_defconfig | 1 +
  configs/orangepi_one_defconfig | 1 +
  configs/orangepi_pc_defconfig | 1 +
  configs/orangepi_pc_plus_defconfig | 1 +
  configs/orangepi_plus2e_defconfig | 1 +
  configs/orangepi_plus_defconfig | 1 +
  drivers/video/Makefile | 1 +
  drivers/video/sunxi_display2.c | 1037 +++++++++++++++++++++++++
  include/configs/sunxi-common.h | 17 +-
  scripts/config_whitelist.txt | 1 +
  16 files changed, 1516 insertions(+), 7 deletions(-)
Quoted 5 lines

create mode 100644 arch/arm/include/asm/arch-sunxi/display2.h create mode 100644 drivers/video/sunxi_display2.c

--
2.10.2

Quoted 7 lines

Regards,
Simon

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.

#17 lore raw
Quoted 31 lines · Chen-Yu Tsai
Quoted 30 lines · Icenowy Zheng

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 9 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

Quoted 7 lines
Quoted 3 lines

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

We're going to use EFI now? Doesn't EFI mean we have to leave another bit of firmware in memory running under the OS? What about PSCI and ATF on ARMv8?

Until EFI on A64 on U-boot is a real thing, I don't really care to be honest.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161214/d98973bc/attachment.sig>
#18 lore raw
Quoted 40 lines

Am 14.12.2016 um 11:25 schrieb Maxime Ripard <[email protected]>:

Quoted 36 lines · Chen-Yu Tsai
Quoted 34 lines · Icenowy Zheng

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 10 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

Quoted 6 lines
Quoted 3 lines

We're going to use EFI now? Doesn't EFI mean we have to leave another bit of firmware in memory running under the OS? What about PSCI and ATF on ARMv8?

Until EFI on A64 on U-boot is a real thing, I don't really care to be honest.

How is it not a real thing today?

Alex

#19 lore raw
Quoted 44 lines · On Wed, 14 Dec 2016 11:37:38 +0200 Alexander Graf <[email protected]> wrote:
Quoted 44 lines

Am 14.12.2016 um 11:25 schrieb Maxime Ripard <[email protected]>:

Quoted 39 lines · Chen-Yu Tsai
Quoted 28 lines · Icenowy Zheng

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 10 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Quoted 6 lines

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

We're going to use EFI now? Doesn't EFI mean we have to leave another bit of firmware in memory running under the OS? What about PSCI and ATF on ARMv8?

Quoted 6 lines
Quoted 2 lines

Until EFI on A64 on U-boot is a real thing, I don't really care to be honest.

How is it not a real thing today?

Alex

We are using it on FreeBSD for Pine64 so it seems pretty real for me.

Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
#20 lore raw
In reply to Alexander Graf

Hi,

Quoted 40 lines · Alexander Graf
Quoted 40 lines

Am 14.12.2016 um 11:25 schrieb Maxime Ripard <[email protected]>:

Quoted 36 lines · Chen-Yu Tsai
Quoted 34 lines · Icenowy Zheng

14.12.2016, 04:29, "Simon Glass" <[email protected]>:

Quoted 15 lines

Hi,

Quoted 10 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

Yes, I think go to Driver Model is also valuable, as Allwinner's display parts are really in reusable components.

In addition, Driver Model provides the possibility to use EFI GOP, which can be a more standardized replacement of SimpleFB, especially for OSes other than Linux. (For example, Windows, if we can really get it running ;-) )

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

We're going to use EFI now? Doesn't EFI mean we have to leave another bit of firmware in memory running under the OS? What about PSCI and ATF on ARMv8?

Until EFI on A64 on U-boot is a real thing, I don't really care to be honest.

How is it not a real thing today?

Sorry, I missed it...

But still, the point remains. If it needs the DT and the device model to be enabled and working properly, since that's not a feature that worked before (on the previous SoC), I don't see why we should hold it off. If and when someone is interested, and if and when we have a DT bindings in Linux, then we will take care of this.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161220/88d5449f/attachment.sig>
#21 lore raw

cover sunxi: video: Add support for HDMI output on H3

In reply to Simon Glass

Hi,

Quoted 15 lines · Simon Glass

Hi,

Quoted 9 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

I'm all in favor of moving to the driver-model, but I believe that we first need proper support for the DE2 and new HMDI encoder in the kernel, so that the dt bindings are clear.

Once that is in place it would be good to look into converting the u-boot code to the driver-model. Since that likely is going to take a while I think it would be good to move ahead with this patch set as is (with review comments addressed) and later replace it with a driver-model based implementation. But that is no longer my call :)

Regards,

Hans

#22 lore raw

cover sunxi: video: Add support for HDMI output on H3

Quoted 24 lines · Hans de Goede

Hi,

Quoted 21 lines · Simon Glass

Hi,

Quoted 9 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

Quoted 6 lines
Quoted 2 lines

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

I'm all in favor of moving to the driver-model, but I believe that we first need proper support for the DE2 and new HMDI encoder in the kernel, so that the dt bindings are clear.

I agree, and I would even say that we shouldn't wait for that to happen either. I don't have any objection merging it without the driver model given how much time it took last time to have a driver merged in the kernel for that block (with its bindings), and then convert to the device model / DT once and when we have that.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161214/2298c767/attachment.sig>
#23 lore raw

cover sunxi: video: Add support for HDMI output on H3

In reply to Hans de Goede

Hi,

Quoted 36 lines · Hans de Goede

Hi,

Quoted 19 lines · Simon Glass

Hi,

Quoted 10 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?

Yes I think so, and in fact it should use driver model also.

Quoted 8 lines

The rockchip driver provides a reasonable example of how to split the driver up as you suggest below. The VIDEO driver provides the top-level video interface, DISPLAY drivers provide display output for the video, and you have PANEL as well for receiving the display output. VIDCONSOLE works automatically to display text.

I actually took a bit of a look at this a few weeks ago so am happy to help with review or discussions.

I'm all in favor of moving to the driver-model, but I believe that we first need proper support for the DE2 and new HMDI encoder in the kernel, so that the dt bindings are clear.

Quoted 6 lines

Once that is in place it would be good to look into converting the u-boot code to the driver-model. Since that likely is going to take a while I think it would be good to move ahead with this patch set as is (with review comments addressed) and later replace it with a driver-model based implementation. But that is no longer my call :)

We can disconnect DT from driver model without too much trouble. But I do worry about adding more code to what is there. I think it would be better to tease apart things into separate files for each block. At least the display driver could converted to driver model (UCLASS_VIDEO) since FWICT it has a compatible string in the kernel. Even if there is nothing else, that is enough to cause the driver to be probed.

Then it is easier to build on. If we go further down the non-DM path it will become infeasible to re-architect later.

So my suggestion is:

- Create a UCLASS_VIDEO driver and put some of the code in that
- Create UCLASS_DISPLAY drivers for the HDMI, LCD, etc. and move that code into a separate file for each
- Use manual probing or whatever to make it work for now. In other words, instead of doing things entirely with the DT as rockchip and tegra do, find the display devices manually / hard coded for now.

Then when DT is sorted out it will be relatively easy to adjust things
without wholesale rewrites.

So please let's not wait for DT bindings. It is just going to create too much tech debt for any one person to fix.

Regards,
Simon

#24 lore raw

cover sunxi: video: Add support for HDMI output on H3

In reply to Jernej Skrabec
Quoted 6 lines · Jernej Skrabec

This patch series add support for HDMI output. Support for other, newer, SoCs, which also uses DE2 and same or similar HDMI controller and PHY can be easily added later (A83T/A64/H5/R40). Current driver can also be easily extended with TV out support, just like video driver for older Allwinner SoCs.

Quoted 14 lines

While driver works, I would like to get few opinions first.
- From what I understand, drivers which supports DT are preferred. Would it be better to rewrite this driver to support device tree?
- TCON code is currently exactly the same as in driver for older SoCs. Should I split it out into shared module? Also TV out code seems to be similar, but I didn't manage to confirm that it works as-is on H3.
- A80 SoC is mix of older display engine and newer HDMI controller, so it doesn't really work with either of sunxi video drivers. Two solutions I see here are either combine both driver into one massive display driver or, much better, split everything by components (TCON/DE/DE2/HDMI/TV) and instantiate compatible ones. I guess this is not much different than adding support for DT in drivers. Note that I don't have any A80 board, I'm just thinking ahead.

I have an A80 board with HDMI connector, so I can help with testing.

Is there anywhere a list of which components are the same between Allwinner's SoCs? If not, I'll also accept pointers to pieces of information I can use to start a page on the wiki about it. How about the order in which the SoCs where released?

Signature · 1 line
Rask Ingemann Lambertsen