Skip to contentSkip to conversation

drm/sun4i: Support first display pipeline on sun6i

PATCH Applied Chen-Yu Tsai 4 participants 19 messages Oct 6, 2016 – Oct 11, 2016 1 message not in the archive

Subsystems (5)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm/sun4i: Support first display pipeline on sun6i

Hi everyone,

This series adds support for the first display pipeline found on the A31 and A31s SoCs, with output through the RGB LCD interface.

This has been tested on the Sinlinx SinA31s development board, with its included 7" LCD panel (see last patch), and the Merrii Hummingbird A31 development board, with its RGB-VGA bridge using Maxime's dumb VGA bridge patches. The Hummingbird A31 patches will be sent once Maxime's patches are merged.

The last patch is only included for completeness. The LCD panel is not exactly supported, and Maxime's previous attempt to add it was postponed pending discussion.

Regards
ChenYu

Chen-Yu Tsai (9):
drm/sun4i: sun6i-drc: Support DRC on A31 and A31s drm/sun4i: tcon: Move SoC specific quirks to a DT matched data
structure
drm/sun4i: Put dotclock range into tcon quirks and check against them drm/sun4i: Add compatible string for A31/A31s TCON (timing controller) drm/sun4i: Add compatible strings for A31/A31s display pipelines
ARM: dts: sun6i: Sort pinmux setting nodes
ARM: dts: sun6i: Add device nodes for first display pipeline
ARM: dts: sun6i: Add A31 LCD0 RGB888 pins
[DO NOT MERGE] ARM: dts: sun6i: Enable 7" LCD panel on Sinlinx SinA31s

 .../bindings/display/sunxi/sun4i-drm.txt           |  10 +-
 arch/arm/boot/dts/sun6i-a31.dtsi                   | 247 +++++++++++++++++----
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts           |  30 +++
 arch/arm/boot/dts/sun6i-a31s.dtsi                  |   8 +
 drivers/gpu/drm/sun4i/sun4i_backend.c              |   1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c                  |   5 +
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   8 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 |  54 +++--
 drivers/gpu/drm/sun4i/sun4i_tcon.h                 |  16 +-
 drivers/gpu/drm/sun4i/sun6i_drc.c                  |   2 +
 10 files changed, 313 insertions(+), 68 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/9 drm/sun4i: sun6i-drc: Support DRC on A31 and A31s

The A31 and A31s also have the DRC as part of the display pipeline. As we know virtually nothing about them, just add compatible strings for both SoCs to the stub driver.

---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 2 ++
 drivers/gpu/drm/sun4i/sun6i_drc.c                             | 2 ++
 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +2 -0
index b95696d748c7..5368961cd727 100644
@@ -64,6 +64,8 @@ adaptive backlight control.
 
 Required properties:
   - compatible: value must be one of:
+    * allwinner,sun6i-a31-drc
+    * allwinner,sun6i-a31s-drc
     * allwinner,sun8i-a33-drc
   - reg: base address and size of the memory-mapped region.
   - interrupts: interrupt associated to this IP
drivers/gpu/drm/sun4i/sun6i_drc.c +2 -0
index bf6d846d8132..6ef707c5a719 100644
@@ -98,6 +98,8 @@ static int sun6i_drc_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id sun6i_drc_of_table[] = {
+	{ .compatible = "allwinner,sun6i-a31-drc" },
+	{ .compatible = "allwinner,sun6i-a31s-drc" },
 	{ .compatible = "allwinner,sun8i-a33-drc" },
 	{ }
 };
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/9 drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure

In reply to Chen-Yu Tsai

We already have some differences between the 2 supported SoCs. More will be added as we support other SoCs. To avoid bloating the probe function with even more conditionals, move the quirks to a separate data structure that's tied to the compatible string.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 35 ++++++++++++++++++++---------------
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 13 +++++++++----
 2 files changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +20 -15
index cadacb517f95..c6c1c7ce94a1 100644
@@ -20,6 +20,7 @@
 #include <linux/component.h>
 #include <linux/ioport.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/of_irq.h>
 #include <linux/regmap.h>
@@ -62,7 +63,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 		return;
 	}
 
-	WARN_ON(!tcon->has_channel_1);
+	WARN_ON(!tcon->quirks->has_channel_1);
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE, 0);
 	clk_disable_unprepare(tcon->sclk1);
@@ -80,7 +81,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 		return;
 	}
 
-	WARN_ON(!tcon->has_channel_1);
+	WARN_ON(!tcon->quirks->has_channel_1);
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE,
 			   SUN4I_TCON1_CTL_TCON_ENABLE);
@@ -202,7 +203,7 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	u8 clk_delay;
 	u32 val;
 
-	WARN_ON(!tcon->has_channel_1);
+	WARN_ON(!tcon->quirks->has_channel_1);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -266,7 +267,7 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	/*
 	 * FIXME: Undocumented bits
 	 */
-	if (tcon->has_mux)
+	if (tcon->quirks->is_sun5i)
 		regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
 }
 EXPORT_SYMBOL(sun4i_tcon1_mode_set);
@@ -327,7 +328,7 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 		return PTR_ERR(tcon->sclk0);
 	}
 
-	if (tcon->has_channel_1) {
+	if (tcon->quirks->has_channel_1) {
 		tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
 		if (IS_ERR(tcon->sclk1)) {
 			dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
@@ -487,14 +488,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	drv->tcon = tcon;
 	tcon->drm = drm;
 	tcon->dev = dev;
-
-	if (of_device_is_compatible(dev->of_node, "allwinner,sun5i-a13-tcon")) {
-		tcon->has_mux = true;
-		tcon->has_channel_1 = true;
-	} else {
-		tcon->has_mux = false;
-		tcon->has_channel_1 = false;
-	}
+	tcon->quirks = of_device_get_match_data(dev);
 
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
@@ -588,9 +582,20 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 	return 0;
 }
 
+const struct sun4i_tcon_quirks sun5i_a13_quirks = {
+	.is_sun5i	= true,
+	.has_channel_1	= true,
+	.has_bypass_src	= true,
+	.has_dma_src	= true,
+};
+
+const struct sun4i_tcon_quirks sun8i_a33_quirks = {
+	/* nothing is supported */
+};
+
 static const struct of_device_id sun4i_tcon_of_table[] = {
-	{ .compatible = "allwinner,sun5i-a13-tcon" },
-	{ .compatible = "allwinner,sun8i-a33-tcon" },
+	{ .compatible = "allwinner,sun5i-a13-tcon", .data = &sun5i_a13_quirks },
+	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
drivers/gpu/drm/sun4i/sun4i_tcon.h +9 -4
index 12bd48925f4d..96c4f15c6922 100644
@@ -142,6 +142,13 @@
 
 #define SUN4I_TCON_MAX_CHANNELS		2
 
+struct sun4i_tcon_quirks {
+	bool	is_sun5i;	/* sun5i has undocumented mux */
+	bool	has_channel_1;	/* a33 does not have channel 1 */
+	bool	has_bypass_src;	/* has separate input bypassing CEU */
+	bool	has_dma_src;	/* has DMA input */
+};
+
 struct sun4i_tcon {
 	struct device			*dev;
 	struct drm_device		*drm;
@@ -160,12 +167,10 @@ struct sun4i_tcon {
 	/* Reset control */
 	struct reset_control		*lcd_rst;
 
-	/* Platform adjustments */
-	bool				has_mux;
-
 	struct drm_panel		*panel;
 
-	bool				has_channel_1;
+	/* Platform adjustments */
+	const struct sun4i_tcon_quirks	*quirks;
 };
 
 struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH 3/9 drm/sun4i: Put dotclock range into tcon quirks and check against them

In reply to Chen-Yu Tsai

In commit bb43d40d7c83 ("drm/sun4i: rgb: Validate the clock rate") the driver was rounding the requested clock rate and then checking the result against the original requested rate.

This does not work well for a number of reasons:

- The pixel clock does not have enough resolution to be able to provide all sub-MHz clock rates. This makes it filter out most modes found in simple-panel.

- When first introduced, the main limiting factors were the video PLL clock range (27 ~ 381 MHz) and the lowest divider (6). On sun6i and later, the valid PLL clock range is extended to 30 ~ 600 MHz. The PLL's multiplier and divider can make it go much higher out of range, but the clock driver currently has no checks for it.

Since the limits are well known, we can hard code the range into the tcon driver, and check against them. And we really only care about the upper limit, which affects the highest resolutions we can support.

Fixes bb43d40d7c83 ("drm/sun4i: rgb: Validate the clock rate")
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c  | 8 +-------
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 ++
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/sun4i/sun4i_rgb.c +1 -7
index 8b520d9f5bd9..edbb42ead1f1 100644
@@ -60,8 +60,6 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector,
 	struct sun4i_tcon *tcon = drv->tcon;
 	u32 hsync = mode->hsync_end - mode->hsync_start;
 	u32 vsync = mode->vsync_end - mode->vsync_start;
-	unsigned long rate = mode->clock * 1000;
-	long rounded_rate;
 
 	DRM_DEBUG_DRIVER("Validating modes...\n");
 
@@ -93,11 +91,7 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector,
 
 	DRM_DEBUG_DRIVER("Vertical parameters OK\n");
 
-	rounded_rate = clk_round_rate(tcon->dclk, rate);
-	if (rounded_rate < rate)
-		return MODE_CLOCK_LOW;
-
-	if (rounded_rate > rate)
+	if (mode->clock > tcon->quirks->max_clock)
 		return MODE_CLOCK_HIGH;
 
 	DRM_DEBUG_DRIVER("Clock rate OK\n");
drivers/gpu/drm/sun4i/sun4i_tcon.c +2 -0
index c6c1c7ce94a1..5a5407193753 100644
@@ -583,6 +583,7 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 }
 
 const struct sun4i_tcon_quirks sun5i_a13_quirks = {
+	.max_clock	= 63500,
 	.is_sun5i	= true,
 	.has_channel_1	= true,
 	.has_bypass_src	= true,
@@ -590,6 +591,7 @@ const struct sun4i_tcon_quirks sun5i_a13_quirks = {
 };
 
 const struct sun4i_tcon_quirks sun8i_a33_quirks = {
+	.max_clock	= 200000,
 	/* nothing is supported */
 };
 
drivers/gpu/drm/sun4i/sun4i_tcon.h +1 -0
index 96c4f15c6922..972ca2b7c8c2 100644
@@ -143,6 +143,7 @@
 #define SUN4I_TCON_MAX_CHANNELS		2
 
 struct sun4i_tcon_quirks {
+	int	max_clock;	/* Highest possible dotclock in kHz */
 	bool	is_sun5i;	/* sun5i has undocumented mux */
 	bool	has_channel_1;	/* a33 does not have channel 1 */
 	bool	has_bypass_src;	/* has separate input bypassing CEU */
Signature · 1 line
2.9.3
#9 lore raw

PATCH 4/9 drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)

In reply to Chen-Yu Tsai

The A31 TCON has mux controls for how TCON outputs are routed to the HDMI and MIPI DSI blocks.

Since the A31s does not have MIPI DSI, it only has a mux for the HDMI controller input.

This patch only adds support for the compatible strings. Actual support for the mux controls should be added with HDMI and MIPI DSI support.

---
 .../devicetree/bindings/display/sunxi/sun4i-drm.txt     |  4 +++-
 drivers/gpu/drm/sun4i/sun4i_drv.c                       |  2 ++
 drivers/gpu/drm/sun4i/sun4i_tcon.c                      | 17 +++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.h                      |  2 ++
 4 files changed, 24 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +3 -1
index 5368961cd727..15fdca8909f2 100644
@@ -28,6 +28,8 @@ The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
 Required properties:
  - compatible: value must be either:
    * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
    * allwinner,sun8i-a33-tcon
  - reg: base address and size of memory-mapped region
  - interrupts: interrupt associated to this IP
@@ -50,7 +52,7 @@ Required properties:
   second the block connected to the TCON channel 1 (usually the TV
   encoder)
 
-On the A13, there is one more clock required:
+On SoCs other than the A33, there is one more clock required:
    - 'tcon-ch1': The clock driving the TCON channel 1
 
 DRC
drivers/gpu/drm/sun4i/sun4i_drv.c +2 -0
index c4d03c1b6db8..35af3728c4ee 100644
@@ -206,6 +206,8 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
+		of_device_is_compatible(node, "allwinner,sun6i-a31-tcon") ||
+		of_device_is_compatible(node, "allwinner,sun6i-a31s-tcon") ||
 		of_device_is_compatible(node, "allwinner,sun8i-a33-tcon");
 }
 
drivers/gpu/drm/sun4i/sun4i_tcon.c +17 -0
index 5a5407193753..745708f85ab6 100644
@@ -590,6 +590,21 @@ const struct sun4i_tcon_quirks sun5i_a13_quirks = {
 	.has_dma_src	= true,
 };
 
+const struct sun4i_tcon_quirks sun6i_a31_quirks = {
+	.max_clock	= 200000,
+	.has_channel_1	= true,
+	.has_dma_src	= true,
+	.has_hdmi_mux	= true,
+	.has_dsi_mux	= true,
+};
+
+const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
+	.max_clock	= 200000,
+	.has_channel_1	= true,
+	.has_dma_src	= true,
+	.has_hdmi_mux	= true,
+};
+
 const struct sun4i_tcon_quirks sun8i_a33_quirks = {
 	.max_clock	= 200000,
 	/* nothing is supported */
@@ -597,6 +612,8 @@ const struct sun4i_tcon_quirks sun8i_a33_quirks = {
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-tcon", .data = &sun5i_a13_quirks },
+	{ .compatible = "allwinner,sun6i-a31-tcon", .data = &sun6i_a31_quirks },
+	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ }
 };
drivers/gpu/drm/sun4i/sun4i_tcon.h +2 -0
index 972ca2b7c8c2..deebb97e9c3f 100644
@@ -148,6 +148,8 @@ struct sun4i_tcon_quirks {
 	bool	has_channel_1;	/* a33 does not have channel 1 */
 	bool	has_bypass_src;	/* has separate input bypassing CEU */
 	bool	has_dma_src;	/* has DMA input */
+	bool	has_hdmi_mux;	/* HDMI source selector */
+	bool	has_dsi_mux;	/* MIPI DSI source selector */
 };
 
 struct sun4i_tcon {
Signature · 1 line
2.9.3
#11 lore raw

PATCH 5/9 drm/sun4i: Add compatible strings for A31/A31s display pipelines

In reply to Chen-Yu Tsai

The A31's display pipeline has 2 frontends, 2 backends, and 2 TCONs. It also has new display enhancement blocks, such as the DRC (Dynamic Range Controller), the DEU (Display Enhancement Unit), and the CMU (Color Management Unit). It supports HDMI, MIPI DSI, and 2 LCD/LVDS channels.

The A31s display pipeline is almost the same, just without MIPI DSI. Only the TCON seems to be different, due to the missing mux for MIPI DSI.

Add compatible strings for both of them.

---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 4 ++++
 drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c                             | 3 +++
 3 files changed, 8 insertions(+)
Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +4 -0
index 15fdca8909f2..b82c00449468 100644
@@ -91,6 +91,7 @@ system.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-backend
+    * allwinner,sun6i-a31-display-backend
     * allwinner,sun8i-a33-display-backend
   - reg: base address and size of the memory-mapped region.
   - clocks: phandles to the clocks feeding the frontend and backend
@@ -121,6 +122,7 @@ deinterlacing and color space conversion.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-frontend
+    * allwinner,sun6i-a31-display-frontend
     * allwinner,sun8i-a33-display-frontend
   - reg: base address and size of the memory-mapped region.
   - interrupts: interrupt associated to this IP
@@ -146,6 +148,8 @@ extra node.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-engine
+    * allwinner,sun6i-a31-display-engine
+    * allwinner,sun6i-a31s-display-engine
     * allwinner,sun8i-a33-display-engine
 
   - allwinner,pipelines: list of phandle to the display engine
drivers/gpu/drm/sun4i/sun4i_backend.c +1 -0
index 32c0584e3c35..6e6c59a661b6 100644
@@ -408,6 +408,7 @@ static int sun4i_backend_remove(struct platform_device *pdev)
 
 static const struct of_device_id sun4i_backend_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-display-backend" },
+	{ .compatible = "allwinner,sun6i-a31-display-backend" },
 	{ .compatible = "allwinner,sun8i-a33-display-backend" },
 	{ }
 };
drivers/gpu/drm/sun4i/sun4i_drv.c +3 -0
index 35af3728c4ee..480a709cc324 100644
@@ -200,6 +200,7 @@ static const struct component_master_ops sun4i_drv_master_ops = {
 static bool sun4i_drv_node_is_frontend(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-display-frontend") ||
+		of_device_is_compatible(node, "allwinner,sun6i-a31-display-frontend") ||
 		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
@@ -323,6 +324,8 @@ static int sun4i_drv_remove(struct platform_device *pdev)
 
 static const struct of_device_id sun4i_drv_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-display-engine" },
+	{ .compatible = "allwinner,sun6i-a31-display-engine" },
+	{ .compatible = "allwinner,sun6i-a31s-display-engine" },
 	{ .compatible = "allwinner,sun8i-a33-display-engine" },
 	{ }
 };
Signature · 1 line
2.9.3
#13 lore raw

PATCH 6/9 ARM: dts: sun6i: Sort pinmux setting nodes

In reply to Chen-Yu Tsai

The pinmux setting nodes for the A31 were added out of alphabetical order. Sort them.

---
 arch/arm/boot/dts/sun6i-a31.dtsi | 82 ++++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 41 deletions(-)
arch/arm/boot/dts/sun6i-a31.dtsi +41 -41
index ce1960453a0b..c1b891e75f18 100644
@@ -434,13 +434,48 @@
 			#interrupt-cells = <3>;
 			#gpio-cells = <3>;
 
-			uart0_pins_a: uart0@0 {
-				allwinner,pins = "PH20", "PH21";
-				allwinner,function = "uart0";
+			gmac_pins_gmii_a: gmac_gmii@0 {
+				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
+						"PA4", "PA5", "PA6", "PA7",
+						"PA8", "PA9", "PA10", "PA11",
+						"PA12", "PA13", "PA14",	"PA15",
+						"PA16", "PA17", "PA18", "PA19",
+						"PA20", "PA21", "PA22", "PA23",
+						"PA24", "PA25", "PA26", "PA27";
+				allwinner,function = "gmac";
+				/*
+				 * data lines in GMII mode run at 125MHz and
+				 * might need a higher signal drive strength
+				 */
+				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			gmac_pins_mii_a: gmac_mii@0 {
+				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
+						"PA8", "PA9", "PA11",
+						"PA12", "PA13", "PA14", "PA19",
+						"PA20", "PA21", "PA22", "PA23",
+						"PA24", "PA26", "PA27";
+				allwinner,function = "gmac";
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
+			gmac_pins_rgmii_a: gmac_rgmii@0 {
+				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
+						"PA9", "PA10", "PA11",
+						"PA12", "PA13", "PA14", "PA19",
+						"PA20", "PA25", "PA26", "PA27";
+				allwinner,function = "gmac";
+				/*
+				 * data lines in RGMII mode use DDR mode
+				 * and need a higher signal drive strength
+				 */
+				allwinner,drive = <SUN4I_PINCTRL_40_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			i2c0_pins_a: i2c0@0 {
 				allwinner,pins = "PH14", "PH15";
 				allwinner,function = "i2c0";
@@ -506,47 +541,12 @@
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
-			gmac_pins_mii_a: gmac_mii@0 {
-				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
-						"PA8", "PA9", "PA11",
-						"PA12", "PA13", "PA14", "PA19",
-						"PA20", "PA21", "PA22", "PA23",
-						"PA24", "PA26", "PA27";
-				allwinner,function = "gmac";
+			uart0_pins_a: uart0@0 {
+				allwinner,pins = "PH20", "PH21";
+				allwinner,function = "uart0";
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
-
-			gmac_pins_gmii_a: gmac_gmii@0 {
-				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
-						"PA4", "PA5", "PA6", "PA7",
-						"PA8", "PA9", "PA10", "PA11",
-						"PA12", "PA13", "PA14",	"PA15",
-						"PA16", "PA17", "PA18", "PA19",
-						"PA20", "PA21", "PA22", "PA23",
-						"PA24", "PA25", "PA26", "PA27";
-				allwinner,function = "gmac";
-				/*
-				 * data lines in GMII mode run at 125MHz and
-				 * might need a higher signal drive strength
-				 */
-				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
-				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-			};
-
-			gmac_pins_rgmii_a: gmac_rgmii@0 {
-				allwinner,pins = "PA0", "PA1", "PA2", "PA3",
-						"PA9", "PA10", "PA11",
-						"PA12", "PA13", "PA14", "PA19",
-						"PA20", "PA25", "PA26", "PA27";
-				allwinner,function = "gmac";
-				/*
-				 * data lines in RGMII mode use DDR mode
-				 * and need a higher signal drive strength
-				 */
-				allwinner,drive = <SUN4I_PINCTRL_40_MA>;
-				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-			};
 		};
 
 		timer@01c20c00 {
Signature · 1 line
2.9.3
#15 lore raw

PATCH 7/9 ARM: dts: sun6i: Add device nodes for first display pipeline

In reply to Chen-Yu Tsai

The A31 has 2 parallel display pipelines, which can be intermixed. However the driver currently only supports one of them.

---
 arch/arm/boot/dts/sun6i-a31.dtsi  | 152 ++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/sun6i-a31s.dtsi |   8 ++
 2 files changed, 160 insertions(+)
arch/arm/boot/dts/sun6i-a31.dtsi +152 -0
index c1b891e75f18..4d2c7786b92a 100644
@@ -231,6 +231,11 @@
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun6i-a31-display-engine";
+		allwinner,pipelines = <&fe0>;
+	};
+
 	soc@01c00000 {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -246,6 +251,44 @@
 			#dma-cells = <1>;
 		};
 
+		tcon0: lcd-controller@01c0c000 {
+			compatible = "allwinner,sun6i-a31-tcon";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&ccu RST_AHB1_LCD0>;
+			reset-names = "lcd";
+			clocks = <&ccu CLK_AHB1_LCD0>,
+				 <&ccu CLK_LCD0_CH0>,
+				 <&ccu CLK_LCD0_CH1>;
+			clock-names = "ahb",
+				      "tcon-ch0",
+				      "tcon-ch1";
+			clock-output-names = "tcon0-pixel-clock";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon0_in_drc0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&drc0_out_tcon0>;
+					};
+				};
+
+				tcon0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+				};
+			};
+		};
+
 		mmc0: mmc@01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
@@ -799,6 +842,115 @@
 			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
 
+		fe0: display-frontend@01e00000 {
+			compatible = "allwinner,sun6i-a31-display-frontend";
+			reg = <0x01e00000 0x20000>;
+			interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_AHB1_FE0>, <&ccu CLK_FE0>,
+				 <&ccu CLK_DRAM_FE0>;
+			clock-names = "ahb", "mod",
+				      "ram";
+			resets = <&ccu RST_AHB1_FE0>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				fe0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					fe0_out_be0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&be0_in_fe0>;
+					};
+				};
+			};
+		};
+
+		be0: display-backend@01e60000 {
+			compatible = "allwinner,sun6i-a31-display-backend";
+			reg = <0x01e60000 0x10000>;
+			interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_AHB1_BE0>, <&ccu CLK_BE0>,
+				 <&ccu CLK_DRAM_BE0>;
+			clock-names = "ahb", "mod",
+				      "ram";
+			resets = <&ccu RST_AHB1_BE0>;
+
+			assigned-clocks = <&ccu CLK_BE0>;
+			assigned-clock-rates = <300000000>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				be0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					be0_in_fe0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&fe0_out_be0>;
+					};
+				};
+
+				be0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					be0_out_drc0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&drc0_in_be0>;
+					};
+				};
+			};
+		};
+
+		drc0: drc@01e70000 {
+			compatible = "allwinner,sun6i-a31-drc";
+			reg = <0x01e70000 0x10000>;
+			interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_AHB1_DRC0>, <&ccu CLK_IEP_DRC0>,
+				 <&ccu CLK_DRAM_DRC0>;
+			clock-names = "ahb", "mod",
+				      "ram";
+			resets = <&ccu RST_AHB1_DRC0>;
+
+			assigned-clocks = <&ccu CLK_IEP_DRC0>;
+			assigned-clock-rates = <300000000>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				drc0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					drc0_in_be0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&be0_out_drc0>;
+					};
+				};
+
+				drc0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					drc0_out_tcon0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon0_in_drc0>;
+					};
+				};
+			};
+		};
+
 		rtc: rtc@01f00000 {
 			compatible = "allwinner,sun6i-a31-rtc";
 			reg = <0x01f00000 0x54>;
arch/arm/boot/dts/sun6i-a31s.dtsi +8 -0
index c17a32771b98..97e2c51d0aea 100644
@@ -48,6 +48,14 @@
 
 #include "sun6i-a31.dtsi"
 
+&de {
+	compatible = "allwinner,sun6i-a31s-display-engine";
+};
+
 &pio {
 	compatible = "allwinner,sun6i-a31s-pinctrl";
 };
+
+&tcon0 {
+	compatible = "allwinner,sun6i-a31s-tcon";
+};
Signature · 1 line
2.9.3
#16 lore raw

PATCH 8/9 ARM: dts: sun6i: Add A31 LCD0 RGB888 pins

In reply to Chen-Yu Tsai

The LCD0 controller on the A31 can do RGB output up to 8 bits per channel. Add the pins for RGB888 output.

---
 arch/arm/boot/dts/sun6i-a31.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun6i-a31.dtsi +13 -0
index 4d2c7786b92a..2e8bf93dcfb2 100644
@@ -540,6 +540,19 @@
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
+			lcd0_rgb888_pins: lcd0_rgb888 {
+				allwinner,pins = "PD0", "PD1", "PD2", "PD3",
+						 "PD4", "PD5", "PD6", "PD7",
+						 "PD8", "PD9", "PD10", "PD11",
+						 "PD12", "PD13", "PD14", "PD15",
+						 "PD16", "PD17", "PD18", "PD19",
+						 "PD20", "PD21", "PD22", "PD23",
+						 "PD24", "PD25", "PD26", "PD27";
+				allwinner,function = "lcd0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			mmc0_pins_a: mmc0@0 {
 				allwinner,pins = "PF0", "PF1", "PF2",
 						 "PF3", "PF4", "PF5";
Signature · 1 line
2.9.3
#17 lore raw

PATCH 9/9 ARM: dts: sun6i: Enable 7" LCD panel on Sinlinx SinA31s

In reply to Chen-Yu Tsai

Sinlinx SinA31s comes with an optional 7" 1024x600 LCD panel with capacitive touch panel that bolts on to the board.

Enable the display using a panel with close timings. This patch is more of a proof of concept. The LCD panel has no markings whatsoever, and the timings are not exactly the same, and as a result the display produces glitch lines sometimes.

---
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/sun6i-a31s-sina31s.dts +30 -0
index 6ead2f5c847a..2d5cf8c9a12f 100644
@@ -63,6 +63,23 @@
 			gpios = <&pio 7 13 GPIO_ACTIVE_HIGH>; /* PH13 */
 		};
 	};
+
+	panel: panel {
+		compatible = "avic,tm070ddh03", "simple-panel";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			panel_input: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&tcon0_out_lcd>;
+			};
+		};
+	};
 };
 
 &ehci0 {
@@ -148,6 +165,19 @@
 	regulator-name = "vcc-gmac-phy";
 };
 
+&tcon0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&lcd0_rgb888_pins>;
+	status = "okay";
+};
+
+&tcon0_out {
+	tcon0_out_lcd: endpoint@0 {
+		reg = <0>;
+		remote-endpoint = <&panel_input>;
+	};
+};
+
 &usbphy {
 	status = "okay";
 };
Signature · 1 line
2.9.3
#19 lore raw

Re: [PATCH 9/9] [DO NOT MERGE] ARM: dts: sun6i: Enable 7" LCD panel on Sinlinx SinA31s

In reply to a message not in the archive

07.10.2016, 00:06, "Chen-Yu Tsai" <[email protected]>:

Quoted 7 lines

Sinlinx SinA31s comes with an optional 7" 1024x600 LCD panel with capacitive touch panel that bolts on to the board.

Enable the display using a panel with close timings. This patch is more of a proof of concept. The LCD panel has no markings whatsoever, and the timings are not exactly the same, and as a result the display produces glitch lines sometimes.

As you say, you can use the panel of SinA33...

Quoted 61 lines

---
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts | 30 ++++++++++++++++++++++++++++++

 1 file changed, 30 insertions(+)
arch/arm/boot/dts/sun6i-a31s-sina31s.dts +0 -0
index 6ead2f5c847a..2d5cf8c9a12f 100644
@@ -63,6 +63,23 @@

                         gpios = <&pio 7 13 GPIO_ACTIVE_HIGH>; /* PH13 */ };
         };

arch/arm/boot/dts/sun6i-a31s-sina31s.dts +17 -0
+
+ panel: panel {
+ compatible = "avic,tm070ddh03", "simple-panel";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ panel_input: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&tcon0_out_lcd>;
+ };
+ };
+ };

 };

 &ehci0 {

arch/arm/boot/dts/sun6i-a31s-sina31s.dts +13 -1
@@ -148,6 +165,19 @@
          regulator-name = "vcc-gmac-phy";
  };
 
+&tcon0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&lcd0_rgb888_pins>;
+ status = "okay";
+};
+
+&tcon0_out {
+ tcon0_out_lcd: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&panel_input>;
+ };
+};
+
  &usbphy {
          status = "okay";
  };
--

2.9.3

--
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-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.

Signature · 3 lines
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-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
#4 lore raw

Re: [PATCH 2/9] drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure

In reply to Chen-Yu Tsai

Hi,

drivers/gpu/drm/sun4i/sun4i_tcon.h line 151

Quoted 7 lines · Chen-Yu Tsai
drivers/gpu/drm/sun4i/sun4i_tcon.h +7 -0
+struct sun4i_tcon_quirks {
+	bool	is_sun5i;	/* sun5i has undocumented mux */
+	bool	has_channel_1;	/* a33 does not have channel 1 */
+	bool	has_bypass_src;	/* has separate input bypassing CEU */
+	bool	has_dma_src;	/* has DMA input */
+};
+

I'd really prefer to keep the has_mux quirk name. is_sun5i doesn't really relate to what we're doing there, is redundant with the compatible, and render the other quirks name useless, since we could just have is_sun.i quirks and deal with that (which is essentially what we were doing before).

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

Re: [PATCH 3/9] drm/sun4i: Put dotclock range into tcon quirks and check against them

In reply to Chen-Yu Tsai
Quoted 16 lines · Chen-Yu Tsai

In commit bb43d40d7c83 ("drm/sun4i: rgb: Validate the clock rate") the driver was rounding the requested clock rate and then checking the result against the original requested rate.

This does not work well for a number of reasons:

- The pixel clock does not have enough resolution to be able to provide all sub-MHz clock rates. This makes it filter out most modes found in simple-panel.

- When first introduced, the main limiting factors were the video PLL clock range (27 ~ 381 MHz) and the lowest divider (6). On sun6i and later, the valid PLL clock range is extended to 30 ~ 600 MHz. The PLL's multiplier and divider can make it go much higher out of range, but the clock driver currently has no checks for it.

Quoted 3 lines

Since the limits are well known, we can hard code the range into the tcon driver, and check against them. And we really only care about the upper limit, which affects the highest resolutions we can support.

We already discussed this, but this is really the wrong way to fix that issue.

clk_round_rate already gives you the maximum clock rate that can be handled in a generic and abstracted way, disregarding the current state of the clock driver.

However, the issue that you're trying to solve is that panels might have a pixel clock requirement that is not aligned on the resolution on the pixel clock we can generate.

And this can actually happen at any rate, you could very well have a display that requires a pixel clock of 63501kHz that you would reject, while using the 63,5 MHz clock rate would be just fine.

On the other hand, (totally made up example) some panel that requires a pixel clock of 43MHz, with a +- 1MHz tolerance, that we wouldn't be able to generate since we would only generate 41 or 45 MHz.

And on yet another hand, the panel might be requesting a pixel clock well below what we can generate, which is also something that we want to reject.

I can see two way of fixing this so far, the second being a solution if the first one fails:
- Look to a decent amount of panels and bridges datasheet to see what their usual tolerance on the pixel clock rate is, then use that to make a decision.
- If there's not really a common tolerance that we can find out, extend the panel and bridges API to be able for the panel to provide its tolerance on the timings, and make a function that we can call to see if a given rate is within boundaries.

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#10 lore raw

Re: [PATCH 4/9] drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)

In reply to Chen-Yu Tsai

Hi,

Quoted 8 lines · Chen-Yu Tsai

The A31 TCON has mux controls for how TCON outputs are routed to the HDMI and MIPI DSI blocks.

Since the A31s does not have MIPI DSI, it only has a mux for the HDMI controller input.

This patch only adds support for the compatible strings. Actual support for the mux controls should be added with HDMI and MIPI DSI support.

Then let's add those fields then, having dead code and useless variables is never a good option :)

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#14 lore raw

Re: [PATCH 6/9] ARM: dts: sun6i: Sort pinmux setting nodes

In reply to Chen-Yu Tsai
Quoted 4 lines · Chen-Yu Tsai

The pinmux setting nodes for the A31 were added out of alphabetical order. Sort them.

Applied, thanks!
Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
maintainer Acked-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] drm/sun4i: sun6i-drc: Support DRC on A31 and A31s

In reply to Chen-Yu Tsai
Quoted 9 lines · Chen-Yu Tsai

The A31 and A31s also have the DRC as part of the display pipeline. As we know virtually nothing about them, just add compatible strings for both SoCs to the stub driver.

---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 2 ++
 drivers/gpu/drm/sun4i/sun6i_drc.c                             | 2 ++
 2 files changed, 4 insertions(+)
maintainer Acked-by on v1 5/9
#12 lore raw

Re: [PATCH 5/9] drm/sun4i: Add compatible strings for A31/A31s display pipelines

In reply to Chen-Yu Tsai
Quoted 9 lines · Chen-Yu Tsai

The A31's display pipeline has 2 frontends, 2 backends, and 2 TCONs. It also has new display enhancement blocks, such as the DRC (Dynamic Range Controller), the DEU (Display Enhancement Unit), and the CMU (Color Management Unit). It supports HDMI, MIPI DSI, and 2 LCD/LVDS channels.

The A31s display pipeline is almost the same, just without MIPI DSI. Only the TCON seems to be different, due to the missing mux for MIPI DSI.

Quoted 8 lines

Add compatible strings for both of them.

---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 4 ++++
 drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c                             | 3 +++
 3 files changed, 8 insertions(+)
#5 lore raw

Re: [PATCH 2/9] drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure

In reply to Maxime Ripard
Quoted 16 lines · Maxime Ripard

Hi,

drivers/gpu/drm/sun4i/sun4i_tcon.h line 151

Quoted 7 lines · Chen-Yu Tsai
drivers/gpu/drm/sun4i/sun4i_tcon.h +7 -0
+struct sun4i_tcon_quirks {
+     bool    is_sun5i;       /* sun5i has undocumented mux */
+     bool    has_channel_1;  /* a33 does not have channel 1 */
+     bool    has_bypass_src; /* has separate input bypassing CEU */
+     bool    has_dma_src;    /* has DMA input */
+};
+

I'd really prefer to keep the has_mux quirk name. is_sun5i doesn't really relate to what we're doing there, is redundant with the compatible, and render the other quirks name useless, since we could just have is_sun.i quirks and deal with that (which is essentially what we were doing before).

Lets call it has_unknown_mux then. has_mux would be confusing with the HDMI and MIPI DSI muxes on sun6i.

ChenYu

#6 lore raw

Re: [PATCH 2/9] drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure

Quoted 19 lines · Chen-Yu Tsai
Quoted 16 lines · Maxime Ripard

Hi,

drivers/gpu/drm/sun4i/sun4i_tcon.h line 151

Quoted 7 lines · Chen-Yu Tsai
drivers/gpu/drm/sun4i/sun4i_tcon.h +7 -0
+struct sun4i_tcon_quirks {
+     bool    is_sun5i;       /* sun5i has undocumented mux */
+     bool    has_channel_1;  /* a33 does not have channel 1 */
+     bool    has_bypass_src; /* has separate input bypassing CEU */
+     bool    has_dma_src;    /* has DMA input */
+};
+

I'd really prefer to keep the has_mux quirk name. is_sun5i doesn't really relate to what we're doing there, is redundant with the compatible, and render the other quirks name useless, since we could just have is_sun.i quirks and deal with that (which is essentially what we were doing before).

Quoted 2 lines

Lets call it has_unknown_mux then. has_mux would be confusing with the HDMI and MIPI DSI muxes on sun6i.

That works for me.

Maxime

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