[PATCH v3 0/9] drm/sun4i: Allwinner R40 MIPI-DSI support

36 views
Skip to first unread message

Jagan Teki

unread,
Dec 31, 2019, 8:05:45 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, Jagan Teki
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(-)

--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:05:50 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, Jagan Teki
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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
Acked-by: Chen-Yu Tsai <we...@csie.org>
Reviewed-by: Rob Herring <ro...@kernel.org>
---
Changes for v3:
- none

Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 31ab72cba3d4..9e9c7f934202 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -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
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:05:55 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
Changes for v3:
- none

drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index fad72799b8df..69611d38c844 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -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 },
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:00 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
Reviewed-by: Chen-Yu Tsai <we...@csie.org>
---
Changes for v3:
- none

arch/arm/boot/dts/sun8i-r40.dtsi | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index c9c2688db66d..3faa35d43afa 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -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";
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:06 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
Changes for v3:
- none

drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index 75d8e60c149d..e0b3c5330b9a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -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])) {
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:09 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
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(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index e0b3c5330b9a..732ac19b4371 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -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;
}
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:15 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
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(+)

diff --git a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
index 8841938050b2..0c283fe79402 100644
--- a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
@@ -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

--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:20 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
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(-)

diff --git a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
index d41ecb5e7f7c..138ffb6ae403 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
@@ -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
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:26 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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.

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
Changes for v3:
- drop clock-names in dsi node

arch/arm/boot/dts/sun8i-r40.dtsi | 72 ++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index 3faa35d43afa..4c61e93d9a0b 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -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";
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Dec 31, 2019, 8:06:30 AM12/31/19
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-...@lists.freedesktop.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, devic...@vger.kernel.org, linux-sunxi, linux-...@amarulasolutions.com, 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

Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
---
Changes for v3:
- none

.../boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 42d62d1ba1dc..99f84e6f15ce 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -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";
};
--
2.18.0.321.gffc6fa0e3

Jagan Teki

unread,
Jan 2, 2020, 10:40:46 AM1/2/20
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-devel, linux-arm-kernel, linux-kernel, devicetree, linux-sunxi, linux-amarula
On Thu, Jan 2, 2020 at 4:24 PM Maxime Ripard <mri...@kernel.org> wrote:
>
> On Tue, Dec 31, 2019 at 06:35:21PM +0530, Jagan Teki wrote:
> > 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.
> >
> > Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
> > ---
> > Changes for v3:
> > - none
> >
> > drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index fad72799b8df..69611d38c844 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -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?

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

Jagan Teki

unread,
Jan 2, 2020, 10:43:50 AM1/2/20
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-devel, linux-arm-kernel, linux-kernel, devicetree, linux-sunxi, linux-amarula
On Thu, Jan 2, 2020 at 4:33 PM Maxime Ripard <mri...@kernel.org> wrote:
> 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.

I got it Maxime, thanks for pointing this.

>
> 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.

Jagan Teki

unread,
Jan 2, 2020, 11:34:54 AM1/2/20
to Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring, David Airlie, Daniel Vetter, Mark Rutland, dri-devel, linux-arm-kernel, linux-kernel, devicetree, linux-sunxi, linux-amarula
On Thu, Jan 2, 2020 at 9:17 PM Maxime Ripard <mri...@kernel.org> wrote:
> It should be in the commit log.

Make sense.

>
> 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?
Reply all
Reply to author
Forward
0 new messages