Skip to contentSkip to conversation

drm/sun4i: Allwinner R40 MIPI-DSI support

PATCH Applied Jagan Teki 2 participants 19 messages Dec 31, 2019 – Jan 4, 2020

Subsystems (7)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v3 cover drm/sun4i: Allwinner R40 MIPI-DSI support

This is v3 version for supporting MIPI-DSI on Allwinner R40 from initial version[1].

The controller look similar like, Allwinner A64 but with associated R40 TCON TOP for DSI pipeline.

Changes for v3:
- collect Rob, Chen-Yu r-b, a-b tags
- move tcon top reset control methods into probe
- rebase on drm-misc
Changes for v2:
- drop tcon top lcd clock patch
- add TODO text while adding tcon lcd support
- add patch for registering tcon top clock gates in probe
- change tcon-ch0 in tcon_lcd0 to CLK_TCON_LCD0
- change mod clock in dphy to tcon_top with index 3

[1] https://patchwork.freedesktop.org/series/62062/

Any inputs?
Jagan.

Jagan Teki (9):
dt-bindings: display: Add TCON LCD compatible for R40
drm/sun4i: tcon: Add TCON LCD support for R40
ARM: dts: sun8i: r40: Use tcon top clock index macros
drm/sun4i: tcon_top: Use clock name index macros
drm/sun4i: tcon_top: Register reset, clock gates in probe
dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)
dt-bindings: sun6i-dsi: Document R40 MIPI-DSI controller (w/ A64
fallback)
ARM: dts: sun8i: r40: Add MIPI DSI pipeline
[DO NOT MERGE] ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable Bananapi S070WV20-CT16

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml |  8 +-
 .../bindings/display/sunxi/sun4i-drm.txt      |  1 +
 .../phy/allwinner,sun6i-a31-mipi-dphy.yaml    |  1 +
 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  | 37 +++++++++
 arch/arm/boot/dts/sun8i-r40.dtsi              | 77 ++++++++++++++++++-
 drivers/gpu/drm/sun4i/sun4i_tcon.c            |  8 ++
 drivers/gpu/drm/sun4i/sun8i_tcon_top.c        | 50 ++++++------
 7 files changed, 154 insertions(+), 28 deletions(-)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH v3 1/9 dt-bindings: display: Add TCON LCD compatible for R40

Like TCON TV0, TV1 allwinner R40 has TCON LCD0, LCD1 which are managed via TCON TOP.

Add tcon lcd compatible R40, the same compatible can handle TCON LCD0, LCD1.

---
Changes for v3:
- none

 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +1 -0
index 31ab72cba3d4..9e9c7f934202 100644
@@ -160,6 +160,7 @@ Required properties:
    * allwinner,sun8i-a33-tcon
    * allwinner,sun8i-a83t-tcon-lcd
    * allwinner,sun8i-a83t-tcon-tv
+   * allwinner,sun8i-r40-tcon-lcd
    * allwinner,sun8i-r40-tcon-tv
    * allwinner,sun8i-v3s-tcon
    * allwinner,sun9i-a80-tcon-lcd
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH v3 2/9 drm/sun4i: tcon: Add TCON LCD support for R40

In reply to Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +8 -0
index fad72799b8df..69611d38c844 100644
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
 	.has_channel_1		= true,
 };
 
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+	.supports_lvds		= true,
+	.has_channel_0		= true,
+	/* TODO Need to support TCON output muxing via GPIO pins */
+	.set_mux		= sun8i_r40_tcon_tv_set_mux,
+};
+
 static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = {
 	.has_channel_1		= true,
 	.set_mux		= sun8i_r40_tcon_tv_set_mux,
@@ -1500,6 +1507,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = &sun8i_a83t_lcd_quirks },
 	{ .compatible = "allwinner,sun8i-a83t-tcon-tv", .data = &sun8i_a83t_tv_quirks },
+	{ .compatible = "allwinner,sun8i-r40-tcon-lcd", .data = &sun8i_r40_lcd_quirks },
 	{ .compatible = "allwinner,sun8i-r40-tcon-tv", .data = &sun8i_r40_tv_quirks },
 	{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
 	{ .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = &sun9i_a80_tcon_lcd_quirks },
Signature · 1 line
2.18.0.321.gffc6fa0e3
maintainer
#3 lore raw

Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

Quoted 21 lines · Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index fad72799b8df..69611d38c844 100644

drivers/gpu/drm/sun4i/sun4i_tcon.c static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { · line 1477

Quoted 8 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +5 -0
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
 	.has_channel_1		= true,
 };
 
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+	.supports_lvds		= true,
+	.has_channel_0		= true,
+	/* TODO Need to support TCON output muxing via GPIO pins */
+	.set_mux		= sun8i_r40_tcon_tv_set_mux,

What is this muking about? And why is it a TODO?

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#4 lore raw

Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index fad72799b8df..69611d38c844 100644
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
      .has_channel_1          = true,
 };
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { · line 1477

Quoted 5 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +5 -0
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+     .supports_lvds          = true,
+     .has_channel_0          = true,
+     /* TODO Need to support TCON output muxing via GPIO pins */
+     .set_mux                = sun8i_r40_tcon_tv_set_mux,

What is this muking about? And why is it a TODO?

Muxing similar like how TCON TOP handle TV0, TV1 I have reused the same so-that it would configure de port selection via sun8i_tcon_top_de_config

TCON output muxing have gpio with GPIOD and GPIOH bits, which select which of LCD or TV TCON outputs to the LCD function pins. I have marked these has TODO for further support as mentioned by Chen-Yu in v1[1].

[1] https://patchwork.freedesktop.org/patch/310210/?series=62062&rev=1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#5 lore raw

Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

Quoted 35 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index fad72799b8df..69611d38c844 100644
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
      .has_channel_1          = true,
 };
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { · line 1477

Quoted 5 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +5 -0
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+     .supports_lvds          = true,
+     .has_channel_0          = true,
+     /* TODO Need to support TCON output muxing via GPIO pins */
+     .set_mux                = sun8i_r40_tcon_tv_set_mux,

What is this muking about? And why is it a TODO?

Quoted 8 lines

Muxing similar like how TCON TOP handle TV0, TV1 I have reused the same so-that it would configure de port selection via sun8i_tcon_top_de_config

TCON output muxing have gpio with GPIOD and GPIOH bits, which select which of LCD or TV TCON outputs to the LCD function pins. I have marked these has TODO for further support as mentioned by Chen-Yu in v1[1].

It should be in the commit log.

What's the plan to support that when needed? And that means that the LCD and TV outputs are mutually exclusive? We should at the very least check that both aren't enabled at the same time.

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#6 lore raw

Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

Quoted 41 lines · Maxime Ripard
Quoted 39 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index fad72799b8df..69611d38c844 100644
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
      .has_channel_1          = true,
 };
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { · line 1477

Quoted 5 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +5 -0
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+     .supports_lvds          = true,
+     .has_channel_0          = true,
+     /* TODO Need to support TCON output muxing via GPIO pins */
+     .set_mux                = sun8i_r40_tcon_tv_set_mux,

What is this muking about? And why is it a TODO?

Muxing similar like how TCON TOP handle TV0, TV1 I have reused the same so-that it would configure de port selection via sun8i_tcon_top_de_config

Quoted 6 lines
Quoted 4 lines

TCON output muxing have gpio with GPIOD and GPIOH bits, which select which of LCD or TV TCON outputs to the LCD function pins. I have marked these has TODO for further support as mentioned by Chen-Yu in v1[1].

It should be in the commit log.

Make sense.

Quoted 4 lines

What's the plan to support that when needed? And that means that the LCD and TV outputs are mutually exclusive? We should at the very least check that both aren't enabled at the same time.

Yes, LCD or TV within the outselect seems to be mutually exclusive. Like LCD0 or TV0 can output to GPIOD incase of TV0_OUTSEL and LCD1 or TV1 can output to GPIOH incase of TV1_OUTSEL. I think checking them before configuring TCON_TOP_PORT_SEL_REG would make sense, let me know if you have any suggestions?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#7 lore raw

Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

Hi,

Quoted 55 lines · Jagan Teki
Quoted 41 lines · Maxime Ripard
Quoted 39 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki

TCON LCD0, LCD1 in allwinner R40, are used for managing LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via tcon top.

Add support for it, in tcon driver.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index fad72799b8df..69611d38c844 100644
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
      .has_channel_1          = true,
 };
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { · line 1477

Quoted 5 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +5 -0
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+     .supports_lvds          = true,
+     .has_channel_0          = true,
+     /* TODO Need to support TCON output muxing via GPIO pins */
+     .set_mux                = sun8i_r40_tcon_tv_set_mux,

What is this muking about? And why is it a TODO?

Muxing similar like how TCON TOP handle TV0, TV1 I have reused the same so-that it would configure de port selection via sun8i_tcon_top_de_config

Quoted 6 lines
Quoted 4 lines

TCON output muxing have gpio with GPIOD and GPIOH bits, which select which of LCD or TV TCON outputs to the LCD function pins. I have marked these has TODO for further support as mentioned by Chen-Yu in v1[1].

It should be in the commit log.

Make sense.

Quoted 3 lines

What's the plan to support that when needed? And that means that the LCD and TV outputs are mutually exclusive? We should at the very least check that both aren't enabled at the same time.

Quoted 5 lines

Yes, LCD or TV within the outselect seems to be mutually exclusive. Like LCD0 or TV0 can output to GPIOD incase of TV0_OUTSEL and LCD1 or TV1 can output to GPIOH incase of TV1_OUTSEL. I think checking them before configuring TCON_TOP_PORT_SEL_REG would make sense, let me know if you have any suggestions?

Making sure in atomic_check that TV and LCD are not used at the same time, and then in encoders mode_set / enable mux the pins to our encoders would be my first guess.

Maxime

author
#8 lore raw

PATCH v3 3/9 ARM: dts: sun8i: r40: Use tcon top clock index macros

In reply to Jagan Teki

tcon_tv0, tcon_tv1 nodes have a clock names of tcon-ch0, tcon-ch1 which are referring tcon_top clocks via index numbers like 0, 1 with CLK_TCON_TV0 and CLK_TCON_TV1 respectively.

Use the macro in place of index numbers, for more code readability.

---
Changes for v3:
- none

 arch/arm/boot/dts/sun8i-r40.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-r40.dtsi +3 -2
index c9c2688db66d..3faa35d43afa 100644
@@ -44,6 +44,7 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/sun8i-de2.h>
 #include <dt-bindings/clock/sun8i-r40-ccu.h>
+#include <dt-bindings/clock/sun8i-tcon-top.h>
 #include <dt-bindings/reset/sun8i-r40-ccu.h>
 #include <dt-bindings/reset/sun8i-de2.h>
 
@@ -709,7 +710,7 @@
 			compatible = "allwinner,sun8i-r40-tcon-tv";
 			reg = <0x01c73000 0x1000>;
 			interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_TCON_TV0>, <&tcon_top 0>;
+			clocks = <&ccu CLK_BUS_TCON_TV0>, <&tcon_top CLK_TCON_TOP_TV0>;
 			clock-names = "ahb", "tcon-ch1";
 			resets = <&ccu RST_BUS_TCON_TV0>;
 			reset-names = "lcd";
@@ -752,7 +753,7 @@
 			compatible = "allwinner,sun8i-r40-tcon-tv";
 			reg = <0x01c74000 0x1000>;
 			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_TCON_TV1>, <&tcon_top 1>;
+			clocks = <&ccu CLK_BUS_TCON_TV1>, <&tcon_top CLK_TCON_TOP_TV1>;
 			clock-names = "ahb", "tcon-ch1";
 			resets = <&ccu RST_BUS_TCON_TV1>;
 			reset-names = "lcd";
Signature · 1 line
2.18.0.321.gffc6fa0e3
maintainer Applied
#9 lore raw

Re: [PATCH v3 3/9] ARM: dts: sun8i: r40: Use tcon top clock index macros

Quoted 10 lines · Jagan Teki

tcon_tv0, tcon_tv1 nodes have a clock names of tcon-ch0, tcon-ch1 which are referring tcon_top clocks via index numbers like 0, 1 with CLK_TCON_TV0 and CLK_TCON_TV1 respectively.

Use the macro in place of index numbers, for more code readability.

Applied, thanks
Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#10 lore raw

PATCH v3 4/9 drm/sun4i: tcon_top: Use clock name index macros

In reply to Jagan Teki

TCON TOP mux blocks in R40 are registering clock using tcon top clock index numbers.

Right now the code is using, real numbers start with 0, but we have proper macros that defined these name index numbers.

Use the existing macros, instead of real numbers for more code readability.

---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/sun4i/sun8i_tcon_top.c +6 -3
index 75d8e60c149d..e0b3c5330b9a 100644
@@ -194,19 +194,22 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
 	clk_data->hws[CLK_TCON_TOP_TV0] =
 		sun8i_tcon_top_register_gate(dev, "tcon-tv0", regs,
 					     &tcon_top->reg_lock,
-					     TCON_TOP_TCON_TV0_GATE, 0);
+					     TCON_TOP_TCON_TV0_GATE,
+					     CLK_TCON_TOP_TV0);
 
 	if (quirks->has_tcon_tv1)
 		clk_data->hws[CLK_TCON_TOP_TV1] =
 			sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs,
 						     &tcon_top->reg_lock,
-						     TCON_TOP_TCON_TV1_GATE, 1);
+						     TCON_TOP_TCON_TV1_GATE,
+						     CLK_TCON_TOP_TV1);
 
 	if (quirks->has_dsi)
 		clk_data->hws[CLK_TCON_TOP_DSI] =
 			sun8i_tcon_top_register_gate(dev, "dsi", regs,
 						     &tcon_top->reg_lock,
-						     TCON_TOP_TCON_DSI_GATE, 2);
+						     TCON_TOP_TCON_DSI_GATE,
+						     CLK_TCON_TOP_DSI);
 
 	for (i = 0; i < CLK_NUM; i++)
 		if (IS_ERR(clk_data->hws[i])) {
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#11 lore raw

PATCH v3 5/9 drm/sun4i: tcon_top: Register reset, clock gates in probe

In reply to Jagan Teki

TCON TOP is processing clock gates and reset control for TV0, TV1 and DSI channels during bind and release the same during unbind component ops.

The usual DSI initialization would setup all controller clocks along with DPHY clocking during probe.

Since the actual clock gates (along with DSI clock gate) are initialized during ton top bind, the DPHY is failed to get the DSI clock during that time.

To solve, this circular dependency move the reset control, clock gate registration from bind to probe and release the same from unbind to remove.

This eventually give a chance DPHY to initialize the DSI clock gate.

---
Changes for v3:
- fixed comments from Chen-Yu
- move reset control methods into probe

 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 41 +++++++++++++-------------
 1 file changed, 21 insertions(+), 20 deletions(-)
drivers/gpu/drm/sun4i/sun8i_tcon_top.c +21 -20
index e0b3c5330b9a..732ac19b4371 100644
@@ -124,7 +124,22 @@ static struct clk_hw *sun8i_tcon_top_register_gate(struct device *dev,
 static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
 			       void *data)
 {
-	struct platform_device *pdev = to_platform_device(dev);
+	return 0;
+}
+
+static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
+				  void *data)
+{
+}
+
+static const struct component_ops sun8i_tcon_top_ops = {
+	.bind	= sun8i_tcon_top_bind,
+	.unbind	= sun8i_tcon_top_unbind,
+};
+
+static int sun8i_tcon_top_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
 	struct clk_hw_onecell_data *clk_data;
 	struct sun8i_tcon_top *tcon_top;
 	const struct sun8i_tcon_top_quirks *quirks;
@@ -132,7 +147,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
 	void __iomem *regs;
 	int ret, i;
 
-	quirks = of_device_get_match_data(&pdev->dev);
+	quirks = of_device_get_match_data(dev);
 
 	tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL);
 	if (!tcon_top)
@@ -226,22 +241,21 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
 
 	dev_set_drvdata(dev, tcon_top);
 
-	return 0;
+	return component_add(dev, &sun8i_tcon_top_ops);
 
 err_unregister_gates:
 	for (i = 0; i < CLK_NUM; i++)
 		if (!IS_ERR_OR_NULL(clk_data->hws[i]))
 			clk_hw_unregister_gate(clk_data->hws[i]);
-	clk_disable_unprepare(tcon_top->bus);
 err_assert_reset:
 	reset_control_assert(tcon_top->rst);
 
 	return ret;
 }
 
-static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
-				  void *data)
+static int sun8i_tcon_top_remove(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct sun8i_tcon_top *tcon_top = dev_get_drvdata(dev);
 	struct clk_hw_onecell_data *clk_data = tcon_top->clk_data;
 	int i;
@@ -253,21 +267,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
 
 	clk_disable_unprepare(tcon_top->bus);
 	reset_control_assert(tcon_top->rst);
-}
-
-static const struct component_ops sun8i_tcon_top_ops = {
-	.bind	= sun8i_tcon_top_bind,
-	.unbind	= sun8i_tcon_top_unbind,
-};
-
-static int sun8i_tcon_top_probe(struct platform_device *pdev)
-{
-	return component_add(&pdev->dev, &sun8i_tcon_top_ops);
-}
 
-static int sun8i_tcon_top_remove(struct platform_device *pdev)
-{
-	component_del(&pdev->dev, &sun8i_tcon_top_ops);
+	component_del(dev, &sun8i_tcon_top_ops);
 
 	return 0;
 }
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#12 lore raw

PATCH v3 6/9 dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)

In reply to Jagan Teki

The MIPI DSI PHY controller on Allwinner R40 is similar on the one on A31.

Add R40 compatible and append A31 compatible as fallback.

---
Changes for v3:
- update the binding in new yaml format

 .../devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml   | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml +1 -0
index 8841938050b2..0c283fe79402 100644
@@ -18,6 +18,7 @@ properties:
     oneOf:
       - const: allwinner,sun6i-a31-mipi-dphy
       - items:
+          - const: allwinner,sun8i-r40-mipi-dphy
           - const: allwinner,sun50i-a64-mipi-dphy
           - const: allwinner,sun6i-a31-mipi-dphy
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
maintainer
#13 lore raw

Re: [PATCH v3 6/9] dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)

Quoted 18 lines · Jagan Teki

The MIPI DSI PHY controller on Allwinner R40 is similar on the one on A31.

Add R40 compatible and append A31 compatible as fallback.

---
Changes for v3:
- update the binding in new yaml format

 .../devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml   | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml +0 -0
index 8841938050b2..0c283fe79402 100644

Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml properties: · line 23

Quoted 6 lines
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml +1 -0
@@ -18,6 +18,7 @@ properties:
     oneOf:
       - const: allwinner,sun6i-a31-mipi-dphy
       - items:
+          - const: allwinner,sun8i-r40-mipi-dphy
           - const: allwinner,sun50i-a64-mipi-dphy
           - const: allwinner,sun6i-a31-mipi-dphy

This isn't doing what you say it does.

Here you're stating that there's two valid values, one that is a single element allwinner,sun6i-a31-mipi-dphy, and another which is a list of three elements allwinner,sun8i-r40-mipi-dphy, allwinner,sun50i-a64-mipi-dphy and allwinner,sun6i-a31-mipi-dphy, in that order.

Did you run make dtbs_check and dt_bindings_check?

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#14 lore raw

Re: [PATCH v3 6/9] dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)

Quoted 29 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki

The MIPI DSI PHY controller on Allwinner R40 is similar on the one on A31.

Add R40 compatible and append A31 compatible as fallback.

---
Changes for v3:
- update the binding in new yaml format

 .../devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml   | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml +0 -0
index 8841938050b2..0c283fe79402 100644

Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml properties: · line 23

Quoted 6 lines
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml +1 -0
@@ -18,6 +18,7 @@ properties:
     oneOf:
       - const: allwinner,sun6i-a31-mipi-dphy
       - items:
+          - const: allwinner,sun8i-r40-mipi-dphy
           - const: allwinner,sun50i-a64-mipi-dphy
           - const: allwinner,sun6i-a31-mipi-dphy

This isn't doing what you say it does.

Quoted 5 lines

Here you're stating that there's two valid values, one that is a single element allwinner,sun6i-a31-mipi-dphy, and another which is a list of three elements allwinner,sun8i-r40-mipi-dphy, allwinner,sun50i-a64-mipi-dphy and allwinner,sun6i-a31-mipi-dphy, in that order.

I got it Maxime, thanks for pointing this.

Quoted 2 lines

Did you run make dtbs_check and dt_bindings_check?

I sure I didn't, thanks for the clue.

Will do this on another patch as well.

Jagan.

author
#15 lore raw

PATCH v3 7/9 dt-bindings: sun6i-dsi: Document R40 MIPI-DSI controller (w/ A64 fallback)

In reply to Jagan Teki

The MIPI DSI controller on Allwinner R40 is similar on the one on A64 like doesn't associate any DSI_SCLK gating.

So, add R40 compatible and append A64 compatible as fallback.

---
Changes for v3:
- update the binding in new yaml format

 .../bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml +5 -3
index d41ecb5e7f7c..138ffb6ae403 100644
@@ -15,9 +15,11 @@ properties:
   "#size-cells": true
 
   compatible:
-    enum:
-      - allwinner,sun6i-a31-mipi-dsi
-      - allwinner,sun50i-a64-mipi-dsi
+    oneOf:
+      - const: allwinner,sun6i-a31-mipi-dsi
+      - const: allwinner,sun50i-a64-mipi-dsi
+      - items:
+          - const: allwinner,sun8i-r40-mipi-dsi
 
   reg:
     maxItems: 1
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#16 lore raw

Re: [PATCH v3 7/9] dt-bindings: sun6i-dsi: Document R40 MIPI-DSI controller (w/ A64 fallback)

Quoted 19 lines · Jagan Teki

The MIPI DSI controller on Allwinner R40 is similar on the one on A64 like doesn't associate any DSI_SCLK gating.

So, add R40 compatible and append A64 compatible as fallback.

---
Changes for v3:
- update the binding in new yaml format

 .../bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml +0 -0
index d41ecb5e7f7c..138ffb6ae403 100644
@@ -15,9 +15,11 @@ properties:
   "#size-cells": true

Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml properties: · line 22

Quoted 10 lines
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml +5 -3
 
   compatible:
-    enum:
-      - allwinner,sun6i-a31-mipi-dsi
-      - allwinner,sun50i-a64-mipi-dsi
+    oneOf:
+      - const: allwinner,sun6i-a31-mipi-dsi
+      - const: allwinner,sun50i-a64-mipi-dsi
+      - items:
+          - const: allwinner,sun8i-r40-mipi-dsi

Again, this isn't what you claim it does.

Maxime

author
#17 lore raw

PATCH v3 8/9 ARM: dts: sun8i: r40: Add MIPI DSI pipeline

In reply to Jagan Teki

Add MIPI DSI pipeline for Allwinner R40.

Unlike conventional Display pipeline in allwinner, R40 have TCON TCOP which would interact various block like muxes, tcon lcd, tcon_tv for better pipeline fitting.

For MIPI DSI pipeline, we have to configure the tcon_lcd0 block which would interact with tcon_top for upper pipeline connections and dsi block for lower pipeline connections.

So, this patch created that pipeline by adding new nodes for tcon_lcd0, dsi, dphy and connet them to make proper pipeline fitting.

---
Changes for v3:
- drop clock-names in dsi node

 arch/arm/boot/dts/sun8i-r40.dtsi | 72 ++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +72 -0
index 3faa35d43afa..4c61e93d9a0b 100644
@@ -628,6 +628,7 @@
 
 					tcon_top_mixer0_out_tcon_lcd0: endpoint@0 {
 						reg = <0>;
+						remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>;
 					};
 
 					tcon_top_mixer0_out_tcon_lcd1: endpoint@1 {
@@ -706,6 +707,45 @@
 			};
 		};
 
+		tcon_lcd0: lcd-controller@1c71000 {
+			compatible = "allwinner,sun8i-r40-tcon-lcd";
+			reg = <0x01c71000 0x1000>;
+			interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON_LCD0>, <&ccu CLK_TCON_LCD0>;
+			clock-names = "ahb", "tcon-ch0";
+			clock-output-names = "tcon-pixel-clock";
+			resets = <&ccu RST_BUS_TCON_LCD0>, <&ccu RST_BUS_LVDS>;
+			reset-names = "lcd", "lvds";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon_lcd0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon_lcd0_in_tcon_top_mixer0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>;
+					};
+				};
+
+				tcon_lcd0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					tcon_lcd0_out_dsi_out: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&dsi_in_tcon_lcd0_out>;
+					};
+				};
+			};
+		};
+
 		tcon_tv0: lcd-controller@1c73000 {
 			compatible = "allwinner,sun8i-r40-tcon-tv";
 			reg = <0x01c73000 0x1000>;
@@ -803,6 +843,38 @@
 			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
 
+		dsi: dsi@1ca0000 {
+			compatible = "allwinner,sun8i-r40-mipi-dsi",
+				     "allwinner,sun50i-a64-mipi-dsi";
+			reg = <0x01ca0000 0x1000>;
+			interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_MIPI_DSI>;
+			resets = <&ccu RST_BUS_MIPI_DSI>;
+			phys = <&dphy>;
+			phy-names = "dphy";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port {
+				dsi_in_tcon_lcd0_out: endpoint {
+					remote-endpoint = <&tcon_lcd0_out_dsi_out>;
+				};
+			};
+		};
+
+		dphy: d-phy@1ca1000 {
+			compatible = "allwinner,sun8i-r40-mipi-dphy",
+				     "allwinner,sun6i-a31-mipi-dphy";
+			reg = <0x01ca1000 0x1000>;
+			clocks = <&ccu CLK_BUS_MIPI_DSI>,
+				 <&tcon_top CLK_TCON_TOP_DSI>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_MIPI_DSI>;
+			status = "disabled";
+			#phy-cells = <0>;
+		};
+
 		hdmi: hdmi@1ee0000 {
 			compatible = "allwinner,sun8i-r40-dw-hdmi",
 				     "allwinner,sun8i-a83t-dw-hdmi";
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#18 lore raw

PATCH v3 9/9 ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable Bananapi S070WV20-CT16

In reply to Jagan Teki

This patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M2U board.

DSI panel connected via board DSI port with,
- DCDC1 as VCC-DSI supply
- PH18 gpio for lcd enable pin
- PD17 gpio for lcd reset pin
- PD16 gpio for backlight enable pin

---
Changes for v3:
- none

 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +37 -0
index 42d62d1ba1dc..99f84e6f15ce 100644
@@ -45,6 +45,7 @@
 #include "sun8i-r40.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "Banana Pi BPI-M2-Ultra";
@@ -55,6 +56,14 @@
 		serial0 = &uart0;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <1 2 4 8 16 32 64 128 255>;
+		default-brightness-level = <2>;
+		enable-gpios = <&pio 7 16 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PH16 */
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -117,6 +126,24 @@
 	status = "okay";
 };
 
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dcdc1>;		/* VCC-DSI */
+	status = "okay";
+
+	panel@0 {
+		compatible = "bananapi,s070wv20-ct16-icn6211";
+		reg = <0>;
+		enable-gpio = <&pio 7 18 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PH18 */
+		reset-gpios = <&pio 7 17 GPIO_ACTIVE_HIGH>; /* LCD-RST: PH17 */
+		vdd-supply = <&reg_dcdc1>;
+		backlight = <&backlight>;
+	};
+};
+
 &ehci1 {
 	status = "okay";
 };
@@ -209,6 +236,12 @@
 	vcc-pg-supply = <&reg_dldo1>;
 };
 
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_pin>;
+	status = "okay";
+};
+
 &reg_aldo2 {
 	regulator-min-microvolt = <2500000>;
 	regulator-max-microvolt = <2500000>;
@@ -295,6 +328,10 @@
 	regulator-name = "vdd1v2-sata";
 };
 
+&tcon_lcd0 {
+	status = "okay";
+};
+
 &tcon_tv0 {
 	status = "okay";
 };
Signature · 1 line
2.18.0.321.gffc6fa0e3