All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/11] Support for H3 Composite Output support
@ 2017-05-17 16:43 ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

This patchset depends on the DE2 patchset, version 8 of that patchset
is available at [1].

Allwinner H3 SoC features a TV Encoder like the one in Allwinner A13,
which can only output TV Composite signal.

The display pipeline of H3 is also special -- it has two mixers and
two TCONs, of which the connection can be swapped. The TCONs do not
have channel 0 (as they are all connected to internal bridges, TVE
and HDMI TX).

Add support for the display pipeline and the TVE in H3, in order to
make it possible to display something with mainline kernel with H3.

The image quality of TVE is bad, so HDMI is a better output -- this
patchset also prepared the mixers and TCONs for HDMI output, and
the HDMI controller driver is already done by Jernej Skrabec.

Currently the jack detection feature of the TVE is still not so
clear -- so it's not implemented in this version. Thus the TV
output shouldn't be defaultly enabled now.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/506806.html

Icenowy Zheng (11):
  dt-bindings: update the binding for Allwinner H3 TVE support
  drm: sun4i: add support for H3 mixers
  drm: sun4i: ignore swapped mixer<->tcon connection for DE2
  drm: sun4i: add support for H3's TCON0/1
  drm: sun4i: add compatible for H3 display engine
  drm: sun4i: add color space correction support for DE2 mixer
  drm: sun4i: add support for the TV encoder in H3 SoC
  clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
  clk: sunxi-ng: export CLK_PLL_DE for H3
  ARM: sun8i: h3: add display engine pipeline for TVE
  [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC

 .../bindings/display/sunxi/sun4i-drm.txt           |  47 ++++-
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts         |  12 ++
 arch/arm/boot/dts/sun8i-h3.dtsi                    | 189 +++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c                |   2 +-
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h                |   3 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c                  |  28 +++
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 | 117 +++++++++----
 drivers/gpu/drm/sun4i/sun4i_tcon.h                 |   5 +
 drivers/gpu/drm/sun4i/sun4i_tv.c                   |  65 ++++++-
 drivers/gpu/drm/sun4i/sun8i_mixer.c                |  53 ++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h                |   6 +-
 include/dt-bindings/clock/sun8i-h3-ccu.h           |   2 +
 12 files changed, 488 insertions(+), 41 deletions(-)

-- 
2.12.2

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 00/11] Support for H3 Composite Output support
@ 2017-05-17 16:43 ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

This patchset depends on the DE2 patchset, version 8 of that patchset
is available at [1].

Allwinner H3 SoC features a TV Encoder like the one in Allwinner A13,
which can only output TV Composite signal.

The display pipeline of H3 is also special -- it has two mixers and
two TCONs, of which the connection can be swapped. The TCONs do not
have channel 0 (as they are all connected to internal bridges, TVE
and HDMI TX).

Add support for the display pipeline and the TVE in H3, in order to
make it possible to display something with mainline kernel with H3.

The image quality of TVE is bad, so HDMI is a better output -- this
patchset also prepared the mixers and TCONs for HDMI output, and
the HDMI controller driver is already done by Jernej Skrabec.

Currently the jack detection feature of the TVE is still not so
clear -- so it's not implemented in this version. Thus the TV
output shouldn't be defaultly enabled now.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/506806.html

Icenowy Zheng (11):
  dt-bindings: update the binding for Allwinner H3 TVE support
  drm: sun4i: add support for H3 mixers
  drm: sun4i: ignore swapped mixer<->tcon connection for DE2
  drm: sun4i: add support for H3's TCON0/1
  drm: sun4i: add compatible for H3 display engine
  drm: sun4i: add color space correction support for DE2 mixer
  drm: sun4i: add support for the TV encoder in H3 SoC
  clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
  clk: sunxi-ng: export CLK_PLL_DE for H3
  ARM: sun8i: h3: add display engine pipeline for TVE
  [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC

 .../bindings/display/sunxi/sun4i-drm.txt           |  47 ++++-
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts         |  12 ++
 arch/arm/boot/dts/sun8i-h3.dtsi                    | 189 +++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c                |   2 +-
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h                |   3 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c                  |  28 +++
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 | 117 +++++++++----
 drivers/gpu/drm/sun4i/sun4i_tcon.h                 |   5 +
 drivers/gpu/drm/sun4i/sun4i_tv.c                   |  65 ++++++-
 drivers/gpu/drm/sun4i/sun8i_mixer.c                |  53 ++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h                |   6 +-
 include/dt-bindings/clock/sun8i-h3-ccu.h           |   2 +
 12 files changed, 488 insertions(+), 41 deletions(-)

-- 
2.12.2

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 00/11] Support for H3 Composite Output support
@ 2017-05-17 16:43 ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset depends on the DE2 patchset, version 8 of that patchset
is available at [1].

Allwinner H3 SoC features a TV Encoder like the one in Allwinner A13,
which can only output TV Composite signal.

The display pipeline of H3 is also special -- it has two mixers and
two TCONs, of which the connection can be swapped. The TCONs do not
have channel 0 (as they are all connected to internal bridges, TVE
and HDMI TX).

Add support for the display pipeline and the TVE in H3, in order to
make it possible to display something with mainline kernel with H3.

The image quality of TVE is bad, so HDMI is a better output -- this
patchset also prepared the mixers and TCONs for HDMI output, and
the HDMI controller driver is already done by Jernej Skrabec.

Currently the jack detection feature of the TVE is still not so
clear -- so it's not implemented in this version. Thus the TV
output shouldn't be defaultly enabled now.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/506806.html

Icenowy Zheng (11):
  dt-bindings: update the binding for Allwinner H3 TVE support
  drm: sun4i: add support for H3 mixers
  drm: sun4i: ignore swapped mixer<->tcon connection for DE2
  drm: sun4i: add support for H3's TCON0/1
  drm: sun4i: add compatible for H3 display engine
  drm: sun4i: add color space correction support for DE2 mixer
  drm: sun4i: add support for the TV encoder in H3 SoC
  clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
  clk: sunxi-ng: export CLK_PLL_DE for H3
  ARM: sun8i: h3: add display engine pipeline for TVE
  [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC

 .../bindings/display/sunxi/sun4i-drm.txt           |  47 ++++-
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts         |  12 ++
 arch/arm/boot/dts/sun8i-h3.dtsi                    | 189 +++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c                |   2 +-
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h                |   3 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c                  |  28 +++
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 | 117 +++++++++----
 drivers/gpu/drm/sun4i/sun4i_tcon.h                 |   5 +
 drivers/gpu/drm/sun4i/sun4i_tv.c                   |  65 ++++++-
 drivers/gpu/drm/sun4i/sun8i_mixer.c                |  53 ++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h                |   6 +-
 include/dt-bindings/clock/sun8i-h3-ccu.h           |   2 +
 12 files changed, 488 insertions(+), 41 deletions(-)

-- 
2.12.2

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Allwinner H3 features a "DE2.0" and a TV Encoder.

Add device tree bindings for the following parts:
- H3 TCONs
- H3 Mixers
- The connection between H3 TCONs and H3 Mixers
- H3 TV Encoder
- H3 Display engine

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 .../bindings/display/sunxi/sun4i-drm.txt           | 47 ++++++++++++++++++++--
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 66b85a195ef2..52781943713b 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -21,7 +21,9 @@ The TV Encoder supports the composite and VGA output. It is one end of
 the pipeline.
 
 Required properties:
- - compatible: value should be "allwinner,sun4i-a10-tv-encoder".
+ - compatible: value must be either:
+    * allwinner,sun4i-a10-tv-encoder
+    * allwinner,sun8i-h3-tv-encoder
  - reg: base address and size of memory-mapped region
  - clocks: the clocks driving the TV encoder
  - resets: phandle to the reset controller driving the encoder
@@ -30,6 +32,13 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint.
 
+For "allwinner,sun4i-a10-tv-encoder", there is only one clock required,
+and it's not named.
+
+For "allwinner,sun8i-h3-tv-encoder", these clocks are needed:
+    - 'bus': the AHB bus clock of TVE
+    - 'mod': the mod clock of TVE
+
 TCON
 ----
 
@@ -41,29 +50,51 @@ Required properties:
    * allwinner,sun6i-a31-tcon
    * allwinner,sun6i-a31s-tcon
    * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-h3-tcon0
+   * allwinner,sun8i-h3-tcon1
    * allwinner,sun8i-v3s-tcon
  - reg: base address and size of memory-mapped region
  - interrupts: interrupt associated to this IP
  - clocks: phandles to the clocks feeding the TCON. Three are needed:
    - 'ahb': the interface clocks
-   - 'tcon-ch0': The clock driving the TCON channel 0
  - resets: phandles to the reset controllers driving the encoder
    - "lcd": the reset line for the TCON channel 0
 
  - clock-names: the clock names mentioned above
  - reset-names: the reset names mentioned above
- - clock-output-names: Name of the pixel clock created
 
 - ports: A ports node with endpoint definitions as defined in
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the input should have two
+  endpoints. The first is the default mixer connected to the TCON,
+  the second the mixer which will be connected to the TCON if the
+  swap bit is set.
+
   The output should have two endpoints. The first is the block
   connected to the TCON channel 0 (usually a panel or a bridge), the
   second the block connected to the TCON channel 1 (usually the TV
   encoder)
 
-On SoCs other than the A33 and V3s, there is one more clock required:
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-v3s-tcon
+there is one more clock and one more property required:
+ - clocks:
+   - 'tcon-ch0': The clock driving the TCON channel 0
+ - clock-output-names: Name of the pixel clock created
+
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-h3-tcon0
+there is one more clock required:
    - 'tcon-ch1': The clock driving the TCON channel 1
 
 DRC
@@ -158,6 +189,8 @@ supported.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun8i-v3s-de2-mixer
+    * allwinner,sun8i-h3-de2-mixer0
+    * allwinner,sun8i-h3-de2-mixer1
   - reg: base address and size of the memory-mapped region.
   - clocks: phandles to the clocks feeding the mixer
     * bus: the mixer interface clock
@@ -169,6 +202,11 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoints, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the output should have two
+  endpoints. The first is the default TCON connected to the mixer,
+  the second the TCON which will be connected to the mixer if the
+  swap bit is set.
 
 Display Engine Pipeline
 -----------------------
@@ -183,6 +221,7 @@ Required properties:
     * allwinner,sun6i-a31-display-engine
     * allwinner,sun6i-a31s-display-engine
     * allwinner,sun8i-a33-display-engine
+    * allwinner,sun8i-h3-display-engine
     * allwinner,sun8i-v3s-display-engine
 
   - allwinner,pipelines: list of phandle to the display engine
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Allwinner H3 features a "DE2.0" and a TV Encoder.

Add device tree bindings for the following parts:
- H3 TCONs
- H3 Mixers
- The connection between H3 TCONs and H3 Mixers
- H3 TV Encoder
- H3 Display engine

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 .../bindings/display/sunxi/sun4i-drm.txt           | 47 ++++++++++++++++++++--
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 66b85a195ef2..52781943713b 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -21,7 +21,9 @@ The TV Encoder supports the composite and VGA output. It is one end of
 the pipeline.
 
 Required properties:
- - compatible: value should be "allwinner,sun4i-a10-tv-encoder".
+ - compatible: value must be either:
+    * allwinner,sun4i-a10-tv-encoder
+    * allwinner,sun8i-h3-tv-encoder
  - reg: base address and size of memory-mapped region
  - clocks: the clocks driving the TV encoder
  - resets: phandle to the reset controller driving the encoder
@@ -30,6 +32,13 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint.
 
+For "allwinner,sun4i-a10-tv-encoder", there is only one clock required,
+and it's not named.
+
+For "allwinner,sun8i-h3-tv-encoder", these clocks are needed:
+    - 'bus': the AHB bus clock of TVE
+    - 'mod': the mod clock of TVE
+
 TCON
 ----
 
@@ -41,29 +50,51 @@ Required properties:
    * allwinner,sun6i-a31-tcon
    * allwinner,sun6i-a31s-tcon
    * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-h3-tcon0
+   * allwinner,sun8i-h3-tcon1
    * allwinner,sun8i-v3s-tcon
  - reg: base address and size of memory-mapped region
  - interrupts: interrupt associated to this IP
  - clocks: phandles to the clocks feeding the TCON. Three are needed:
    - 'ahb': the interface clocks
-   - 'tcon-ch0': The clock driving the TCON channel 0
  - resets: phandles to the reset controllers driving the encoder
    - "lcd": the reset line for the TCON channel 0
 
  - clock-names: the clock names mentioned above
  - reset-names: the reset names mentioned above
- - clock-output-names: Name of the pixel clock created
 
 - ports: A ports node with endpoint definitions as defined in
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the input should have two
+  endpoints. The first is the default mixer connected to the TCON,
+  the second the mixer which will be connected to the TCON if the
+  swap bit is set.
+
   The output should have two endpoints. The first is the block
   connected to the TCON channel 0 (usually a panel or a bridge), the
   second the block connected to the TCON channel 1 (usually the TV
   encoder)
 
-On SoCs other than the A33 and V3s, there is one more clock required:
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-v3s-tcon
+there is one more clock and one more property required:
+ - clocks:
+   - 'tcon-ch0': The clock driving the TCON channel 0
+ - clock-output-names: Name of the pixel clock created
+
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-h3-tcon0
+there is one more clock required:
    - 'tcon-ch1': The clock driving the TCON channel 1
 
 DRC
@@ -158,6 +189,8 @@ supported.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun8i-v3s-de2-mixer
+    * allwinner,sun8i-h3-de2-mixer0
+    * allwinner,sun8i-h3-de2-mixer1
   - reg: base address and size of the memory-mapped region.
   - clocks: phandles to the clocks feeding the mixer
     * bus: the mixer interface clock
@@ -169,6 +202,11 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoints, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the output should have two
+  endpoints. The first is the default TCON connected to the mixer,
+  the second the TCON which will be connected to the mixer if the
+  swap bit is set.
 
 Display Engine Pipeline
 -----------------------
@@ -183,6 +221,7 @@ Required properties:
     * allwinner,sun6i-a31-display-engine
     * allwinner,sun6i-a31s-display-engine
     * allwinner,sun8i-a33-display-engine
+    * allwinner,sun8i-h3-display-engine
     * allwinner,sun8i-v3s-display-engine
 
   - allwinner,pipelines: list of phandle to the display engine
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner H3 features a "DE2.0" and a TV Encoder.

Add device tree bindings for the following parts:
- H3 TCONs
- H3 Mixers
- The connection between H3 TCONs and H3 Mixers
- H3 TV Encoder
- H3 Display engine

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 .../bindings/display/sunxi/sun4i-drm.txt           | 47 ++++++++++++++++++++--
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 66b85a195ef2..52781943713b 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -21,7 +21,9 @@ The TV Encoder supports the composite and VGA output. It is one end of
 the pipeline.
 
 Required properties:
- - compatible: value should be "allwinner,sun4i-a10-tv-encoder".
+ - compatible: value must be either:
+    * allwinner,sun4i-a10-tv-encoder
+    * allwinner,sun8i-h3-tv-encoder
  - reg: base address and size of memory-mapped region
  - clocks: the clocks driving the TV encoder
  - resets: phandle to the reset controller driving the encoder
@@ -30,6 +32,13 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint.
 
+For "allwinner,sun4i-a10-tv-encoder", there is only one clock required,
+and it's not named.
+
+For "allwinner,sun8i-h3-tv-encoder", these clocks are needed:
+    - 'bus': the AHB bus clock of TVE
+    - 'mod': the mod clock of TVE
+
 TCON
 ----
 
@@ -41,29 +50,51 @@ Required properties:
    * allwinner,sun6i-a31-tcon
    * allwinner,sun6i-a31s-tcon
    * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-h3-tcon0
+   * allwinner,sun8i-h3-tcon1
    * allwinner,sun8i-v3s-tcon
  - reg: base address and size of memory-mapped region
  - interrupts: interrupt associated to this IP
  - clocks: phandles to the clocks feeding the TCON. Three are needed:
    - 'ahb': the interface clocks
-   - 'tcon-ch0': The clock driving the TCON channel 0
  - resets: phandles to the reset controllers driving the encoder
    - "lcd": the reset line for the TCON channel 0
 
  - clock-names: the clock names mentioned above
  - reset-names: the reset names mentioned above
- - clock-output-names: Name of the pixel clock created
 
 - ports: A ports node with endpoint definitions as defined in
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoint, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the input should have two
+  endpoints. The first is the default mixer connected to the TCON,
+  the second the mixer which will be connected to the TCON if the
+  swap bit is set.
+
   The output should have two endpoints. The first is the block
   connected to the TCON channel 0 (usually a panel or a bridge), the
   second the block connected to the TCON channel 1 (usually the TV
   encoder)
 
-On SoCs other than the A33 and V3s, there is one more clock required:
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-a33-tcon
+   * allwinner,sun8i-v3s-tcon
+there is one more clock and one more property required:
+ - clocks:
+   - 'tcon-ch0': The clock driving the TCON channel 0
+ - clock-output-names: Name of the pixel clock created
+
+For the following compatibles:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun6i-a31-tcon
+   * allwinner,sun6i-a31s-tcon
+   * allwinner,sun8i-h3-tcon0
+there is one more clock required:
    - 'tcon-ch1': The clock driving the TCON channel 1
 
 DRC
@@ -158,6 +189,8 @@ supported.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun8i-v3s-de2-mixer
+    * allwinner,sun8i-h3-de2-mixer0
+    * allwinner,sun8i-h3-de2-mixer1
   - reg: base address and size of the memory-mapped region.
   - clocks: phandles to the clocks feeding the mixer
     * bus: the mixer interface clock
@@ -169,6 +202,11 @@ Required properties:
   Documentation/devicetree/bindings/media/video-interfaces.txt. The
   first port should be the input endpoints, the second one the output
 
+  In the situation of Display Engine 2.0 that the connection between
+  the mixer and the TCON can be swapped, the output should have two
+  endpoints. The first is the default TCON connected to the mixer,
+  the second the TCON which will be connected to the mixer if the
+  swap bit is set.
 
 Display Engine Pipeline
 -----------------------
@@ -183,6 +221,7 @@ Required properties:
     * allwinner,sun6i-a31-display-engine
     * allwinner,sun6i-a31s-display-engine
     * allwinner,sun8i-a33-display-engine
+    * allwinner,sun8i-h3-display-engine
     * allwinner,sun8i-v3s-display-engine
 
   - allwinner,pipelines: list of phandle to the display engine
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
and the other has 1 VI and 1 UI.

Add support for these two variants.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index cb193c5f1686..d658a3a8159a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 	.ui_num = 1,
 };
 
+static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
+	.vi_num = 1,
+	.ui_num = 3,
+};
+
+static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
+	.vi_num = 1,
+	.ui_num = 1,
+};
+
 static const struct of_device_id sun8i_mixer_of_table[] = {
 	{
 		.compatible = "allwinner,sun8i-v3s-de2-mixer",
 		.data = &sun8i_v3s_mixer_cfg,
 	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer0",
+		.data = &sun8i_h3_mixer0_cfg
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer1",
+		.data = &sun8i_h3_mixer1_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>

Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
and the other has 1 VI and 1 UI.

Add support for these two variants.

Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index cb193c5f1686..d658a3a8159a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 	.ui_num = 1,
 };
 
+static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
+	.vi_num = 1,
+	.ui_num = 3,
+};
+
+static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
+	.vi_num = 1,
+	.ui_num = 1,
+};
+
 static const struct of_device_id sun8i_mixer_of_table[] = {
 	{
 		.compatible = "allwinner,sun8i-v3s-de2-mixer",
 		.data = &sun8i_v3s_mixer_cfg,
 	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer0",
+		.data = &sun8i_h3_mixer0_cfg
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer1",
+		.data = &sun8i_h3_mixer1_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, Icenowy Zheng,
	linux-clk, linux-arm-kernel

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
and the other has 1 VI and 1 UI.

Add support for these two variants.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index cb193c5f1686..d658a3a8159a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 	.ui_num = 1,
 };
 
+static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
+	.vi_num = 1,
+	.ui_num = 3,
+};
+
+static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
+	.vi_num = 1,
+	.ui_num = 1,
+};
+
 static const struct of_device_id sun8i_mixer_of_table[] = {
 	{
 		.compatible = "allwinner,sun8i-v3s-de2-mixer",
 		.data = &sun8i_v3s_mixer_cfg,
 	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer0",
+		.data = &sun8i_h3_mixer0_cfg
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer1",
+		.data = &sun8i_h3_mixer1_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
and the other has 1 VI and 1 UI.

Add support for these two variants.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index cb193c5f1686..d658a3a8159a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 	.ui_num = 1,
 };
 
+static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
+	.vi_num = 1,
+	.ui_num = 3,
+};
+
+static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
+	.vi_num = 1,
+	.ui_num = 1,
+};
+
 static const struct of_device_id sun8i_mixer_of_table[] = {
 	{
 		.compatible = "allwinner,sun8i-v3s-de2-mixer",
 		.data = &sun8i_v3s_mixer_cfg,
 	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer0",
+		.data = &sun8i_h3_mixer0_cfg
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-de2-mixer1",
+		.data = &sun8i_h3_mixer1_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
tcon0 and mixer1 is connected to tcon1; however by setting a bit
the connection can be swapped.

As we now hardcode the default connection, ignore the bonus endpoint for
the mixer's output and the TCON's input, as they stands for the swapped
connection.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 1dd1948025d2..29bf1325ded6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
 		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
+static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
+{
+	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
+	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
+		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
+}
+
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
@@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
 			}
 		}
 
+		/*
+		 * The second endpoint of the output of a swappable DE2 mixer
+		 * is the TCON after connection swapping.
+		 * Ignore it now, as we now hardcode mixer0->tcon0,
+		 * mixer1->tcon1 connection.
+		 */
+		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
+				continue;
+			}
+		}
+
 		/* Walk down our tree */
 		count += sun4i_drv_add_endpoints(dev, match, remote);
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index f44a37a5993d..89a215ff2370 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
  * requested via the get_id function of the engine.
  */
 static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
-						   struct device_node *node)
+						   struct device_node *node,
+						   bool skip_bonus_ep)
 {
 	struct device_node *port, *ep, *remote;
 	struct sunxi_engine *engine;
@@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		if (!remote)
 			continue;
 
+		if (skip_bonus_ep) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
+				continue;
+			}
+		}
+
 		/* does this node match any registered engines? */
 		list_for_each_entry(engine, &drv->engine_list, list) {
 			if (remote == engine->node) {
@@ -449,7 +464,7 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		}
 
 		/* keep looking through upstream ports */
-		engine = sun4i_tcon_find_engine(drv, remote);
+		engine = sun4i_tcon_find_engine(drv, remote, skip_bonus_ep);
 		if (!IS_ERR(engine)) {
 			of_node_put(remote);
 			of_node_put(port);
@@ -469,21 +484,27 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon;
 	int ret;
 
-	engine = sun4i_tcon_find_engine(drv, dev->of_node);
-	if (IS_ERR(engine)) {
-		dev_err(dev, "Couldn't find matching engine\n");
-		return -EPROBE_DEFER;
-	}
-
 	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
 	if (!tcon)
 		return -ENOMEM;
 	dev_set_drvdata(dev, tcon);
 	tcon->drm = drm;
 	tcon->dev = dev;
-	tcon->id = engine->id;
 	tcon->quirks = of_device_get_match_data(dev);
 
+	/*
+	 * As we keep the connection between DE2 mixer and TCON not swapped,
+	 * skip the bonus endpoints (which stand for swapped connection)
+	 * when finding the correspoing engine.
+	 */
+	engine = sun4i_tcon_find_engine(drv, dev->of_node,
+					tcon->quirks->swappable_input);
+	if (IS_ERR(engine)) {
+		dev_err(dev, "Couldn't find matching engine\n");
+		return -EPROBE_DEFER;
+	}
+	tcon->id = engine->id;
+
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
 		dev_err(dev, "Couldn't get our reset line\n");
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index d37e1e2ed60e..568dc736238a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -146,6 +146,8 @@
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* Some DE2 can swap the mixer<->TCON connection */
+	bool	swappable_input;
 };
 
 struct sun4i_tcon {
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
tcon0 and mixer1 is connected to tcon1; however by setting a bit
the connection can be swapped.

As we now hardcode the default connection, ignore the bonus endpoint for
the mixer's output and the TCON's input, as they stands for the swapped
connection.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 1dd1948025d2..29bf1325ded6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
 		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
+static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
+{
+	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
+	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
+		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
+}
+
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
@@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
 			}
 		}
 
+		/*
+		 * The second endpoint of the output of a swappable DE2 mixer
+		 * is the TCON after connection swapping.
+		 * Ignore it now, as we now hardcode mixer0->tcon0,
+		 * mixer1->tcon1 connection.
+		 */
+		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
+				continue;
+			}
+		}
+
 		/* Walk down our tree */
 		count += sun4i_drv_add_endpoints(dev, match, remote);
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index f44a37a5993d..89a215ff2370 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
  * requested via the get_id function of the engine.
  */
 static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
-						   struct device_node *node)
+						   struct device_node *node,
+						   bool skip_bonus_ep)
 {
 	struct device_node *port, *ep, *remote;
 	struct sunxi_engine *engine;
@@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		if (!remote)
 			continue;
 
+		if (skip_bonus_ep) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
+				continue;
+			}
+		}
+
 		/* does this node match any registered engines? */
 		list_for_each_entry(engine, &drv->engine_list, list) {
 			if (remote == engine->node) {
@@ -449,7 +464,7 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		}
 
 		/* keep looking through upstream ports */
-		engine = sun4i_tcon_find_engine(drv, remote);
+		engine = sun4i_tcon_find_engine(drv, remote, skip_bonus_ep);
 		if (!IS_ERR(engine)) {
 			of_node_put(remote);
 			of_node_put(port);
@@ -469,21 +484,27 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon;
 	int ret;
 
-	engine = sun4i_tcon_find_engine(drv, dev->of_node);
-	if (IS_ERR(engine)) {
-		dev_err(dev, "Couldn't find matching engine\n");
-		return -EPROBE_DEFER;
-	}
-
 	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
 	if (!tcon)
 		return -ENOMEM;
 	dev_set_drvdata(dev, tcon);
 	tcon->drm = drm;
 	tcon->dev = dev;
-	tcon->id = engine->id;
 	tcon->quirks = of_device_get_match_data(dev);
 
+	/*
+	 * As we keep the connection between DE2 mixer and TCON not swapped,
+	 * skip the bonus endpoints (which stand for swapped connection)
+	 * when finding the correspoing engine.
+	 */
+	engine = sun4i_tcon_find_engine(drv, dev->of_node,
+					tcon->quirks->swappable_input);
+	if (IS_ERR(engine)) {
+		dev_err(dev, "Couldn't find matching engine\n");
+		return -EPROBE_DEFER;
+	}
+	tcon->id = engine->id;
+
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
 		dev_err(dev, "Couldn't get our reset line\n");
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index d37e1e2ed60e..568dc736238a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -146,6 +146,8 @@
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* Some DE2 can swap the mixer<->TCON connection */
+	bool	swappable_input;
 };
 
 struct sun4i_tcon {
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
tcon0 and mixer1 is connected to tcon1; however by setting a bit
the connection can be swapped.

As we now hardcode the default connection, ignore the bonus endpoint for
the mixer's output and the TCON's input, as they stands for the swapped
connection.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 1dd1948025d2..29bf1325ded6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
 		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
+static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
+{
+	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
+	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
+		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
+}
+
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
@@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
 			}
 		}
 
+		/*
+		 * The second endpoint of the output of a swappable DE2 mixer
+		 * is the TCON after connection swapping.
+		 * Ignore it now, as we now hardcode mixer0->tcon0,
+		 * mixer1->tcon1 connection.
+		 */
+		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
+				continue;
+			}
+		}
+
 		/* Walk down our tree */
 		count += sun4i_drv_add_endpoints(dev, match, remote);
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index f44a37a5993d..89a215ff2370 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
  * requested via the get_id function of the engine.
  */
 static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
-						   struct device_node *node)
+						   struct device_node *node,
+						   bool skip_bonus_ep)
 {
 	struct device_node *port, *ep, *remote;
 	struct sunxi_engine *engine;
@@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		if (!remote)
 			continue;
 
+		if (skip_bonus_ep) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
+				continue;
+			}
+		}
+
 		/* does this node match any registered engines? */
 		list_for_each_entry(engine, &drv->engine_list, list) {
 			if (remote == engine->node) {
@@ -449,7 +464,7 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		}
 
 		/* keep looking through upstream ports */
-		engine = sun4i_tcon_find_engine(drv, remote);
+		engine = sun4i_tcon_find_engine(drv, remote, skip_bonus_ep);
 		if (!IS_ERR(engine)) {
 			of_node_put(remote);
 			of_node_put(port);
@@ -469,21 +484,27 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon;
 	int ret;
 
-	engine = sun4i_tcon_find_engine(drv, dev->of_node);
-	if (IS_ERR(engine)) {
-		dev_err(dev, "Couldn't find matching engine\n");
-		return -EPROBE_DEFER;
-	}
-
 	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
 	if (!tcon)
 		return -ENOMEM;
 	dev_set_drvdata(dev, tcon);
 	tcon->drm = drm;
 	tcon->dev = dev;
-	tcon->id = engine->id;
 	tcon->quirks = of_device_get_match_data(dev);
 
+	/*
+	 * As we keep the connection between DE2 mixer and TCON not swapped,
+	 * skip the bonus endpoints (which stand for swapped connection)
+	 * when finding the correspoing engine.
+	 */
+	engine = sun4i_tcon_find_engine(drv, dev->of_node,
+					tcon->quirks->swappable_input);
+	if (IS_ERR(engine)) {
+		dev_err(dev, "Couldn't find matching engine\n");
+		return -EPROBE_DEFER;
+	}
+	tcon->id = engine->id;
+
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
 		dev_err(dev, "Couldn't get our reset line\n");
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index d37e1e2ed60e..568dc736238a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -146,6 +146,8 @@
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* Some DE2 can swap the mixer<->TCON connection */
+	bool	swappable_input;
 };
 
 struct sun4i_tcon {
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
tcon0 and mixer1 is connected to tcon1; however by setting a bit
the connection can be swapped.

As we now hardcode the default connection, ignore the bonus endpoint for
the mixer's output and the TCON's input, as they stands for the swapped
connection.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 1dd1948025d2..29bf1325ded6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
 		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
+static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
+{
+	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
+	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
+		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
+}
+
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
 	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
@@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
 			}
 		}
 
+		/*
+		 * The second endpoint of the output of a swappable DE2 mixer
+		 * is the TCON after connection swapping.
+		 * Ignore it now, as we now hardcode mixer0->tcon0,
+		 * mixer1->tcon1 connection.
+		 */
+		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
+				continue;
+			}
+		}
+
 		/* Walk down our tree */
 		count += sun4i_drv_add_endpoints(dev, match, remote);
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index f44a37a5993d..89a215ff2370 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
  * requested via the get_id function of the engine.
  */
 static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
-						   struct device_node *node)
+						   struct device_node *node,
+						   bool skip_bonus_ep)
 {
 	struct device_node *port, *ep, *remote;
 	struct sunxi_engine *engine;
@@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		if (!remote)
 			continue;
 
+		if (skip_bonus_ep) {
+			struct of_endpoint endpoint;
+
+			if (of_graph_parse_endpoint(ep, &endpoint)) {
+				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
+				continue;
+			}
+
+			if (endpoint.id) {
+				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
+				continue;
+			}
+		}
+
 		/* does this node match any registered engines? */
 		list_for_each_entry(engine, &drv->engine_list, list) {
 			if (remote == engine->node) {
@@ -449,7 +464,7 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
 		}
 
 		/* keep looking through upstream ports */
-		engine = sun4i_tcon_find_engine(drv, remote);
+		engine = sun4i_tcon_find_engine(drv, remote, skip_bonus_ep);
 		if (!IS_ERR(engine)) {
 			of_node_put(remote);
 			of_node_put(port);
@@ -469,21 +484,27 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon;
 	int ret;
 
-	engine = sun4i_tcon_find_engine(drv, dev->of_node);
-	if (IS_ERR(engine)) {
-		dev_err(dev, "Couldn't find matching engine\n");
-		return -EPROBE_DEFER;
-	}
-
 	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
 	if (!tcon)
 		return -ENOMEM;
 	dev_set_drvdata(dev, tcon);
 	tcon->drm = drm;
 	tcon->dev = dev;
-	tcon->id = engine->id;
 	tcon->quirks = of_device_get_match_data(dev);
 
+	/*
+	 * As we keep the connection between DE2 mixer and TCON not swapped,
+	 * skip the bonus endpoints (which stand for swapped connection)
+	 * when finding the correspoing engine.
+	 */
+	engine = sun4i_tcon_find_engine(drv, dev->of_node,
+					tcon->quirks->swappable_input);
+	if (IS_ERR(engine)) {
+		dev_err(dev, "Couldn't find matching engine\n");
+		return -EPROBE_DEFER;
+	}
+	tcon->id = engine->id;
+
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
 		dev_err(dev, "Couldn't get our reset line\n");
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index d37e1e2ed60e..568dc736238a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -146,6 +146,8 @@
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* Some DE2 can swap the mixer<->TCON connection */
+	bool	swappable_input;
 };
 
 struct sun4i_tcon {
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 04/11] drm: sun4i: add support for H3's TCON0/1
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng, Icenowy Zheng

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 has two special TCONs, both come without channel0. And the
TCON1 of H3 has no special clocks even for the channel1.

Add support for these kinds of TCON.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 78 ++++++++++++++++++++++++++++----------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  3 ++
 2 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 89a215ff2370..7009292f99e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -57,6 +57,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Disable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE, 0);
 		clk_disable_unprepare(tcon->dclk);
@@ -66,7 +67,8 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 	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);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_disable_unprepare(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
@@ -74,6 +76,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Enable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE,
 				   SUN4I_TCON0_CTL_TCON_ENABLE);
@@ -85,7 +88,8 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE,
 			   SUN4I_TCON1_CTL_TCON_ENABLE);
-	clk_prepare_enable(tcon->sclk1);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_prepare_enable(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_enable);
 
@@ -132,6 +136,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 
 	/* Configure the dot clock */
 	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+	WARN_ON(!tcon->quirks->has_channel_0);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -209,7 +214,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	WARN_ON(!tcon->quirks->has_channel_1);
 
 	/* Configure the dot clock */
-	clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -327,13 +333,15 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 	}
 	clk_prepare_enable(tcon->clk);
 
-	tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
-	if (IS_ERR(tcon->sclk0)) {
-		dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
-		return PTR_ERR(tcon->sclk0);
+	if (tcon->quirks->has_channel_0) {
+		tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
+		if (IS_ERR(tcon->sclk0)) {
+			dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
+			return PTR_ERR(tcon->sclk0);
+		}
 	}
 
-	if (tcon->quirks->has_channel_1) {
+	if (tcon->quirks->has_channel_1 && tcon->quirks->has_channel_1_clk) {
 		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");
@@ -533,10 +541,12 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		goto err_free_clocks;
 	}
 
-	ret = sun4i_dclk_create(dev, tcon);
-	if (ret) {
-		dev_err(dev, "Couldn't create our TCON dot clock\n");
-		goto err_free_clocks;
+	if (tcon->quirks->has_channel_0) {
+		ret = sun4i_dclk_create(dev, tcon);
+		if (ret) {
+			dev_err(dev, "Couldn't create our TCON dot clock\n");
+			goto err_free_clocks;
+		}
 	}
 
 	ret = sun4i_tcon_init_irq(dev, tcon);
@@ -561,7 +571,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	return 0;
 
 err_free_dotclock:
-	sun4i_dclk_free(tcon);
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 err_free_clocks:
 	sun4i_tcon_free_clocks(tcon);
 err_assert_reset:
@@ -575,7 +586,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon = dev_get_drvdata(dev);
 
 	list_del(&tcon->list);
-	sun4i_dclk_free(tcon);
+
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 	sun4i_tcon_free_clocks(tcon);
 }
 
@@ -606,24 +619,41 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 }
 
 static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
-	.has_unknown_mux = true,
-	.has_channel_1	= true,
+	.has_unknown_mux	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon0_quirks = {
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
+	.swappable_input	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon1_quirks = {
+	.has_channel_1		= true,
+	.swappable_input	= true,
 };
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
@@ -632,6 +662,14 @@ static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
+	{
+		.compatible = "allwinner,sun8i-h3-tcon0",
+		.data = &sun8i_h3_tcon0_quirks
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tcon1",
+		.data = &sun8i_h3_tcon1_quirks
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 568dc736238a..6aeb2d68b523 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -145,7 +145,10 @@
 
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
+	bool	has_channel_0;	/* some A83T+ TCONs don't have channel 0*/
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* H3 TCON1 doesn't have channel 1 sclk */
+	bool	has_channel_1_clk;
 	/* Some DE2 can swap the mixer<->TCON connection */
 	bool	swappable_input;
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 04/11] drm: sun4i: add support for H3's TCON0/1
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng, Icenowy Zheng

From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>

Allwinner H3 has two special TCONs, both come without channel0. And the
TCON1 of H3 has no special clocks even for the channel1.

Add support for these kinds of TCON.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 78 ++++++++++++++++++++++++++++----------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  3 ++
 2 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 89a215ff2370..7009292f99e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -57,6 +57,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Disable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE, 0);
 		clk_disable_unprepare(tcon->dclk);
@@ -66,7 +67,8 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 	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);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_disable_unprepare(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
@@ -74,6 +76,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Enable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE,
 				   SUN4I_TCON0_CTL_TCON_ENABLE);
@@ -85,7 +88,8 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE,
 			   SUN4I_TCON1_CTL_TCON_ENABLE);
-	clk_prepare_enable(tcon->sclk1);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_prepare_enable(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_enable);
 
@@ -132,6 +136,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 
 	/* Configure the dot clock */
 	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+	WARN_ON(!tcon->quirks->has_channel_0);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -209,7 +214,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	WARN_ON(!tcon->quirks->has_channel_1);
 
 	/* Configure the dot clock */
-	clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -327,13 +333,15 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 	}
 	clk_prepare_enable(tcon->clk);
 
-	tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
-	if (IS_ERR(tcon->sclk0)) {
-		dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
-		return PTR_ERR(tcon->sclk0);
+	if (tcon->quirks->has_channel_0) {
+		tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
+		if (IS_ERR(tcon->sclk0)) {
+			dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
+			return PTR_ERR(tcon->sclk0);
+		}
 	}
 
-	if (tcon->quirks->has_channel_1) {
+	if (tcon->quirks->has_channel_1 && tcon->quirks->has_channel_1_clk) {
 		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");
@@ -533,10 +541,12 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		goto err_free_clocks;
 	}
 
-	ret = sun4i_dclk_create(dev, tcon);
-	if (ret) {
-		dev_err(dev, "Couldn't create our TCON dot clock\n");
-		goto err_free_clocks;
+	if (tcon->quirks->has_channel_0) {
+		ret = sun4i_dclk_create(dev, tcon);
+		if (ret) {
+			dev_err(dev, "Couldn't create our TCON dot clock\n");
+			goto err_free_clocks;
+		}
 	}
 
 	ret = sun4i_tcon_init_irq(dev, tcon);
@@ -561,7 +571,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	return 0;
 
 err_free_dotclock:
-	sun4i_dclk_free(tcon);
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 err_free_clocks:
 	sun4i_tcon_free_clocks(tcon);
 err_assert_reset:
@@ -575,7 +586,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon = dev_get_drvdata(dev);
 
 	list_del(&tcon->list);
-	sun4i_dclk_free(tcon);
+
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 	sun4i_tcon_free_clocks(tcon);
 }
 
@@ -606,24 +619,41 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 }
 
 static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
-	.has_unknown_mux = true,
-	.has_channel_1	= true,
+	.has_unknown_mux	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon0_quirks = {
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
+	.swappable_input	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon1_quirks = {
+	.has_channel_1		= true,
+	.swappable_input	= true,
 };
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
@@ -632,6 +662,14 @@ static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
+	{
+		.compatible = "allwinner,sun8i-h3-tcon0",
+		.data = &sun8i_h3_tcon0_quirks
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tcon1",
+		.data = &sun8i_h3_tcon1_quirks
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 568dc736238a..6aeb2d68b523 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -145,7 +145,10 @@
 
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
+	bool	has_channel_0;	/* some A83T+ TCONs don't have channel 0*/
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* H3 TCON1 doesn't have channel 1 sclk */
+	bool	has_channel_1_clk;
 	/* Some DE2 can swap the mixer<->TCON connection */
 	bool	swappable_input;
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 04/11] drm: sun4i: add support for H3's TCON0/1
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, Icenowy Zheng,
	linux-clk, linux-arm-kernel, Icenowy Zheng

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 has two special TCONs, both come without channel0. And the
TCON1 of H3 has no special clocks even for the channel1.

Add support for these kinds of TCON.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 78 ++++++++++++++++++++++++++++----------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  3 ++
 2 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 89a215ff2370..7009292f99e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -57,6 +57,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Disable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE, 0);
 		clk_disable_unprepare(tcon->dclk);
@@ -66,7 +67,8 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 	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);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_disable_unprepare(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
@@ -74,6 +76,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Enable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE,
 				   SUN4I_TCON0_CTL_TCON_ENABLE);
@@ -85,7 +88,8 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE,
 			   SUN4I_TCON1_CTL_TCON_ENABLE);
-	clk_prepare_enable(tcon->sclk1);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_prepare_enable(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_enable);
 
@@ -132,6 +136,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 
 	/* Configure the dot clock */
 	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+	WARN_ON(!tcon->quirks->has_channel_0);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -209,7 +214,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	WARN_ON(!tcon->quirks->has_channel_1);
 
 	/* Configure the dot clock */
-	clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -327,13 +333,15 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 	}
 	clk_prepare_enable(tcon->clk);
 
-	tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
-	if (IS_ERR(tcon->sclk0)) {
-		dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
-		return PTR_ERR(tcon->sclk0);
+	if (tcon->quirks->has_channel_0) {
+		tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
+		if (IS_ERR(tcon->sclk0)) {
+			dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
+			return PTR_ERR(tcon->sclk0);
+		}
 	}
 
-	if (tcon->quirks->has_channel_1) {
+	if (tcon->quirks->has_channel_1 && tcon->quirks->has_channel_1_clk) {
 		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");
@@ -533,10 +541,12 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		goto err_free_clocks;
 	}
 
-	ret = sun4i_dclk_create(dev, tcon);
-	if (ret) {
-		dev_err(dev, "Couldn't create our TCON dot clock\n");
-		goto err_free_clocks;
+	if (tcon->quirks->has_channel_0) {
+		ret = sun4i_dclk_create(dev, tcon);
+		if (ret) {
+			dev_err(dev, "Couldn't create our TCON dot clock\n");
+			goto err_free_clocks;
+		}
 	}
 
 	ret = sun4i_tcon_init_irq(dev, tcon);
@@ -561,7 +571,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	return 0;
 
 err_free_dotclock:
-	sun4i_dclk_free(tcon);
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 err_free_clocks:
 	sun4i_tcon_free_clocks(tcon);
 err_assert_reset:
@@ -575,7 +586,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon = dev_get_drvdata(dev);
 
 	list_del(&tcon->list);
-	sun4i_dclk_free(tcon);
+
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 	sun4i_tcon_free_clocks(tcon);
 }
 
@@ -606,24 +619,41 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 }
 
 static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
-	.has_unknown_mux = true,
-	.has_channel_1	= true,
+	.has_unknown_mux	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon0_quirks = {
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
+	.swappable_input	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon1_quirks = {
+	.has_channel_1		= true,
+	.swappable_input	= true,
 };
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
@@ -632,6 +662,14 @@ static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
+	{
+		.compatible = "allwinner,sun8i-h3-tcon0",
+		.data = &sun8i_h3_tcon0_quirks
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tcon1",
+		.data = &sun8i_h3_tcon1_quirks
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 568dc736238a..6aeb2d68b523 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -145,7 +145,10 @@
 
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
+	bool	has_channel_0;	/* some A83T+ TCONs don't have channel 0*/
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* H3 TCON1 doesn't have channel 1 sclk */
+	bool	has_channel_1_clk;
 	/* Some DE2 can swap the mixer<->TCON connection */
 	bool	swappable_input;
 };
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 04/11] drm: sun4i: add support for H3's TCON0/1
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner H3 has two special TCONs, both come without channel0. And the
TCON1 of H3 has no special clocks even for the channel1.

Add support for these kinds of TCON.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 78 ++++++++++++++++++++++++++++----------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  3 ++
 2 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 89a215ff2370..7009292f99e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -57,6 +57,7 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Disable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE, 0);
 		clk_disable_unprepare(tcon->dclk);
@@ -66,7 +67,8 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 	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);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_disable_unprepare(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
@@ -74,6 +76,7 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 {
 	/* Enable the TCON's channel */
 	if (channel == 0) {
+		WARN_ON(!tcon->quirks->has_channel_0);
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE,
 				   SUN4I_TCON0_CTL_TCON_ENABLE);
@@ -85,7 +88,8 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
 			   SUN4I_TCON1_CTL_TCON_ENABLE,
 			   SUN4I_TCON1_CTL_TCON_ENABLE);
-	clk_prepare_enable(tcon->sclk1);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_prepare_enable(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_enable);
 
@@ -132,6 +136,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 
 	/* Configure the dot clock */
 	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+	WARN_ON(!tcon->quirks->has_channel_0);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -209,7 +214,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	WARN_ON(!tcon->quirks->has_channel_1);
 
 	/* Configure the dot clock */
-	clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
+	if (tcon->quirks->has_channel_1_clk)
+		clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -327,13 +333,15 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 	}
 	clk_prepare_enable(tcon->clk);
 
-	tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
-	if (IS_ERR(tcon->sclk0)) {
-		dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
-		return PTR_ERR(tcon->sclk0);
+	if (tcon->quirks->has_channel_0) {
+		tcon->sclk0 = devm_clk_get(dev, "tcon-ch0");
+		if (IS_ERR(tcon->sclk0)) {
+			dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
+			return PTR_ERR(tcon->sclk0);
+		}
 	}
 
-	if (tcon->quirks->has_channel_1) {
+	if (tcon->quirks->has_channel_1 && tcon->quirks->has_channel_1_clk) {
 		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");
@@ -533,10 +541,12 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		goto err_free_clocks;
 	}
 
-	ret = sun4i_dclk_create(dev, tcon);
-	if (ret) {
-		dev_err(dev, "Couldn't create our TCON dot clock\n");
-		goto err_free_clocks;
+	if (tcon->quirks->has_channel_0) {
+		ret = sun4i_dclk_create(dev, tcon);
+		if (ret) {
+			dev_err(dev, "Couldn't create our TCON dot clock\n");
+			goto err_free_clocks;
+		}
 	}
 
 	ret = sun4i_tcon_init_irq(dev, tcon);
@@ -561,7 +571,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	return 0;
 
 err_free_dotclock:
-	sun4i_dclk_free(tcon);
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 err_free_clocks:
 	sun4i_tcon_free_clocks(tcon);
 err_assert_reset:
@@ -575,7 +586,9 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
 	struct sun4i_tcon *tcon = dev_get_drvdata(dev);
 
 	list_del(&tcon->list);
-	sun4i_dclk_free(tcon);
+
+	if (tcon->quirks->has_channel_0)
+		sun4i_dclk_free(tcon);
 	sun4i_tcon_free_clocks(tcon);
 }
 
@@ -606,24 +619,41 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 }
 
 static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
-	.has_unknown_mux = true,
-	.has_channel_1	= true,
+	.has_unknown_mux	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
-	.has_channel_1	= true,
+	.has_channel_0		= true,
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
 };
 
 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
-	/* nothing is supported */
+	.has_channel_0	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon0_quirks = {
+	.has_channel_1		= true,
+	.has_channel_1_clk	= true,
+	.swappable_input	= true,
+};
+
+static const struct sun4i_tcon_quirks sun8i_h3_tcon1_quirks = {
+	.has_channel_1		= true,
+	.swappable_input	= true,
 };
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
@@ -632,6 +662,14 @@ static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
 	{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
 	{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
+	{
+		.compatible = "allwinner,sun8i-h3-tcon0",
+		.data = &sun8i_h3_tcon0_quirks
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tcon1",
+		.data = &sun8i_h3_tcon1_quirks
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 568dc736238a..6aeb2d68b523 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -145,7 +145,10 @@
 
 struct sun4i_tcon_quirks {
 	bool	has_unknown_mux; /* sun5i has undocumented mux */
+	bool	has_channel_0;	/* some A83T+ TCONs don't have channel 0*/
 	bool	has_channel_1;	/* a33 does not have channel 1 */
+	/* H3 TCON1 doesn't have channel 1 sclk */
+	bool	has_channel_1_clk;
 	/* Some DE2 can swap the mixer<->TCON connection */
 	bool	swappable_input;
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 05/11] drm: sun4i: add compatible for H3 display engine
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Add a compatible string for H3 display engine in sun4i_drv code.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 29bf1325ded6..c0de0741c923 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -324,6 +324,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31-display-engine" },
 	{ .compatible = "allwinner,sun6i-a31s-display-engine" },
 	{ .compatible = "allwinner,sun8i-a33-display-engine" },
+	{ .compatible = "allwinner,sun8i-h3-display-engine" },
 	{ .compatible = "allwinner,sun8i-v3s-display-engine" },
 	{ }
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 05/11] drm: sun4i: add compatible for H3 display engine
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Add a compatible string for H3 display engine in sun4i_drv code.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 29bf1325ded6..c0de0741c923 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -324,6 +324,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31-display-engine" },
 	{ .compatible = "allwinner,sun6i-a31s-display-engine" },
 	{ .compatible = "allwinner,sun8i-a33-display-engine" },
+	{ .compatible = "allwinner,sun8i-h3-display-engine" },
 	{ .compatible = "allwinner,sun8i-v3s-display-engine" },
 	{ }
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 05/11] drm: sun4i: add compatible for H3 display engine
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Add a compatible string for H3 display engine in sun4i_drv code.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 29bf1325ded6..c0de0741c923 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -324,6 +324,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
 	{ .compatible = "allwinner,sun6i-a31-display-engine" },
 	{ .compatible = "allwinner,sun6i-a31s-display-engine" },
 	{ .compatible = "allwinner,sun8i-a33-display-engine" },
+	{ .compatible = "allwinner,sun8i-h3-display-engine" },
 	{ .compatible = "allwinner,sun8i-v3s-display-engine" },
 	{ }
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

The DE2 mixer can do color space correction needed by TV Encoder with
its DCSC sub-engine.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h |  6 +++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index d658a3a8159a..65f86641eca3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -29,6 +29,14 @@
 #include "sun8i_layer.h"
 #include "sunxi_engine.h"
 
+static const u32 sun8i_rgb2yuv_coef[12] = {
+	0x00000107, 0x00000204, 0x00000064, 0x00004200,
+	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
+	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
+};
+
+static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
+
 static void sun8i_mixer_commit(struct sunxi_engine *engine)
 {
 	DRM_DEBUG_DRIVER("Committing changes\n");
@@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine)
 		     SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
 }
 
+static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
+{
+	int i;
+
+	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
+
+	/* Set color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
+
+	for (i = 0; i < 12; i++)
+		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
+			     sun8i_rgb2yuv_coef[i]);
+
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
+		     sun8i_rgb2yuv_dcsc_alpha);
+}
+
+static void sun8i_mixer_disable_color_correction(struct sunxi_engine *engine)
+{
+	DRM_DEBUG_DRIVER("Disabling color correction\n");
+
+	/* Disable color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
+}
+
 void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
 				int layer, bool enable)
 {
@@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer,
 static const struct sunxi_engine_ops sun8i_engine_ops = {
 	.commit		= sun8i_mixer_commit,
 	.layers_init	= sun8i_layers_init,
+	.apply_color_correction		= sun8i_mixer_apply_color_correction,
+	.disable_color_correction	= sun8i_mixer_disable_color_correction,
 };
 
 static struct regmap_config sun8i_mixer_regmap_config = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 4785ac090b8c..d7f7513898b6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -88,6 +88,11 @@
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
 
+/* The DCSC sub-engine is used to do color space conversation */
+#define SUN8I_MIXER_DCSC_EN			0xb0000
+#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
+#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
+
 /*
  * These sub-engines are still unknown now, the EN registers are here only to
  * be used to disable these sub-engines.
@@ -102,7 +107,6 @@
 #define SUN8I_MIXER_PEAK_EN			0xa6000
 #define SUN8I_MIXER_ASE_EN			0xa8000
 #define SUN8I_MIXER_FCC_EN			0xaa000
-#define SUN8I_MIXER_DCSC_EN			0xb0000
 
 struct sun8i_mixer_cfg {
 	int		vi_num;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

The DE2 mixer can do color space correction needed by TV Encoder with
its DCSC sub-engine.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h |  6 +++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index d658a3a8159a..65f86641eca3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -29,6 +29,14 @@
 #include "sun8i_layer.h"
 #include "sunxi_engine.h"
 
+static const u32 sun8i_rgb2yuv_coef[12] = {
+	0x00000107, 0x00000204, 0x00000064, 0x00004200,
+	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
+	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
+};
+
+static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
+
 static void sun8i_mixer_commit(struct sunxi_engine *engine)
 {
 	DRM_DEBUG_DRIVER("Committing changes\n");
@@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine)
 		     SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
 }
 
+static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
+{
+	int i;
+
+	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
+
+	/* Set color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
+
+	for (i = 0; i < 12; i++)
+		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
+			     sun8i_rgb2yuv_coef[i]);
+
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
+		     sun8i_rgb2yuv_dcsc_alpha);
+}
+
+static void sun8i_mixer_disable_color_correction(struct sunxi_engine *engine)
+{
+	DRM_DEBUG_DRIVER("Disabling color correction\n");
+
+	/* Disable color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
+}
+
 void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
 				int layer, bool enable)
 {
@@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer,
 static const struct sunxi_engine_ops sun8i_engine_ops = {
 	.commit		= sun8i_mixer_commit,
 	.layers_init	= sun8i_layers_init,
+	.apply_color_correction		= sun8i_mixer_apply_color_correction,
+	.disable_color_correction	= sun8i_mixer_disable_color_correction,
 };
 
 static struct regmap_config sun8i_mixer_regmap_config = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 4785ac090b8c..d7f7513898b6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -88,6 +88,11 @@
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
 
+/* The DCSC sub-engine is used to do color space conversation */
+#define SUN8I_MIXER_DCSC_EN			0xb0000
+#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
+#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
+
 /*
  * These sub-engines are still unknown now, the EN registers are here only to
  * be used to disable these sub-engines.
@@ -102,7 +107,6 @@
 #define SUN8I_MIXER_PEAK_EN			0xa6000
 #define SUN8I_MIXER_ASE_EN			0xa8000
 #define SUN8I_MIXER_FCC_EN			0xaa000
-#define SUN8I_MIXER_DCSC_EN			0xb0000
 
 struct sun8i_mixer_cfg {
 	int		vi_num;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

The DE2 mixer can do color space correction needed by TV Encoder with
its DCSC sub-engine.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h |  6 +++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index d658a3a8159a..65f86641eca3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -29,6 +29,14 @@
 #include "sun8i_layer.h"
 #include "sunxi_engine.h"
 
+static const u32 sun8i_rgb2yuv_coef[12] = {
+	0x00000107, 0x00000204, 0x00000064, 0x00004200,
+	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
+	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
+};
+
+static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
+
 static void sun8i_mixer_commit(struct sunxi_engine *engine)
 {
 	DRM_DEBUG_DRIVER("Committing changes\n");
@@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine)
 		     SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
 }
 
+static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
+{
+	int i;
+
+	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
+
+	/* Set color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
+
+	for (i = 0; i < 12; i++)
+		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
+			     sun8i_rgb2yuv_coef[i]);
+
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
+		     sun8i_rgb2yuv_dcsc_alpha);
+}
+
+static void sun8i_mixer_disable_color_correction(struct sunxi_engine *engine)
+{
+	DRM_DEBUG_DRIVER("Disabling color correction\n");
+
+	/* Disable color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
+}
+
 void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
 				int layer, bool enable)
 {
@@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer,
 static const struct sunxi_engine_ops sun8i_engine_ops = {
 	.commit		= sun8i_mixer_commit,
 	.layers_init	= sun8i_layers_init,
+	.apply_color_correction		= sun8i_mixer_apply_color_correction,
+	.disable_color_correction	= sun8i_mixer_disable_color_correction,
 };
 
 static struct regmap_config sun8i_mixer_regmap_config = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 4785ac090b8c..d7f7513898b6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -88,6 +88,11 @@
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
 
+/* The DCSC sub-engine is used to do color space conversation */
+#define SUN8I_MIXER_DCSC_EN			0xb0000
+#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
+#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
+
 /*
  * These sub-engines are still unknown now, the EN registers are here only to
  * be used to disable these sub-engines.
@@ -102,7 +107,6 @@
 #define SUN8I_MIXER_PEAK_EN			0xa6000
 #define SUN8I_MIXER_ASE_EN			0xa8000
 #define SUN8I_MIXER_FCC_EN			0xaa000
-#define SUN8I_MIXER_DCSC_EN			0xb0000
 
 struct sun8i_mixer_cfg {
 	int		vi_num;
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

The DE2 mixer can do color space correction needed by TV Encoder with
its DCSC sub-engine.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun8i_mixer.h |  6 +++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index d658a3a8159a..65f86641eca3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -29,6 +29,14 @@
 #include "sun8i_layer.h"
 #include "sunxi_engine.h"
 
+static const u32 sun8i_rgb2yuv_coef[12] = {
+	0x00000107, 0x00000204, 0x00000064, 0x00004200,
+	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
+	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
+};
+
+static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
+
 static void sun8i_mixer_commit(struct sunxi_engine *engine)
 {
 	DRM_DEBUG_DRIVER("Committing changes\n");
@@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine)
 		     SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
 }
 
+static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
+{
+	int i;
+
+	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
+
+	/* Set color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
+
+	for (i = 0; i < 12; i++)
+		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
+			     sun8i_rgb2yuv_coef[i]);
+
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
+		     sun8i_rgb2yuv_dcsc_alpha);
+}
+
+static void sun8i_mixer_disable_color_correction(struct sunxi_engine *engine)
+{
+	DRM_DEBUG_DRIVER("Disabling color correction\n");
+
+	/* Disable color correction */
+	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
+}
+
 void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
 				int layer, bool enable)
 {
@@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer,
 static const struct sunxi_engine_ops sun8i_engine_ops = {
 	.commit		= sun8i_mixer_commit,
 	.layers_init	= sun8i_layers_init,
+	.apply_color_correction		= sun8i_mixer_apply_color_correction,
+	.disable_color_correction	= sun8i_mixer_disable_color_correction,
 };
 
 static struct regmap_config sun8i_mixer_regmap_config = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 4785ac090b8c..d7f7513898b6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -88,6 +88,11 @@
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
 
+/* The DCSC sub-engine is used to do color space conversation */
+#define SUN8I_MIXER_DCSC_EN			0xb0000
+#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
+#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
+
 /*
  * These sub-engines are still unknown now, the EN registers are here only to
  * be used to disable these sub-engines.
@@ -102,7 +107,6 @@
 #define SUN8I_MIXER_PEAK_EN			0xa6000
 #define SUN8I_MIXER_ASE_EN			0xa8000
 #define SUN8I_MIXER_FCC_EN			0xaa000
-#define SUN8I_MIXER_DCSC_EN			0xb0000
 
 struct sun8i_mixer_cfg {
 	int		vi_num;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
but with some different points about clocks:
- It has a mod clock and a bus clock.
- The mod clock must be at a fixed rate to generate signal.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 65 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index a9cad00d4ee8..c9943103f499 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -169,14 +170,23 @@ struct tv_mode {
 	const struct resync_parameters	*resync_params;
 };
 
+struct sun4i_tv_quirks {
+	bool has_mod_clk;
+	bool fixed_clock;
+	unsigned long fixed_clock_rate;
+};
+
 struct sun4i_tv {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
 
 	struct clk		*clk;
+	struct clk		*mod_clk;
 	struct regmap		*regs;
 	struct reset_control	*reset;
 
+	const struct sun4i_tv_quirks *quirks;
+
 	struct sun4i_drv	*drv;
 };
 
@@ -578,6 +588,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	tv->drv = drv;
 	dev_set_drvdata(dev, tv);
 
+	tv->quirks = of_device_get_match_data(dev);
+	if (!tv->quirks)
+		return -EINVAL;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs)) {
@@ -604,7 +618,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	tv->clk = devm_clk_get(dev, NULL);
+	if (tv->quirks->has_mod_clk)
+		tv->clk = devm_clk_get(dev, "bus");
+	else
+		tv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(tv->clk)) {
 		dev_err(dev, "Couldn't get the TV encoder clock\n");
 		ret = PTR_ERR(tv->clk);
@@ -612,6 +629,26 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	}
 	clk_prepare_enable(tv->clk);
 
+	if (tv->quirks->has_mod_clk) {
+		tv->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(tv->mod_clk)) {
+			dev_err(dev, "Couldn't get the TV encoder mod clock\n");
+			ret = PTR_ERR(tv->mod_clk);
+			goto err_disable_clk;
+		};
+
+		if (tv->quirks->fixed_clock) {
+			ret = clk_set_rate(tv->mod_clk,
+					   tv->quirks->fixed_clock_rate);
+			if (ret) {
+				dev_err(dev, "Couldn't set TV encoder mod clock rate\n");
+				goto err_disable_clk;
+			}
+		}
+
+		clk_prepare_enable(tv->mod_clk);
+	}
+
 	drm_encoder_helper_add(&tv->encoder,
 			       &sun4i_tv_helper_funcs);
 	ret = drm_encoder_init(drm,
@@ -621,14 +658,14 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 			       NULL);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the TV encoder\n");
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	tv->encoder.possible_crtcs = drm_of_find_possible_crtcs(drm,
 								dev->of_node);
 	if (!tv->encoder.possible_crtcs) {
 		ret = -EPROBE_DEFER;
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	drm_connector_helper_add(&tv->connector,
@@ -649,6 +686,9 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 
 err_cleanup_connector:
 	drm_encoder_cleanup(&tv->encoder);
+err_disable_mod_clk:
+	if (tv->quirks->has_mod_clk)
+		clk_disable_unprepare(tv->mod_clk);
 err_disable_clk:
 	clk_disable_unprepare(tv->clk);
 err_assert_reset:
@@ -683,8 +723,25 @@ static int sun4i_tv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct sun4i_tv_quirks sun4i_a10_tv_quirks = {
+	/* Nothing special */
+};
+
+static const struct sun4i_tv_quirks sun8i_h3_tv_quirks = {
+	.has_mod_clk = true,
+	.fixed_clock = true,
+	.fixed_clock_rate = 216000000UL,
+};
+
 static const struct of_device_id sun4i_tv_of_table[] = {
-	{ .compatible = "allwinner,sun4i-a10-tv-encoder" },
+	{
+		.compatible = "allwinner,sun4i-a10-tv-encoder",
+		.data = &sun4i_a10_tv_quirks,
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tv-encoder",
+		.data = &sun8i_h3_tv_quirks,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tv_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
but with some different points about clocks:
- It has a mod clock and a bus clock.
- The mod clock must be at a fixed rate to generate signal.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 65 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index a9cad00d4ee8..c9943103f499 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -169,14 +170,23 @@ struct tv_mode {
 	const struct resync_parameters	*resync_params;
 };
 
+struct sun4i_tv_quirks {
+	bool has_mod_clk;
+	bool fixed_clock;
+	unsigned long fixed_clock_rate;
+};
+
 struct sun4i_tv {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
 
 	struct clk		*clk;
+	struct clk		*mod_clk;
 	struct regmap		*regs;
 	struct reset_control	*reset;
 
+	const struct sun4i_tv_quirks *quirks;
+
 	struct sun4i_drv	*drv;
 };
 
@@ -578,6 +588,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	tv->drv = drv;
 	dev_set_drvdata(dev, tv);
 
+	tv->quirks = of_device_get_match_data(dev);
+	if (!tv->quirks)
+		return -EINVAL;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs)) {
@@ -604,7 +618,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	tv->clk = devm_clk_get(dev, NULL);
+	if (tv->quirks->has_mod_clk)
+		tv->clk = devm_clk_get(dev, "bus");
+	else
+		tv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(tv->clk)) {
 		dev_err(dev, "Couldn't get the TV encoder clock\n");
 		ret = PTR_ERR(tv->clk);
@@ -612,6 +629,26 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	}
 	clk_prepare_enable(tv->clk);
 
+	if (tv->quirks->has_mod_clk) {
+		tv->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(tv->mod_clk)) {
+			dev_err(dev, "Couldn't get the TV encoder mod clock\n");
+			ret = PTR_ERR(tv->mod_clk);
+			goto err_disable_clk;
+		};
+
+		if (tv->quirks->fixed_clock) {
+			ret = clk_set_rate(tv->mod_clk,
+					   tv->quirks->fixed_clock_rate);
+			if (ret) {
+				dev_err(dev, "Couldn't set TV encoder mod clock rate\n");
+				goto err_disable_clk;
+			}
+		}
+
+		clk_prepare_enable(tv->mod_clk);
+	}
+
 	drm_encoder_helper_add(&tv->encoder,
 			       &sun4i_tv_helper_funcs);
 	ret = drm_encoder_init(drm,
@@ -621,14 +658,14 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 			       NULL);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the TV encoder\n");
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	tv->encoder.possible_crtcs = drm_of_find_possible_crtcs(drm,
 								dev->of_node);
 	if (!tv->encoder.possible_crtcs) {
 		ret = -EPROBE_DEFER;
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	drm_connector_helper_add(&tv->connector,
@@ -649,6 +686,9 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 
 err_cleanup_connector:
 	drm_encoder_cleanup(&tv->encoder);
+err_disable_mod_clk:
+	if (tv->quirks->has_mod_clk)
+		clk_disable_unprepare(tv->mod_clk);
 err_disable_clk:
 	clk_disable_unprepare(tv->clk);
 err_assert_reset:
@@ -683,8 +723,25 @@ static int sun4i_tv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct sun4i_tv_quirks sun4i_a10_tv_quirks = {
+	/* Nothing special */
+};
+
+static const struct sun4i_tv_quirks sun8i_h3_tv_quirks = {
+	.has_mod_clk = true,
+	.fixed_clock = true,
+	.fixed_clock_rate = 216000000UL,
+};
+
 static const struct of_device_id sun4i_tv_of_table[] = {
-	{ .compatible = "allwinner,sun4i-a10-tv-encoder" },
+	{
+		.compatible = "allwinner,sun4i-a10-tv-encoder",
+		.data = &sun4i_a10_tv_quirks,
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tv-encoder",
+		.data = &sun8i_h3_tv_quirks,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tv_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
but with some different points about clocks:
- It has a mod clock and a bus clock.
- The mod clock must be at a fixed rate to generate signal.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 65 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index a9cad00d4ee8..c9943103f499 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -169,14 +170,23 @@ struct tv_mode {
 	const struct resync_parameters	*resync_params;
 };
 
+struct sun4i_tv_quirks {
+	bool has_mod_clk;
+	bool fixed_clock;
+	unsigned long fixed_clock_rate;
+};
+
 struct sun4i_tv {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
 
 	struct clk		*clk;
+	struct clk		*mod_clk;
 	struct regmap		*regs;
 	struct reset_control	*reset;
 
+	const struct sun4i_tv_quirks *quirks;
+
 	struct sun4i_drv	*drv;
 };
 
@@ -578,6 +588,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	tv->drv = drv;
 	dev_set_drvdata(dev, tv);
 
+	tv->quirks = of_device_get_match_data(dev);
+	if (!tv->quirks)
+		return -EINVAL;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs)) {
@@ -604,7 +618,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	tv->clk = devm_clk_get(dev, NULL);
+	if (tv->quirks->has_mod_clk)
+		tv->clk = devm_clk_get(dev, "bus");
+	else
+		tv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(tv->clk)) {
 		dev_err(dev, "Couldn't get the TV encoder clock\n");
 		ret = PTR_ERR(tv->clk);
@@ -612,6 +629,26 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	}
 	clk_prepare_enable(tv->clk);
 
+	if (tv->quirks->has_mod_clk) {
+		tv->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(tv->mod_clk)) {
+			dev_err(dev, "Couldn't get the TV encoder mod clock\n");
+			ret = PTR_ERR(tv->mod_clk);
+			goto err_disable_clk;
+		};
+
+		if (tv->quirks->fixed_clock) {
+			ret = clk_set_rate(tv->mod_clk,
+					   tv->quirks->fixed_clock_rate);
+			if (ret) {
+				dev_err(dev, "Couldn't set TV encoder mod clock rate\n");
+				goto err_disable_clk;
+			}
+		}
+
+		clk_prepare_enable(tv->mod_clk);
+	}
+
 	drm_encoder_helper_add(&tv->encoder,
 			       &sun4i_tv_helper_funcs);
 	ret = drm_encoder_init(drm,
@@ -621,14 +658,14 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 			       NULL);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the TV encoder\n");
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	tv->encoder.possible_crtcs = drm_of_find_possible_crtcs(drm,
 								dev->of_node);
 	if (!tv->encoder.possible_crtcs) {
 		ret = -EPROBE_DEFER;
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	drm_connector_helper_add(&tv->connector,
@@ -649,6 +686,9 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 
 err_cleanup_connector:
 	drm_encoder_cleanup(&tv->encoder);
+err_disable_mod_clk:
+	if (tv->quirks->has_mod_clk)
+		clk_disable_unprepare(tv->mod_clk);
 err_disable_clk:
 	clk_disable_unprepare(tv->clk);
 err_assert_reset:
@@ -683,8 +723,25 @@ static int sun4i_tv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct sun4i_tv_quirks sun4i_a10_tv_quirks = {
+	/* Nothing special */
+};
+
+static const struct sun4i_tv_quirks sun8i_h3_tv_quirks = {
+	.has_mod_clk = true,
+	.fixed_clock = true,
+	.fixed_clock_rate = 216000000UL,
+};
+
 static const struct of_device_id sun4i_tv_of_table[] = {
-	{ .compatible = "allwinner,sun4i-a10-tv-encoder" },
+	{
+		.compatible = "allwinner,sun4i-a10-tv-encoder",
+		.data = &sun4i_a10_tv_quirks,
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tv-encoder",
+		.data = &sun8i_h3_tv_quirks,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tv_of_table);
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
but with some different points about clocks:
- It has a mod clock and a bus clock.
- The mod clock must be at a fixed rate to generate signal.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 65 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index a9cad00d4ee8..c9943103f499 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -169,14 +170,23 @@ struct tv_mode {
 	const struct resync_parameters	*resync_params;
 };
 
+struct sun4i_tv_quirks {
+	bool has_mod_clk;
+	bool fixed_clock;
+	unsigned long fixed_clock_rate;
+};
+
 struct sun4i_tv {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
 
 	struct clk		*clk;
+	struct clk		*mod_clk;
 	struct regmap		*regs;
 	struct reset_control	*reset;
 
+	const struct sun4i_tv_quirks *quirks;
+
 	struct sun4i_drv	*drv;
 };
 
@@ -578,6 +588,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	tv->drv = drv;
 	dev_set_drvdata(dev, tv);
 
+	tv->quirks = of_device_get_match_data(dev);
+	if (!tv->quirks)
+		return -EINVAL;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs)) {
@@ -604,7 +618,10 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	tv->clk = devm_clk_get(dev, NULL);
+	if (tv->quirks->has_mod_clk)
+		tv->clk = devm_clk_get(dev, "bus");
+	else
+		tv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(tv->clk)) {
 		dev_err(dev, "Couldn't get the TV encoder clock\n");
 		ret = PTR_ERR(tv->clk);
@@ -612,6 +629,26 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 	}
 	clk_prepare_enable(tv->clk);
 
+	if (tv->quirks->has_mod_clk) {
+		tv->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(tv->mod_clk)) {
+			dev_err(dev, "Couldn't get the TV encoder mod clock\n");
+			ret = PTR_ERR(tv->mod_clk);
+			goto err_disable_clk;
+		};
+
+		if (tv->quirks->fixed_clock) {
+			ret = clk_set_rate(tv->mod_clk,
+					   tv->quirks->fixed_clock_rate);
+			if (ret) {
+				dev_err(dev, "Couldn't set TV encoder mod clock rate\n");
+				goto err_disable_clk;
+			}
+		}
+
+		clk_prepare_enable(tv->mod_clk);
+	}
+
 	drm_encoder_helper_add(&tv->encoder,
 			       &sun4i_tv_helper_funcs);
 	ret = drm_encoder_init(drm,
@@ -621,14 +658,14 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 			       NULL);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the TV encoder\n");
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	tv->encoder.possible_crtcs = drm_of_find_possible_crtcs(drm,
 								dev->of_node);
 	if (!tv->encoder.possible_crtcs) {
 		ret = -EPROBE_DEFER;
-		goto err_disable_clk;
+		goto err_disable_mod_clk;
 	}
 
 	drm_connector_helper_add(&tv->connector,
@@ -649,6 +686,9 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
 
 err_cleanup_connector:
 	drm_encoder_cleanup(&tv->encoder);
+err_disable_mod_clk:
+	if (tv->quirks->has_mod_clk)
+		clk_disable_unprepare(tv->mod_clk);
 err_disable_clk:
 	clk_disable_unprepare(tv->clk);
 err_assert_reset:
@@ -683,8 +723,25 @@ static int sun4i_tv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct sun4i_tv_quirks sun4i_a10_tv_quirks = {
+	/* Nothing special */
+};
+
+static const struct sun4i_tv_quirks sun8i_h3_tv_quirks = {
+	.has_mod_clk = true,
+	.fixed_clock = true,
+	.fixed_clock_rate = 216000000UL,
+};
+
 static const struct of_device_id sun4i_tv_of_table[] = {
-	{ .compatible = "allwinner,sun4i-a10-tv-encoder" },
+	{
+		.compatible = "allwinner,sun4i-a10-tv-encoder",
+		.data = &sun4i_a10_tv_quirks,
+	},
+	{
+		.compatible = "allwinner,sun8i-h3-tv-encoder",
+		.data = &sun8i_h3_tv_quirks,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tv_of_table);
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Allwinner H3 features a PLL named CLK_PLL_DE, and a mod clock for the
"Display Engine 2.0" named CLK_DE. As the name indicated, the CLK_PLL_DE
is a PLL for CLK_DE.

Only CLK_DE and CLK_TVE have a parent of CLK_PLL_DE, and CLK_TVE is also
one part of the display clocks.

So allow CLK_DE to set CLK_PLL_DE (add CLK_SET_RATE_PARENT to it).

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 4cbc1b701b7c..6e39ba7cb173 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -439,7 +439,7 @@ static SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"dram",
 
 static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
 static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
-				 0x104, 0, 4, 24, 3, BIT(31), 0);
+				 0x104, 0, 4, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const tcon_parents[] = { "pll-video" };
 static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Allwinner H3 features a PLL named CLK_PLL_DE, and a mod clock for the
"Display Engine 2.0" named CLK_DE. As the name indicated, the CLK_PLL_DE
is a PLL for CLK_DE.

Only CLK_DE and CLK_TVE have a parent of CLK_PLL_DE, and CLK_TVE is also
one part of the display clocks.

So allow CLK_DE to set CLK_PLL_DE (add CLK_SET_RATE_PARENT to it).

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 4cbc1b701b7c..6e39ba7cb173 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -439,7 +439,7 @@ static SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"dram",
 
 static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
 static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
-				 0x104, 0, 4, 24, 3, BIT(31), 0);
+				 0x104, 0, 4, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const tcon_parents[] = { "pll-video" };
 static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

Allwinner H3 features a PLL named CLK_PLL_DE, and a mod clock for the
"Display Engine 2.0" named CLK_DE. As the name indicated, the CLK_PLL_DE
is a PLL for CLK_DE.

Only CLK_DE and CLK_TVE have a parent of CLK_PLL_DE, and CLK_TVE is also
one part of the display clocks.

So allow CLK_DE to set CLK_PLL_DE (add CLK_SET_RATE_PARENT to it).

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 4cbc1b701b7c..6e39ba7cb173 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -439,7 +439,7 @@ static SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"dram",
 
 static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
 static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
-				 0x104, 0, 4, 24, 3, BIT(31), 0);
+				 0x104, 0, 4, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const tcon_parents[] = { "pll-video" };
 static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner H3 features a PLL named CLK_PLL_DE, and a mod clock for the
"Display Engine 2.0" named CLK_DE. As the name indicated, the CLK_PLL_DE
is a PLL for CLK_DE.

Only CLK_DE and CLK_TVE have a parent of CLK_PLL_DE, and CLK_TVE is also
one part of the display clocks.

So allow CLK_DE to set CLK_PLL_DE (add CLK_SET_RATE_PARENT to it).

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 4cbc1b701b7c..6e39ba7cb173 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -439,7 +439,7 @@ static SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"dram",
 
 static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
 static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
-				 0x104, 0, 4, 24, 3, BIT(31), 0);
+				 0x104, 0, 4, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const tcon_parents[] = { "pll-video" };
 static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

The CLK_PLL_DE is needed to be referenced in device tree for H3, for
both forcing the parent of PLL_DE.

So export it to the device tree binding header.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h      | 3 +--
 include/dt-bindings/clock/sun8i-h3-ccu.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
index 85973d1e8165..7029091a6c9f 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
@@ -33,9 +33,8 @@
 #define CLK_PLL_PERIPH0_2X	10
 #define CLK_PLL_GPU		11
 #define CLK_PLL_PERIPH1		12
-#define CLK_PLL_DE		13
 
-/* The CPUX clock is exported */
+/* The PLL_DE and CPUX clocks is exported */
 
 #define CLK_AXI			15
 #define CLK_AHB1		16
diff --git a/include/dt-bindings/clock/sun8i-h3-ccu.h b/include/dt-bindings/clock/sun8i-h3-ccu.h
index c2afc41d6964..82496a57efd4 100644
--- a/include/dt-bindings/clock/sun8i-h3-ccu.h
+++ b/include/dt-bindings/clock/sun8i-h3-ccu.h
@@ -43,6 +43,8 @@
 #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_
 #define _DT_BINDINGS_CLK_SUN8I_H3_H_
 
+#define CLK_PLL_DE		13
+
 #define CLK_CPUX		14
 
 #define CLK_BUS_CE		20
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

The CLK_PLL_DE is needed to be referenced in device tree for H3, for
both forcing the parent of PLL_DE.

So export it to the device tree binding header.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h      | 3 +--
 include/dt-bindings/clock/sun8i-h3-ccu.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
index 85973d1e8165..7029091a6c9f 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
@@ -33,9 +33,8 @@
 #define CLK_PLL_PERIPH0_2X	10
 #define CLK_PLL_GPU		11
 #define CLK_PLL_PERIPH1		12
-#define CLK_PLL_DE		13
 
-/* The CPUX clock is exported */
+/* The PLL_DE and CPUX clocks is exported */
 
 #define CLK_AXI			15
 #define CLK_AHB1		16
diff --git a/include/dt-bindings/clock/sun8i-h3-ccu.h b/include/dt-bindings/clock/sun8i-h3-ccu.h
index c2afc41d6964..82496a57efd4 100644
--- a/include/dt-bindings/clock/sun8i-h3-ccu.h
+++ b/include/dt-bindings/clock/sun8i-h3-ccu.h
@@ -43,6 +43,8 @@
 #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_
 #define _DT_BINDINGS_CLK_SUN8I_H3_H_
 
+#define CLK_PLL_DE		13
+
 #define CLK_CPUX		14
 
 #define CLK_BUS_CE		20
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

The CLK_PLL_DE is needed to be referenced in device tree for H3, for
both forcing the parent of PLL_DE.

So export it to the device tree binding header.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h      | 3 +--
 include/dt-bindings/clock/sun8i-h3-ccu.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
index 85973d1e8165..7029091a6c9f 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
@@ -33,9 +33,8 @@
 #define CLK_PLL_PERIPH0_2X	10
 #define CLK_PLL_GPU		11
 #define CLK_PLL_PERIPH1		12
-#define CLK_PLL_DE		13
 
-/* The CPUX clock is exported */
+/* The PLL_DE and CPUX clocks is exported */
 
 #define CLK_AXI			15
 #define CLK_AHB1		16
diff --git a/include/dt-bindings/clock/sun8i-h3-ccu.h b/include/dt-bindings/clock/sun8i-h3-ccu.h
index c2afc41d6964..82496a57efd4 100644
--- a/include/dt-bindings/clock/sun8i-h3-ccu.h
+++ b/include/dt-bindings/clock/sun8i-h3-ccu.h
@@ -43,6 +43,8 @@
 #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_
 #define _DT_BINDINGS_CLK_SUN8I_H3_H_
 
+#define CLK_PLL_DE		13
+
 #define CLK_CPUX		14
 
 #define CLK_BUS_CE		20
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 09/11] clk: sunxi-ng: export CLK_PLL_DE for H3
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

The CLK_PLL_DE is needed to be referenced in device tree for H3, for
both forcing the parent of PLL_DE.

So export it to the device tree binding header.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.h      | 3 +--
 include/dt-bindings/clock/sun8i-h3-ccu.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
index 85973d1e8165..7029091a6c9f 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.h
@@ -33,9 +33,8 @@
 #define CLK_PLL_PERIPH0_2X	10
 #define CLK_PLL_GPU		11
 #define CLK_PLL_PERIPH1		12
-#define CLK_PLL_DE		13
 
-/* The CPUX clock is exported */
+/* The PLL_DE and CPUX clocks is exported */
 
 #define CLK_AXI			15
 #define CLK_AHB1		16
diff --git a/include/dt-bindings/clock/sun8i-h3-ccu.h b/include/dt-bindings/clock/sun8i-h3-ccu.h
index c2afc41d6964..82496a57efd4 100644
--- a/include/dt-bindings/clock/sun8i-h3-ccu.h
+++ b/include/dt-bindings/clock/sun8i-h3-ccu.h
@@ -43,6 +43,8 @@
 #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_
 #define _DT_BINDINGS_CLK_SUN8I_H3_H_
 
+#define CLK_PLL_DE		13
+
 #define CLK_CPUX		14
 
 #define CLK_BUS_CE		20
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

As we have already the support for the TV encoder on Allwinner H3, add
the display engine pipeline device tree nodes to its DTSI file.

The H5 pipeline has some differences and will be enabled later.

The currently-unused mixer0 and tcon0 are also needed, for the
completement of the pipeline.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..20172ef92415 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -41,6 +41,8 @@
  */
 
 #include "sunxi-h3-h5.dtsi"
+#include <dt-bindings/clock/sun8i-de2.h>
+#include <dt-bindings/reset/sun8i-de2.h>
 
 / {
 	cpus {
@@ -72,6 +74,193 @@
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun8i-h3-display-engine";
+		allwinner,pipelines = <&mixer0>,
+				      <&mixer1>;
+		status = "disabled";
+	};
+
+	soc {
+		display_clocks: clock@1000000 {
+			compatible = "allwinner,sun8i-a83t-de2-clk";
+			reg = <0x01000000 0x100000>;
+			clocks = <&ccu CLK_BUS_DE>,
+				 <&ccu CLK_DE>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&ccu RST_BUS_DE>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			assigned-clocks = <&ccu CLK_DE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <432000000>;
+		};
+
+		mixer0: mixer@1100000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer0";
+			reg = <0x01100000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER0>,
+				 <&display_clocks CLK_MIXER0>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_MIXER0>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer0_out_tcon0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon0_in_mixer0>;
+					};
+
+					mixer0_out_tcon1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon1_in_mixer0>;
+					};
+				};
+			};
+		};
+
+		mixer1: mixer@1200000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer1";
+			reg = <0x01200000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER1>,
+				 <&display_clocks CLK_MIXER1>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_WB>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer1_out_tcon1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon1_in_mixer1>;
+					};
+
+					mixer1_out_tcon0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon0_in_mixer1>;
+					};
+				};
+			};
+		};
+
+		tcon0: lcd-controller@1c0c000 {
+			compatible = "allwinner,sun8i-h3-tcon0";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON0>,
+				 <&ccu CLK_TCON0>;
+			clock-names = "ahb",
+				      "tcon-ch1";
+			resets = <&ccu RST_BUS_TCON0>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon0_in_mixer0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer0_out_tcon0>;
+					};
+
+					tcon0_in_mixer1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer1_out_tcon0>;
+					};
+				};
+			};
+		};
+
+		tcon1: lcd-controller@1c0d000 {
+			compatible = "allwinner,sun8i-h3-tcon1";
+			reg = <0x01c0d000 0x1000>;
+			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON1>;
+			clock-names = "ahb";
+			resets = <&ccu RST_BUS_TCON1>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon1_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon1_in_mixer1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer1_out_tcon1>;
+					};
+
+					tcon1_in_mixer0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer0_out_tcon1>;
+					};
+				};
+
+				tcon1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					tcon1_out_tve0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tve0_in_tcon1>;
+					};
+				};
+			};
+		};
+
+		tve0: tv-encoder@1e00000 {
+			compatible = "allwinner,sun8i-h3-tv-encoder";
+			reg = <0x01e00000 0x1000>;
+			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_TVE>;
+			status = "disabled";
+
+			assigned-clocks = <&ccu CLK_TVE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <216000000>;
+
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tve0_in_tcon1: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&tcon1_out_tve0>;
+				};
+			};
+		};
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

As we have already the support for the TV encoder on Allwinner H3, add
the display engine pipeline device tree nodes to its DTSI file.

The H5 pipeline has some differences and will be enabled later.

The currently-unused mixer0 and tcon0 are also needed, for the
completement of the pipeline.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..20172ef92415 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -41,6 +41,8 @@
  */
 
 #include "sunxi-h3-h5.dtsi"
+#include <dt-bindings/clock/sun8i-de2.h>
+#include <dt-bindings/reset/sun8i-de2.h>
 
 / {
 	cpus {
@@ -72,6 +74,193 @@
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun8i-h3-display-engine";
+		allwinner,pipelines = <&mixer0>,
+				      <&mixer1>;
+		status = "disabled";
+	};
+
+	soc {
+		display_clocks: clock@1000000 {
+			compatible = "allwinner,sun8i-a83t-de2-clk";
+			reg = <0x01000000 0x100000>;
+			clocks = <&ccu CLK_BUS_DE>,
+				 <&ccu CLK_DE>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&ccu RST_BUS_DE>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			assigned-clocks = <&ccu CLK_DE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <432000000>;
+		};
+
+		mixer0: mixer@1100000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer0";
+			reg = <0x01100000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER0>,
+				 <&display_clocks CLK_MIXER0>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_MIXER0>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer0_out_tcon0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon0_in_mixer0>;
+					};
+
+					mixer0_out_tcon1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon1_in_mixer0>;
+					};
+				};
+			};
+		};
+
+		mixer1: mixer@1200000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer1";
+			reg = <0x01200000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER1>,
+				 <&display_clocks CLK_MIXER1>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_WB>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer1_out_tcon1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon1_in_mixer1>;
+					};
+
+					mixer1_out_tcon0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon0_in_mixer1>;
+					};
+				};
+			};
+		};
+
+		tcon0: lcd-controller@1c0c000 {
+			compatible = "allwinner,sun8i-h3-tcon0";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON0>,
+				 <&ccu CLK_TCON0>;
+			clock-names = "ahb",
+				      "tcon-ch1";
+			resets = <&ccu RST_BUS_TCON0>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon0_in_mixer0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer0_out_tcon0>;
+					};
+
+					tcon0_in_mixer1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer1_out_tcon0>;
+					};
+				};
+			};
+		};
+
+		tcon1: lcd-controller@1c0d000 {
+			compatible = "allwinner,sun8i-h3-tcon1";
+			reg = <0x01c0d000 0x1000>;
+			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON1>;
+			clock-names = "ahb";
+			resets = <&ccu RST_BUS_TCON1>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon1_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon1_in_mixer1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer1_out_tcon1>;
+					};
+
+					tcon1_in_mixer0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer0_out_tcon1>;
+					};
+				};
+
+				tcon1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					tcon1_out_tve0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tve0_in_tcon1>;
+					};
+				};
+			};
+		};
+
+		tve0: tv-encoder@1e00000 {
+			compatible = "allwinner,sun8i-h3-tv-encoder";
+			reg = <0x01e00000 0x1000>;
+			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_TVE>;
+			status = "disabled";
+
+			assigned-clocks = <&ccu CLK_TVE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <216000000>;
+
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tve0_in_tcon1: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&tcon1_out_tve0>;
+				};
+			};
+		};
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: devicetree, linux-kernel, dri-devel, linux-sunxi, linux-clk,
	linux-arm-kernel, Icenowy Zheng

As we have already the support for the TV encoder on Allwinner H3, add
the display engine pipeline device tree nodes to its DTSI file.

The H5 pipeline has some differences and will be enabled later.

The currently-unused mixer0 and tcon0 are also needed, for the
completement of the pipeline.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..20172ef92415 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -41,6 +41,8 @@
  */
 
 #include "sunxi-h3-h5.dtsi"
+#include <dt-bindings/clock/sun8i-de2.h>
+#include <dt-bindings/reset/sun8i-de2.h>
 
 / {
 	cpus {
@@ -72,6 +74,193 @@
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun8i-h3-display-engine";
+		allwinner,pipelines = <&mixer0>,
+				      <&mixer1>;
+		status = "disabled";
+	};
+
+	soc {
+		display_clocks: clock@1000000 {
+			compatible = "allwinner,sun8i-a83t-de2-clk";
+			reg = <0x01000000 0x100000>;
+			clocks = <&ccu CLK_BUS_DE>,
+				 <&ccu CLK_DE>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&ccu RST_BUS_DE>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			assigned-clocks = <&ccu CLK_DE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <432000000>;
+		};
+
+		mixer0: mixer@1100000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer0";
+			reg = <0x01100000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER0>,
+				 <&display_clocks CLK_MIXER0>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_MIXER0>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer0_out_tcon0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon0_in_mixer0>;
+					};
+
+					mixer0_out_tcon1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon1_in_mixer0>;
+					};
+				};
+			};
+		};
+
+		mixer1: mixer@1200000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer1";
+			reg = <0x01200000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER1>,
+				 <&display_clocks CLK_MIXER1>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_WB>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer1_out_tcon1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&tcon1_in_mixer1>;
+					};
+
+					mixer1_out_tcon0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tcon0_in_mixer1>;
+					};
+				};
+			};
+		};
+
+		tcon0: lcd-controller@1c0c000 {
+			compatible = "allwinner,sun8i-h3-tcon0";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON0>,
+				 <&ccu CLK_TCON0>;
+			clock-names = "ahb",
+				      "tcon-ch1";
+			resets = <&ccu RST_BUS_TCON0>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon0_in_mixer0: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer0_out_tcon0>;
+					};
+
+					tcon0_in_mixer1: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer1_out_tcon0>;
+					};
+				};
+			};
+		};
+
+		tcon1: lcd-controller@1c0d000 {
+			compatible = "allwinner,sun8i-h3-tcon1";
+			reg = <0x01c0d000 0x1000>;
+			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON1>;
+			clock-names = "ahb";
+			resets = <&ccu RST_BUS_TCON1>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon1_in: port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon1_in_mixer1: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&mixer1_out_tcon1>;
+					};
+
+					tcon1_in_mixer0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&mixer0_out_tcon1>;
+					};
+				};
+
+				tcon1_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					tcon1_out_tve0: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&tve0_in_tcon1>;
+					};
+				};
+			};
+		};
+
+		tve0: tv-encoder@1e00000 {
+			compatible = "allwinner,sun8i-h3-tv-encoder";
+			reg = <0x01e00000 0x1000>;
+			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_TVE>;
+			status = "disabled";
+
+			assigned-clocks = <&ccu CLK_TVE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <216000000>;
+
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tve0_in_tcon1: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&tcon1_out_tve0>;
+				};
+			};
+		};
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-- 
2.12.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

As we have already the support for the TV encoder on Allwinner H3, add
the display engine pipeline device tree nodes to its DTSI file.

The H5 pipeline has some differences and will be enabled later.

The currently-unused mixer0 and tcon0 are also needed, for the
completement of the pipeline.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..20172ef92415 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -41,6 +41,8 @@
  */
 
 #include "sunxi-h3-h5.dtsi"
+#include <dt-bindings/clock/sun8i-de2.h>
+#include <dt-bindings/reset/sun8i-de2.h>
 
 / {
 	cpus {
@@ -72,6 +74,193 @@
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun8i-h3-display-engine";
+		allwinner,pipelines = <&mixer0>,
+				      <&mixer1>;
+		status = "disabled";
+	};
+
+	soc {
+		display_clocks: clock at 1000000 {
+			compatible = "allwinner,sun8i-a83t-de2-clk";
+			reg = <0x01000000 0x100000>;
+			clocks = <&ccu CLK_BUS_DE>,
+				 <&ccu CLK_DE>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&ccu RST_BUS_DE>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			assigned-clocks = <&ccu CLK_DE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <432000000>;
+		};
+
+		mixer0: mixer at 1100000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer0";
+			reg = <0x01100000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER0>,
+				 <&display_clocks CLK_MIXER0>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_MIXER0>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer0_out: port at 1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer0_out_tcon0: endpoint at 0 {
+						reg = <0>;
+						remote-endpoint = <&tcon0_in_mixer0>;
+					};
+
+					mixer0_out_tcon1: endpoint at 1 {
+						reg = <1>;
+						remote-endpoint = <&tcon1_in_mixer0>;
+					};
+				};
+			};
+		};
+
+		mixer1: mixer at 1200000 {
+			compatible = "allwinner,sun8i-h3-de2-mixer1";
+			reg = <0x01200000 0x100000>;
+			clocks = <&display_clocks CLK_BUS_MIXER1>,
+				 <&display_clocks CLK_MIXER1>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks RST_WB>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer1_out: port at 1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					mixer1_out_tcon1: endpoint at 0 {
+						reg = <0>;
+						remote-endpoint = <&tcon1_in_mixer1>;
+					};
+
+					mixer1_out_tcon0: endpoint at 1 {
+						reg = <1>;
+						remote-endpoint = <&tcon0_in_mixer1>;
+					};
+				};
+			};
+		};
+
+		tcon0: lcd-controller at 1c0c000 {
+			compatible = "allwinner,sun8i-h3-tcon0";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON0>,
+				 <&ccu CLK_TCON0>;
+			clock-names = "ahb",
+				      "tcon-ch1";
+			resets = <&ccu RST_BUS_TCON0>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port at 0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon0_in_mixer0: endpoint at 0 {
+						reg = <0>;
+						remote-endpoint = <&mixer0_out_tcon0>;
+					};
+
+					tcon0_in_mixer1: endpoint at 1 {
+						reg = <1>;
+						remote-endpoint = <&mixer1_out_tcon0>;
+					};
+				};
+			};
+		};
+
+		tcon1: lcd-controller at 1c0d000 {
+			compatible = "allwinner,sun8i-h3-tcon1";
+			reg = <0x01c0d000 0x1000>;
+			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON1>;
+			clock-names = "ahb";
+			resets = <&ccu RST_BUS_TCON1>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon1_in: port at 0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					tcon1_in_mixer1: endpoint at 0 {
+						reg = <0>;
+						remote-endpoint = <&mixer1_out_tcon1>;
+					};
+
+					tcon1_in_mixer0: endpoint at 1 {
+						reg = <1>;
+						remote-endpoint = <&mixer0_out_tcon1>;
+					};
+				};
+
+				tcon1_out: port at 1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+
+					tcon1_out_tve0: endpoint at 1 {
+						reg = <1>;
+						remote-endpoint = <&tve0_in_tcon1>;
+					};
+				};
+			};
+		};
+
+		tve0: tv-encoder at 1e00000 {
+			compatible = "allwinner,sun8i-h3-tv-encoder";
+			reg = <0x01e00000 0x1000>;
+			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_TVE>;
+			status = "disabled";
+
+			assigned-clocks = <&ccu CLK_TVE>;
+			assigned-clock-parents = <&ccu CLK_PLL_DE>;
+			assigned-clock-rates = <216000000>;
+
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tve0_in_tcon1: endpoint at 0 {
+					reg = <0>;
+					remote-endpoint = <&tcon1_out_tve0>;
+				};
+			};
+		};
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel, linux-clk,
	linux-sunxi, Icenowy Zheng

Orange Pi PC features a 3.5mm jack with TV output in it.

Enable the TV output.

As it currently do not have jack detection feature, do not merge this
patch.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
index 1a044b17d6c6..9c50ac3e82f3 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
@@ -97,6 +97,10 @@
 	status = "okay";
 };
 
+&de {
+	status = "okay";
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -169,6 +173,14 @@
 	status = "okay";
 };
 
+&tcon1 {
+	status = "okay";
+};
+
+&tve0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Chen-Yu Tsai
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Orange Pi PC features a 3.5mm jack with TV output in it.

Enable the TV output.

As it currently do not have jack detection feature, do not merge this
patch.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
index 1a044b17d6c6..9c50ac3e82f3 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
@@ -97,6 +97,10 @@
 	status = "okay";
 };
 
+&de {
+	status = "okay";
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -169,6 +173,14 @@
 	status = "okay";
 };
 
+&tcon1 {
+	status = "okay";
+};
+
+&tve0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* [RFC PATCH 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC
@ 2017-05-17 16:43   ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-17 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Orange Pi PC features a 3.5mm jack with TV output in it.

Enable the TV output.

As it currently do not have jack detection feature, do not merge this
patch.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
index 1a044b17d6c6..9c50ac3e82f3 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
@@ -97,6 +97,10 @@
 	status = "okay";
 };
 
+&de {
+	status = "okay";
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -169,6 +173,14 @@
 	status = "okay";
 };
 
+&tcon1 {
+	status = "okay";
+};
+
+&tve0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 20:14     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:14 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sreda, 17. maj 2017 ob 18:43:49 CEST je Icenowy Zheng napisal(a):
> The DE2 mixer can do color space correction needed by TV Encoder with
> its DCSC sub-engine.
> 
> Add support for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 35
> +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 
> 6 +++++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> b/drivers/gpu/drm/sun4i/sun8i_mixer.c index d658a3a8159a..65f86641eca3
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -29,6 +29,14 @@
>  #include "sun8i_layer.h"
>  #include "sunxi_engine.h"
> 
> +static const u32 sun8i_rgb2yuv_coef[12] = {
> +	0x00000107, 0x00000204, 0x00000064, 0x00004200,
> +	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
> +	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
> +};
> +
> +static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
> +

There is no need to set/use alpha. BSP code doesn't set it and 0x00020200 
value is default.

Best regards,
Jernej

>  static void sun8i_mixer_commit(struct sunxi_engine *engine)
>  {
>  	DRM_DEBUG_DRIVER("Committing changes\n");
> @@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine
> *engine) SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
>  }
> 
> +static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
> +{
> +	int i;
> +
> +	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
> +
> +	/* Set color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
> +
> +	for (i = 0; i < 12; i++)
> +		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
> +			     sun8i_rgb2yuv_coef[i]);
> +
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
> +		     sun8i_rgb2yuv_dcsc_alpha);
> +}
> +
> +static void sun8i_mixer_disable_color_correction(struct sunxi_engine
> *engine) +{
> +	DRM_DEBUG_DRIVER("Disabling color correction\n");
> +
> +	/* Disable color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
> +}
> +
>  void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
>  				int layer, bool enable)
>  {
> @@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer
> *mixer, static const struct sunxi_engine_ops sun8i_engine_ops = {
>  	.commit		= sun8i_mixer_commit,
>  	.layers_init	= sun8i_layers_init,
> +	.apply_color_correction		= sun8i_mixer_apply_color_correction,
> +	.disable_color_correction	= sun8i_mixer_disable_color_correction,
>  };
> 
>  static struct regmap_config sun8i_mixer_regmap_config = {
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> b/drivers/gpu/drm/sun4i/sun8i_mixer.h index 4785ac090b8c..d7f7513898b6
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> @@ -88,6 +88,11 @@
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
> 
> +/* The DCSC sub-engine is used to do color space conversation */
> +#define SUN8I_MIXER_DCSC_EN			0xb0000
> +#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
> +#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
> +
>  /*
>   * These sub-engines are still unknown now, the EN registers are here only
> to * be used to disable these sub-engines.
> @@ -102,7 +107,6 @@
>  #define SUN8I_MIXER_PEAK_EN			0xa6000
>  #define SUN8I_MIXER_ASE_EN			0xa8000
>  #define SUN8I_MIXER_FCC_EN			0xaa000
> -#define SUN8I_MIXER_DCSC_EN			0xb0000
> 
>  struct sun8i_mixer_cfg {
>  	int		vi_num;
> --
> 2.12.2
> 
> --
> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 20:14     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:14 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, icenowy-h8G6r0blFSE
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

Hi,

Dne sreda, 17. maj 2017 ob 18:43:49 CEST je Icenowy Zheng napisal(a):
> The DE2 mixer can do color space correction needed by TV Encoder with
> its DCSC sub-engine.
> 
> Add support for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 35
> +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 
> 6 +++++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> b/drivers/gpu/drm/sun4i/sun8i_mixer.c index d658a3a8159a..65f86641eca3
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -29,6 +29,14 @@
>  #include "sun8i_layer.h"
>  #include "sunxi_engine.h"
> 
> +static const u32 sun8i_rgb2yuv_coef[12] = {
> +	0x00000107, 0x00000204, 0x00000064, 0x00004200,
> +	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
> +	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
> +};
> +
> +static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
> +

There is no need to set/use alpha. BSP code doesn't set it and 0x00020200 
value is default.

Best regards,
Jernej

>  static void sun8i_mixer_commit(struct sunxi_engine *engine)
>  {
>  	DRM_DEBUG_DRIVER("Committing changes\n");
> @@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine
> *engine) SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
>  }
> 
> +static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
> +{
> +	int i;
> +
> +	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
> +
> +	/* Set color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
> +
> +	for (i = 0; i < 12; i++)
> +		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
> +			     sun8i_rgb2yuv_coef[i]);
> +
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
> +		     sun8i_rgb2yuv_dcsc_alpha);
> +}
> +
> +static void sun8i_mixer_disable_color_correction(struct sunxi_engine
> *engine) +{
> +	DRM_DEBUG_DRIVER("Disabling color correction\n");
> +
> +	/* Disable color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
> +}
> +
>  void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
>  				int layer, bool enable)
>  {
> @@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer
> *mixer, static const struct sunxi_engine_ops sun8i_engine_ops = {
>  	.commit		= sun8i_mixer_commit,
>  	.layers_init	= sun8i_layers_init,
> +	.apply_color_correction		= sun8i_mixer_apply_color_correction,
> +	.disable_color_correction	= sun8i_mixer_disable_color_correction,
>  };
> 
>  static struct regmap_config sun8i_mixer_regmap_config = {
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> b/drivers/gpu/drm/sun4i/sun8i_mixer.h index 4785ac090b8c..d7f7513898b6
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> @@ -88,6 +88,11 @@
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
> 
> +/* The DCSC sub-engine is used to do color space conversation */
> +#define SUN8I_MIXER_DCSC_EN			0xb0000
> +#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
> +#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
> +
>  /*
>   * These sub-engines are still unknown now, the EN registers are here only
> to * be used to disable these sub-engines.
> @@ -102,7 +107,6 @@
>  #define SUN8I_MIXER_PEAK_EN			0xa6000
>  #define SUN8I_MIXER_ASE_EN			0xa8000
>  #define SUN8I_MIXER_FCC_EN			0xaa000
> -#define SUN8I_MIXER_DCSC_EN			0xb0000
> 
>  struct sun8i_mixer_cfg {
>  	int		vi_num;
> --
> 2.12.2
> 
> --
> 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/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 20:14     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:14 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: devicetree, linux-kernel, dri-devel, Chen-Yu Tsai, Rob Herring,
	Maxime Ripard, linux-clk, linux-arm-kernel

Hi,

Dne sreda, 17. maj 2017 ob 18:43:49 CEST je Icenowy Zheng napisal(a):
> The DE2 mixer can do color space correction needed by TV Encoder with
> its DCSC sub-engine.
> 
> Add support for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 35
> +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 
> 6 +++++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> b/drivers/gpu/drm/sun4i/sun8i_mixer.c index d658a3a8159a..65f86641eca3
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -29,6 +29,14 @@
>  #include "sun8i_layer.h"
>  #include "sunxi_engine.h"
> 
> +static const u32 sun8i_rgb2yuv_coef[12] = {
> +	0x00000107, 0x00000204, 0x00000064, 0x00004200,
> +	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
> +	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
> +};
> +
> +static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
> +

There is no need to set/use alpha. BSP code doesn't set it and 0x00020200 
value is default.

Best regards,
Jernej

>  static void sun8i_mixer_commit(struct sunxi_engine *engine)
>  {
>  	DRM_DEBUG_DRIVER("Committing changes\n");
> @@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine
> *engine) SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
>  }
> 
> +static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
> +{
> +	int i;
> +
> +	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
> +
> +	/* Set color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
> +
> +	for (i = 0; i < 12; i++)
> +		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
> +			     sun8i_rgb2yuv_coef[i]);
> +
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
> +		     sun8i_rgb2yuv_dcsc_alpha);
> +}
> +
> +static void sun8i_mixer_disable_color_correction(struct sunxi_engine
> *engine) +{
> +	DRM_DEBUG_DRIVER("Disabling color correction\n");
> +
> +	/* Disable color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
> +}
> +
>  void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
>  				int layer, bool enable)
>  {
> @@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer
> *mixer, static const struct sunxi_engine_ops sun8i_engine_ops = {
>  	.commit		= sun8i_mixer_commit,
>  	.layers_init	= sun8i_layers_init,
> +	.apply_color_correction		= sun8i_mixer_apply_color_correction,
> +	.disable_color_correction	= sun8i_mixer_disable_color_correction,
>  };
> 
>  static struct regmap_config sun8i_mixer_regmap_config = {
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> b/drivers/gpu/drm/sun4i/sun8i_mixer.h index 4785ac090b8c..d7f7513898b6
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> @@ -88,6 +88,11 @@
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
> 
> +/* The DCSC sub-engine is used to do color space conversation */
> +#define SUN8I_MIXER_DCSC_EN			0xb0000
> +#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
> +#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
> +
>  /*
>   * These sub-engines are still unknown now, the EN registers are here only
> to * be used to disable these sub-engines.
> @@ -102,7 +107,6 @@
>  #define SUN8I_MIXER_PEAK_EN			0xa6000
>  #define SUN8I_MIXER_ASE_EN			0xa8000
>  #define SUN8I_MIXER_FCC_EN			0xaa000
> -#define SUN8I_MIXER_DCSC_EN			0xb0000
> 
>  struct sun8i_mixer_cfg {
>  	int		vi_num;
> --
> 2.12.2
> 
> --
> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer
@ 2017-05-17 20:14     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dne sreda, 17. maj 2017 ob 18:43:49 CEST je Icenowy Zheng napisal(a):
> The DE2 mixer can do color space correction needed by TV Encoder with
> its DCSC sub-engine.
> 
> Add support for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 35
> +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 
> 6 +++++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> b/drivers/gpu/drm/sun4i/sun8i_mixer.c index d658a3a8159a..65f86641eca3
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -29,6 +29,14 @@
>  #include "sun8i_layer.h"
>  #include "sunxi_engine.h"
> 
> +static const u32 sun8i_rgb2yuv_coef[12] = {
> +	0x00000107, 0x00000204, 0x00000064, 0x00004200,
> +	0x00001f68, 0x00001ed6, 0x000001c2, 0x00020200,
> +	0x000001c2, 0x00001e87, 0x00001fb7, 0x00020200,
> +};
> +
> +static const u32 sun8i_rgb2yuv_dcsc_alpha = 0x00020200;
> +

There is no need to set/use alpha. BSP code doesn't set it and 0x00020200 
value is default.

Best regards,
Jernej

>  static void sun8i_mixer_commit(struct sunxi_engine *engine)
>  {
>  	DRM_DEBUG_DRIVER("Committing changes\n");
> @@ -37,6 +45,31 @@ static void sun8i_mixer_commit(struct sunxi_engine
> *engine) SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
>  }
> 
> +static void sun8i_mixer_apply_color_correction(struct sunxi_engine *engine)
> +{
> +	int i;
> +
> +	DRM_DEBUG_DRIVER("Applying RGB to YUV color correction\n");
> +
> +	/* Set color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 1);
> +
> +	for (i = 0; i < 12; i++)
> +		regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_REG(i),
> +			     sun8i_rgb2yuv_coef[i]);
> +
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_COEF_ALPHA,
> +		     sun8i_rgb2yuv_dcsc_alpha);
> +}
> +
> +static void sun8i_mixer_disable_color_correction(struct sunxi_engine
> *engine) +{
> +	DRM_DEBUG_DRIVER("Disabling color correction\n");
> +
> +	/* Disable color correction */
> +	regmap_write(engine->regs, SUN8I_MIXER_DCSC_EN, 0);
> +}
> +
>  void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer,
>  				int layer, bool enable)
>  {
> @@ -229,6 +262,8 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer
> *mixer, static const struct sunxi_engine_ops sun8i_engine_ops = {
>  	.commit		= sun8i_mixer_commit,
>  	.layers_init	= sun8i_layers_init,
> +	.apply_color_correction		= sun8i_mixer_apply_color_correction,
> +	.disable_color_correction	= sun8i_mixer_disable_color_correction,
>  };
> 
>  static struct regmap_config sun8i_mixer_regmap_config = {
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> b/drivers/gpu/drm/sun4i/sun8i_mixer.h index 4785ac090b8c..d7f7513898b6
> 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> @@ -88,6 +88,11 @@
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888	(8 << 8)
>  #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF	(0xff << 24)
> 
> +/* The DCSC sub-engine is used to do color space conversation */
> +#define SUN8I_MIXER_DCSC_EN			0xb0000
> +#define SUN8I_MIXER_DCSC_COEF_REG(x)		(0xb0010 + 0x4 * x)
> +#define SUN8I_MIXER_DCSC_COEF_ALPHA		0xb0040
> +
>  /*
>   * These sub-engines are still unknown now, the EN registers are here only
> to * be used to disable these sub-engines.
> @@ -102,7 +107,6 @@
>  #define SUN8I_MIXER_PEAK_EN			0xa6000
>  #define SUN8I_MIXER_ASE_EN			0xa8000
>  #define SUN8I_MIXER_FCC_EN			0xaa000
> -#define SUN8I_MIXER_DCSC_EN			0xb0000
> 
>  struct sun8i_mixer_cfg {
>  	int		vi_num;
> --
> 2.12.2
> 
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 20:19     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:19 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sreda, 17. maj 2017 ob 18:43:53 CEST je Icenowy Zheng napisal(a):
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> b/arch/arm/boot/dts/sun8i-h3.dtsi index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
> 
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
> 
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
> 
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock@1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;
> +		};
> +
> +		mixer0: mixer@1100000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer0";
> +			reg = <0x01100000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER0>,
> +				 <&display_clocks CLK_MIXER0>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_MIXER0>;
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer0_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer0_out_tcon0: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon0_in_mixer0>;
> +					};
> +
> +					mixer0_out_tcon1: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon1_in_mixer0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		mixer1: mixer@1200000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer1";
> +			reg = <0x01200000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER1>,
> +				 <&display_clocks CLK_MIXER1>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_WB>;
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer1_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer1_out_tcon1: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon1_in_mixer1>;
> +					};
> +
> +					mixer1_out_tcon0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon0_in_mixer1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon0: lcd-controller@1c0c000 {
> +			compatible = "allwinner,sun8i-h3-tcon0";
> +			reg = <0x01c0c000 0x1000>;
> +			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON0>,
> +				 <&ccu CLK_TCON0>;
> +			clock-names = "ahb",
> +				      "tcon-ch1";
> +			resets = <&ccu RST_BUS_TCON0>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon0_in: port@0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon0_in_mixer0: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer0_out_tcon0>;
> +					};
> +
> +					tcon0_in_mixer1: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer1_out_tcon0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon1: lcd-controller@1c0d000 {
> +			compatible = "allwinner,sun8i-h3-tcon1";
> +			reg = <0x01c0d000 0x1000>;
> +			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON1>;
> +			clock-names = "ahb";
> +			resets = <&ccu RST_BUS_TCON1>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon1_in: port@0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon1_in_mixer1: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer1_out_tcon1>;
> +					};
> +
> +					tcon1_in_mixer0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer0_out_tcon1>;
> +					};
> +				};
> +
> +				tcon1_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					tcon1_out_tve0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tve0_in_tcon1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tve0: tv-encoder@1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <216000000>;
> +
> +			port {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tve0_in_tcon1: endpoint@0 {
> +					reg = <0>;
> +					remote-endpoint = <&tcon1_out_tve0>;
> +				};

I think there should be out endpoint to composite connector (compatible: 
"composite-video-connector").

Best regards,
Jernej

> +			};
> +		};
> +	};
> +
>  	timer {
>  		compatible = "arm,armv7-timer";
>  		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
> 
> --
> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 20:19     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:19 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, icenowy-h8G6r0blFSE
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

Hi,

Dne sreda, 17. maj 2017 ob 18:43:53 CEST je Icenowy Zheng napisal(a):
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> b/arch/arm/boot/dts/sun8i-h3.dtsi index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
> 
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
> 
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
> 
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock@1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;
> +		};
> +
> +		mixer0: mixer@1100000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer0";
> +			reg = <0x01100000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER0>,
> +				 <&display_clocks CLK_MIXER0>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_MIXER0>;
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer0_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer0_out_tcon0: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon0_in_mixer0>;
> +					};
> +
> +					mixer0_out_tcon1: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon1_in_mixer0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		mixer1: mixer@1200000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer1";
> +			reg = <0x01200000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER1>,
> +				 <&display_clocks CLK_MIXER1>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_WB>;
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer1_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer1_out_tcon1: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon1_in_mixer1>;
> +					};
> +
> +					mixer1_out_tcon0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon0_in_mixer1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon0: lcd-controller@1c0c000 {
> +			compatible = "allwinner,sun8i-h3-tcon0";
> +			reg = <0x01c0c000 0x1000>;
> +			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON0>,
> +				 <&ccu CLK_TCON0>;
> +			clock-names = "ahb",
> +				      "tcon-ch1";
> +			resets = <&ccu RST_BUS_TCON0>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon0_in: port@0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon0_in_mixer0: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer0_out_tcon0>;
> +					};
> +
> +					tcon0_in_mixer1: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer1_out_tcon0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon1: lcd-controller@1c0d000 {
> +			compatible = "allwinner,sun8i-h3-tcon1";
> +			reg = <0x01c0d000 0x1000>;
> +			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON1>;
> +			clock-names = "ahb";
> +			resets = <&ccu RST_BUS_TCON1>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon1_in: port@0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon1_in_mixer1: endpoint@0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer1_out_tcon1>;
> +					};
> +
> +					tcon1_in_mixer0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer0_out_tcon1>;
> +					};
> +				};
> +
> +				tcon1_out: port@1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					tcon1_out_tve0: endpoint@1 {
> +						reg = <1>;
> +						remote-endpoint = <&tve0_in_tcon1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tve0: tv-encoder@1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <216000000>;
> +
> +			port {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tve0_in_tcon1: endpoint@0 {
> +					reg = <0>;
> +					remote-endpoint = <&tcon1_out_tve0>;
> +				};

I think there should be out endpoint to composite connector (compatible: 
"composite-video-connector").

Best regards,
Jernej

> +			};
> +		};
> +	};
> +
>  	timer {
>  		compatible = "arm,armv7-timer";
>  		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
> 
> --
> 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/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-17 20:19     ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-17 20:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dne sreda, 17. maj 2017 ob 18:43:53 CEST je Icenowy Zheng napisal(a):
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> b/arch/arm/boot/dts/sun8i-h3.dtsi index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
> 
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
> 
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
> 
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock at 1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;
> +		};
> +
> +		mixer0: mixer at 1100000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer0";
> +			reg = <0x01100000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER0>,
> +				 <&display_clocks CLK_MIXER0>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_MIXER0>;
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer0_out: port at 1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer0_out_tcon0: endpoint at 0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon0_in_mixer0>;
> +					};
> +
> +					mixer0_out_tcon1: endpoint at 1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon1_in_mixer0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		mixer1: mixer at 1200000 {
> +			compatible = "allwinner,sun8i-h3-de2-mixer1";
> +			reg = <0x01200000 0x100000>;
> +			clocks = <&display_clocks CLK_BUS_MIXER1>,
> +				 <&display_clocks CLK_MIXER1>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&display_clocks RST_WB>;
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				mixer1_out: port at 1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					mixer1_out_tcon1: endpoint at 0 {
> +						reg = <0>;
> +						remote-endpoint = <&tcon1_in_mixer1>;
> +					};
> +
> +					mixer1_out_tcon0: endpoint at 1 {
> +						reg = <1>;
> +						remote-endpoint = <&tcon0_in_mixer1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon0: lcd-controller at 1c0c000 {
> +			compatible = "allwinner,sun8i-h3-tcon0";
> +			reg = <0x01c0c000 0x1000>;
> +			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON0>,
> +				 <&ccu CLK_TCON0>;
> +			clock-names = "ahb",
> +				      "tcon-ch1";
> +			resets = <&ccu RST_BUS_TCON0>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon0_in: port at 0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon0_in_mixer0: endpoint at 0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer0_out_tcon0>;
> +					};
> +
> +					tcon0_in_mixer1: endpoint at 1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer1_out_tcon0>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tcon1: lcd-controller at 1c0d000 {
> +			compatible = "allwinner,sun8i-h3-tcon1";
> +			reg = <0x01c0d000 0x1000>;
> +			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_TCON1>;
> +			clock-names = "ahb";
> +			resets = <&ccu RST_BUS_TCON1>;
> +			reset-names = "lcd";
> +			status = "disabled";
> +
> +			ports {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tcon1_in: port at 0 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <0>;
> +
> +					tcon1_in_mixer1: endpoint at 0 {
> +						reg = <0>;
> +						remote-endpoint = <&mixer1_out_tcon1>;
> +					};
> +
> +					tcon1_in_mixer0: endpoint at 1 {
> +						reg = <1>;
> +						remote-endpoint = <&mixer0_out_tcon1>;
> +					};
> +				};
> +
> +				tcon1_out: port at 1 {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +					reg = <1>;
> +
> +					tcon1_out_tve0: endpoint at 1 {
> +						reg = <1>;
> +						remote-endpoint = <&tve0_in_tcon1>;
> +					};
> +				};
> +			};
> +		};
> +
> +		tve0: tv-encoder at 1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <216000000>;
> +
> +			port {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				tve0_in_tcon1: endpoint at 0 {
> +					reg = <0>;
> +					remote-endpoint = <&tcon1_out_tve0>;
> +				};

I think there should be out endpoint to composite connector (compatible: 
"composite-video-connector").

Best regards,
Jernej

> +			};
> +		};
> +	};
> +
>  	timer {
>  		compatible = "arm,armv7-timer";
>  		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
> 
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:47     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:47 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi,
	Icenowy Zheng

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> From: Icenowy Zheng <icenowy@aosc.xyz>
> 
> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
> and the other has 1 VI and 1 UI.
> 
> Add support for these two variants.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index cb193c5f1686..d658a3a8159a 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
>  	.ui_num = 1,
>  };
>  
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 3,
> +};
> +
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 1,
> +};
> +
>  static const struct of_device_id sun8i_mixer_of_table[] = {
>  	{
>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>  		.data = &sun8i_v3s_mixer_cfg,
>  	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> +		.data = &sun8i_h3_mixer0_cfg
> +	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> +		.data = &sun8i_h3_mixer1_cfg
> +	},

So the only difference between the two is the number of ui planes?

Why not create a property to give the number then, instead of a
compatible?

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:47     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:47 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
> 
> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
> and the other has 1 VI and 1 UI.
> 
> Add support for these two variants.
> 
> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index cb193c5f1686..d658a3a8159a 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
>  	.ui_num = 1,
>  };
>  
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 3,
> +};
> +
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 1,
> +};
> +
>  static const struct of_device_id sun8i_mixer_of_table[] = {
>  	{
>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>  		.data = &sun8i_v3s_mixer_cfg,
>  	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> +		.data = &sun8i_h3_mixer0_cfg
> +	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> +		.data = &sun8i_h3_mixer1_cfg
> +	},

So the only difference between the two is the number of ui planes?

Why not create a property to give the number then, instead of a
compatible?

Maxime

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:47     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:47 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, Icenowy Zheng, linux-clk, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1632 bytes --]

On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> From: Icenowy Zheng <icenowy@aosc.xyz>
> 
> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
> and the other has 1 VI and 1 UI.
> 
> Add support for these two variants.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index cb193c5f1686..d658a3a8159a 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
>  	.ui_num = 1,
>  };
>  
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 3,
> +};
> +
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 1,
> +};
> +
>  static const struct of_device_id sun8i_mixer_of_table[] = {
>  	{
>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>  		.data = &sun8i_v3s_mixer_cfg,
>  	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> +		.data = &sun8i_h3_mixer0_cfg
> +	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> +		.data = &sun8i_h3_mixer1_cfg
> +	},

So the only difference between the two is the number of ui planes?

Why not create a property to give the number then, instead of a
compatible?

Maxime

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:47     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> From: Icenowy Zheng <icenowy@aosc.xyz>
> 
> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI channels,
> and the other has 1 VI and 1 UI.
> 
> Add support for these two variants.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index cb193c5f1686..d658a3a8159a 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
>  	.ui_num = 1,
>  };
>  
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 3,
> +};
> +
> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> +	.vi_num = 1,
> +	.ui_num = 1,
> +};
> +
>  static const struct of_device_id sun8i_mixer_of_table[] = {
>  	{
>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>  		.data = &sun8i_v3s_mixer_cfg,
>  	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> +		.data = &sun8i_h3_mixer0_cfg
> +	},
> +	{
> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> +		.data = &sun8i_h3_mixer1_cfg
> +	},

So the only difference between the two is the number of ui planes?

Why not create a property to give the number then, instead of a
compatible?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170519/faff51d3/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:49       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 17:49 UTC (permalink / raw)
  To: maxime.ripard, Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi,
	Icenowy Zheng



于 2017年5月20日 GMT+08:00 上午1:47:29, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
>> From: Icenowy Zheng <icenowy@aosc.xyz>
>> 
>> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
>channels,
>> and the other has 1 VI and 1 UI.
>> 
>> Add support for these two variants.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> ---
>>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> index cb193c5f1686..d658a3a8159a 100644
>> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
>sun8i_v3s_mixer_cfg = {
>>  	.ui_num = 1,
>>  };
>>  
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 3,
>> +};
>> +
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 1,
>> +};
>> +
>>  static const struct of_device_id sun8i_mixer_of_table[] = {
>>  	{
>>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>>  		.data = &sun8i_v3s_mixer_cfg,
>>  	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
>> +		.data = &sun8i_h3_mixer0_cfg
>> +	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
>> +		.data = &sun8i_h3_mixer1_cfg
>> +	},
>
>So the only difference between the two is the number of ui planes?

Not only., but currently we only implemented this.

More functions differ, but we still don't support them...

>
>Why not create a property to give the number then, instead of a
>compatible?
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:49       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 17:49 UTC (permalink / raw)
  To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng



于 2017年5月20日 GMT+08:00 上午1:47:29, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
>> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>> 
>> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
>channels,
>> and the other has 1 VI and 1 UI.
>> 
>> Add support for these two variants.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>> ---
>>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> index cb193c5f1686..d658a3a8159a 100644
>> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
>sun8i_v3s_mixer_cfg = {
>>  	.ui_num = 1,
>>  };
>>  
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 3,
>> +};
>> +
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 1,
>> +};
>> +
>>  static const struct of_device_id sun8i_mixer_of_table[] = {
>>  	{
>>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>>  		.data = &sun8i_v3s_mixer_cfg,
>>  	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
>> +		.data = &sun8i_h3_mixer0_cfg
>> +	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
>> +		.data = &sun8i_h3_mixer1_cfg
>> +	},
>
>So the only difference between the two is the number of ui planes?

Not only., but currently we only implemented this.

More functions differ, but we still don't support them...

>
>Why not create a property to give the number then, instead of a
>compatible?
>
>Maxime

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:49       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 17:49 UTC (permalink / raw)
  To: maxime.ripard, Maxime Ripard
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, Icenowy Zheng, linux-clk, linux-arm-kernel

Cgrkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2IMTo0NzoyOSwgTWF4aW1lIFJp
cGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLWVsZWN0cm9ucy5jb20+IOWGmeWIsDoKPk9uIFRodSwg
TWF5IDE4LCAyMDE3IGF0IDEyOjQzOjQ1QU0gKzA4MDAsIEljZW5vd3kgWmhlbmcgd3JvdGU6Cj4+
IEZyb206IEljZW5vd3kgWmhlbmcgPGljZW5vd3lAYW9zYy54eXo+Cj4+IAo+PiBBbGx3aW5uZXIg
SDMgU29DIGhhcyB0d28gbWl4ZXJzLCBvbmUgaGFzIDEgVkkgY2hhbm5lbCBhbmQgMyBVSQo+Y2hh
bm5lbHMsCj4+IGFuZCB0aGUgb3RoZXIgaGFzIDEgVkkgYW5kIDEgVUkuCj4+IAo+PiBBZGQgc3Vw
cG9ydCBmb3IgdGhlc2UgdHdvIHZhcmlhbnRzLgo+PiAKPj4gU2lnbmVkLW9mZi1ieTogSWNlbm93
eSBaaGVuZyA8aWNlbm93eUBhb3NjLnh5ej4KPj4gLS0tCj4+ICBkcml2ZXJzL2dwdS9kcm0vc3Vu
NGkvc3VuOGlfbWl4ZXIuYyB8IDE4ICsrKysrKysrKysrKysrKysrKwo+PiAgMSBmaWxlIGNoYW5n
ZWQsIDE4IGluc2VydGlvbnMoKykKPj4gCj4+IGRpZmYgLS1naXQgYS9kcml2ZXJzL2dwdS9kcm0v
c3VuNGkvc3VuOGlfbWl4ZXIuYwo+Yi9kcml2ZXJzL2dwdS9kcm0vc3VuNGkvc3VuOGlfbWl4ZXIu
Ywo+PiBpbmRleCBjYjE5M2M1ZjE2ODYuLmQ2NThhM2E4MTU5YSAxMDA2NDQKPj4gLS0tIGEvZHJp
dmVycy9ncHUvZHJtL3N1bjRpL3N1bjhpX21peGVyLmMKPj4gKysrIGIvZHJpdmVycy9ncHUvZHJt
L3N1bjRpL3N1bjhpX21peGVyLmMKPj4gQEAgLTM5MCwxMSArMzkwLDI5IEBAIHN0YXRpYyBjb25z
dCBzdHJ1Y3Qgc3VuOGlfbWl4ZXJfY2ZnCj5zdW44aV92M3NfbWl4ZXJfY2ZnID0gewo+PiAgCS51
aV9udW0gPSAxLAo+PiAgfTsKPj4gIAo+PiArc3RhdGljIGNvbnN0IHN0cnVjdCBzdW44aV9taXhl
cl9jZmcgc3VuOGlfaDNfbWl4ZXIwX2NmZyA9IHsKPj4gKwkudmlfbnVtID0gMSwKPj4gKwkudWlf
bnVtID0gMywKPj4gK307Cj4+ICsKPj4gK3N0YXRpYyBjb25zdCBzdHJ1Y3Qgc3VuOGlfbWl4ZXJf
Y2ZnIHN1bjhpX2gzX21peGVyMV9jZmcgPSB7Cj4+ICsJLnZpX251bSA9IDEsCj4+ICsJLnVpX251
bSA9IDEsCj4+ICt9Owo+PiArCj4+ICBzdGF0aWMgY29uc3Qgc3RydWN0IG9mX2RldmljZV9pZCBz
dW44aV9taXhlcl9vZl90YWJsZVtdID0gewo+PiAgCXsKPj4gIAkJLmNvbXBhdGlibGUgPSAiYWxs
d2lubmVyLHN1bjhpLXYzcy1kZTItbWl4ZXIiLAo+PiAgCQkuZGF0YSA9ICZzdW44aV92M3NfbWl4
ZXJfY2ZnLAo+PiAgCX0sCj4+ICsJewo+PiArCQkuY29tcGF0aWJsZSA9ICJhbGx3aW5uZXIsc3Vu
OGktaDMtZGUyLW1peGVyMCIsCj4+ICsJCS5kYXRhID0gJnN1bjhpX2gzX21peGVyMF9jZmcKPj4g
Kwl9LAo+PiArCXsKPj4gKwkJLmNvbXBhdGlibGUgPSAiYWxsd2lubmVyLHN1bjhpLWgzLWRlMi1t
aXhlcjEiLAo+PiArCQkuZGF0YSA9ICZzdW44aV9oM19taXhlcjFfY2ZnCj4+ICsJfSwKPgo+U28g
dGhlIG9ubHkgZGlmZmVyZW5jZSBiZXR3ZWVuIHRoZSB0d28gaXMgdGhlIG51bWJlciBvZiB1aSBw
bGFuZXM/CgpOb3Qgb25seS4sIGJ1dCBjdXJyZW50bHkgd2Ugb25seSBpbXBsZW1lbnRlZCB0aGlz
LgoKTW9yZSBmdW5jdGlvbnMgZGlmZmVyLCBidXQgd2Ugc3RpbGwgZG9uJ3Qgc3VwcG9ydCB0aGVt
Li4uCgo+Cj5XaHkgbm90IGNyZWF0ZSBhIHByb3BlcnR5IHRvIGdpdmUgdGhlIG51bWJlciB0aGVu
LCBpbnN0ZWFkIG9mIGEKPmNvbXBhdGlibGU/Cj4KPk1heGltZQoKX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxp
c3QKbGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZy
YWRlYWQub3JnL21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 17:49       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 17:49 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?20? GMT+08:00 ??1:47:29, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
>> From: Icenowy Zheng <icenowy@aosc.xyz>
>> 
>> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
>channels,
>> and the other has 1 VI and 1 UI.
>> 
>> Add support for these two variants.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> ---
>>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> index cb193c5f1686..d658a3a8159a 100644
>> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
>> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
>sun8i_v3s_mixer_cfg = {
>>  	.ui_num = 1,
>>  };
>>  
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 3,
>> +};
>> +
>> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
>> +	.vi_num = 1,
>> +	.ui_num = 1,
>> +};
>> +
>>  static const struct of_device_id sun8i_mixer_of_table[] = {
>>  	{
>>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
>>  		.data = &sun8i_v3s_mixer_cfg,
>>  	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
>> +		.data = &sun8i_h3_mixer0_cfg
>> +	},
>> +	{
>> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
>> +		.data = &sun8i_h3_mixer1_cfg
>> +	},
>
>So the only difference between the two is the number of ui planes?

Not only., but currently we only implemented this.

More functions differ, but we still don't support them...

>
>Why not create a property to give the number then, instead of a
>compatible?
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 17:57     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:57 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 3735 bytes --]

On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> the connection can be swapped.
> 
> As we now hardcode the default connection, ignore the bonus endpoint for
> the mixer's output and the TCON's input, as they stands for the swapped
> connection.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>  3 files changed, 59 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 1dd1948025d2..29bf1325ded6 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
>  		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
>  }
>  
> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
> +{
> +	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
> +	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> +}
> +
>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>  {
>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
>  			}
>  		}
>  
> +		/*
> +		 * The second endpoint of the output of a swappable DE2 mixer
> +		 * is the TCON after connection swapping.
> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> +		 * mixer1->tcon1 connection.
> +		 */
> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
> +				continue;
> +			}
> +		}
> +
>  		/* Walk down our tree */
>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index f44a37a5993d..89a215ff2370 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
>   * requested via the get_id function of the engine.
>   */
>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
> -						   struct device_node *node)
> +						   struct device_node *node,
> +						   bool skip_bonus_ep)
>  {
>  	struct device_node *port, *ep, *remote;
>  	struct sunxi_engine *engine;
> @@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
>  		if (!remote)
>  			continue;
>  
> +		if (skip_bonus_ep) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
> +				continue;
> +			}
> +		}
> +

You don't list the mixers in the tcon's output, why do you need that
exactly?

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 17:57     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:57 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3652 bytes --]

On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> the connection can be swapped.
> 
> As we now hardcode the default connection, ignore the bonus endpoint for
> the mixer's output and the TCON's input, as they stands for the swapped
> connection.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>  3 files changed, 59 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 1dd1948025d2..29bf1325ded6 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
>  		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
>  }
>  
> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
> +{
> +	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
> +	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> +}
> +
>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>  {
>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
>  			}
>  		}
>  
> +		/*
> +		 * The second endpoint of the output of a swappable DE2 mixer
> +		 * is the TCON after connection swapping.
> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> +		 * mixer1->tcon1 connection.
> +		 */
> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
> +				continue;
> +			}
> +		}
> +
>  		/* Walk down our tree */
>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index f44a37a5993d..89a215ff2370 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
>   * requested via the get_id function of the engine.
>   */
>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
> -						   struct device_node *node)
> +						   struct device_node *node,
> +						   bool skip_bonus_ep)
>  {
>  	struct device_node *port, *ep, *remote;
>  	struct sunxi_engine *engine;
> @@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
>  		if (!remote)
>  			continue;
>  
> +		if (skip_bonus_ep) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
> +				continue;
> +			}
> +		}
> +

You don't list the mixers in the tcon's output, why do you need that
exactly?

Maxime

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 17:57     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 17:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> the connection can be swapped.
> 
> As we now hardcode the default connection, ignore the bonus endpoint for
> the mixer's output and the TCON's input, as they stands for the swapped
> connection.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 +++++++++++++++++++++++++++++---------
>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>  3 files changed, 59 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 1dd1948025d2..29bf1325ded6 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
>  		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
>  }
>  
> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node *node)
> +{
> +	/* The V3s has only one mixer-tcon pair, so it's not listed here. */
> +	return of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer0") ||
> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> +}
> +
>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>  {
>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device *dev,
>  			}
>  		}
>  
> +		/*
> +		 * The second endpoint of the output of a swappable DE2 mixer
> +		 * is the TCON after connection swapping.
> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> +		 * mixer1->tcon1 connection.
> +		 */
> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2 mixer... skipping\n");
> +				continue;
> +			}
> +		}
> +
>  		/* Walk down our tree */
>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index f44a37a5993d..89a215ff2370 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device *dev,
>   * requested via the get_id function of the engine.
>   */
>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
> -						   struct device_node *node)
> +						   struct device_node *node,
> +						   bool skip_bonus_ep)
>  {
>  	struct device_node *port, *ep, *remote;
>  	struct sunxi_engine *engine;
> @@ -439,6 +440,20 @@ static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
>  		if (!remote)
>  			continue;
>  
> +		if (skip_bonus_ep) {
> +			struct of_endpoint endpoint;
> +
> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> +				continue;
> +			}
> +
> +			if (endpoint.id) {
> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when searching engine\n");
> +				continue;
> +			}
> +		}
> +

You don't list the mixers in the tcon's output, why do you need that
exactly?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170519/eb1f9469/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 18:00         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:00 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: maxime.ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, Icenowy Zheng

Hi!

Dne petek, 19. maj 2017 ob 19:49:58 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月20日 GMT+08:00 上午1:47:29, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> >> From: Icenowy Zheng <icenowy@aosc.xyz>
> >> 
> >> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
> >
> >channels,
> >
> >> and the other has 1 VI and 1 UI.
> >> 
> >> Add support for these two variants.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >> ---
> >> 
> >>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
> >>  1 file changed, 18 insertions(+)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >> index cb193c5f1686..d658a3a8159a 100644
> >> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
> >
> >sun8i_v3s_mixer_cfg = {
> >
> >>  	.ui_num = 1,
> >>  
> >>  };
> >> 
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 3,
> >> +};
> >> +
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 1,
> >> +};
> >> +
> >> 
> >>  static const struct of_device_id sun8i_mixer_of_table[] = {
> >>  
> >>  	{
> >>  	
> >>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
> >>  		.data = &sun8i_v3s_mixer_cfg,
> >>  	
> >>  	},
> >> 
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> >> +		.data = &sun8i_h3_mixer0_cfg
> >> +	},
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> >> +		.data = &sun8i_h3_mixer1_cfg
> >> +	},
> >
> >So the only difference between the two is the number of ui planes?
> 
> Not only., but currently we only implemented this.
> 
> More functions differ, but we still don't support them...
> 

As far as I can tell, they only differ in ui & vi number of planes and between 
different SoCs, max plane size.

Icenowy,
Do you know any other property they differ? I think everything else is based 
mostly on ui & vi number of planes.

Best regards,
Jernej

> >Why not create a property to give the number then, instead of a
> >compatible?
> >
> >Maxime
> 
> --
> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 18:00         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:00 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, icenowy-h8G6r0blFSE
  Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Rob Herring,
	Chen-Yu Tsai, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA, Icenowy Zheng

Hi!

Dne petek, 19. maj 2017 ob 19:49:58 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月20日 GMT+08:00 上午1:47:29, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> >> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
> >> 
> >> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
> >
> >channels,
> >
> >> and the other has 1 VI and 1 UI.
> >> 
> >> Add support for these two variants.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
> >> ---
> >> 
> >>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
> >>  1 file changed, 18 insertions(+)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >> index cb193c5f1686..d658a3a8159a 100644
> >> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
> >
> >sun8i_v3s_mixer_cfg = {
> >
> >>  	.ui_num = 1,
> >>  
> >>  };
> >> 
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 3,
> >> +};
> >> +
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 1,
> >> +};
> >> +
> >> 
> >>  static const struct of_device_id sun8i_mixer_of_table[] = {
> >>  
> >>  	{
> >>  	
> >>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
> >>  		.data = &sun8i_v3s_mixer_cfg,
> >>  	
> >>  	},
> >> 
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> >> +		.data = &sun8i_h3_mixer0_cfg
> >> +	},
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> >> +		.data = &sun8i_h3_mixer1_cfg
> >> +	},
> >
> >So the only difference between the two is the number of ui planes?
> 
> Not only., but currently we only implemented this.
> 
> More functions differ, but we still don't support them...
> 

As far as I can tell, they only differ in ui & vi number of planes and between 
different SoCs, max plane size.

Icenowy,
Do you know any other property they differ? I think everything else is based 
mostly on ui & vi number of planes.

Best regards,
Jernej

> >Why not create a property to give the number then, instead of a
> >compatible?
> >
> >Maxime
> 
> --
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> For more options, visit https://groups.google.com/d/optout.


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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 18:00         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:00 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: devicetree, linux-kernel, dri-devel, Chen-Yu Tsai, Rob Herring,
	Icenowy Zheng, maxime.ripard, linux-clk, linux-arm-kernel

SGkhCgpEbmUgcGV0ZWssIDE5LiBtYWogMjAxNyBvYiAxOTo0OTo1OCBDRVNUIGplIEljZW5vd3kg
WmhlbmcgbmFwaXNhbChhKToKPiDkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2I
MTo0NzoyOSwgTWF4aW1lIFJpcGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLQplbGVjdHJvbnMuY29t
PiDlhpnliLA6Cj4gPk9uIFRodSwgTWF5IDE4LCAyMDE3IGF0IDEyOjQzOjQ1QU0gKzA4MDAsIElj
ZW5vd3kgWmhlbmcgd3JvdGU6Cj4gPj4gRnJvbTogSWNlbm93eSBaaGVuZyA8aWNlbm93eUBhb3Nj
Lnh5ej4KPiA+PiAKPiA+PiBBbGx3aW5uZXIgSDMgU29DIGhhcyB0d28gbWl4ZXJzLCBvbmUgaGFz
IDEgVkkgY2hhbm5lbCBhbmQgMyBVSQo+ID4KPiA+Y2hhbm5lbHMsCj4gPgo+ID4+IGFuZCB0aGUg
b3RoZXIgaGFzIDEgVkkgYW5kIDEgVUkuCj4gPj4gCj4gPj4gQWRkIHN1cHBvcnQgZm9yIHRoZXNl
IHR3byB2YXJpYW50cy4KPiA+PiAKPiA+PiBTaWduZWQtb2ZmLWJ5OiBJY2Vub3d5IFpoZW5nIDxp
Y2Vub3d5QGFvc2MueHl6Pgo+ID4+IC0tLQo+ID4+IAo+ID4+ICBkcml2ZXJzL2dwdS9kcm0vc3Vu
NGkvc3VuOGlfbWl4ZXIuYyB8IDE4ICsrKysrKysrKysrKysrKysrKwo+ID4+ICAxIGZpbGUgY2hh
bmdlZCwgMTggaW5zZXJ0aW9ucygrKQo+ID4+IAo+ID4+IGRpZmYgLS1naXQgYS9kcml2ZXJzL2dw
dS9kcm0vc3VuNGkvc3VuOGlfbWl4ZXIuYwo+ID4KPiA+Yi9kcml2ZXJzL2dwdS9kcm0vc3VuNGkv
c3VuOGlfbWl4ZXIuYwo+ID4KPiA+PiBpbmRleCBjYjE5M2M1ZjE2ODYuLmQ2NThhM2E4MTU5YSAx
MDA2NDQKPiA+PiAtLS0gYS9kcml2ZXJzL2dwdS9kcm0vc3VuNGkvc3VuOGlfbWl4ZXIuYwo+ID4+
ICsrKyBiL2RyaXZlcnMvZ3B1L2RybS9zdW40aS9zdW44aV9taXhlci5jCj4gPj4gQEAgLTM5MCwx
MSArMzkwLDI5IEBAIHN0YXRpYyBjb25zdCBzdHJ1Y3Qgc3VuOGlfbWl4ZXJfY2ZnCj4gPgo+ID5z
dW44aV92M3NfbWl4ZXJfY2ZnID0gewo+ID4KPiA+PiAgCS51aV9udW0gPSAxLAo+ID4+ICAKPiA+
PiAgfTsKPiA+PiAKPiA+PiArc3RhdGljIGNvbnN0IHN0cnVjdCBzdW44aV9taXhlcl9jZmcgc3Vu
OGlfaDNfbWl4ZXIwX2NmZyA9IHsKPiA+PiArCS52aV9udW0gPSAxLAo+ID4+ICsJLnVpX251bSA9
IDMsCj4gPj4gK307Cj4gPj4gKwo+ID4+ICtzdGF0aWMgY29uc3Qgc3RydWN0IHN1bjhpX21peGVy
X2NmZyBzdW44aV9oM19taXhlcjFfY2ZnID0gewo+ID4+ICsJLnZpX251bSA9IDEsCj4gPj4gKwku
dWlfbnVtID0gMSwKPiA+PiArfTsKPiA+PiArCj4gPj4gCj4gPj4gIHN0YXRpYyBjb25zdCBzdHJ1
Y3Qgb2ZfZGV2aWNlX2lkIHN1bjhpX21peGVyX29mX3RhYmxlW10gPSB7Cj4gPj4gIAo+ID4+ICAJ
ewo+ID4+ICAJCj4gPj4gIAkJLmNvbXBhdGlibGUgPSAiYWxsd2lubmVyLHN1bjhpLXYzcy1kZTIt
bWl4ZXIiLAo+ID4+ICAJCS5kYXRhID0gJnN1bjhpX3Yzc19taXhlcl9jZmcsCj4gPj4gIAkKPiA+
PiAgCX0sCj4gPj4gCj4gPj4gKwl7Cj4gPj4gKwkJLmNvbXBhdGlibGUgPSAiYWxsd2lubmVyLHN1
bjhpLWgzLWRlMi1taXhlcjAiLAo+ID4+ICsJCS5kYXRhID0gJnN1bjhpX2gzX21peGVyMF9jZmcK
PiA+PiArCX0sCj4gPj4gKwl7Cj4gPj4gKwkJLmNvbXBhdGlibGUgPSAiYWxsd2lubmVyLHN1bjhp
LWgzLWRlMi1taXhlcjEiLAo+ID4+ICsJCS5kYXRhID0gJnN1bjhpX2gzX21peGVyMV9jZmcKPiA+
PiArCX0sCj4gPgo+ID5TbyB0aGUgb25seSBkaWZmZXJlbmNlIGJldHdlZW4gdGhlIHR3byBpcyB0
aGUgbnVtYmVyIG9mIHVpIHBsYW5lcz8KPiAKPiBOb3Qgb25seS4sIGJ1dCBjdXJyZW50bHkgd2Ug
b25seSBpbXBsZW1lbnRlZCB0aGlzLgo+IAo+IE1vcmUgZnVuY3Rpb25zIGRpZmZlciwgYnV0IHdl
IHN0aWxsIGRvbid0IHN1cHBvcnQgdGhlbS4uLgo+IAoKQXMgZmFyIGFzIEkgY2FuIHRlbGwsIHRo
ZXkgb25seSBkaWZmZXIgaW4gdWkgJiB2aSBudW1iZXIgb2YgcGxhbmVzIGFuZCBiZXR3ZWVuIApk
aWZmZXJlbnQgU29DcywgbWF4IHBsYW5lIHNpemUuCgpJY2Vub3d5LApEbyB5b3Uga25vdyBhbnkg
b3RoZXIgcHJvcGVydHkgdGhleSBkaWZmZXI/IEkgdGhpbmsgZXZlcnl0aGluZyBlbHNlIGlzIGJh
c2VkIAptb3N0bHkgb24gdWkgJiB2aSBudW1iZXIgb2YgcGxhbmVzLgoKQmVzdCByZWdhcmRzLApK
ZXJuZWoKCj4gPldoeSBub3QgY3JlYXRlIGEgcHJvcGVydHkgdG8gZ2l2ZSB0aGUgbnVtYmVyIHRo
ZW4sIGluc3RlYWQgb2YgYQo+ID5jb21wYXRpYmxlPwo+ID4KPiA+TWF4aW1lCj4gCj4gLS0KPiBZ
b3UgcmVjZWl2ZWQgdGhpcyBtZXNzYWdlIGJlY2F1c2UgeW91IGFyZSBzdWJzY3JpYmVkIHRvIHRo
ZSBHb29nbGUgR3JvdXBzCj4gImxpbnV4LXN1bnhpIiBncm91cC4gVG8gdW5zdWJzY3JpYmUgZnJv
bSB0aGlzIGdyb3VwIGFuZCBzdG9wIHJlY2VpdmluZwo+IGVtYWlscyBmcm9tIGl0LCBzZW5kIGFu
IGVtYWlsIHRvIGxpbnV4LXN1bnhpK3Vuc3Vic2NyaWJlQGdvb2dsZWdyb3Vwcy5jb20uCj4gRm9y
IG1vcmUgb3B0aW9ucywgdmlzaXQgaHR0cHM6Ly9ncm91cHMuZ29vZ2xlLmNvbS9kL29wdG91dC4K
CgoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGludXgt
YXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QKbGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQu
b3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21haWxtYW4vbGlzdGluZm8vbGludXgtYXJt
LWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers
@ 2017-05-19 18:00         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi!

Dne petek, 19. maj 2017 ob 19:49:58 CEST je Icenowy Zheng napisal(a):
> ? 2017?5?20? GMT+08:00 ??1:47:29, Maxime Ripard <maxime.ripard@free-
electrons.com> ??:
> >On Thu, May 18, 2017 at 12:43:45AM +0800, Icenowy Zheng wrote:
> >> From: Icenowy Zheng <icenowy@aosc.xyz>
> >> 
> >> Allwinner H3 SoC has two mixers, one has 1 VI channel and 3 UI
> >
> >channels,
> >
> >> and the other has 1 VI and 1 UI.
> >> 
> >> Add support for these two variants.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >> ---
> >> 
> >>  drivers/gpu/drm/sun4i/sun8i_mixer.c | 18 ++++++++++++++++++
> >>  1 file changed, 18 insertions(+)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >
> >> index cb193c5f1686..d658a3a8159a 100644
> >> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> >> @@ -390,11 +390,29 @@ static const struct sun8i_mixer_cfg
> >
> >sun8i_v3s_mixer_cfg = {
> >
> >>  	.ui_num = 1,
> >>  
> >>  };
> >> 
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 3,
> >> +};
> >> +
> >> +static const struct sun8i_mixer_cfg sun8i_h3_mixer1_cfg = {
> >> +	.vi_num = 1,
> >> +	.ui_num = 1,
> >> +};
> >> +
> >> 
> >>  static const struct of_device_id sun8i_mixer_of_table[] = {
> >>  
> >>  	{
> >>  	
> >>  		.compatible = "allwinner,sun8i-v3s-de2-mixer",
> >>  		.data = &sun8i_v3s_mixer_cfg,
> >>  	
> >>  	},
> >> 
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer0",
> >> +		.data = &sun8i_h3_mixer0_cfg
> >> +	},
> >> +	{
> >> +		.compatible = "allwinner,sun8i-h3-de2-mixer1",
> >> +		.data = &sun8i_h3_mixer1_cfg
> >> +	},
> >
> >So the only difference between the two is the number of ui planes?
> 
> Not only., but currently we only implemented this.
> 
> More functions differ, but we still don't support them...
> 

As far as I can tell, they only differ in ui & vi number of planes and between 
different SoCs, max plane size.

Icenowy,
Do you know any other property they differ? I think everything else is based 
mostly on ui & vi number of planes.

Best regards,
Jernej

> >Why not create a property to give the number then, instead of a
> >compatible?
> >
> >Maxime
> 
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 18:00       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:00 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
>> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
>> tcon0 and mixer1 is connected to tcon1; however by setting a bit
>> the connection can be swapped.
>> 
>> As we now hardcode the default connection, ignore the bonus endpoint
>for
>> the mixer's output and the TCON's input, as they stands for the
>swapped
>> connection.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
>+++++++++++++++++++++++++++++---------
>>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>>  3 files changed, 59 insertions(+), 9 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
>b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> index 1dd1948025d2..29bf1325ded6 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
>device_node *node)
>>  		of_device_is_compatible(node,
>"allwinner,sun8i-a33-display-frontend");
>>  }
>>  
>> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
>*node)
>> +{
>> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
>*/
>> +	return of_device_is_compatible(node,
>"allwinner,sun8i-h3-de2-mixer0") ||
>> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
>> +}
>> +
>>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>>  {
>>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
>> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
>*dev,
>>  			}
>>  		}
>>  
>> +		/*
>> +		 * The second endpoint of the output of a swappable DE2 mixer
>> +		 * is the TCON after connection swapping.
>> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
>> +		 * mixer1->tcon1 connection.
>> +		 */
>> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
>mixer... skipping\n");
>> +				continue;
>> +			}
>> +		}
>> +
>>  		/* Walk down our tree */
>>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>>  
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> index f44a37a5993d..89a215ff2370 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
>*dev,
>>   * requested via the get_id function of the engine.
>>   */
>>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
>*drv,
>> -						   struct device_node *node)
>> +						   struct device_node *node,
>> +						   bool skip_bonus_ep)
>>  {
>>  	struct device_node *port, *ep, *remote;
>>  	struct sunxi_engine *engine;
>> @@ -439,6 +440,20 @@ static struct sunxi_engine
>*sun4i_tcon_find_engine(struct sun4i_drv *drv,
>>  		if (!remote)
>>  			continue;
>>  
>> +		if (skip_bonus_ep) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
>searching engine\n");
>> +				continue;
>> +			}
>> +		}
>> +
>
>You don't list the mixers in the tcon's output, why do you need that
>exactly?

Mixers are TCONs' input, not output...

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 18:00       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:00 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw



于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
>> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
>> tcon0 and mixer1 is connected to tcon1; however by setting a bit
>> the connection can be swapped.
>> 
>> As we now hardcode the default connection, ignore the bonus endpoint
>for
>> the mixer's output and the TCON's input, as they stands for the
>swapped
>> connection.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>> ---
>>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
>+++++++++++++++++++++++++++++---------
>>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>>  3 files changed, 59 insertions(+), 9 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
>b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> index 1dd1948025d2..29bf1325ded6 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
>device_node *node)
>>  		of_device_is_compatible(node,
>"allwinner,sun8i-a33-display-frontend");
>>  }
>>  
>> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
>*node)
>> +{
>> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
>*/
>> +	return of_device_is_compatible(node,
>"allwinner,sun8i-h3-de2-mixer0") ||
>> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
>> +}
>> +
>>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>>  {
>>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
>> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
>*dev,
>>  			}
>>  		}
>>  
>> +		/*
>> +		 * The second endpoint of the output of a swappable DE2 mixer
>> +		 * is the TCON after connection swapping.
>> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
>> +		 * mixer1->tcon1 connection.
>> +		 */
>> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
>mixer... skipping\n");
>> +				continue;
>> +			}
>> +		}
>> +
>>  		/* Walk down our tree */
>>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>>  
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> index f44a37a5993d..89a215ff2370 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
>*dev,
>>   * requested via the get_id function of the engine.
>>   */
>>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
>*drv,
>> -						   struct device_node *node)
>> +						   struct device_node *node,
>> +						   bool skip_bonus_ep)
>>  {
>>  	struct device_node *port, *ep, *remote;
>>  	struct sunxi_engine *engine;
>> @@ -439,6 +440,20 @@ static struct sunxi_engine
>*sun4i_tcon_find_engine(struct sun4i_drv *drv,
>>  		if (!remote)
>>  			continue;
>>  
>> +		if (skip_bonus_ep) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
>searching engine\n");
>> +				continue;
>> +			}
>> +		}
>> +
>
>You don't list the mixers in the tcon's output, why do you need that
>exactly?

Mixers are TCONs' input, not output...

>
>Maxime

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 18:00       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:00 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel

Cgrkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2IMTo1Nzo1MywgTWF4aW1lIFJp
cGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLWVsZWN0cm9ucy5jb20+IOWGmeWIsDoKPk9uIFRodSwg
TWF5IDE4LCAyMDE3IGF0IDEyOjQzOjQ2QU0gKzA4MDAsIEljZW5vd3kgWmhlbmcgd3JvdGU6Cj4+
IFNvbWUgU29DJ3MgREUyIGhhcyB0d28gbWl4ZXJzLiBEZWZhdWx0bHkgdGhlIG1peGVyMCBpcyBj
b25uZWN0ZWQgdG8KPj4gdGNvbjAgYW5kIG1peGVyMSBpcyBjb25uZWN0ZWQgdG8gdGNvbjE7IGhv
d2V2ZXIgYnkgc2V0dGluZyBhIGJpdAo+PiB0aGUgY29ubmVjdGlvbiBjYW4gYmUgc3dhcHBlZC4K
Pj4gCj4+IEFzIHdlIG5vdyBoYXJkY29kZSB0aGUgZGVmYXVsdCBjb25uZWN0aW9uLCBpZ25vcmUg
dGhlIGJvbnVzIGVuZHBvaW50Cj5mb3IKPj4gdGhlIG1peGVyJ3Mgb3V0cHV0IGFuZCB0aGUgVENP
TidzIGlucHV0LCBhcyB0aGV5IHN0YW5kcyBmb3IgdGhlCj5zd2FwcGVkCj4+IGNvbm5lY3Rpb24u
Cj4+IAo+PiBTaWduZWQtb2ZmLWJ5OiBJY2Vub3d5IFpoZW5nIDxpY2Vub3d5QGFvc2MuaW8+Cj4+
IC0tLQo+PiAgZHJpdmVycy9ncHUvZHJtL3N1bjRpL3N1bjRpX2Rydi5jICB8IDI3ICsrKysrKysr
KysrKysrKysrKysrKysrKysrCj4+ICBkcml2ZXJzL2dwdS9kcm0vc3VuNGkvc3VuNGlfdGNvbi5j
IHwgMzkKPisrKysrKysrKysrKysrKysrKysrKysrKysrKysrLS0tLS0tLS0tCj4+ICBkcml2ZXJz
L2dwdS9kcm0vc3VuNGkvc3VuNGlfdGNvbi5oIHwgIDIgKysKPj4gIDMgZmlsZXMgY2hhbmdlZCwg
NTkgaW5zZXJ0aW9ucygrKSwgOSBkZWxldGlvbnMoLSkKPj4gCj4+IGRpZmYgLS1naXQgYS9kcml2
ZXJzL2dwdS9kcm0vc3VuNGkvc3VuNGlfZHJ2LmMKPmIvZHJpdmVycy9ncHUvZHJtL3N1bjRpL3N1
bjRpX2Rydi5jCj4+IGluZGV4IDFkZDE5NDgwMjVkMi4uMjliZjEzMjVkZWQ2IDEwMDY0NAo+PiAt
LS0gYS9kcml2ZXJzL2dwdS9kcm0vc3VuNGkvc3VuNGlfZHJ2LmMKPj4gKysrIGIvZHJpdmVycy9n
cHUvZHJtL3N1bjRpL3N1bjRpX2Rydi5jCj4+IEBAIC0xNzMsNiArMTczLDEzIEBAIHN0YXRpYyBi
b29sIHN1bjRpX2Rydl9ub2RlX2lzX2Zyb250ZW5kKHN0cnVjdAo+ZGV2aWNlX25vZGUgKm5vZGUp
Cj4+ICAJCW9mX2RldmljZV9pc19jb21wYXRpYmxlKG5vZGUsCj4iYWxsd2lubmVyLHN1bjhpLWEz
My1kaXNwbGF5LWZyb250ZW5kIik7Cj4+ICB9Cj4+ICAKPj4gK3N0YXRpYyBib29sIHN1bjRpX2Ry
dl9ub2RlX2lzX3N3YXBwYWJsZV9kZTJfbWl4ZXIoc3RydWN0IGRldmljZV9ub2RlCj4qbm9kZSkK
Pj4gK3sKPj4gKwkvKiBUaGUgVjNzIGhhcyBvbmx5IG9uZSBtaXhlci10Y29uIHBhaXIsIHNvIGl0
J3Mgbm90IGxpc3RlZCBoZXJlLgo+Ki8KPj4gKwlyZXR1cm4gb2ZfZGV2aWNlX2lzX2NvbXBhdGli
bGUobm9kZSwKPiJhbGx3aW5uZXIsc3VuOGktaDMtZGUyLW1peGVyMCIpIHx8Cj4+ICsJCW9mX2Rl
dmljZV9pc19jb21wYXRpYmxlKG5vZGUsICJhbGx3aW5uZXIsc3VuOGktaDMtZGUyLW1peGVyMSIp
Owo+PiArfQo+PiArCj4+ICBzdGF0aWMgYm9vbCBzdW40aV9kcnZfbm9kZV9pc190Y29uKHN0cnVj
dCBkZXZpY2Vfbm9kZSAqbm9kZSkKPj4gIHsKPj4gIAlyZXR1cm4gb2ZfZGV2aWNlX2lzX2NvbXBh
dGlibGUobm9kZSwgImFsbHdpbm5lcixzdW41aS1hMTMtdGNvbiIpIHx8Cj4+IEBAIC0yNDksNiAr
MjU2LDI2IEBAIHN0YXRpYyBpbnQgc3VuNGlfZHJ2X2FkZF9lbmRwb2ludHMoc3RydWN0IGRldmlj
ZQo+KmRldiwKPj4gIAkJCX0KPj4gIAkJfQo+PiAgCj4+ICsJCS8qCj4+ICsJCSAqIFRoZSBzZWNv
bmQgZW5kcG9pbnQgb2YgdGhlIG91dHB1dCBvZiBhIHN3YXBwYWJsZSBERTIgbWl4ZXIKPj4gKwkJ
ICogaXMgdGhlIFRDT04gYWZ0ZXIgY29ubmVjdGlvbiBzd2FwcGluZy4KPj4gKwkJICogSWdub3Jl
IGl0IG5vdywgYXMgd2Ugbm93IGhhcmRjb2RlIG1peGVyMC0+dGNvbjAsCj4+ICsJCSAqIG1peGVy
MS0+dGNvbjEgY29ubmVjdGlvbi4KPj4gKwkJICovCj4+ICsJCWlmIChzdW40aV9kcnZfbm9kZV9p
c19zd2FwcGFibGVfZGUyX21peGVyKG5vZGUpKSB7Cj4+ICsJCQlzdHJ1Y3Qgb2ZfZW5kcG9pbnQg
ZW5kcG9pbnQ7Cj4+ICsKPj4gKwkJCWlmIChvZl9ncmFwaF9wYXJzZV9lbmRwb2ludChlcCwgJmVu
ZHBvaW50KSkgewo+PiArCQkJCURSTV9ERUJVR19EUklWRVIoIkNvdWxkbid0IHBhcnNlIGVuZHBv
aW50XG4iKTsKPj4gKwkJCQljb250aW51ZTsKPj4gKwkJCX0KPj4gKwo+PiArCQkJaWYgKGVuZHBv
aW50LmlkKSB7Cj4+ICsJCQkJRFJNX0RFQlVHX0RSSVZFUigiRW5kcG9pbnQgaXMgYW4gdW51c2Vk
IGNvbm5lY3Rpb24gZm9yIERFMgo+bWl4ZXIuLi4gc2tpcHBpbmdcbiIpOwo+PiArCQkJCWNvbnRp
bnVlOwo+PiArCQkJfQo+PiArCQl9Cj4+ICsKPj4gIAkJLyogV2FsayBkb3duIG91ciB0cmVlICov
Cj4+ICAJCWNvdW50ICs9IHN1bjRpX2Rydl9hZGRfZW5kcG9pbnRzKGRldiwgbWF0Y2gsIHJlbW90
ZSk7Cj4+ICAKPj4gZGlmZiAtLWdpdCBhL2RyaXZlcnMvZ3B1L2RybS9zdW40aS9zdW40aV90Y29u
LmMKPmIvZHJpdmVycy9ncHUvZHJtL3N1bjRpL3N1bjRpX3Rjb24uYwo+PiBpbmRleCBmNDRhMzdh
NTk5M2QuLjg5YTIxNWZmMjM3MCAxMDA2NDQKPj4gLS0tIGEvZHJpdmVycy9ncHUvZHJtL3N1bjRp
L3N1bjRpX3Rjb24uYwo+PiArKysgYi9kcml2ZXJzL2dwdS9kcm0vc3VuNGkvc3VuNGlfdGNvbi5j
Cj4+IEBAIC00MjUsNyArNDI1LDggQEAgc3RhdGljIGludCBzdW40aV90Y29uX2luaXRfcmVnbWFw
KHN0cnVjdCBkZXZpY2UKPipkZXYsCj4+ICAgKiByZXF1ZXN0ZWQgdmlhIHRoZSBnZXRfaWQgZnVu
Y3Rpb24gb2YgdGhlIGVuZ2luZS4KPj4gICAqLwo+PiAgc3RhdGljIHN0cnVjdCBzdW54aV9lbmdp
bmUgKnN1bjRpX3Rjb25fZmluZF9lbmdpbmUoc3RydWN0IHN1bjRpX2Rydgo+KmRydiwKPj4gLQkJ
CQkJCSAgIHN0cnVjdCBkZXZpY2Vfbm9kZSAqbm9kZSkKPj4gKwkJCQkJCSAgIHN0cnVjdCBkZXZp
Y2Vfbm9kZSAqbm9kZSwKPj4gKwkJCQkJCSAgIGJvb2wgc2tpcF9ib251c19lcCkKPj4gIHsKPj4g
IAlzdHJ1Y3QgZGV2aWNlX25vZGUgKnBvcnQsICplcCwgKnJlbW90ZTsKPj4gIAlzdHJ1Y3Qgc3Vu
eGlfZW5naW5lICplbmdpbmU7Cj4+IEBAIC00MzksNiArNDQwLDIwIEBAIHN0YXRpYyBzdHJ1Y3Qg
c3VueGlfZW5naW5lCj4qc3VuNGlfdGNvbl9maW5kX2VuZ2luZShzdHJ1Y3Qgc3VuNGlfZHJ2ICpk
cnYsCj4+ICAJCWlmICghcmVtb3RlKQo+PiAgCQkJY29udGludWU7Cj4+ICAKPj4gKwkJaWYgKHNr
aXBfYm9udXNfZXApIHsKPj4gKwkJCXN0cnVjdCBvZl9lbmRwb2ludCBlbmRwb2ludDsKPj4gKwo+
PiArCQkJaWYgKG9mX2dyYXBoX3BhcnNlX2VuZHBvaW50KGVwLCAmZW5kcG9pbnQpKSB7Cj4+ICsJ
CQkJRFJNX0RFQlVHX0RSSVZFUigiQ291bGRuJ3QgcGFyc2UgZW5kcG9pbnRcbiIpOwo+PiArCQkJ
CWNvbnRpbnVlOwo+PiArCQkJfQo+PiArCj4+ICsJCQlpZiAoZW5kcG9pbnQuaWQpIHsKPj4gKwkJ
CQlEUk1fREVCVUdfRFJJVkVSKCJTa2lwcGluZyBib251cyBtaXhlci0+VENPTiBjb25uZWN0aW9u
IHdoZW4KPnNlYXJjaGluZyBlbmdpbmVcbiIpOwo+PiArCQkJCWNvbnRpbnVlOwo+PiArCQkJfQo+
PiArCQl9Cj4+ICsKPgo+WW91IGRvbid0IGxpc3QgdGhlIG1peGVycyBpbiB0aGUgdGNvbidzIG91
dHB1dCwgd2h5IGRvIHlvdSBuZWVkIHRoYXQKPmV4YWN0bHk/CgpNaXhlcnMgYXJlIFRDT05zJyBp
bnB1dCwgbm90IG91dHB1dC4uLgoKPgo+TWF4aW1lCgpfX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fXwpsaW51eC1hcm0ta2VybmVsIG1haWxpbmcgbGlzdApsaW51
eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmluZnJhZGVhZC5v
cmcvbWFpbG1hbi9saXN0aW5mby9saW51eC1hcm0ta2VybmVsCg==

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-19 18:00       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:00 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?20? GMT+08:00 ??1:57:53, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
>> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
>> tcon0 and mixer1 is connected to tcon1; however by setting a bit
>> the connection can be swapped.
>> 
>> As we now hardcode the default connection, ignore the bonus endpoint
>for
>> the mixer's output and the TCON's input, as they stands for the
>swapped
>> connection.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
>+++++++++++++++++++++++++++++---------
>>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>>  3 files changed, 59 insertions(+), 9 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
>b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> index 1dd1948025d2..29bf1325ded6 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
>device_node *node)
>>  		of_device_is_compatible(node,
>"allwinner,sun8i-a33-display-frontend");
>>  }
>>  
>> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
>*node)
>> +{
>> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
>*/
>> +	return of_device_is_compatible(node,
>"allwinner,sun8i-h3-de2-mixer0") ||
>> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
>> +}
>> +
>>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>>  {
>>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
>> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
>*dev,
>>  			}
>>  		}
>>  
>> +		/*
>> +		 * The second endpoint of the output of a swappable DE2 mixer
>> +		 * is the TCON after connection swapping.
>> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
>> +		 * mixer1->tcon1 connection.
>> +		 */
>> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
>mixer... skipping\n");
>> +				continue;
>> +			}
>> +		}
>> +
>>  		/* Walk down our tree */
>>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>>  
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> index f44a37a5993d..89a215ff2370 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
>*dev,
>>   * requested via the get_id function of the engine.
>>   */
>>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
>*drv,
>> -						   struct device_node *node)
>> +						   struct device_node *node,
>> +						   bool skip_bonus_ep)
>>  {
>>  	struct device_node *port, *ep, *remote;
>>  	struct sunxi_engine *engine;
>> @@ -439,6 +440,20 @@ static struct sunxi_engine
>*sun4i_tcon_find_engine(struct sun4i_drv *drv,
>>  		if (!remote)
>>  			continue;
>>  
>> +		if (skip_bonus_ep) {
>> +			struct of_endpoint endpoint;
>> +
>> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> +				continue;
>> +			}
>> +
>> +			if (endpoint.id) {
>> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
>searching engine\n");
>> +				continue;
>> +			}
>> +		}
>> +
>
>You don't list the mixers in the tcon's output, why do you need that
>exactly?

Mixers are TCONs' input, not output...

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:02     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
> -On SoCs other than the A33 and V3s, there is one more clock required:
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-a33-tcon
> +   * allwinner,sun8i-v3s-tcon
> +there is one more clock and one more property required:
> + - clocks:
> +   - 'tcon-ch0': The clock driving the TCON channel 0
> + - clock-output-names: Name of the pixel clock created
> +
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-h3-tcon0
> +there is one more clock required:
>     - 'tcon-ch1': The clock driving the TCON channel 1

Putting ID's in the compatible name is usually a bad idea. What is the
difference between the two? Only that the second one doesn't have a
clock?

That seems highly unlikely. How does it generate the pixel clock
frequency?

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:02     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
> -On SoCs other than the A33 and V3s, there is one more clock required:
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-a33-tcon
> +   * allwinner,sun8i-v3s-tcon
> +there is one more clock and one more property required:
> + - clocks:
> +   - 'tcon-ch0': The clock driving the TCON channel 0
> + - clock-output-names: Name of the pixel clock created
> +
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-h3-tcon0
> +there is one more clock required:
>     - 'tcon-ch1': The clock driving the TCON channel 1

Putting ID's in the compatible name is usually a bad idea. What is the
difference between the two? Only that the second one doesn't have a
clock?

That seems highly unlikely. How does it generate the pixel clock
frequency?

Maxime

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:02     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1154 bytes --]

On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
> -On SoCs other than the A33 and V3s, there is one more clock required:
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-a33-tcon
> +   * allwinner,sun8i-v3s-tcon
> +there is one more clock and one more property required:
> + - clocks:
> +   - 'tcon-ch0': The clock driving the TCON channel 0
> + - clock-output-names: Name of the pixel clock created
> +
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-h3-tcon0
> +there is one more clock required:
>     - 'tcon-ch1': The clock driving the TCON channel 1

Putting ID's in the compatible name is usually a bad idea. What is the
difference between the two? Only that the second one doesn't have a
clock?

That seems highly unlikely. How does it generate the pixel clock
frequency?

Maxime

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:02     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
> -On SoCs other than the A33 and V3s, there is one more clock required:
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-a33-tcon
> +   * allwinner,sun8i-v3s-tcon
> +there is one more clock and one more property required:
> + - clocks:
> +   - 'tcon-ch0': The clock driving the TCON channel 0
> + - clock-output-names: Name of the pixel clock created
> +
> +For the following compatibles:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun6i-a31-tcon
> +   * allwinner,sun6i-a31s-tcon
> +   * allwinner,sun8i-h3-tcon0
> +there is one more clock required:
>     - 'tcon-ch1': The clock driving the TCON channel 1

Putting ID's in the compatible name is usually a bad idea. What is the
difference between the two? Only that the second one doesn't have a
clock?

That seems highly unlikely. How does it generate the pixel clock
frequency?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170519/6b634b74/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:03     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
> but with some different points about clocks:
> - It has a mod clock and a bus clock.
> - The mod clock must be at a fixed rate to generate signal.

Why?

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:03     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
> but with some different points about clocks:
> - It has a mod clock and a bus clock.
> - The mod clock must be at a fixed rate to generate signal.

Why?

Maxime

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:03     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 412 bytes --]

On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
> but with some different points about clocks:
> - It has a mod clock and a bus clock.
> - The mod clock must be at a fixed rate to generate signal.

Why?

Maxime

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:03     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> Allwinner H3 features a TV encoder similar to the one in earlier SoCs,
> but with some different points about clocks:
> - It has a mod clock and a bus clock.
> - The mod clock must be at a fixed rate to generate signal.

Why?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170519/f6a71f40/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:06     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:06 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]

On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>  
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>  
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
>  
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock@1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;

This shouldn't be set in the DT, but evaluated at runtime when calling
clk_set_rate.

> +		tve0: tv-encoder@1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;

Same thing here. clk_set_rate should just do the right thing.

> +			assigned-clock-rates = <216000000>;

And why are you setting it in the driver and in the DT?

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:06     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:06 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2335 bytes --]

On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>  
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>  
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
>  
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock@1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;

This shouldn't be set in the DT, but evaluated at runtime when calling
clk_set_rate.

> +		tve0: tv-encoder@1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;

Same thing here. clk_set_rate should just do the right thing.

> +			assigned-clock-rates = <216000000>;

And why are you setting it in the driver and in the DT?

Maxime

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:06     ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-19 18:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
> 
> The H5 pipeline has some differences and will be enabled later.
> 
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>  
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>  
>  / {
>  	cpus {
> @@ -72,6 +74,193 @@
>  		};
>  	};
>  
> +	de: display-engine {
> +		compatible = "allwinner,sun8i-h3-display-engine";
> +		allwinner,pipelines = <&mixer0>,
> +				      <&mixer1>;
> +		status = "disabled";
> +	};
> +
> +	soc {
> +		display_clocks: clock at 1000000 {
> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> +			reg = <0x01000000 0x100000>;
> +			clocks = <&ccu CLK_BUS_DE>,
> +				 <&ccu CLK_DE>;
> +			clock-names = "bus",
> +				      "mod";
> +			resets = <&ccu RST_BUS_DE>;
> +			#clock-cells = <1>;
> +			#reset-cells = <1>;
> +			assigned-clocks = <&ccu CLK_DE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +			assigned-clock-rates = <432000000>;

This shouldn't be set in the DT, but evaluated at runtime when calling
clk_set_rate.

> +		tve0: tv-encoder at 1e00000 {
> +			compatible = "allwinner,sun8i-h3-tv-encoder";
> +			reg = <0x01e00000 0x1000>;
> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +			clock-names = "bus", "mod";
> +			resets = <&ccu RST_BUS_TVE>;
> +			status = "disabled";
> +
> +			assigned-clocks = <&ccu CLK_TVE>;
> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;

Same thing here. clk_set_rate should just do the right thing.

> +			assigned-clock-rates = <216000000>;

And why are you setting it in the driver and in the DT?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170519/c57dec29/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:06       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:06 UTC (permalink / raw)
  To: linux-arm-kernel, Maxime Ripard
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk



于 2017年5月20日 GMT+08:00 上午2:02:15, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>> -On SoCs other than the A33 and V3s, there is one more clock
>required:
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-a33-tcon
>> +   * allwinner,sun8i-v3s-tcon
>> +there is one more clock and one more property required:
>> + - clocks:
>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>> + - clock-output-names: Name of the pixel clock created
>> +
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-h3-tcon0
>> +there is one more clock required:
>>     - 'tcon-ch1': The clock driving the TCON channel 1
>
>Putting ID's in the compatible name is usually a bad idea. What is the
>difference between the two? Only that the second one doesn't have a
>clock?

Yes.

>
>That seems highly unlikely. How does it generate the pixel clock
>frequency?

Yes it seems impossible, but it's also the fact.

There's only one CLK_TCON in H3/5, which is for TCON0.

It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
Although we have a lcd-ch1 clock, we cannot touch it, otherwise
the TVE will refuse to work (the TVE can only work under 216MHz).

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:06       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:06 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Maxime Ripard
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Chen-Yu Tsai,
	Rob Herring, linux-clk-u79uwXL29TY76Z2rM5mHXA



于 2017年5月20日 GMT+08:00 上午2:02:15, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>> -On SoCs other than the A33 and V3s, there is one more clock
>required:
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-a33-tcon
>> +   * allwinner,sun8i-v3s-tcon
>> +there is one more clock and one more property required:
>> + - clocks:
>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>> + - clock-output-names: Name of the pixel clock created
>> +
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-h3-tcon0
>> +there is one more clock required:
>>     - 'tcon-ch1': The clock driving the TCON channel 1
>
>Putting ID's in the compatible name is usually a bad idea. What is the
>difference between the two? Only that the second one doesn't have a
>clock?

Yes.

>
>That seems highly unlikely. How does it generate the pixel clock
>frequency?

Yes it seems impossible, but it's also the fact.

There's only one CLK_TCON in H3/5, which is for TCON0.

It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
Although we have a lcd-ch1 clock, we cannot touch it, otherwise
the TVE will refuse to work (the TVE can only work under 216MHz).

>
>Maxime

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:06       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:06 UTC (permalink / raw)
  To: linux-arm-kernel, Maxime Ripard
  Cc: devicetree, Chen-Yu Tsai, dri-devel, linux-kernel, linux-sunxi,
	Rob Herring, linux-clk

Cgrkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2IMjowMjoxNSwgTWF4aW1lIFJp
cGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLWVsZWN0cm9ucy5jb20+IOWGmeWIsDoKPk9uIFRodSwg
TWF5IDE4LCAyMDE3IGF0IDEyOjQzOjQ0QU0gKzA4MDAsIEljZW5vd3kgWmhlbmcgd3JvdGU6Cj4+
IC1PbiBTb0NzIG90aGVyIHRoYW4gdGhlIEEzMyBhbmQgVjNzLCB0aGVyZSBpcyBvbmUgbW9yZSBj
bG9jawo+cmVxdWlyZWQ6Cj4+ICtGb3IgdGhlIGZvbGxvd2luZyBjb21wYXRpYmxlczoKPj4gKyAg
ICogYWxsd2lubmVyLHN1bjVpLWExMy10Y29uCj4+ICsgICAqIGFsbHdpbm5lcixzdW42aS1hMzEt
dGNvbgo+PiArICAgKiBhbGx3aW5uZXIsc3VuNmktYTMxcy10Y29uCj4+ICsgICAqIGFsbHdpbm5l
cixzdW44aS1hMzMtdGNvbgo+PiArICAgKiBhbGx3aW5uZXIsc3VuOGktdjNzLXRjb24KPj4gK3Ro
ZXJlIGlzIG9uZSBtb3JlIGNsb2NrIGFuZCBvbmUgbW9yZSBwcm9wZXJ0eSByZXF1aXJlZDoKPj4g
KyAtIGNsb2NrczoKPj4gKyAgIC0gJ3Rjb24tY2gwJzogVGhlIGNsb2NrIGRyaXZpbmcgdGhlIFRD
T04gY2hhbm5lbCAwCj4+ICsgLSBjbG9jay1vdXRwdXQtbmFtZXM6IE5hbWUgb2YgdGhlIHBpeGVs
IGNsb2NrIGNyZWF0ZWQKPj4gKwo+PiArRm9yIHRoZSBmb2xsb3dpbmcgY29tcGF0aWJsZXM6Cj4+
ICsgICAqIGFsbHdpbm5lcixzdW41aS1hMTMtdGNvbgo+PiArICAgKiBhbGx3aW5uZXIsc3VuNmkt
YTMxLXRjb24KPj4gKyAgICogYWxsd2lubmVyLHN1bjZpLWEzMXMtdGNvbgo+PiArICAgKiBhbGx3
aW5uZXIsc3VuOGktaDMtdGNvbjAKPj4gK3RoZXJlIGlzIG9uZSBtb3JlIGNsb2NrIHJlcXVpcmVk
Ogo+PiAgICAgLSAndGNvbi1jaDEnOiBUaGUgY2xvY2sgZHJpdmluZyB0aGUgVENPTiBjaGFubmVs
IDEKPgo+UHV0dGluZyBJRCdzIGluIHRoZSBjb21wYXRpYmxlIG5hbWUgaXMgdXN1YWxseSBhIGJh
ZCBpZGVhLiBXaGF0IGlzIHRoZQo+ZGlmZmVyZW5jZSBiZXR3ZWVuIHRoZSB0d28/IE9ubHkgdGhh
dCB0aGUgc2Vjb25kIG9uZSBkb2Vzbid0IGhhdmUgYQo+Y2xvY2s/CgpZZXMuCgo+Cj5UaGF0IHNl
ZW1zIGhpZ2hseSB1bmxpa2VseS4gSG93IGRvZXMgaXQgZ2VuZXJhdGUgdGhlIHBpeGVsIGNsb2Nr
Cj5mcmVxdWVuY3k/CgpZZXMgaXQgc2VlbXMgaW1wb3NzaWJsZSwgYnV0IGl0J3MgYWxzbyB0aGUg
ZmFjdC4KClRoZXJlJ3Mgb25seSBvbmUgQ0xLX1RDT04gaW4gSDMvNSwgd2hpY2ggaXMgZm9yIFRD
T04wLgoKSXQncyBwb3NzaWJsZSB0aGF0IGxjZC1jaDEgY2xrIGlzIENMS19UVkUsIGJ1dCBpdCdz
IHN0aWxsIGEgd2VpcmQgc2l0dWF0aW9uIC0tCkFsdGhvdWdoIHdlIGhhdmUgYSBsY2QtY2gxIGNs
b2NrLCB3ZSBjYW5ub3QgdG91Y2ggaXQsIG90aGVyd2lzZQp0aGUgVFZFIHdpbGwgcmVmdXNlIHRv
IHdvcmsgKHRoZSBUVkUgY2FuIG9ubHkgd29yayB1bmRlciAyMTZNSHopLgoKPgo+TWF4aW1lCgpf
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpsaW51eC1hcm0t
a2VybmVsIG1haWxpbmcgbGlzdApsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmcK
aHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5mby9saW51eC1hcm0ta2Vy
bmVsCg==

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-19 18:06       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:06 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?20? GMT+08:00 ??2:02:15, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>> -On SoCs other than the A33 and V3s, there is one more clock
>required:
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-a33-tcon
>> +   * allwinner,sun8i-v3s-tcon
>> +there is one more clock and one more property required:
>> + - clocks:
>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>> + - clock-output-names: Name of the pixel clock created
>> +
>> +For the following compatibles:
>> +   * allwinner,sun5i-a13-tcon
>> +   * allwinner,sun6i-a31-tcon
>> +   * allwinner,sun6i-a31s-tcon
>> +   * allwinner,sun8i-h3-tcon0
>> +there is one more clock required:
>>     - 'tcon-ch1': The clock driving the TCON channel 1
>
>Putting ID's in the compatible name is usually a bad idea. What is the
>difference between the two? Only that the second one doesn't have a
>clock?

Yes.

>
>That seems highly unlikely. How does it generate the pixel clock
>frequency?

Yes it seems impossible, but it's also the fact.

There's only one CLK_TCON in H3/5, which is for TCON0.

It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
Although we have a lcd-ch1 clock, we cannot touch it, otherwise
the TVE will refuse to work (the TVE can only work under 216MHz).

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:08       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:08 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> Allwinner H3 features a TV encoder similar to the one in earlier
>SoCs,
>> but with some different points about clocks:
>> - It has a mod clock and a bus clock.
>> - The mod clock must be at a fixed rate to generate signal.
>
>Why?

It's experiment result by Jernej.

The clock rates in BSP kernel is also specially designed
(PLL_DE at 432MHz) in order to be able to feed the TVE.

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:08       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:08 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw



于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> Allwinner H3 features a TV encoder similar to the one in earlier
>SoCs,
>> but with some different points about clocks:
>> - It has a mod clock and a bus clock.
>> - The mod clock must be at a fixed rate to generate signal.
>
>Why?

It's experiment result by Jernej.

The clock rates in BSP kernel is also specially designed
(PLL_DE at 432MHz) in order to be able to feed the TVE.

>
>Maxime

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:08       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:08 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel

Cgrkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2IMjowMzozMCwgTWF4aW1lIFJp
cGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLWVsZWN0cm9ucy5jb20+IOWGmeWIsDoKPk9uIFRodSwg
TWF5IDE4LCAyMDE3IGF0IDEyOjQzOjUwQU0gKzA4MDAsIEljZW5vd3kgWmhlbmcgd3JvdGU6Cj4+
IEFsbHdpbm5lciBIMyBmZWF0dXJlcyBhIFRWIGVuY29kZXIgc2ltaWxhciB0byB0aGUgb25lIGlu
IGVhcmxpZXIKPlNvQ3MsCj4+IGJ1dCB3aXRoIHNvbWUgZGlmZmVyZW50IHBvaW50cyBhYm91dCBj
bG9ja3M6Cj4+IC0gSXQgaGFzIGEgbW9kIGNsb2NrIGFuZCBhIGJ1cyBjbG9jay4KPj4gLSBUaGUg
bW9kIGNsb2NrIG11c3QgYmUgYXQgYSBmaXhlZCByYXRlIHRvIGdlbmVyYXRlIHNpZ25hbC4KPgo+
V2h5PwoKSXQncyBleHBlcmltZW50IHJlc3VsdCBieSBKZXJuZWouCgpUaGUgY2xvY2sgcmF0ZXMg
aW4gQlNQIGtlcm5lbCBpcyBhbHNvIHNwZWNpYWxseSBkZXNpZ25lZAooUExMX0RFIGF0IDQzMk1I
eikgaW4gb3JkZXIgdG8gYmUgYWJsZSB0byBmZWVkIHRoZSBUVkUuCgo+Cj5NYXhpbWUKCl9fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCmxpbnV4LWFybS1rZXJu
ZWwgbWFpbGluZyBsaXN0CmxpbnV4LWFybS1rZXJuZWxAbGlzdHMuaW5mcmFkZWFkLm9yZwpodHRw
Oi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9tYWlsbWFuL2xpc3RpbmZvL2xpbnV4LWFybS1rZXJuZWwK

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:08       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:08 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> Allwinner H3 features a TV encoder similar to the one in earlier
>SoCs,
>> but with some different points about clocks:
>> - It has a mod clock and a bus clock.
>> - The mod clock must be at a fixed rate to generate signal.
>
>Why?

It's experiment result by Jernej.

The clock rates in BSP kernel is also specially designed
(PLL_DE at 432MHz) in order to be able to feed the TVE.

>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:10       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:10 UTC (permalink / raw)
  To: maxime.ripard, Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月20日 GMT+08:00 上午2:06:16, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>> 
>> The H5 pipeline has some differences and will be enabled later.
>> 
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>  
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>  
>>  / {
>>  	cpus {
>> @@ -72,6 +74,193 @@
>>  		};
>>  	};
>>  
>> +	de: display-engine {
>> +		compatible = "allwinner,sun8i-h3-display-engine";
>> +		allwinner,pipelines = <&mixer0>,
>> +				      <&mixer1>;
>> +		status = "disabled";
>> +	};
>> +
>> +	soc {
>> +		display_clocks: clock@1000000 {
>> +			compatible = "allwinner,sun8i-a83t-de2-clk";
>> +			reg = <0x01000000 0x100000>;
>> +			clocks = <&ccu CLK_BUS_DE>,
>> +				 <&ccu CLK_DE>;
>> +			clock-names = "bus",
>> +				      "mod";
>> +			resets = <&ccu RST_BUS_DE>;
>> +			#clock-cells = <1>;
>> +			#reset-cells = <1>;
>> +			assigned-clocks = <&ccu CLK_DE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +			assigned-clock-rates = <432000000>;
>
>This shouldn't be set in the DT, but evaluated at runtime when calling
>clk_set_rate.

Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
DE2 mixers' output signal. (Although it seems that SoCs with larger
plane size will use higher clock.)

And setting it to 432MHz is also needed for properly 216MHz clock to TVE.

>
>> +		tve0: tv-encoder@1e00000 {
>> +			compatible = "allwinner,sun8i-h3-tv-encoder";
>> +			reg = <0x01e00000 0x1000>;
>> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +			clock-names = "bus", "mod";
>> +			resets = <&ccu RST_BUS_TVE>;
>> +			status = "disabled";
>> +
>> +			assigned-clocks = <&ccu CLK_TVE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>
>Same thing here. clk_set_rate should just do the right thing.
>
>> +			assigned-clock-rates = <216000000>;
>
>And why are you setting it in the driver and in the DT?
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:10       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:10 UTC (permalink / raw)
  To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw



于 2017年5月20日 GMT+08:00 上午2:06:16, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>> 
>> The H5 pipeline has some differences and will be enabled later.
>> 
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>  
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>  
>>  / {
>>  	cpus {
>> @@ -72,6 +74,193 @@
>>  		};
>>  	};
>>  
>> +	de: display-engine {
>> +		compatible = "allwinner,sun8i-h3-display-engine";
>> +		allwinner,pipelines = <&mixer0>,
>> +				      <&mixer1>;
>> +		status = "disabled";
>> +	};
>> +
>> +	soc {
>> +		display_clocks: clock@1000000 {
>> +			compatible = "allwinner,sun8i-a83t-de2-clk";
>> +			reg = <0x01000000 0x100000>;
>> +			clocks = <&ccu CLK_BUS_DE>,
>> +				 <&ccu CLK_DE>;
>> +			clock-names = "bus",
>> +				      "mod";
>> +			resets = <&ccu RST_BUS_DE>;
>> +			#clock-cells = <1>;
>> +			#reset-cells = <1>;
>> +			assigned-clocks = <&ccu CLK_DE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +			assigned-clock-rates = <432000000>;
>
>This shouldn't be set in the DT, but evaluated at runtime when calling
>clk_set_rate.

Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
DE2 mixers' output signal. (Although it seems that SoCs with larger
plane size will use higher clock.)

And setting it to 432MHz is also needed for properly 216MHz clock to TVE.

>
>> +		tve0: tv-encoder@1e00000 {
>> +			compatible = "allwinner,sun8i-h3-tv-encoder";
>> +			reg = <0x01e00000 0x1000>;
>> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +			clock-names = "bus", "mod";
>> +			resets = <&ccu RST_BUS_TVE>;
>> +			status = "disabled";
>> +
>> +			assigned-clocks = <&ccu CLK_TVE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>
>Same thing here. clk_set_rate should just do the right thing.
>
>> +			assigned-clock-rates = <216000000>;
>
>And why are you setting it in the driver and in the DT?
>
>Maxime

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:10       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:10 UTC (permalink / raw)
  To: maxime.ripard, Maxime Ripard
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel

Cgrkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2IMjowNjoxNiwgTWF4aW1lIFJp
cGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLWVsZWN0cm9ucy5jb20+IOWGmeWIsDoKPk9uIFRodSwg
TWF5IDE4LCAyMDE3IGF0IDEyOjQzOjUzQU0gKzA4MDAsIEljZW5vd3kgWmhlbmcgd3JvdGU6Cj4+
IEFzIHdlIGhhdmUgYWxyZWFkeSB0aGUgc3VwcG9ydCBmb3IgdGhlIFRWIGVuY29kZXIgb24gQWxs
d2lubmVyIEgzLAo+YWRkCj4+IHRoZSBkaXNwbGF5IGVuZ2luZSBwaXBlbGluZSBkZXZpY2UgdHJl
ZSBub2RlcyB0byBpdHMgRFRTSSBmaWxlLgo+PiAKPj4gVGhlIEg1IHBpcGVsaW5lIGhhcyBzb21l
IGRpZmZlcmVuY2VzIGFuZCB3aWxsIGJlIGVuYWJsZWQgbGF0ZXIuCj4+IAo+PiBUaGUgY3VycmVu
dGx5LXVudXNlZCBtaXhlcjAgYW5kIHRjb24wIGFyZSBhbHNvIG5lZWRlZCwgZm9yIHRoZQo+PiBj
b21wbGV0ZW1lbnQgb2YgdGhlIHBpcGVsaW5lLgo+PiAKPj4gU2lnbmVkLW9mZi1ieTogSWNlbm93
eSBaaGVuZyA8aWNlbm93eUBhb3NjLmlvPgo+PiAtLS0KPj4gIGFyY2gvYXJtL2Jvb3QvZHRzL3N1
bjhpLWgzLmR0c2kgfCAxODkKPisrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr
KysKPj4gIDEgZmlsZSBjaGFuZ2VkLCAxODkgaW5zZXJ0aW9ucygrKQo+PiAKPj4gZGlmZiAtLWdp
dCBhL2FyY2gvYXJtL2Jvb3QvZHRzL3N1bjhpLWgzLmR0c2kKPmIvYXJjaC9hcm0vYm9vdC9kdHMv
c3VuOGktaDMuZHRzaQo+PiBpbmRleCBiMzZmOWY0MjNjMzkuLjIwMTcyZWY5MjQxNSAxMDA2NDQK
Pj4gLS0tIGEvYXJjaC9hcm0vYm9vdC9kdHMvc3VuOGktaDMuZHRzaQo+PiArKysgYi9hcmNoL2Fy
bS9ib290L2R0cy9zdW44aS1oMy5kdHNpCj4+IEBAIC00MSw2ICs0MSw4IEBACj4+ICAgKi8KPj4g
IAo+PiAgI2luY2x1ZGUgInN1bnhpLWgzLWg1LmR0c2kiCj4+ICsjaW5jbHVkZSA8ZHQtYmluZGlu
Z3MvY2xvY2svc3VuOGktZGUyLmg+Cj4+ICsjaW5jbHVkZSA8ZHQtYmluZGluZ3MvcmVzZXQvc3Vu
OGktZGUyLmg+Cj4+ICAKPj4gIC8gewo+PiAgCWNwdXMgewo+PiBAQCAtNzIsNiArNzQsMTkzIEBA
Cj4+ICAJCX07Cj4+ICAJfTsKPj4gIAo+PiArCWRlOiBkaXNwbGF5LWVuZ2luZSB7Cj4+ICsJCWNv
bXBhdGlibGUgPSAiYWxsd2lubmVyLHN1bjhpLWgzLWRpc3BsYXktZW5naW5lIjsKPj4gKwkJYWxs
d2lubmVyLHBpcGVsaW5lcyA9IDwmbWl4ZXIwPiwKPj4gKwkJCQkgICAgICA8Jm1peGVyMT47Cj4+
ICsJCXN0YXR1cyA9ICJkaXNhYmxlZCI7Cj4+ICsJfTsKPj4gKwo+PiArCXNvYyB7Cj4+ICsJCWRp
c3BsYXlfY2xvY2tzOiBjbG9ja0AxMDAwMDAwIHsKPj4gKwkJCWNvbXBhdGlibGUgPSAiYWxsd2lu
bmVyLHN1bjhpLWE4M3QtZGUyLWNsayI7Cj4+ICsJCQlyZWcgPSA8MHgwMTAwMDAwMCAweDEwMDAw
MD47Cj4+ICsJCQljbG9ja3MgPSA8JmNjdSBDTEtfQlVTX0RFPiwKPj4gKwkJCQkgPCZjY3UgQ0xL
X0RFPjsKPj4gKwkJCWNsb2NrLW5hbWVzID0gImJ1cyIsCj4+ICsJCQkJICAgICAgIm1vZCI7Cj4+
ICsJCQlyZXNldHMgPSA8JmNjdSBSU1RfQlVTX0RFPjsKPj4gKwkJCSNjbG9jay1jZWxscyA9IDwx
PjsKPj4gKwkJCSNyZXNldC1jZWxscyA9IDwxPjsKPj4gKwkJCWFzc2lnbmVkLWNsb2NrcyA9IDwm
Y2N1IENMS19ERT47Cj4+ICsJCQlhc3NpZ25lZC1jbG9jay1wYXJlbnRzID0gPCZjY3UgQ0xLX1BM
TF9ERT47Cj4+ICsJCQlhc3NpZ25lZC1jbG9jay1yYXRlcyA9IDw0MzIwMDAwMDA+Owo+Cj5UaGlz
IHNob3VsZG4ndCBiZSBzZXQgaW4gdGhlIERULCBidXQgZXZhbHVhdGVkIGF0IHJ1bnRpbWUgd2hl
biBjYWxsaW5nCj5jbGtfc2V0X3JhdGUuCgpOb3BlLCBERTIgY2xvY2sgZG9lc24ndCBuZWVkIGV2
YWx1dGlvbiwgYXMgdGhlIGNsb2NrIGlzIGRlY291cGxlZCB3aXRoCkRFMiBtaXhlcnMnIG91dHB1
dCBzaWduYWwuIChBbHRob3VnaCBpdCBzZWVtcyB0aGF0IFNvQ3Mgd2l0aCBsYXJnZXIKcGxhbmUg
c2l6ZSB3aWxsIHVzZSBoaWdoZXIgY2xvY2suKQoKQW5kIHNldHRpbmcgaXQgdG8gNDMyTUh6IGlz
IGFsc28gbmVlZGVkIGZvciBwcm9wZXJseSAyMTZNSHogY2xvY2sgdG8gVFZFLgoKPgo+PiArCQl0
dmUwOiB0di1lbmNvZGVyQDFlMDAwMDAgewo+PiArCQkJY29tcGF0aWJsZSA9ICJhbGx3aW5uZXIs
c3VuOGktaDMtdHYtZW5jb2RlciI7Cj4+ICsJCQlyZWcgPSA8MHgwMWUwMDAwMCAweDEwMDA+Owo+
PiArCQkJY2xvY2tzID0gPCZjY3UgQ0xLX0JVU19UVkU+LCA8JmNjdSBDTEtfVFZFPjsKPj4gKwkJ
CWNsb2NrLW5hbWVzID0gImJ1cyIsICJtb2QiOwo+PiArCQkJcmVzZXRzID0gPCZjY3UgUlNUX0JV
U19UVkU+Owo+PiArCQkJc3RhdHVzID0gImRpc2FibGVkIjsKPj4gKwo+PiArCQkJYXNzaWduZWQt
Y2xvY2tzID0gPCZjY3UgQ0xLX1RWRT47Cj4+ICsJCQlhc3NpZ25lZC1jbG9jay1wYXJlbnRzID0g
PCZjY3UgQ0xLX1BMTF9ERT47Cj4KPlNhbWUgdGhpbmcgaGVyZS4gY2xrX3NldF9yYXRlIHNob3Vs
ZCBqdXN0IGRvIHRoZSByaWdodCB0aGluZy4KPgo+PiArCQkJYXNzaWduZWQtY2xvY2stcmF0ZXMg
PSA8MjE2MDAwMDAwPjsKPgo+QW5kIHdoeSBhcmUgeW91IHNldHRpbmcgaXQgaW4gdGhlIGRyaXZl
ciBhbmQgaW4gdGhlIERUPwo+Cj5NYXhpbWUKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fCmxpbnV4LWFybS1rZXJuZWwgbWFpbGluZyBsaXN0CmxpbnV4LWFy
bS1rZXJuZWxAbGlzdHMuaW5mcmFkZWFkLm9yZwpodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9t
YWlsbWFuL2xpc3RpbmZvL2xpbnV4LWFybS1rZXJuZWwK

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-19 18:10       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-19 18:10 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?20? GMT+08:00 ??2:06:16, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>> 
>> The H5 pipeline has some differences and will be enabled later.
>> 
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>  
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>  
>>  / {
>>  	cpus {
>> @@ -72,6 +74,193 @@
>>  		};
>>  	};
>>  
>> +	de: display-engine {
>> +		compatible = "allwinner,sun8i-h3-display-engine";
>> +		allwinner,pipelines = <&mixer0>,
>> +				      <&mixer1>;
>> +		status = "disabled";
>> +	};
>> +
>> +	soc {
>> +		display_clocks: clock at 1000000 {
>> +			compatible = "allwinner,sun8i-a83t-de2-clk";
>> +			reg = <0x01000000 0x100000>;
>> +			clocks = <&ccu CLK_BUS_DE>,
>> +				 <&ccu CLK_DE>;
>> +			clock-names = "bus",
>> +				      "mod";
>> +			resets = <&ccu RST_BUS_DE>;
>> +			#clock-cells = <1>;
>> +			#reset-cells = <1>;
>> +			assigned-clocks = <&ccu CLK_DE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +			assigned-clock-rates = <432000000>;
>
>This shouldn't be set in the DT, but evaluated at runtime when calling
>clk_set_rate.

Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
DE2 mixers' output signal. (Although it seems that SoCs with larger
plane size will use higher clock.)

And setting it to 432MHz is also needed for properly 216MHz clock to TVE.

>
>> +		tve0: tv-encoder at 1e00000 {
>> +			compatible = "allwinner,sun8i-h3-tv-encoder";
>> +			reg = <0x01e00000 0x1000>;
>> +			clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +			clock-names = "bus", "mod";
>> +			resets = <&ccu RST_BUS_TVE>;
>> +			status = "disabled";
>> +
>> +			assigned-clocks = <&ccu CLK_TVE>;
>> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
>
>Same thing here. clk_set_rate should just do the right thing.
>
>> +			assigned-clock-rates = <216000000>;
>
>And why are you setting it in the driver and in the DT?
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:23         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:23 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >
> >SoCs,
> >
> >> but with some different points about clocks:
> >> - It has a mod clock and a bus clock.
> >> - The mod clock must be at a fixed rate to generate signal.
> >
> >Why?
> 
> It's experiment result by Jernej.
> 
> The clock rates in BSP kernel is also specially designed
> (PLL_DE at 432MHz) in order to be able to feed the TVE.

My experiments and search through BSP code showed that TVE seems to have 
additional fixed predivider 8. So if you want to generate 27 MHz clock, unit 
has to be feed with 216 MHz. 

TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2, 
BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This 
clock is then divided by 8 internaly to get final 27 MHz.

Please note that I don't have any hard evidence to support that, only 
experimental data. However, only that explanation make sense to me.

BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base 
clock. Further experiments are needed to check if there is any possibility to 
have other resolutions by manipulating clocks and give other proper settings. 
I plan to do that, but not in very near future.

Best regards,
Jernej

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:23         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:23 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, icenowy-h8G6r0blFSE
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

Hi,

Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >
> >SoCs,
> >
> >> but with some different points about clocks:
> >> - It has a mod clock and a bus clock.
> >> - The mod clock must be at a fixed rate to generate signal.
> >
> >Why?
> 
> It's experiment result by Jernej.
> 
> The clock rates in BSP kernel is also specially designed
> (PLL_DE at 432MHz) in order to be able to feed the TVE.

My experiments and search through BSP code showed that TVE seems to have 
additional fixed predivider 8. So if you want to generate 27 MHz clock, unit 
has to be feed with 216 MHz. 

TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2, 
BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This 
clock is then divided by 8 internaly to get final 27 MHz.

Please note that I don't have any hard evidence to support that, only 
experimental data. However, only that explanation make sense to me.

BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base 
clock. Further experiments are needed to check if there is any possibility to 
have other resolutions by manipulating clocks and give other proper settings. 
I plan to do that, but not in very near future.

Best regards,
Jernej

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:23         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:23 UTC (permalink / raw)
  To: linux-sunxi, icenowy
  Cc: devicetree, linux-kernel, dri-devel, Chen-Yu Tsai, Rob Herring,
	Maxime Ripard, linux-clk, linux-arm-kernel

SGksCgpEbmUgcGV0ZWssIDE5LiBtYWogMjAxNyBvYiAyMDowODoxOCBDRVNUIGplIEljZW5vd3kg
WmhlbmcgbmFwaXNhbChhKToKPiDkuo4gMjAxN+W5tDXmnIgyMOaXpSBHTVQrMDg6MDAg5LiK5Y2I
MjowMzozMCwgTWF4aW1lIFJpcGFyZCA8bWF4aW1lLnJpcGFyZEBmcmVlLQplbGVjdHJvbnMuY29t
PiDlhpnliLA6Cj4gPk9uIFRodSwgTWF5IDE4LCAyMDE3IGF0IDEyOjQzOjUwQU0gKzA4MDAsIElj
ZW5vd3kgWmhlbmcgd3JvdGU6Cj4gPj4gQWxsd2lubmVyIEgzIGZlYXR1cmVzIGEgVFYgZW5jb2Rl
ciBzaW1pbGFyIHRvIHRoZSBvbmUgaW4gZWFybGllcgo+ID4KPiA+U29DcywKPiA+Cj4gPj4gYnV0
IHdpdGggc29tZSBkaWZmZXJlbnQgcG9pbnRzIGFib3V0IGNsb2NrczoKPiA+PiAtIEl0IGhhcyBh
IG1vZCBjbG9jayBhbmQgYSBidXMgY2xvY2suCj4gPj4gLSBUaGUgbW9kIGNsb2NrIG11c3QgYmUg
YXQgYSBmaXhlZCByYXRlIHRvIGdlbmVyYXRlIHNpZ25hbC4KPiA+Cj4gPldoeT8KPiAKPiBJdCdz
IGV4cGVyaW1lbnQgcmVzdWx0IGJ5IEplcm5lai4KPiAKPiBUaGUgY2xvY2sgcmF0ZXMgaW4gQlNQ
IGtlcm5lbCBpcyBhbHNvIHNwZWNpYWxseSBkZXNpZ25lZAo+IChQTExfREUgYXQgNDMyTUh6KSBp
biBvcmRlciB0byBiZSBhYmxlIHRvIGZlZWQgdGhlIFRWRS4KCk15IGV4cGVyaW1lbnRzIGFuZCBz
ZWFyY2ggdGhyb3VnaCBCU1AgY29kZSBzaG93ZWQgdGhhdCBUVkUgc2VlbXMgdG8gaGF2ZSAKYWRk
aXRpb25hbCBmaXhlZCBwcmVkaXZpZGVyIDguIFNvIGlmIHlvdSB3YW50IHRvIGdlbmVyYXRlIDI3
IE1IeiBjbG9jaywgdW5pdCAKaGFzIHRvIGJlIGZlZWQgd2l0aCAyMTYgTUh6LiAKClRWRSBoYXMg
b25seSBvbmUgUExMIHNvdXJjZSBQTExfREUuIEFuZCBzaW5jZSAyMTYgTUh6IGlzIGEgYml0IGxv
dyBmb3IgREUyLCAKQlNQIGRlZmF1bHRzIHRvIDQzMiBNSHogZm9yIFBMTF9ERSBhbmQgdXNlIGRp
dmlkZXIgMiB0byBnZW5lcmF0ZSAyMTYgTUh6LiBUaGlzIApjbG9jayBpcyB0aGVuIGRpdmlkZWQg
YnkgOCBpbnRlcm5hbHkgdG8gZ2V0IGZpbmFsIDI3IE1Iei4KClBsZWFzZSBub3RlIHRoYXQgSSBk
b24ndCBoYXZlIGFueSBoYXJkIGV2aWRlbmNlIHRvIHN1cHBvcnQgdGhhdCwgb25seSAKZXhwZXJp
bWVudGFsIGRhdGEuIEhvd2V2ZXIsIG9ubHkgdGhhdCBleHBsYW5hdGlvbiBtYWtlIHNlbnNlIHRv
IG1lLgoKQlRXLCBCU1AgSDMvSDUgVFYgZHJpdmVyIHN1cHBvcnRzIG9ubHkgUEFMIGFuZCBOVFND
IHdoaWNoIGJvdGggdXNlIDI3IE1IeiBiYXNlIApjbG9jay4gRnVydGhlciBleHBlcmltZW50cyBh
cmUgbmVlZGVkIHRvIGNoZWNrIGlmIHRoZXJlIGlzIGFueSBwb3NzaWJpbGl0eSB0byAKaGF2ZSBv
dGhlciByZXNvbHV0aW9ucyBieSBtYW5pcHVsYXRpbmcgY2xvY2tzIGFuZCBnaXZlIG90aGVyIHBy
b3BlciBzZXR0aW5ncy4gCkkgcGxhbiB0byBkbyB0aGF0LCBidXQgbm90IGluIHZlcnkgbmVhciBm
dXR1cmUuCgpCZXN0IHJlZ2FyZHMsCkplcm5lagoKX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QKbGludXgt
YXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3Jn
L21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-19 18:23         ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-19 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
electrons.com> ??:
> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >
> >SoCs,
> >
> >> but with some different points about clocks:
> >> - It has a mod clock and a bus clock.
> >> - The mod clock must be at a fixed rate to generate signal.
> >
> >Why?
> 
> It's experiment result by Jernej.
> 
> The clock rates in BSP kernel is also specially designed
> (PLL_DE at 432MHz) in order to be able to feed the TVE.

My experiments and search through BSP code showed that TVE seems to have 
additional fixed predivider 8. So if you want to generate 27 MHz clock, unit 
has to be feed with 216 MHz. 

TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2, 
BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This 
clock is then divided by 8 internaly to get final 27 MHz.

Please note that I don't have any hard evidence to support that, only 
experimental data. However, only that explanation make sense to me.

BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base 
clock. Further experiments are needed to check if there is any possibility to 
have other resolutions by manipulating clocks and give other proper settings. 
I plan to do that, but not in very near future.

Best regards,
Jernej

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
  2017-05-19 18:23         ` Jernej Škrabec
  (?)
  (?)
@ 2017-05-20  1:37           ` Chen-Yu Tsai
  -1 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  1:37 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: linux-sunxi, Icenowy Zheng, Maxime Ripard, Rob Herring,
	Chen-Yu Tsai, dri-devel, devicetree, linux-arm-kernel,
	linux-kernel, linux-clk

On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> wrote:
> Hi,
>
> Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> electrons.com> 写到:
>> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> >
>> >SoCs,
>> >
>> >> but with some different points about clocks:
>> >> - It has a mod clock and a bus clock.
>> >> - The mod clock must be at a fixed rate to generate signal.
>> >
>> >Why?
>>
>> It's experiment result by Jernej.
>>
>> The clock rates in BSP kernel is also specially designed
>> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>
> My experiments and search through BSP code showed that TVE seems to have
> additional fixed predivider 8. So if you want to generate 27 MHz clock, unit
> has to be feed with 216 MHz.
>
> TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2,
> BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This
> clock is then divided by 8 internaly to get final 27 MHz.
>
> Please note that I don't have any hard evidence to support that, only
> experimental data. However, only that explanation make sense to me.
>
> BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base
> clock. Further experiments are needed to check if there is any possibility to
> have other resolutions by manipulating clocks and give other proper settings.
> I plan to do that, but not in very near future.

You only have composite video output, and those are the only 2 standard
resolutions that make any sense.

ChenYu

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-20  1:37           ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  1:37 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: linux-sunxi, Icenowy Zheng, Maxime Ripard, Rob Herring,
	Chen-Yu Tsai, dri-devel, devicetree, linux-arm-kernel,
	linux-kernel, linux-clk

On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> wrote:
> Hi,
>
> Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> electrons.com> 写到:
>> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> >
>> >SoCs,
>> >
>> >> but with some different points about clocks:
>> >> - It has a mod clock and a bus clock.
>> >> - The mod clock must be at a fixed rate to generate signal.
>> >
>> >Why?
>>
>> It's experiment result by Jernej.
>>
>> The clock rates in BSP kernel is also specially designed
>> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>
> My experiments and search through BSP code showed that TVE seems to have
> additional fixed predivider 8. So if you want to generate 27 MHz clock, unit
> has to be feed with 216 MHz.
>
> TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2,
> BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This
> clock is then divided by 8 internaly to get final 27 MHz.
>
> Please note that I don't have any hard evidence to support that, only
> experimental data. However, only that explanation make sense to me.
>
> BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base
> clock. Further experiments are needed to check if there is any possibility to
> have other resolutions by manipulating clocks and give other proper settings.
> I plan to do that, but not in very near future.

You only have composite video output, and those are the only 2 standard
resolutions that make any sense.

ChenYu

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-20  1:37           ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  1:37 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: devicetree, linux-sunxi, dri-devel, linux-kernel, Chen-Yu Tsai,
	Rob Herring, Maxime Ripard, linux-clk, linux-arm-kernel,
	Icenowy Zheng

T24gU2F0LCBNYXkgMjAsIDIwMTcgYXQgMjoyMyBBTSwgSmVybmVqIMWga3JhYmVjIDxqZXJuZWou
c2tyYWJlY0BzaW9sLm5ldD4gd3JvdGU6Cj4gSGksCj4KPiBEbmUgcGV0ZWssIDE5LiBtYWogMjAx
NyBvYiAyMDowODoxOCBDRVNUIGplIEljZW5vd3kgWmhlbmcgbmFwaXNhbChhKToKPj4g5LqOIDIw
MTflubQ15pyIMjDml6UgR01UKzA4OjAwIOS4iuWNiDI6MDM6MzAsIE1heGltZSBSaXBhcmQgPG1h
eGltZS5yaXBhcmRAZnJlZS0KPiBlbGVjdHJvbnMuY29tPiDlhpnliLA6Cj4+ID5PbiBUaHUsIE1h
eSAxOCwgMjAxNyBhdCAxMjo0Mzo1MEFNICswODAwLCBJY2Vub3d5IFpoZW5nIHdyb3RlOgo+PiA+
PiBBbGx3aW5uZXIgSDMgZmVhdHVyZXMgYSBUViBlbmNvZGVyIHNpbWlsYXIgdG8gdGhlIG9uZSBp
biBlYXJsaWVyCj4+ID4KPj4gPlNvQ3MsCj4+ID4KPj4gPj4gYnV0IHdpdGggc29tZSBkaWZmZXJl
bnQgcG9pbnRzIGFib3V0IGNsb2NrczoKPj4gPj4gLSBJdCBoYXMgYSBtb2QgY2xvY2sgYW5kIGEg
YnVzIGNsb2NrLgo+PiA+PiAtIFRoZSBtb2QgY2xvY2sgbXVzdCBiZSBhdCBhIGZpeGVkIHJhdGUg
dG8gZ2VuZXJhdGUgc2lnbmFsLgo+PiA+Cj4+ID5XaHk/Cj4+Cj4+IEl0J3MgZXhwZXJpbWVudCBy
ZXN1bHQgYnkgSmVybmVqLgo+Pgo+PiBUaGUgY2xvY2sgcmF0ZXMgaW4gQlNQIGtlcm5lbCBpcyBh
bHNvIHNwZWNpYWxseSBkZXNpZ25lZAo+PiAoUExMX0RFIGF0IDQzMk1IeikgaW4gb3JkZXIgdG8g
YmUgYWJsZSB0byBmZWVkIHRoZSBUVkUuCj4KPiBNeSBleHBlcmltZW50cyBhbmQgc2VhcmNoIHRo
cm91Z2ggQlNQIGNvZGUgc2hvd2VkIHRoYXQgVFZFIHNlZW1zIHRvIGhhdmUKPiBhZGRpdGlvbmFs
IGZpeGVkIHByZWRpdmlkZXIgOC4gU28gaWYgeW91IHdhbnQgdG8gZ2VuZXJhdGUgMjcgTUh6IGNs
b2NrLCB1bml0Cj4gaGFzIHRvIGJlIGZlZWQgd2l0aCAyMTYgTUh6Lgo+Cj4gVFZFIGhhcyBvbmx5
IG9uZSBQTEwgc291cmNlIFBMTF9ERS4gQW5kIHNpbmNlIDIxNiBNSHogaXMgYSBiaXQgbG93IGZv
ciBERTIsCj4gQlNQIGRlZmF1bHRzIHRvIDQzMiBNSHogZm9yIFBMTF9ERSBhbmQgdXNlIGRpdmlk
ZXIgMiB0byBnZW5lcmF0ZSAyMTYgTUh6LiBUaGlzCj4gY2xvY2sgaXMgdGhlbiBkaXZpZGVkIGJ5
IDggaW50ZXJuYWx5IHRvIGdldCBmaW5hbCAyNyBNSHouCj4KPiBQbGVhc2Ugbm90ZSB0aGF0IEkg
ZG9uJ3QgaGF2ZSBhbnkgaGFyZCBldmlkZW5jZSB0byBzdXBwb3J0IHRoYXQsIG9ubHkKPiBleHBl
cmltZW50YWwgZGF0YS4gSG93ZXZlciwgb25seSB0aGF0IGV4cGxhbmF0aW9uIG1ha2Ugc2Vuc2Ug
dG8gbWUuCj4KPiBCVFcsIEJTUCBIMy9INSBUViBkcml2ZXIgc3VwcG9ydHMgb25seSBQQUwgYW5k
IE5UU0Mgd2hpY2ggYm90aCB1c2UgMjcgTUh6IGJhc2UKPiBjbG9jay4gRnVydGhlciBleHBlcmlt
ZW50cyBhcmUgbmVlZGVkIHRvIGNoZWNrIGlmIHRoZXJlIGlzIGFueSBwb3NzaWJpbGl0eSB0bwo+
IGhhdmUgb3RoZXIgcmVzb2x1dGlvbnMgYnkgbWFuaXB1bGF0aW5nIGNsb2NrcyBhbmQgZ2l2ZSBv
dGhlciBwcm9wZXIgc2V0dGluZ3MuCj4gSSBwbGFuIHRvIGRvIHRoYXQsIGJ1dCBub3QgaW4gdmVy
eSBuZWFyIGZ1dHVyZS4KCllvdSBvbmx5IGhhdmUgY29tcG9zaXRlIHZpZGVvIG91dHB1dCwgYW5k
IHRob3NlIGFyZSB0aGUgb25seSAyIHN0YW5kYXJkCnJlc29sdXRpb25zIHRoYXQgbWFrZSBhbnkg
c2Vuc2UuCgpDaGVuWXUKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fCmxpbnV4LWFybS1rZXJuZWwgbWFpbGluZyBsaXN0CmxpbnV4LWFybS1rZXJuZWxAbGlz
dHMuaW5mcmFkZWFkLm9yZwpodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9tYWlsbWFuL2xpc3Rp
bmZvL2xpbnV4LWFybS1rZXJuZWwK

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-20  1:37           ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  1:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net> wrote:
> Hi,
>
> Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
> electrons.com> ??:
>> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> >
>> >SoCs,
>> >
>> >> but with some different points about clocks:
>> >> - It has a mod clock and a bus clock.
>> >> - The mod clock must be at a fixed rate to generate signal.
>> >
>> >Why?
>>
>> It's experiment result by Jernej.
>>
>> The clock rates in BSP kernel is also specially designed
>> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>
> My experiments and search through BSP code showed that TVE seems to have
> additional fixed predivider 8. So if you want to generate 27 MHz clock, unit
> has to be feed with 216 MHz.
>
> TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for DE2,
> BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz. This
> clock is then divided by 8 internaly to get final 27 MHz.
>
> Please note that I don't have any hard evidence to support that, only
> experimental data. However, only that explanation make sense to me.
>
> BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz base
> clock. Further experiments are needed to check if there is any possibility to
> have other resolutions by manipulating clocks and give other proper settings.
> I plan to do that, but not in very near future.

You only have composite video output, and those are the only 2 standard
resolutions that make any sense.

ChenYu

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-20  2:01         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  2:01 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: linux-arm-kernel, Maxime Ripard, devicetree, linux-sunxi,
	linux-kernel, dri-devel, Chen-Yu Tsai, Rob Herring, linux-clk

On Sat, May 20, 2017 at 2:06 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> 于 2017年5月20日 GMT+08:00 上午2:02:15, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>>> -On SoCs other than the A33 and V3s, there is one more clock
>>required:
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-a33-tcon
>>> +   * allwinner,sun8i-v3s-tcon
>>> +there is one more clock and one more property required:
>>> + - clocks:
>>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>>> + - clock-output-names: Name of the pixel clock created
>>> +
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-h3-tcon0
>>> +there is one more clock required:
>>>     - 'tcon-ch1': The clock driving the TCON channel 1
>>
>>Putting ID's in the compatible name is usually a bad idea. What is the
>>difference between the two? Only that the second one doesn't have a
>>clock?
>
> Yes.
>
>>
>>That seems highly unlikely. How does it generate the pixel clock
>>frequency?
>
> Yes it seems impossible, but it's also the fact.
>
> There's only one CLK_TCON in H3/5, which is for TCON0.
>
> It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
> Although we have a lcd-ch1 clock, we cannot touch it, otherwise
> the TVE will refuse to work (the TVE can only work under 216MHz).

Assuming the TV encoder is like the old one, then it never had a
separate module clock. Instead its timing signals are fed from the
TCON. So CLK_TVE is likely the clock for TCON1 here.

ChenYu

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-20  2:01         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  2:01 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: linux-arm-kernel, Maxime Ripard, devicetree, linux-sunxi,
	linux-kernel, dri-devel, Chen-Yu Tsai, Rob Herring, linux-clk

On Sat, May 20, 2017 at 2:06 AM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
>
>
> 于 2017年5月20日 GMT+08:00 上午2:02:15, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>>> -On SoCs other than the A33 and V3s, there is one more clock
>>required:
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-a33-tcon
>>> +   * allwinner,sun8i-v3s-tcon
>>> +there is one more clock and one more property required:
>>> + - clocks:
>>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>>> + - clock-output-names: Name of the pixel clock created
>>> +
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-h3-tcon0
>>> +there is one more clock required:
>>>     - 'tcon-ch1': The clock driving the TCON channel 1
>>
>>Putting ID's in the compatible name is usually a bad idea. What is the
>>difference between the two? Only that the second one doesn't have a
>>clock?
>
> Yes.
>
>>
>>That seems highly unlikely. How does it generate the pixel clock
>>frequency?
>
> Yes it seems impossible, but it's also the fact.
>
> There's only one CLK_TCON in H3/5, which is for TCON0.
>
> It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
> Although we have a lcd-ch1 clock, we cannot touch it, otherwise
> the TVE will refuse to work (the TVE can only work under 216MHz).

Assuming the TV encoder is like the old one, then it never had a
separate module clock. Instead its timing signals are fed from the
TCON. So CLK_TVE is likely the clock for TCON1 here.

ChenYu

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support
@ 2017-05-20  2:01         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-20  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 20, 2017 at 2:06 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> ? 2017?5?20? GMT+08:00 ??2:02:15, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>>On Thu, May 18, 2017 at 12:43:44AM +0800, Icenowy Zheng wrote:
>>> -On SoCs other than the A33 and V3s, there is one more clock
>>required:
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-a33-tcon
>>> +   * allwinner,sun8i-v3s-tcon
>>> +there is one more clock and one more property required:
>>> + - clocks:
>>> +   - 'tcon-ch0': The clock driving the TCON channel 0
>>> + - clock-output-names: Name of the pixel clock created
>>> +
>>> +For the following compatibles:
>>> +   * allwinner,sun5i-a13-tcon
>>> +   * allwinner,sun6i-a31-tcon
>>> +   * allwinner,sun6i-a31s-tcon
>>> +   * allwinner,sun8i-h3-tcon0
>>> +there is one more clock required:
>>>     - 'tcon-ch1': The clock driving the TCON channel 1
>>
>>Putting ID's in the compatible name is usually a bad idea. What is the
>>difference between the two? Only that the second one doesn't have a
>>clock?
>
> Yes.
>
>>
>>That seems highly unlikely. How does it generate the pixel clock
>>frequency?
>
> Yes it seems impossible, but it's also the fact.
>
> There's only one CLK_TCON in H3/5, which is for TCON0.
>
> It's possible that lcd-ch1 clk is CLK_TVE, but it's still a weird situation --
> Although we have a lcd-ch1 clock, we cannot touch it, otherwise
> the TVE will refuse to work (the TVE can only work under 216MHz).

Assuming the TV encoder is like the old one, then it never had a
separate module clock. Instead its timing signals are fed from the
TCON. So CLK_TVE is likely the clock for TCON1 here.

ChenYu

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-22 17:55             ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-22 17:55 UTC (permalink / raw)
  To: linux-sunxi, wens
  Cc: Icenowy Zheng, Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> 
wrote:
> > Hi,
> > 
> > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > 
> > electrons.com> 写到:
> >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >> >
> >> >SoCs,
> >> >
> >> >> but with some different points about clocks:
> >> >> - It has a mod clock and a bus clock.
> >> >> - The mod clock must be at a fixed rate to generate signal.
> >> >
> >> >Why?
> >> 
> >> It's experiment result by Jernej.
> >> 
> >> The clock rates in BSP kernel is also specially designed
> >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > 
> > My experiments and search through BSP code showed that TVE seems to have
> > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > unit has to be feed with 216 MHz.
> > 
> > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > DE2,
> > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > This clock is then divided by 8 internaly to get final 27 MHz.
> > 
> > Please note that I don't have any hard evidence to support that, only
> > experimental data. However, only that explanation make sense to me.
> > 
> > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > base clock. Further experiments are needed to check if there is any
> > possibility to have other resolutions by manipulating clocks and give
> > other proper settings. I plan to do that, but not in very near future.
> 
> You only have composite video output, and those are the only 2 standard
> resolutions that make any sense.

Right, other resolutions are for VGA.

Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
unit is something in between. R40 TVE has a setting to select "up sample". 
Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
think that H3 may have this hardwired to 216 MHz and this would be the reason 
why 216 MHz is needed.

Has anyone else any better explanation?

Best regards,
Jernej

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-22 17:55             ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-22 17:55 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, wens-jdAy2FN1RRM
  Cc: Icenowy Zheng, Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> 
wrote:
> > Hi,
> > 
> > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > 
> > electrons.com> 写到:
> >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >> >
> >> >SoCs,
> >> >
> >> >> but with some different points about clocks:
> >> >> - It has a mod clock and a bus clock.
> >> >> - The mod clock must be at a fixed rate to generate signal.
> >> >
> >> >Why?
> >> 
> >> It's experiment result by Jernej.
> >> 
> >> The clock rates in BSP kernel is also specially designed
> >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > 
> > My experiments and search through BSP code showed that TVE seems to have
> > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > unit has to be feed with 216 MHz.
> > 
> > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > DE2,
> > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > This clock is then divided by 8 internaly to get final 27 MHz.
> > 
> > Please note that I don't have any hard evidence to support that, only
> > experimental data. However, only that explanation make sense to me.
> > 
> > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > base clock. Further experiments are needed to check if there is any
> > possibility to have other resolutions by manipulating clocks and give
> > other proper settings. I plan to do that, but not in very near future.
> 
> You only have composite video output, and those are the only 2 standard
> resolutions that make any sense.

Right, other resolutions are for VGA.

Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
unit is something in between. R40 TVE has a setting to select "up sample". 
Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
think that H3 may have this hardwired to 216 MHz and this would be the reason 
why 216 MHz is needed.

Has anyone else any better explanation?

Best regards,
Jernej

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-22 17:55             ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-22 17:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net> 
wrote:
> > Hi,
> > 
> > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
> > 
> > electrons.com> ??:
> >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> >> >
> >> >SoCs,
> >> >
> >> >> but with some different points about clocks:
> >> >> - It has a mod clock and a bus clock.
> >> >> - The mod clock must be at a fixed rate to generate signal.
> >> >
> >> >Why?
> >> 
> >> It's experiment result by Jernej.
> >> 
> >> The clock rates in BSP kernel is also specially designed
> >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > 
> > My experiments and search through BSP code showed that TVE seems to have
> > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > unit has to be feed with 216 MHz.
> > 
> > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > DE2,
> > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > This clock is then divided by 8 internaly to get final 27 MHz.
> > 
> > Please note that I don't have any hard evidence to support that, only
> > experimental data. However, only that explanation make sense to me.
> > 
> > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > base clock. Further experiments are needed to check if there is any
> > possibility to have other resolutions by manipulating clocks and give
> > other proper settings. I plan to do that, but not in very near future.
> 
> You only have composite video output, and those are the only 2 standard
> resolutions that make any sense.

Right, other resolutions are for VGA.

Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
unit is something in between. R40 TVE has a setting to select "up sample". 
Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
think that H3 may have this hardwired to 216 MHz and this would be the reason 
why 216 MHz is needed.

Has anyone else any better explanation?

Best regards,
Jernej

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
  2017-05-22 17:55             ` Jernej Škrabec
  (?)
@ 2017-05-23 12:53               ` Maxime Ripard
  -1 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-23 12:53 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: linux-sunxi, wens, Icenowy Zheng, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 3128 bytes --]

On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> Hi,
> 
> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> 
> wrote:
> > > Hi,
> > > 
> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > 
> > > electrons.com> 写到:
> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > >> >
> > >> >SoCs,
> > >> >
> > >> >> but with some different points about clocks:
> > >> >> - It has a mod clock and a bus clock.
> > >> >> - The mod clock must be at a fixed rate to generate signal.
> > >> >
> > >> >Why?
> > >> 
> > >> It's experiment result by Jernej.
> > >> 
> > >> The clock rates in BSP kernel is also specially designed
> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > 
> > > My experiments and search through BSP code showed that TVE seems to have
> > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > unit has to be feed with 216 MHz.
> > > 
> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > DE2,
> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > 
> > > Please note that I don't have any hard evidence to support that, only
> > > experimental data. However, only that explanation make sense to me.
> > > 
> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > base clock. Further experiments are needed to check if there is any
> > > possibility to have other resolutions by manipulating clocks and give
> > > other proper settings. I plan to do that, but not in very near future.
> > 
> > You only have composite video output, and those are the only 2 standard
> > resolutions that make any sense.
> 
> Right, other resolutions are for VGA.
> 
> Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
> unit is something in between. R40 TVE has a setting to select "up sample".

That might be just another translation of oversampling :)

I didn't know it could be applied to composite signals though, but I
guess this is just another analog signal after all.

> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
> has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
> think that H3 may have this hardwired to 216 MHz and this would be the reason 
> why 216 MHz is needed.
> 
> Has anyone else any better explanation?

That's already a pretty good one.

Either way, wether this is upsampling, oversampling or just a
pre-divider, this can and should be dealt with in the mode_set
callback, and not in the probe.

Thanks!
Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-23 12:53               ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-23 12:53 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, wens-jdAy2FN1RRM,
	Icenowy Zheng, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 3450 bytes --]

On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> Hi,
> 
> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net> 
> wrote:
> > > Hi,
> > > 
> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > 
> > > electrons.com> 写到:
> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > >> >
> > >> >SoCs,
> > >> >
> > >> >> but with some different points about clocks:
> > >> >> - It has a mod clock and a bus clock.
> > >> >> - The mod clock must be at a fixed rate to generate signal.
> > >> >
> > >> >Why?
> > >> 
> > >> It's experiment result by Jernej.
> > >> 
> > >> The clock rates in BSP kernel is also specially designed
> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > 
> > > My experiments and search through BSP code showed that TVE seems to have
> > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > unit has to be feed with 216 MHz.
> > > 
> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > DE2,
> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > 
> > > Please note that I don't have any hard evidence to support that, only
> > > experimental data. However, only that explanation make sense to me.
> > > 
> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > base clock. Further experiments are needed to check if there is any
> > > possibility to have other resolutions by manipulating clocks and give
> > > other proper settings. I plan to do that, but not in very near future.
> > 
> > You only have composite video output, and those are the only 2 standard
> > resolutions that make any sense.
> 
> Right, other resolutions are for VGA.
> 
> Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
> unit is something in between. R40 TVE has a setting to select "up sample".

That might be just another translation of oversampling :)

I didn't know it could be applied to composite signals though, but I
guess this is just another analog signal after all.

> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
> has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
> think that H3 may have this hardwired to 216 MHz and this would be the reason 
> why 216 MHz is needed.
> 
> Has anyone else any better explanation?

That's already a pretty good one.

Either way, wether this is upsampling, oversampling or just a
pre-divider, this can and should be dealt with in the mode_set
callback, and not in the probe.

Thanks!
Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-23 12:53               ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-23 12:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> Hi,
> 
> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net> 
> wrote:
> > > Hi,
> > > 
> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
> > > 
> > > electrons.com> ??:
> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > >> >
> > >> >SoCs,
> > >> >
> > >> >> but with some different points about clocks:
> > >> >> - It has a mod clock and a bus clock.
> > >> >> - The mod clock must be at a fixed rate to generate signal.
> > >> >
> > >> >Why?
> > >> 
> > >> It's experiment result by Jernej.
> > >> 
> > >> The clock rates in BSP kernel is also specially designed
> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > 
> > > My experiments and search through BSP code showed that TVE seems to have
> > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > unit has to be feed with 216 MHz.
> > > 
> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > DE2,
> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > 
> > > Please note that I don't have any hard evidence to support that, only
> > > experimental data. However, only that explanation make sense to me.
> > > 
> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > base clock. Further experiments are needed to check if there is any
> > > possibility to have other resolutions by manipulating clocks and give
> > > other proper settings. I plan to do that, but not in very near future.
> > 
> > You only have composite video output, and those are the only 2 standard
> > resolutions that make any sense.
> 
> Right, other resolutions are for VGA.
> 
> Anyway, I did some more digging in A10 and R40 datasheets. I think that H3 TVE 
> unit is something in between. R40 TVE has a setting to select "up sample".

That might be just another translation of oversampling :)

I didn't know it could be applied to composite signals though, but I
guess this is just another analog signal after all.

> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver on R40 
> has this setting enabled only for PAL and NTSC and it is always 216 MHz. I 
> think that H3 may have this hardwired to 216 MHz and this would be the reason 
> why 216 MHz is needed.
> 
> Has anyone else any better explanation?

That's already a pretty good one.

Either way, wether this is upsampling, oversampling or just a
pre-divider, this can and should be dealt with in the mode_set
callback, and not in the probe.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170523/9b264e48/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
  2017-05-23 12:53               ` Maxime Ripard
  (?)
@ 2017-05-23 12:56                 ` Icenowy Zheng
  -1 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-23 12:56 UTC (permalink / raw)
  To: maxime.ripard, Maxime Ripard, Jernej Škrabec
  Cc: linux-sunxi, wens, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk



于 2017年5月23日 GMT+08:00 下午8:53:21, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> Hi,
>> 
>> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
><jernej.skrabec@siol.net> 
>> wrote:
>> > > Hi,
>> > > 
>> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > 
>> > > electrons.com> 写到:
>> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > >> >
>> > >> >SoCs,
>> > >> >
>> > >> >> but with some different points about clocks:
>> > >> >> - It has a mod clock and a bus clock.
>> > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > >> >
>> > >> >Why?
>> > >> 
>> > >> It's experiment result by Jernej.
>> > >> 
>> > >> The clock rates in BSP kernel is also specially designed
>> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > 
>> > > My experiments and search through BSP code showed that TVE seems
>to have
>> > > additional fixed predivider 8. So if you want to generate 27 MHz
>clock,
>> > > unit has to be feed with 216 MHz.
>> > > 
>> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit
>low for
>> > > DE2,
>> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate
>216 MHz.
>> > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > > 
>> > > Please note that I don't have any hard evidence to support that,
>only
>> > > experimental data. However, only that explanation make sense to
>me.
>> > > 
>> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both
>use 27 MHz
>> > > base clock. Further experiments are needed to check if there is
>any
>> > > possibility to have other resolutions by manipulating clocks and
>give
>> > > other proper settings. I plan to do that, but not in very near
>future.
>> > 
>> > You only have composite video output, and those are the only 2
>standard
>> > resolutions that make any sense.
>> 
>> Right, other resolutions are for VGA.
>> 
>> Anyway, I did some more digging in A10 and R40 datasheets. I think
>that H3 TVE 
>> unit is something in between. R40 TVE has a setting to select "up
>sample".
>
>That might be just another translation of oversampling :)
>
>I didn't know it could be applied to composite signals though, but I
>guess this is just another analog signal after all.
>
>> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver
>on R40 
>> has this setting enabled only for PAL and NTSC and it is always 216
>MHz. I 
>> think that H3 may have this hardwired to 216 MHz and this would be
>the reason 
>> why 216 MHz is needed.
>> 
>> Has anyone else any better explanation?
>
>That's already a pretty good one.
>
>Either way, wether this is upsampling, oversampling or just a
>pre-divider, this can and should be dealt with in the mode_set
>callback, and not in the probe.

What should we do for this?

Add a hook in TCON driver and let TVE driver affect the clock value (*16, as the dotclock is halfed)?

>
>Thanks!
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-23 12:56                 ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-23 12:56 UTC (permalink / raw)
  To: maxime.ripard
  Cc: linux-sunxi, wens, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk



于 2017年5月23日 GMT+08:00 下午8:53:21, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> Hi,
>> 
>> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
><jernej.skrabec@siol.net> 
>> wrote:
>> > > Hi,
>> > > 
>> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > 
>> > > electrons.com> 写到:
>> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > >> >
>> > >> >SoCs,
>> > >> >
>> > >> >> but with some different points about clocks:
>> > >> >> - It has a mod clock and a bus clock.
>> > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > >> >
>> > >> >Why?
>> > >> 
>> > >> It's experiment result by Jernej.
>> > >> 
>> > >> The clock rates in BSP kernel is also specially designed
>> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > 
>> > > My experiments and search through BSP code showed that TVE seems
>to have
>> > > additional fixed predivider 8. So if you want to generate 27 MHz
>clock,
>> > > unit has to be feed with 216 MHz.
>> > > 
>> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit
>low for
>> > > DE2,
>> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate
>216 MHz.
>> > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > > 
>> > > Please note that I don't have any hard evidence to support that,
>only
>> > > experimental data. However, only that explanation make sense to
>me.
>> > > 
>> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both
>use 27 MHz
>> > > base clock. Further experiments are needed to check if there is
>any
>> > > possibility to have other resolutions by manipulating clocks and
>give
>> > > other proper settings. I plan to do that, but not in very near
>future.
>> > 
>> > You only have composite video output, and those are the only 2
>standard
>> > resolutions that make any sense.
>> 
>> Right, other resolutions are for VGA.
>> 
>> Anyway, I did some more digging in A10 and R40 datasheets. I think
>that H3 TVE 
>> unit is something in between. R40 TVE has a setting to select "up
>sample".
>
>That might be just another translation of oversampling :)
>
>I didn't know it could be applied to composite signals though, but I
>guess this is just another analog signal after all.
>
>> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver
>on R40 
>> has this setting enabled only for PAL and NTSC and it is always 216
>MHz. I 
>> think that H3 may have this hardwired to 216 MHz and this would be
>the reason 
>> why 216 MHz is needed.
>> 
>> Has anyone else any better explanation?
>
>That's already a pretty good one.
>
>Either way, wether this is upsampling, oversampling or just a
>pre-divider, this can and should be dealt with in the mode_set
>callback, and not in the probe.

What should we do for this?

Add a hook in TCON driver and let TVE driver affect the clock value (*16, as the dotclock is halfed)?

>
>Thanks!
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-23 12:56                 ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-23 12:56 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?23? GMT+08:00 ??8:53:21, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
>> Hi,
>> 
>> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
><jernej.skrabec@siol.net> 
>> wrote:
>> > > Hi,
>> > > 
>> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > 
>> > > electrons.com> ??:
>> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > >> >
>> > >> >SoCs,
>> > >> >
>> > >> >> but with some different points about clocks:
>> > >> >> - It has a mod clock and a bus clock.
>> > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > >> >
>> > >> >Why?
>> > >> 
>> > >> It's experiment result by Jernej.
>> > >> 
>> > >> The clock rates in BSP kernel is also specially designed
>> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > 
>> > > My experiments and search through BSP code showed that TVE seems
>to have
>> > > additional fixed predivider 8. So if you want to generate 27 MHz
>clock,
>> > > unit has to be feed with 216 MHz.
>> > > 
>> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit
>low for
>> > > DE2,
>> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate
>216 MHz.
>> > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > > 
>> > > Please note that I don't have any hard evidence to support that,
>only
>> > > experimental data. However, only that explanation make sense to
>me.
>> > > 
>> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both
>use 27 MHz
>> > > base clock. Further experiments are needed to check if there is
>any
>> > > possibility to have other resolutions by manipulating clocks and
>give
>> > > other proper settings. I plan to do that, but not in very near
>future.
>> > 
>> > You only have composite video output, and those are the only 2
>standard
>> > resolutions that make any sense.
>> 
>> Right, other resolutions are for VGA.
>> 
>> Anyway, I did some more digging in A10 and R40 datasheets. I think
>that H3 TVE 
>> unit is something in between. R40 TVE has a setting to select "up
>sample".
>
>That might be just another translation of oversampling :)
>
>I didn't know it could be applied to composite signals though, but I
>guess this is just another analog signal after all.
>
>> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver
>on R40 
>> has this setting enabled only for PAL and NTSC and it is always 216
>MHz. I 
>> think that H3 may have this hardwired to 216 MHz and this would be
>the reason 
>> why 216 MHz is needed.
>> 
>> Has anyone else any better explanation?
>
>That's already a pretty good one.
>
>Either way, wether this is upsampling, oversampling or just a
>pre-divider, this can and should be dealt with in the mode_set
>callback, and not in the probe.

What should we do for this?

Add a hook in TCON driver and let TVE driver affect the clock value (*16, as the dotclock is halfed)?

>
>Thanks!
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
  2017-05-23 12:53               ` Maxime Ripard
@ 2017-05-23 13:00                 ` icenowy at aosc.io
  -1 siblings, 0 replies; 159+ messages in thread
From: icenowy @ 2017-05-23 13:00 UTC (permalink / raw)
  To: maxime.ripard
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

在 2017-05-23 20:53,Maxime Ripard 写道:
> On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> Hi,
>> 
>> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net>
>> wrote:
>> > > Hi,
>> > >
>> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
>> > >
>> > > electrons.com> 写到:
>> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> > >> >
>> > >> >SoCs,
>> > >> >
>> > >> >> but with some different points about clocks:
>> > >> >> - It has a mod clock and a bus clock.
>> > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > >> >
>> > >> >Why?
>> > >>
>> > >> It's experiment result by Jernej.
>> > >>
>> > >> The clock rates in BSP kernel is also specially designed
>> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > >
>> > > My experiments and search through BSP code showed that TVE seems to have
>> > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
>> > > unit has to be feed with 216 MHz.
>> > >
>> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
>> > > DE2,
>> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
>> > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > >
>> > > Please note that I don't have any hard evidence to support that, only
>> > > experimental data. However, only that explanation make sense to me.
>> > >
>> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
>> > > base clock. Further experiments are needed to check if there is any
>> > > possibility to have other resolutions by manipulating clocks and give
>> > > other proper settings. I plan to do that, but not in very near future.
>> >
>> > You only have composite video output, and those are the only 2 standard
>> > resolutions that make any sense.
>> 
>> Right, other resolutions are for VGA.
>> 
>> Anyway, I did some more digging in A10 and R40 datasheets. I think 
>> that H3 TVE
>> unit is something in between. R40 TVE has a setting to select "up 
>> sample".
> 
> That might be just another translation of oversampling :)
> 
> I didn't know it could be applied to composite signals though, but I
> guess this is just another analog signal after all.
> 
>> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver 
>> on R40
>> has this setting enabled only for PAL and NTSC and it is always 216 
>> MHz. I
>> think that H3 may have this hardwired to 216 MHz and this would be the 
>> reason
>> why 216 MHz is needed.
>> 
>> Has anyone else any better explanation?
> 
> That's already a pretty good one.
> 
> Either way, wether this is upsampling, oversampling or just a
> pre-divider, this can and should be dealt with in the mode_set
> callback, and not in the probe.

I got a better idea -- let TVE driver have the CLK_TVE as an
input and create a subclock output with divider 16, and feed this
subclock to TCON lcd-ch1.

This is a model of the real hardware -- the clock divider is in
TVE, not TCON.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-23 13:00                 ` icenowy at aosc.io
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy at aosc.io @ 2017-05-23 13:00 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-05-23 20:53?Maxime Ripard ???
> On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
>> Hi,
>> 
>> Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net>
>> wrote:
>> > > Hi,
>> > >
>> > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
>> > >
>> > > electrons.com> ??:
>> > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> > >> >
>> > >> >SoCs,
>> > >> >
>> > >> >> but with some different points about clocks:
>> > >> >> - It has a mod clock and a bus clock.
>> > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > >> >
>> > >> >Why?
>> > >>
>> > >> It's experiment result by Jernej.
>> > >>
>> > >> The clock rates in BSP kernel is also specially designed
>> > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > >
>> > > My experiments and search through BSP code showed that TVE seems to have
>> > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
>> > > unit has to be feed with 216 MHz.
>> > >
>> > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
>> > > DE2,
>> > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
>> > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > >
>> > > Please note that I don't have any hard evidence to support that, only
>> > > experimental data. However, only that explanation make sense to me.
>> > >
>> > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
>> > > base clock. Further experiments are needed to check if there is any
>> > > possibility to have other resolutions by manipulating clocks and give
>> > > other proper settings. I plan to do that, but not in very near future.
>> >
>> > You only have composite video output, and those are the only 2 standard
>> > resolutions that make any sense.
>> 
>> Right, other resolutions are for VGA.
>> 
>> Anyway, I did some more digging in A10 and R40 datasheets. I think 
>> that H3 TVE
>> unit is something in between. R40 TVE has a setting to select "up 
>> sample".
> 
> That might be just another translation of oversampling :)
> 
> I didn't know it could be applied to composite signals though, but I
> guess this is just another analog signal after all.
> 
>> Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP driver 
>> on R40
>> has this setting enabled only for PAL and NTSC and it is always 216 
>> MHz. I
>> think that H3 may have this hardwired to 216 MHz and this would be the 
>> reason
>> why 216 MHz is needed.
>> 
>> Has anyone else any better explanation?
> 
> That's already a pretty good one.
> 
> Either way, wether this is upsampling, oversampling or just a
> pre-divider, this can and should be dealt with in the mode_set
> callback, and not in the probe.

I got a better idea -- let TVE driver have the CLK_TVE as an
input and create a subclock output with divider 16, and feed this
subclock to TCON lcd-ch1.

This is a model of the real hardware -- the clock divider is in
TVE, not TCON.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:24     ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:24 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
>
> The H5 pipeline has some differences and will be enabled later.
>
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>
>  / {
>         cpus {
> @@ -72,6 +74,193 @@
>                 };
>         };
>
> +       de: display-engine {
> +               compatible = "allwinner,sun8i-h3-display-engine";
> +               allwinner,pipelines = <&mixer0>,
> +                                     <&mixer1>;
> +               status = "disabled";
> +       };
> +
> +       soc {
> +               display_clocks: clock@1000000 {
> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
> +                       reg = <0x01000000 0x100000>;
> +                       clocks = <&ccu CLK_BUS_DE>,
> +                                <&ccu CLK_DE>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&ccu RST_BUS_DE>;
> +                       #clock-cells = <1>;
> +                       #reset-cells = <1>;
> +                       assigned-clocks = <&ccu CLK_DE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <432000000>;
> +               };
> +
> +               mixer0: mixer@1100000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
> +                       reg = <0x01100000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
> +                                <&display_clocks CLK_MIXER0>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_MIXER0>;
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer0_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer0_out_tcon0: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&tcon0_in_mixer0>;
> +                                       };
> +
> +                                       mixer0_out_tcon1: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon1_in_mixer0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               mixer1: mixer@1200000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
> +                       reg = <0x01200000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
> +                                <&display_clocks CLK_MIXER1>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_WB>;
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer1_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer1_out_tcon1: endpoint@0 {
> +                                               reg = <0>;

I would prefer if you could stick to the numbering scheme we're using for
Display Engine 1.0, as in endpoint 0 links to component 0 of whatever type.

We're probably going to stick to that for the R40's incredibly complicated
pipeline. I don't want to have any outliers unless absolutely necessary.

ChenYu

> +                                               remote-endpoint = <&tcon1_in_mixer1>;
> +                                       };
> +
> +                                       mixer1_out_tcon0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon0_in_mixer1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon0: lcd-controller@1c0c000 {
> +                       compatible = "allwinner,sun8i-h3-tcon0";
> +                       reg = <0x01c0c000 0x1000>;
> +                       interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON0>,
> +                                <&ccu CLK_TCON0>;
> +                       clock-names = "ahb",
> +                                     "tcon-ch1";
> +                       resets = <&ccu RST_BUS_TCON0>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon0_in: port@0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon0_in_mixer0: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer0_out_tcon0>;
> +                                       };
> +
> +                                       tcon0_in_mixer1: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer1_out_tcon0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon1: lcd-controller@1c0d000 {
> +                       compatible = "allwinner,sun8i-h3-tcon1";
> +                       reg = <0x01c0d000 0x1000>;
> +                       interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON1>;
> +                       clock-names = "ahb";
> +                       resets = <&ccu RST_BUS_TCON1>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon1_in: port@0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon1_in_mixer1: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer1_out_tcon1>;
> +                                       };
> +
> +                                       tcon1_in_mixer0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer0_out_tcon1>;
> +                                       };
> +                               };
> +
> +                               tcon1_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       tcon1_out_tve0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tve0_in_tcon1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tve0: tv-encoder@1e00000 {
> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
> +                       reg = <0x01e00000 0x1000>;
> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +                       clock-names = "bus", "mod";
> +                       resets = <&ccu RST_BUS_TVE>;
> +                       status = "disabled";
> +
> +                       assigned-clocks = <&ccu CLK_TVE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <216000000>;
> +
> +                       port {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tve0_in_tcon1: endpoint@0 {
> +                                       reg = <0>;
> +                                       remote-endpoint = <&tcon1_out_tve0>;
> +                               };
> +                       };
> +               };
> +       };
> +
>         timer {
>                 compatible = "arm,armv7-timer";
>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
>
> --
> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:24     ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:24 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
>
> The H5 pipeline has some differences and will be enabled later.
>
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
>
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>
>  / {
>         cpus {
> @@ -72,6 +74,193 @@
>                 };
>         };
>
> +       de: display-engine {
> +               compatible = "allwinner,sun8i-h3-display-engine";
> +               allwinner,pipelines = <&mixer0>,
> +                                     <&mixer1>;
> +               status = "disabled";
> +       };
> +
> +       soc {
> +               display_clocks: clock@1000000 {
> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
> +                       reg = <0x01000000 0x100000>;
> +                       clocks = <&ccu CLK_BUS_DE>,
> +                                <&ccu CLK_DE>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&ccu RST_BUS_DE>;
> +                       #clock-cells = <1>;
> +                       #reset-cells = <1>;
> +                       assigned-clocks = <&ccu CLK_DE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <432000000>;
> +               };
> +
> +               mixer0: mixer@1100000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
> +                       reg = <0x01100000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
> +                                <&display_clocks CLK_MIXER0>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_MIXER0>;
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer0_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer0_out_tcon0: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&tcon0_in_mixer0>;
> +                                       };
> +
> +                                       mixer0_out_tcon1: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon1_in_mixer0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               mixer1: mixer@1200000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
> +                       reg = <0x01200000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
> +                                <&display_clocks CLK_MIXER1>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_WB>;
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer1_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer1_out_tcon1: endpoint@0 {
> +                                               reg = <0>;

I would prefer if you could stick to the numbering scheme we're using for
Display Engine 1.0, as in endpoint 0 links to component 0 of whatever type.

We're probably going to stick to that for the R40's incredibly complicated
pipeline. I don't want to have any outliers unless absolutely necessary.

ChenYu

> +                                               remote-endpoint = <&tcon1_in_mixer1>;
> +                                       };
> +
> +                                       mixer1_out_tcon0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon0_in_mixer1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon0: lcd-controller@1c0c000 {
> +                       compatible = "allwinner,sun8i-h3-tcon0";
> +                       reg = <0x01c0c000 0x1000>;
> +                       interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON0>,
> +                                <&ccu CLK_TCON0>;
> +                       clock-names = "ahb",
> +                                     "tcon-ch1";
> +                       resets = <&ccu RST_BUS_TCON0>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon0_in: port@0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon0_in_mixer0: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer0_out_tcon0>;
> +                                       };
> +
> +                                       tcon0_in_mixer1: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer1_out_tcon0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon1: lcd-controller@1c0d000 {
> +                       compatible = "allwinner,sun8i-h3-tcon1";
> +                       reg = <0x01c0d000 0x1000>;
> +                       interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON1>;
> +                       clock-names = "ahb";
> +                       resets = <&ccu RST_BUS_TCON1>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon1_in: port@0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon1_in_mixer1: endpoint@0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer1_out_tcon1>;
> +                                       };
> +
> +                                       tcon1_in_mixer0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer0_out_tcon1>;
> +                                       };
> +                               };
> +
> +                               tcon1_out: port@1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       tcon1_out_tve0: endpoint@1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tve0_in_tcon1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tve0: tv-encoder@1e00000 {
> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
> +                       reg = <0x01e00000 0x1000>;
> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +                       clock-names = "bus", "mod";
> +                       resets = <&ccu RST_BUS_TVE>;
> +                       status = "disabled";
> +
> +                       assigned-clocks = <&ccu CLK_TVE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <216000000>;
> +
> +                       port {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tve0_in_tcon1: endpoint@0 {
> +                                       reg = <0>;
> +                                       remote-endpoint = <&tcon1_out_tve0>;
> +                               };
> +                       };
> +               };
> +       };
> +
>         timer {
>                 compatible = "arm,armv7-timer";
>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
>
> --
> 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/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:24     ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
> As we have already the support for the TV encoder on Allwinner H3, add
> the display engine pipeline device tree nodes to its DTSI file.
>
> The H5 pipeline has some differences and will be enabled later.
>
> The currently-unused mixer0 and tcon0 are also needed, for the
> completement of the pipeline.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 189 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 189 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index b36f9f423c39..20172ef92415 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -41,6 +41,8 @@
>   */
>
>  #include "sunxi-h3-h5.dtsi"
> +#include <dt-bindings/clock/sun8i-de2.h>
> +#include <dt-bindings/reset/sun8i-de2.h>
>
>  / {
>         cpus {
> @@ -72,6 +74,193 @@
>                 };
>         };
>
> +       de: display-engine {
> +               compatible = "allwinner,sun8i-h3-display-engine";
> +               allwinner,pipelines = <&mixer0>,
> +                                     <&mixer1>;
> +               status = "disabled";
> +       };
> +
> +       soc {
> +               display_clocks: clock at 1000000 {
> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
> +                       reg = <0x01000000 0x100000>;
> +                       clocks = <&ccu CLK_BUS_DE>,
> +                                <&ccu CLK_DE>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&ccu RST_BUS_DE>;
> +                       #clock-cells = <1>;
> +                       #reset-cells = <1>;
> +                       assigned-clocks = <&ccu CLK_DE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <432000000>;
> +               };
> +
> +               mixer0: mixer at 1100000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
> +                       reg = <0x01100000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
> +                                <&display_clocks CLK_MIXER0>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_MIXER0>;
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer0_out: port at 1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer0_out_tcon0: endpoint at 0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&tcon0_in_mixer0>;
> +                                       };
> +
> +                                       mixer0_out_tcon1: endpoint at 1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon1_in_mixer0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               mixer1: mixer at 1200000 {
> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
> +                       reg = <0x01200000 0x100000>;
> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
> +                                <&display_clocks CLK_MIXER1>;
> +                       clock-names = "bus",
> +                                     "mod";
> +                       resets = <&display_clocks RST_WB>;
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               mixer1_out: port at 1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       mixer1_out_tcon1: endpoint at 0 {
> +                                               reg = <0>;

I would prefer if you could stick to the numbering scheme we're using for
Display Engine 1.0, as in endpoint 0 links to component 0 of whatever type.

We're probably going to stick to that for the R40's incredibly complicated
pipeline. I don't want to have any outliers unless absolutely necessary.

ChenYu

> +                                               remote-endpoint = <&tcon1_in_mixer1>;
> +                                       };
> +
> +                                       mixer1_out_tcon0: endpoint at 1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tcon0_in_mixer1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon0: lcd-controller at 1c0c000 {
> +                       compatible = "allwinner,sun8i-h3-tcon0";
> +                       reg = <0x01c0c000 0x1000>;
> +                       interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON0>,
> +                                <&ccu CLK_TCON0>;
> +                       clock-names = "ahb",
> +                                     "tcon-ch1";
> +                       resets = <&ccu RST_BUS_TCON0>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon0_in: port at 0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon0_in_mixer0: endpoint at 0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer0_out_tcon0>;
> +                                       };
> +
> +                                       tcon0_in_mixer1: endpoint at 1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer1_out_tcon0>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tcon1: lcd-controller at 1c0d000 {
> +                       compatible = "allwinner,sun8i-h3-tcon1";
> +                       reg = <0x01c0d000 0x1000>;
> +                       interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&ccu CLK_BUS_TCON1>;
> +                       clock-names = "ahb";
> +                       resets = <&ccu RST_BUS_TCON1>;
> +                       reset-names = "lcd";
> +                       status = "disabled";
> +
> +                       ports {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tcon1_in: port at 0 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <0>;
> +
> +                                       tcon1_in_mixer1: endpoint at 0 {
> +                                               reg = <0>;
> +                                               remote-endpoint = <&mixer1_out_tcon1>;
> +                                       };
> +
> +                                       tcon1_in_mixer0: endpoint at 1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&mixer0_out_tcon1>;
> +                                       };
> +                               };
> +
> +                               tcon1_out: port at 1 {
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       reg = <1>;
> +
> +                                       tcon1_out_tve0: endpoint at 1 {
> +                                               reg = <1>;
> +                                               remote-endpoint = <&tve0_in_tcon1>;
> +                                       };
> +                               };
> +                       };
> +               };
> +
> +               tve0: tv-encoder at 1e00000 {
> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
> +                       reg = <0x01e00000 0x1000>;
> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
> +                       clock-names = "bus", "mod";
> +                       resets = <&ccu RST_BUS_TVE>;
> +                       status = "disabled";
> +
> +                       assigned-clocks = <&ccu CLK_TVE>;
> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
> +                       assigned-clock-rates = <216000000>;
> +
> +                       port {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               tve0_in_tcon1: endpoint at 0 {
> +                                       reg = <0>;
> +                                       remote-endpoint = <&tcon1_out_tve0>;
> +                               };
> +                       };
> +               };
> +       };
> +
>         timer {
>                 compatible = "arm,armv7-timer";
>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> --
> 2.12.2
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:28       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens@csie.org> 写到:
>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>>
>> The H5 pipeline has some differences and will be enabled later.
>>
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>
>>  / {
>>         cpus {
>> @@ -72,6 +74,193 @@
>>                 };
>>         };
>>
>> +       de: display-engine {
>> +               compatible = "allwinner,sun8i-h3-display-engine";
>> +               allwinner,pipelines = <&mixer0>,
>> +                                     <&mixer1>;
>> +               status = "disabled";
>> +       };
>> +
>> +       soc {
>> +               display_clocks: clock@1000000 {
>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>> +                       reg = <0x01000000 0x100000>;
>> +                       clocks = <&ccu CLK_BUS_DE>,
>> +                                <&ccu CLK_DE>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&ccu RST_BUS_DE>;
>> +                       #clock-cells = <1>;
>> +                       #reset-cells = <1>;
>> +                       assigned-clocks = <&ccu CLK_DE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <432000000>;
>> +               };
>> +
>> +               mixer0: mixer@1100000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>> +                       reg = <0x01100000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>> +                                <&display_clocks CLK_MIXER0>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_MIXER0>;
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer0_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer0_out_tcon0: endpoint@0
>{
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer0>;
>> +                                       };
>> +
>> +                                       mixer0_out_tcon1: endpoint@1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon1_in_mixer0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               mixer1: mixer@1200000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>> +                       reg = <0x01200000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>> +                                <&display_clocks CLK_MIXER1>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_WB>;
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer1_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer1_out_tcon1: endpoint@0
>{
>> +                                               reg = <0>;
>
>I would prefer if you could stick to the numbering scheme we're using
>for
>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>type.

If we keep this we will need a ugly id property in mixer node,
otherwise we cannot know which TCON to be bind.

>
>We're probably going to stick to that for the R40's incredibly
>complicated
>pipeline. I don't want to have any outliers unless absolutely
>necessary.
>
>ChenYu
>
>> +                                               remote-endpoint =
><&tcon1_in_mixer1>;
>> +                                       };
>> +
>> +                                       mixer1_out_tcon0: endpoint@1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon0: lcd-controller@1c0c000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>> +                       reg = <0x01c0c000 0x1000>;
>> +                       interrupts = <GIC_SPI 86
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>> +                                <&ccu CLK_TCON0>;
>> +                       clock-names = "ahb",
>> +                                     "tcon-ch1";
>> +                       resets = <&ccu RST_BUS_TCON0>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon0_in: port@0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon0_in_mixer0: endpoint@0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon0>;
>> +                                       };
>> +
>> +                                       tcon0_in_mixer1: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon1: lcd-controller@1c0d000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>> +                       reg = <0x01c0d000 0x1000>;
>> +                       interrupts = <GIC_SPI 87
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>> +                       clock-names = "ahb";
>> +                       resets = <&ccu RST_BUS_TCON1>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon1_in: port@0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon1_in_mixer1: endpoint@0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon1>;
>> +                                       };
>> +
>> +                                       tcon1_in_mixer0: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon1>;
>> +                                       };
>> +                               };
>> +
>> +                               tcon1_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       tcon1_out_tve0: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tve0_in_tcon1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tve0: tv-encoder@1e00000 {
>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>> +                       reg = <0x01e00000 0x1000>;
>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +                       clock-names = "bus", "mod";
>> +                       resets = <&ccu RST_BUS_TVE>;
>> +                       status = "disabled";
>> +
>> +                       assigned-clocks = <&ccu CLK_TVE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <216000000>;
>> +
>> +                       port {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tve0_in_tcon1: endpoint@0 {
>> +                                       reg = <0>;
>> +                                       remote-endpoint =
><&tcon1_out_tve0>;
>> +                               };
>> +                       };
>> +               };
>> +       };
>> +
>>         timer {
>>                 compatible = "arm,armv7-timer";
>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>IRQ_TYPE_LEVEL_LOW)>,
>> --
>> 2.12.2
>>
>> --
>> 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@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:28       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> 写到:
>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>>
>> The H5 pipeline has some differences and will be enabled later.
>>
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>>
>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>
>>  / {
>>         cpus {
>> @@ -72,6 +74,193 @@
>>                 };
>>         };
>>
>> +       de: display-engine {
>> +               compatible = "allwinner,sun8i-h3-display-engine";
>> +               allwinner,pipelines = <&mixer0>,
>> +                                     <&mixer1>;
>> +               status = "disabled";
>> +       };
>> +
>> +       soc {
>> +               display_clocks: clock@1000000 {
>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>> +                       reg = <0x01000000 0x100000>;
>> +                       clocks = <&ccu CLK_BUS_DE>,
>> +                                <&ccu CLK_DE>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&ccu RST_BUS_DE>;
>> +                       #clock-cells = <1>;
>> +                       #reset-cells = <1>;
>> +                       assigned-clocks = <&ccu CLK_DE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <432000000>;
>> +               };
>> +
>> +               mixer0: mixer@1100000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>> +                       reg = <0x01100000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>> +                                <&display_clocks CLK_MIXER0>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_MIXER0>;
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer0_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer0_out_tcon0: endpoint@0
>{
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer0>;
>> +                                       };
>> +
>> +                                       mixer0_out_tcon1: endpoint@1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon1_in_mixer0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               mixer1: mixer@1200000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>> +                       reg = <0x01200000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>> +                                <&display_clocks CLK_MIXER1>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_WB>;
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer1_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer1_out_tcon1: endpoint@0
>{
>> +                                               reg = <0>;
>
>I would prefer if you could stick to the numbering scheme we're using
>for
>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>type.

If we keep this we will need a ugly id property in mixer node,
otherwise we cannot know which TCON to be bind.

>
>We're probably going to stick to that for the R40's incredibly
>complicated
>pipeline. I don't want to have any outliers unless absolutely
>necessary.
>
>ChenYu
>
>> +                                               remote-endpoint =
><&tcon1_in_mixer1>;
>> +                                       };
>> +
>> +                                       mixer1_out_tcon0: endpoint@1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon0: lcd-controller@1c0c000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>> +                       reg = <0x01c0c000 0x1000>;
>> +                       interrupts = <GIC_SPI 86
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>> +                                <&ccu CLK_TCON0>;
>> +                       clock-names = "ahb",
>> +                                     "tcon-ch1";
>> +                       resets = <&ccu RST_BUS_TCON0>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon0_in: port@0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon0_in_mixer0: endpoint@0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon0>;
>> +                                       };
>> +
>> +                                       tcon0_in_mixer1: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon1: lcd-controller@1c0d000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>> +                       reg = <0x01c0d000 0x1000>;
>> +                       interrupts = <GIC_SPI 87
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>> +                       clock-names = "ahb";
>> +                       resets = <&ccu RST_BUS_TCON1>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon1_in: port@0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon1_in_mixer1: endpoint@0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon1>;
>> +                                       };
>> +
>> +                                       tcon1_in_mixer0: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon1>;
>> +                                       };
>> +                               };
>> +
>> +                               tcon1_out: port@1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       tcon1_out_tve0: endpoint@1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tve0_in_tcon1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tve0: tv-encoder@1e00000 {
>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>> +                       reg = <0x01e00000 0x1000>;
>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +                       clock-names = "bus", "mod";
>> +                       resets = <&ccu RST_BUS_TVE>;
>> +                       status = "disabled";
>> +
>> +                       assigned-clocks = <&ccu CLK_TVE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <216000000>;
>> +
>> +                       port {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tve0_in_tcon1: endpoint@0 {
>> +                                       reg = <0>;
>> +                                       remote-endpoint =
><&tcon1_out_tve0>;
>> +                               };
>> +                       };
>> +               };
>> +       };
>> +
>>         timer {
>>                 compatible = "arm,armv7-timer";
>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>IRQ_TYPE_LEVEL_LOW)>,
>> --
>> 2.12.2
>>
>> --
>> 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/Ez6ZCGd0@public.gmane.org
>> For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:28       ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:28 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?24? GMT+08:00 ??1:24:29, Chen-Yu Tsai <wens@csie.org> ??:
>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>wrote:
>> As we have already the support for the TV encoder on Allwinner H3,
>add
>> the display engine pipeline device tree nodes to its DTSI file.
>>
>> The H5 pipeline has some differences and will be enabled later.
>>
>> The currently-unused mixer0 and tcon0 are also needed, for the
>> completement of the pipeline.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index b36f9f423c39..20172ef92415 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -41,6 +41,8 @@
>>   */
>>
>>  #include "sunxi-h3-h5.dtsi"
>> +#include <dt-bindings/clock/sun8i-de2.h>
>> +#include <dt-bindings/reset/sun8i-de2.h>
>>
>>  / {
>>         cpus {
>> @@ -72,6 +74,193 @@
>>                 };
>>         };
>>
>> +       de: display-engine {
>> +               compatible = "allwinner,sun8i-h3-display-engine";
>> +               allwinner,pipelines = <&mixer0>,
>> +                                     <&mixer1>;
>> +               status = "disabled";
>> +       };
>> +
>> +       soc {
>> +               display_clocks: clock at 1000000 {
>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>> +                       reg = <0x01000000 0x100000>;
>> +                       clocks = <&ccu CLK_BUS_DE>,
>> +                                <&ccu CLK_DE>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&ccu RST_BUS_DE>;
>> +                       #clock-cells = <1>;
>> +                       #reset-cells = <1>;
>> +                       assigned-clocks = <&ccu CLK_DE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <432000000>;
>> +               };
>> +
>> +               mixer0: mixer at 1100000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>> +                       reg = <0x01100000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>> +                                <&display_clocks CLK_MIXER0>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_MIXER0>;
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer0_out: port at 1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer0_out_tcon0: endpoint at 0
>{
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer0>;
>> +                                       };
>> +
>> +                                       mixer0_out_tcon1: endpoint at 1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon1_in_mixer0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               mixer1: mixer at 1200000 {
>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>> +                       reg = <0x01200000 0x100000>;
>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>> +                                <&display_clocks CLK_MIXER1>;
>> +                       clock-names = "bus",
>> +                                     "mod";
>> +                       resets = <&display_clocks RST_WB>;
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               mixer1_out: port at 1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       mixer1_out_tcon1: endpoint at 0
>{
>> +                                               reg = <0>;
>
>I would prefer if you could stick to the numbering scheme we're using
>for
>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>type.

If we keep this we will need a ugly id property in mixer node,
otherwise we cannot know which TCON to be bind.

>
>We're probably going to stick to that for the R40's incredibly
>complicated
>pipeline. I don't want to have any outliers unless absolutely
>necessary.
>
>ChenYu
>
>> +                                               remote-endpoint =
><&tcon1_in_mixer1>;
>> +                                       };
>> +
>> +                                       mixer1_out_tcon0: endpoint at 1
>{
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tcon0_in_mixer1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon0: lcd-controller at 1c0c000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>> +                       reg = <0x01c0c000 0x1000>;
>> +                       interrupts = <GIC_SPI 86
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>> +                                <&ccu CLK_TCON0>;
>> +                       clock-names = "ahb",
>> +                                     "tcon-ch1";
>> +                       resets = <&ccu RST_BUS_TCON0>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon0_in: port at 0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon0_in_mixer0: endpoint at 0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon0>;
>> +                                       };
>> +
>> +                                       tcon0_in_mixer1: endpoint at 1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon0>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tcon1: lcd-controller at 1c0d000 {
>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>> +                       reg = <0x01c0d000 0x1000>;
>> +                       interrupts = <GIC_SPI 87
>IRQ_TYPE_LEVEL_HIGH>;
>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>> +                       clock-names = "ahb";
>> +                       resets = <&ccu RST_BUS_TCON1>;
>> +                       reset-names = "lcd";
>> +                       status = "disabled";
>> +
>> +                       ports {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tcon1_in: port at 0 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <0>;
>> +
>> +                                       tcon1_in_mixer1: endpoint at 0 {
>> +                                               reg = <0>;
>> +                                               remote-endpoint =
><&mixer1_out_tcon1>;
>> +                                       };
>> +
>> +                                       tcon1_in_mixer0: endpoint at 1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&mixer0_out_tcon1>;
>> +                                       };
>> +                               };
>> +
>> +                               tcon1_out: port at 1 {
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <0>;
>> +                                       reg = <1>;
>> +
>> +                                       tcon1_out_tve0: endpoint at 1 {
>> +                                               reg = <1>;
>> +                                               remote-endpoint =
><&tve0_in_tcon1>;
>> +                                       };
>> +                               };
>> +                       };
>> +               };
>> +
>> +               tve0: tv-encoder at 1e00000 {
>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>> +                       reg = <0x01e00000 0x1000>;
>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>> +                       clock-names = "bus", "mod";
>> +                       resets = <&ccu RST_BUS_TVE>;
>> +                       status = "disabled";
>> +
>> +                       assigned-clocks = <&ccu CLK_TVE>;
>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>> +                       assigned-clock-rates = <216000000>;
>> +
>> +                       port {
>> +                               #address-cells = <1>;
>> +                               #size-cells = <0>;
>> +
>> +                               tve0_in_tcon1: endpoint at 0 {
>> +                                       reg = <0>;
>> +                                       remote-endpoint =
><&tcon1_out_tve0>;
>> +                               };
>> +                       };
>> +               };
>> +       };
>> +
>>         timer {
>>                 compatible = "arm,armv7-timer";
>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>IRQ_TYPE_LEVEL_LOW)>,
>> --
>> 2.12.2
>>
>> --
>> You received this message because you are subscribed to the Google
>Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it,
>send an email to linux-sunxi+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:34         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:34 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> 于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens@csie.org> 写到:
>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>>wrote:
>>> As we have already the support for the TV encoder on Allwinner H3,
>>add
>>> the display engine pipeline device tree nodes to its DTSI file.
>>>
>>> The H5 pipeline has some differences and will be enabled later.
>>>
>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>> completement of the pipeline.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> ---
>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 189 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> index b36f9f423c39..20172ef92415 100644
>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> @@ -41,6 +41,8 @@
>>>   */
>>>
>>>  #include "sunxi-h3-h5.dtsi"
>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>
>>>  / {
>>>         cpus {
>>> @@ -72,6 +74,193 @@
>>>                 };
>>>         };
>>>
>>> +       de: display-engine {
>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>> +               allwinner,pipelines = <&mixer0>,
>>> +                                     <&mixer1>;
>>> +               status = "disabled";
>>> +       };
>>> +
>>> +       soc {
>>> +               display_clocks: clock@1000000 {
>>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>>> +                       reg = <0x01000000 0x100000>;
>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>> +                                <&ccu CLK_DE>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&ccu RST_BUS_DE>;
>>> +                       #clock-cells = <1>;
>>> +                       #reset-cells = <1>;
>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <432000000>;
>>> +               };
>>> +
>>> +               mixer0: mixer@1100000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>>> +                       reg = <0x01100000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>> +                                <&display_clocks CLK_MIXER0>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_MIXER0>;
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer0_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer0_out_tcon0: endpoint@0
>>{
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer0>;
>>> +                                       };
>>> +
>>> +                                       mixer0_out_tcon1: endpoint@1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               mixer1: mixer@1200000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>>> +                       reg = <0x01200000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>> +                                <&display_clocks CLK_MIXER1>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_WB>;
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer1_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer1_out_tcon1: endpoint@0
>>{
>>> +                                               reg = <0>;
>>
>>I would prefer if you could stick to the numbering scheme we're using
>>for
>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>type.
>
> If we keep this we will need a ugly id property in mixer node,
> otherwise we cannot know which TCON to be bind.

Why? You can simply change the logic in your driver from:

    if (remote_endpoint.id) { continue; }

to:

    if (local_endpoint.id != remote_endpoint.id) { continue; }

I don't see the need for any ID property in the mixer node in this case.
The ID is already encoded into the endpoint IDs.

ChenYu

>>
>>We're probably going to stick to that for the R40's incredibly
>>complicated
>>pipeline. I don't want to have any outliers unless absolutely
>>necessary.
>>
>>ChenYu
>>
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer1>;
>>> +                                       };
>>> +
>>> +                                       mixer1_out_tcon0: endpoint@1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon0: lcd-controller@1c0c000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>> +                       reg = <0x01c0c000 0x1000>;
>>> +                       interrupts = <GIC_SPI 86
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>> +                                <&ccu CLK_TCON0>;
>>> +                       clock-names = "ahb",
>>> +                                     "tcon-ch1";
>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon0_in: port@0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon0_in_mixer0: endpoint@0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon0>;
>>> +                                       };
>>> +
>>> +                                       tcon0_in_mixer1: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon1: lcd-controller@1c0d000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>> +                       reg = <0x01c0d000 0x1000>;
>>> +                       interrupts = <GIC_SPI 87
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>> +                       clock-names = "ahb";
>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon1_in: port@0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon1_in_mixer1: endpoint@0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon1>;
>>> +                                       };
>>> +
>>> +                                       tcon1_in_mixer0: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon1>;
>>> +                                       };
>>> +                               };
>>> +
>>> +                               tcon1_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       tcon1_out_tve0: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tve0_in_tcon1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tve0: tv-encoder@1e00000 {
>>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>>> +                       reg = <0x01e00000 0x1000>;
>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>>> +                       clock-names = "bus", "mod";
>>> +                       resets = <&ccu RST_BUS_TVE>;
>>> +                       status = "disabled";
>>> +
>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <216000000>;
>>> +
>>> +                       port {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tve0_in_tcon1: endpoint@0 {
>>> +                                       reg = <0>;
>>> +                                       remote-endpoint =
>><&tcon1_out_tve0>;
>>> +                               };
>>> +                       };
>>> +               };
>>> +       };
>>> +
>>>         timer {
>>>                 compatible = "arm,armv7-timer";
>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>IRQ_TYPE_LEVEL_LOW)>,
>>> --
>>> 2.12.2
>>>
>>> --
>>> 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@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:34         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:34 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
>
>
> 于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> 写到:
>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>>wrote:
>>> As we have already the support for the TV encoder on Allwinner H3,
>>add
>>> the display engine pipeline device tree nodes to its DTSI file.
>>>
>>> The H5 pipeline has some differences and will be enabled later.
>>>
>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>> completement of the pipeline.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>>> ---
>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 189 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> index b36f9f423c39..20172ef92415 100644
>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> @@ -41,6 +41,8 @@
>>>   */
>>>
>>>  #include "sunxi-h3-h5.dtsi"
>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>
>>>  / {
>>>         cpus {
>>> @@ -72,6 +74,193 @@
>>>                 };
>>>         };
>>>
>>> +       de: display-engine {
>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>> +               allwinner,pipelines = <&mixer0>,
>>> +                                     <&mixer1>;
>>> +               status = "disabled";
>>> +       };
>>> +
>>> +       soc {
>>> +               display_clocks: clock@1000000 {
>>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>>> +                       reg = <0x01000000 0x100000>;
>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>> +                                <&ccu CLK_DE>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&ccu RST_BUS_DE>;
>>> +                       #clock-cells = <1>;
>>> +                       #reset-cells = <1>;
>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <432000000>;
>>> +               };
>>> +
>>> +               mixer0: mixer@1100000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>>> +                       reg = <0x01100000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>> +                                <&display_clocks CLK_MIXER0>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_MIXER0>;
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer0_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer0_out_tcon0: endpoint@0
>>{
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer0>;
>>> +                                       };
>>> +
>>> +                                       mixer0_out_tcon1: endpoint@1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               mixer1: mixer@1200000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>>> +                       reg = <0x01200000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>> +                                <&display_clocks CLK_MIXER1>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_WB>;
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer1_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer1_out_tcon1: endpoint@0
>>{
>>> +                                               reg = <0>;
>>
>>I would prefer if you could stick to the numbering scheme we're using
>>for
>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>type.
>
> If we keep this we will need a ugly id property in mixer node,
> otherwise we cannot know which TCON to be bind.

Why? You can simply change the logic in your driver from:

    if (remote_endpoint.id) { continue; }

to:

    if (local_endpoint.id != remote_endpoint.id) { continue; }

I don't see the need for any ID property in the mixer node in this case.
The ID is already encoded into the endpoint IDs.

ChenYu

>>
>>We're probably going to stick to that for the R40's incredibly
>>complicated
>>pipeline. I don't want to have any outliers unless absolutely
>>necessary.
>>
>>ChenYu
>>
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer1>;
>>> +                                       };
>>> +
>>> +                                       mixer1_out_tcon0: endpoint@1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon0: lcd-controller@1c0c000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>> +                       reg = <0x01c0c000 0x1000>;
>>> +                       interrupts = <GIC_SPI 86
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>> +                                <&ccu CLK_TCON0>;
>>> +                       clock-names = "ahb",
>>> +                                     "tcon-ch1";
>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon0_in: port@0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon0_in_mixer0: endpoint@0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon0>;
>>> +                                       };
>>> +
>>> +                                       tcon0_in_mixer1: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon1: lcd-controller@1c0d000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>> +                       reg = <0x01c0d000 0x1000>;
>>> +                       interrupts = <GIC_SPI 87
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>> +                       clock-names = "ahb";
>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon1_in: port@0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon1_in_mixer1: endpoint@0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon1>;
>>> +                                       };
>>> +
>>> +                                       tcon1_in_mixer0: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon1>;
>>> +                                       };
>>> +                               };
>>> +
>>> +                               tcon1_out: port@1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       tcon1_out_tve0: endpoint@1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tve0_in_tcon1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tve0: tv-encoder@1e00000 {
>>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>>> +                       reg = <0x01e00000 0x1000>;
>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>>> +                       clock-names = "bus", "mod";
>>> +                       resets = <&ccu RST_BUS_TVE>;
>>> +                       status = "disabled";
>>> +
>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <216000000>;
>>> +
>>> +                       port {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tve0_in_tcon1: endpoint@0 {
>>> +                                       reg = <0>;
>>> +                                       remote-endpoint =
>><&tcon1_out_tve0>;
>>> +                               };
>>> +                       };
>>> +               };
>>> +       };
>>> +
>>>         timer {
>>>                 compatible = "arm,armv7-timer";
>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>IRQ_TYPE_LEVEL_LOW)>,
>>> --
>>> 2.12.2
>>>
>>> --
>>> 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/Ez6ZCGd0@public.gmane.org
>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:34         ` Chen-Yu Tsai
  0 siblings, 0 replies; 159+ messages in thread
From: Chen-Yu Tsai @ 2017-05-24  5:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> ? 2017?5?24? GMT+08:00 ??1:24:29, Chen-Yu Tsai <wens@csie.org> ??:
>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>>wrote:
>>> As we have already the support for the TV encoder on Allwinner H3,
>>add
>>> the display engine pipeline device tree nodes to its DTSI file.
>>>
>>> The H5 pipeline has some differences and will be enabled later.
>>>
>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>> completement of the pipeline.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> ---
>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 189 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> index b36f9f423c39..20172ef92415 100644
>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>> @@ -41,6 +41,8 @@
>>>   */
>>>
>>>  #include "sunxi-h3-h5.dtsi"
>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>
>>>  / {
>>>         cpus {
>>> @@ -72,6 +74,193 @@
>>>                 };
>>>         };
>>>
>>> +       de: display-engine {
>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>> +               allwinner,pipelines = <&mixer0>,
>>> +                                     <&mixer1>;
>>> +               status = "disabled";
>>> +       };
>>> +
>>> +       soc {
>>> +               display_clocks: clock at 1000000 {
>>> +                       compatible = "allwinner,sun8i-a83t-de2-clk";
>>> +                       reg = <0x01000000 0x100000>;
>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>> +                                <&ccu CLK_DE>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&ccu RST_BUS_DE>;
>>> +                       #clock-cells = <1>;
>>> +                       #reset-cells = <1>;
>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <432000000>;
>>> +               };
>>> +
>>> +               mixer0: mixer at 1100000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer0";
>>> +                       reg = <0x01100000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>> +                                <&display_clocks CLK_MIXER0>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_MIXER0>;
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer0_out: port at 1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer0_out_tcon0: endpoint at 0
>>{
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer0>;
>>> +                                       };
>>> +
>>> +                                       mixer0_out_tcon1: endpoint at 1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               mixer1: mixer at 1200000 {
>>> +                       compatible = "allwinner,sun8i-h3-de2-mixer1";
>>> +                       reg = <0x01200000 0x100000>;
>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>> +                                <&display_clocks CLK_MIXER1>;
>>> +                       clock-names = "bus",
>>> +                                     "mod";
>>> +                       resets = <&display_clocks RST_WB>;
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               mixer1_out: port at 1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       mixer1_out_tcon1: endpoint at 0
>>{
>>> +                                               reg = <0>;
>>
>>I would prefer if you could stick to the numbering scheme we're using
>>for
>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>type.
>
> If we keep this we will need a ugly id property in mixer node,
> otherwise we cannot know which TCON to be bind.

Why? You can simply change the logic in your driver from:

    if (remote_endpoint.id) { continue; }

to:

    if (local_endpoint.id != remote_endpoint.id) { continue; }

I don't see the need for any ID property in the mixer node in this case.
The ID is already encoded into the endpoint IDs.

ChenYu

>>
>>We're probably going to stick to that for the R40's incredibly
>>complicated
>>pipeline. I don't want to have any outliers unless absolutely
>>necessary.
>>
>>ChenYu
>>
>>> +                                               remote-endpoint =
>><&tcon1_in_mixer1>;
>>> +                                       };
>>> +
>>> +                                       mixer1_out_tcon0: endpoint at 1
>>{
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tcon0_in_mixer1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon0: lcd-controller at 1c0c000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>> +                       reg = <0x01c0c000 0x1000>;
>>> +                       interrupts = <GIC_SPI 86
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>> +                                <&ccu CLK_TCON0>;
>>> +                       clock-names = "ahb",
>>> +                                     "tcon-ch1";
>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon0_in: port at 0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon0_in_mixer0: endpoint at 0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon0>;
>>> +                                       };
>>> +
>>> +                                       tcon0_in_mixer1: endpoint at 1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon0>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tcon1: lcd-controller at 1c0d000 {
>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>> +                       reg = <0x01c0d000 0x1000>;
>>> +                       interrupts = <GIC_SPI 87
>>IRQ_TYPE_LEVEL_HIGH>;
>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>> +                       clock-names = "ahb";
>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>> +                       reset-names = "lcd";
>>> +                       status = "disabled";
>>> +
>>> +                       ports {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tcon1_in: port at 0 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <0>;
>>> +
>>> +                                       tcon1_in_mixer1: endpoint at 0 {
>>> +                                               reg = <0>;
>>> +                                               remote-endpoint =
>><&mixer1_out_tcon1>;
>>> +                                       };
>>> +
>>> +                                       tcon1_in_mixer0: endpoint at 1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&mixer0_out_tcon1>;
>>> +                                       };
>>> +                               };
>>> +
>>> +                               tcon1_out: port at 1 {
>>> +                                       #address-cells = <1>;
>>> +                                       #size-cells = <0>;
>>> +                                       reg = <1>;
>>> +
>>> +                                       tcon1_out_tve0: endpoint at 1 {
>>> +                                               reg = <1>;
>>> +                                               remote-endpoint =
>><&tve0_in_tcon1>;
>>> +                                       };
>>> +                               };
>>> +                       };
>>> +               };
>>> +
>>> +               tve0: tv-encoder at 1e00000 {
>>> +                       compatible = "allwinner,sun8i-h3-tv-encoder";
>>> +                       reg = <0x01e00000 0x1000>;
>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu CLK_TVE>;
>>> +                       clock-names = "bus", "mod";
>>> +                       resets = <&ccu RST_BUS_TVE>;
>>> +                       status = "disabled";
>>> +
>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>> +                       assigned-clock-rates = <216000000>;
>>> +
>>> +                       port {
>>> +                               #address-cells = <1>;
>>> +                               #size-cells = <0>;
>>> +
>>> +                               tve0_in_tcon1: endpoint at 0 {
>>> +                                       reg = <0>;
>>> +                                       remote-endpoint =
>><&tcon1_out_tve0>;
>>> +                               };
>>> +                       };
>>> +               };
>>> +       };
>>> +
>>>         timer {
>>>                 compatible = "arm,armv7-timer";
>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>IRQ_TYPE_LEVEL_LOW)>,
>>> --
>>> 2.12.2
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>Groups "linux-sunxi" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>send an email to linux-sunxi+unsubscribe at googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:36           ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:36 UTC (permalink / raw)
  To: wens, Chen-Yu Tsai
  Cc: Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月24日 GMT+08:00 下午1:34:58, Chen-Yu Tsai <wens@csie.org> 写到:
>On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>>
>>
>> 于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens@csie.org> 写到:
>>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>>>wrote:
>>>> As we have already the support for the TV encoder on Allwinner H3,
>>>add
>>>> the display engine pipeline device tree nodes to its DTSI file.
>>>>
>>>> The H5 pipeline has some differences and will be enabled later.
>>>>
>>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>>> completement of the pipeline.
>>>>
>>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>>> ---
>>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>>++++++++++++++++++++++++++++++++++++++++
>>>>  1 file changed, 189 insertions(+)
>>>>
>>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> index b36f9f423c39..20172ef92415 100644
>>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> @@ -41,6 +41,8 @@
>>>>   */
>>>>
>>>>  #include "sunxi-h3-h5.dtsi"
>>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>>
>>>>  / {
>>>>         cpus {
>>>> @@ -72,6 +74,193 @@
>>>>                 };
>>>>         };
>>>>
>>>> +       de: display-engine {
>>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>>> +               allwinner,pipelines = <&mixer0>,
>>>> +                                     <&mixer1>;
>>>> +               status = "disabled";
>>>> +       };
>>>> +
>>>> +       soc {
>>>> +               display_clocks: clock@1000000 {
>>>> +                       compatible =
>"allwinner,sun8i-a83t-de2-clk";
>>>> +                       reg = <0x01000000 0x100000>;
>>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>>> +                                <&ccu CLK_DE>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&ccu RST_BUS_DE>;
>>>> +                       #clock-cells = <1>;
>>>> +                       #reset-cells = <1>;
>>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <432000000>;
>>>> +               };
>>>> +
>>>> +               mixer0: mixer@1100000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer0";
>>>> +                       reg = <0x01100000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>>> +                                <&display_clocks CLK_MIXER0>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_MIXER0>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer0_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer0_out_tcon0:
>endpoint@0
>>>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer0>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer0_out_tcon1:
>endpoint@1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               mixer1: mixer@1200000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer1";
>>>> +                       reg = <0x01200000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>>> +                                <&display_clocks CLK_MIXER1>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_WB>;
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer1_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer1_out_tcon1:
>endpoint@0
>>>{
>>>> +                                               reg = <0>;
>>>
>>>I would prefer if you could stick to the numbering scheme we're using
>>>for
>>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>>type.
>>
>> If we keep this we will need a ugly id property in mixer node,
>> otherwise we cannot know which TCON to be bind.
>
>Why? You can simply change the logic in your driver from:
>
>    if (remote_endpoint.id) { continue; }
>
>to:
>
>    if (local_endpoint.id != remote_endpoint.id) { continue; }

Thanks, I forgot that there's two endpoint ids...

So silly I am.

>
>I don't see the need for any ID property in the mixer node in this
>case.
>The ID is already encoded into the endpoint IDs.
>
>ChenYu
>
>>>
>>>We're probably going to stick to that for the R40's incredibly
>>>complicated
>>>pipeline. I don't want to have any outliers unless absolutely
>>>necessary.
>>>
>>>ChenYu
>>>
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer1>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer1_out_tcon0:
>endpoint@1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon0: lcd-controller@1c0c000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>>> +                       reg = <0x01c0c000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 86
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>>> +                                <&ccu CLK_TCON0>;
>>>> +                       clock-names = "ahb",
>>>> +                                     "tcon-ch1";
>>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon0_in: port@0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon0_in_mixer0: endpoint@0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon0>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon0_in_mixer1: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon1: lcd-controller@1c0d000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>>> +                       reg = <0x01c0d000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 87
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>>> +                       clock-names = "ahb";
>>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon1_in: port@0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon1_in_mixer1: endpoint@0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon1>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon1_in_mixer0: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +
>>>> +                               tcon1_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       tcon1_out_tve0: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tve0_in_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tve0: tv-encoder@1e00000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-tv-encoder";
>>>> +                       reg = <0x01e00000 0x1000>;
>>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu
>CLK_TVE>;
>>>> +                       clock-names = "bus", "mod";
>>>> +                       resets = <&ccu RST_BUS_TVE>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <216000000>;
>>>> +
>>>> +                       port {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tve0_in_tcon1: endpoint@0 {
>>>> +                                       reg = <0>;
>>>> +                                       remote-endpoint =
>>><&tcon1_out_tve0>;
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +       };
>>>> +
>>>>         timer {
>>>>                 compatible = "arm,armv7-timer";
>>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>>IRQ_TYPE_LEVEL_LOW)>,
>>>> --
>>>> 2.12.2
>>>>
>>>> --
>>>> 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@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google
>Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it,
>send an email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:36           ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:36 UTC (permalink / raw)
  To: wens-jdAy2FN1RRM
  Cc: Maxime Ripard, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi



于 2017年5月24日 GMT+08:00 下午1:34:58, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> 写到:
>On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
>>
>>
>> 于 2017年5月24日 GMT+08:00 下午1:24:29, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> 写到:
>>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>>>wrote:
>>>> As we have already the support for the TV encoder on Allwinner H3,
>>>add
>>>> the display engine pipeline device tree nodes to its DTSI file.
>>>>
>>>> The H5 pipeline has some differences and will be enabled later.
>>>>
>>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>>> completement of the pipeline.
>>>>
>>>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>>>> ---
>>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>>++++++++++++++++++++++++++++++++++++++++
>>>>  1 file changed, 189 insertions(+)
>>>>
>>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> index b36f9f423c39..20172ef92415 100644
>>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> @@ -41,6 +41,8 @@
>>>>   */
>>>>
>>>>  #include "sunxi-h3-h5.dtsi"
>>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>>
>>>>  / {
>>>>         cpus {
>>>> @@ -72,6 +74,193 @@
>>>>                 };
>>>>         };
>>>>
>>>> +       de: display-engine {
>>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>>> +               allwinner,pipelines = <&mixer0>,
>>>> +                                     <&mixer1>;
>>>> +               status = "disabled";
>>>> +       };
>>>> +
>>>> +       soc {
>>>> +               display_clocks: clock@1000000 {
>>>> +                       compatible =
>"allwinner,sun8i-a83t-de2-clk";
>>>> +                       reg = <0x01000000 0x100000>;
>>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>>> +                                <&ccu CLK_DE>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&ccu RST_BUS_DE>;
>>>> +                       #clock-cells = <1>;
>>>> +                       #reset-cells = <1>;
>>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <432000000>;
>>>> +               };
>>>> +
>>>> +               mixer0: mixer@1100000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer0";
>>>> +                       reg = <0x01100000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>>> +                                <&display_clocks CLK_MIXER0>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_MIXER0>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer0_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer0_out_tcon0:
>endpoint@0
>>>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer0>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer0_out_tcon1:
>endpoint@1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               mixer1: mixer@1200000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer1";
>>>> +                       reg = <0x01200000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>>> +                                <&display_clocks CLK_MIXER1>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_WB>;
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer1_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer1_out_tcon1:
>endpoint@0
>>>{
>>>> +                                               reg = <0>;
>>>
>>>I would prefer if you could stick to the numbering scheme we're using
>>>for
>>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>>type.
>>
>> If we keep this we will need a ugly id property in mixer node,
>> otherwise we cannot know which TCON to be bind.
>
>Why? You can simply change the logic in your driver from:
>
>    if (remote_endpoint.id) { continue; }
>
>to:
>
>    if (local_endpoint.id != remote_endpoint.id) { continue; }

Thanks, I forgot that there's two endpoint ids...

So silly I am.

>
>I don't see the need for any ID property in the mixer node in this
>case.
>The ID is already encoded into the endpoint IDs.
>
>ChenYu
>
>>>
>>>We're probably going to stick to that for the R40's incredibly
>>>complicated
>>>pipeline. I don't want to have any outliers unless absolutely
>>>necessary.
>>>
>>>ChenYu
>>>
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer1>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer1_out_tcon0:
>endpoint@1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon0: lcd-controller@1c0c000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>>> +                       reg = <0x01c0c000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 86
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>>> +                                <&ccu CLK_TCON0>;
>>>> +                       clock-names = "ahb",
>>>> +                                     "tcon-ch1";
>>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon0_in: port@0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon0_in_mixer0: endpoint@0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon0>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon0_in_mixer1: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon1: lcd-controller@1c0d000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>>> +                       reg = <0x01c0d000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 87
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>>> +                       clock-names = "ahb";
>>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon1_in: port@0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon1_in_mixer1: endpoint@0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon1>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon1_in_mixer0: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +
>>>> +                               tcon1_out: port@1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       tcon1_out_tve0: endpoint@1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tve0_in_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tve0: tv-encoder@1e00000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-tv-encoder";
>>>> +                       reg = <0x01e00000 0x1000>;
>>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu
>CLK_TVE>;
>>>> +                       clock-names = "bus", "mod";
>>>> +                       resets = <&ccu RST_BUS_TVE>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <216000000>;
>>>> +
>>>> +                       port {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tve0_in_tcon1: endpoint@0 {
>>>> +                                       reg = <0>;
>>>> +                                       remote-endpoint =
>>><&tcon1_out_tve0>;
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +       };
>>>> +
>>>>         timer {
>>>>                 compatible = "arm,armv7-timer";
>>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>>IRQ_TYPE_LEVEL_LOW)>,
>>>> --
>>>> 2.12.2
>>>>
>>>> --
>>>> 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/Ez6ZCGd0@public.gmane.org
>>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google
>Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it,
>send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  5:36           ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  5:36 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?24? GMT+08:00 ??1:34:58, Chen-Yu Tsai <wens@csie.org> ??:
>On Wed, May 24, 2017 at 1:28 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>>
>>
>> ? 2017?5?24? GMT+08:00 ??1:24:29, Chen-Yu Tsai <wens@csie.org> ??:
>>>On Thu, May 18, 2017 at 12:43 AM, Icenowy Zheng <icenowy@aosc.io>
>>>wrote:
>>>> As we have already the support for the TV encoder on Allwinner H3,
>>>add
>>>> the display engine pipeline device tree nodes to its DTSI file.
>>>>
>>>> The H5 pipeline has some differences and will be enabled later.
>>>>
>>>> The currently-unused mixer0 and tcon0 are also needed, for the
>>>> completement of the pipeline.
>>>>
>>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>>> ---
>>>>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
>>>++++++++++++++++++++++++++++++++++++++++
>>>>  1 file changed, 189 insertions(+)
>>>>
>>>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> index b36f9f423c39..20172ef92415 100644
>>>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>>>> @@ -41,6 +41,8 @@
>>>>   */
>>>>
>>>>  #include "sunxi-h3-h5.dtsi"
>>>> +#include <dt-bindings/clock/sun8i-de2.h>
>>>> +#include <dt-bindings/reset/sun8i-de2.h>
>>>>
>>>>  / {
>>>>         cpus {
>>>> @@ -72,6 +74,193 @@
>>>>                 };
>>>>         };
>>>>
>>>> +       de: display-engine {
>>>> +               compatible = "allwinner,sun8i-h3-display-engine";
>>>> +               allwinner,pipelines = <&mixer0>,
>>>> +                                     <&mixer1>;
>>>> +               status = "disabled";
>>>> +       };
>>>> +
>>>> +       soc {
>>>> +               display_clocks: clock at 1000000 {
>>>> +                       compatible =
>"allwinner,sun8i-a83t-de2-clk";
>>>> +                       reg = <0x01000000 0x100000>;
>>>> +                       clocks = <&ccu CLK_BUS_DE>,
>>>> +                                <&ccu CLK_DE>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&ccu RST_BUS_DE>;
>>>> +                       #clock-cells = <1>;
>>>> +                       #reset-cells = <1>;
>>>> +                       assigned-clocks = <&ccu CLK_DE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <432000000>;
>>>> +               };
>>>> +
>>>> +               mixer0: mixer at 1100000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer0";
>>>> +                       reg = <0x01100000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER0>,
>>>> +                                <&display_clocks CLK_MIXER0>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_MIXER0>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer0_out: port at 1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer0_out_tcon0:
>endpoint at 0
>>>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer0>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer0_out_tcon1:
>endpoint at 1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               mixer1: mixer at 1200000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-de2-mixer1";
>>>> +                       reg = <0x01200000 0x100000>;
>>>> +                       clocks = <&display_clocks CLK_BUS_MIXER1>,
>>>> +                                <&display_clocks CLK_MIXER1>;
>>>> +                       clock-names = "bus",
>>>> +                                     "mod";
>>>> +                       resets = <&display_clocks RST_WB>;
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               mixer1_out: port at 1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       mixer1_out_tcon1:
>endpoint at 0
>>>{
>>>> +                                               reg = <0>;
>>>
>>>I would prefer if you could stick to the numbering scheme we're using
>>>for
>>>Display Engine 1.0, as in endpoint 0 links to component 0 of whatever
>>>type.
>>
>> If we keep this we will need a ugly id property in mixer node,
>> otherwise we cannot know which TCON to be bind.
>
>Why? You can simply change the logic in your driver from:
>
>    if (remote_endpoint.id) { continue; }
>
>to:
>
>    if (local_endpoint.id != remote_endpoint.id) { continue; }

Thanks, I forgot that there's two endpoint ids...

So silly I am.

>
>I don't see the need for any ID property in the mixer node in this
>case.
>The ID is already encoded into the endpoint IDs.
>
>ChenYu
>
>>>
>>>We're probably going to stick to that for the R40's incredibly
>>>complicated
>>>pipeline. I don't want to have any outliers unless absolutely
>>>necessary.
>>>
>>>ChenYu
>>>
>>>> +                                               remote-endpoint =
>>><&tcon1_in_mixer1>;
>>>> +                                       };
>>>> +
>>>> +                                       mixer1_out_tcon0:
>endpoint at 1
>>>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tcon0_in_mixer1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon0: lcd-controller at 1c0c000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon0";
>>>> +                       reg = <0x01c0c000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 86
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON0>,
>>>> +                                <&ccu CLK_TCON0>;
>>>> +                       clock-names = "ahb",
>>>> +                                     "tcon-ch1";
>>>> +                       resets = <&ccu RST_BUS_TCON0>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon0_in: port at 0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon0_in_mixer0: endpoint at 0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon0>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon0_in_mixer1: endpoint at 1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon0>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tcon1: lcd-controller at 1c0d000 {
>>>> +                       compatible = "allwinner,sun8i-h3-tcon1";
>>>> +                       reg = <0x01c0d000 0x1000>;
>>>> +                       interrupts = <GIC_SPI 87
>>>IRQ_TYPE_LEVEL_HIGH>;
>>>> +                       clocks = <&ccu CLK_BUS_TCON1>;
>>>> +                       clock-names = "ahb";
>>>> +                       resets = <&ccu RST_BUS_TCON1>;
>>>> +                       reset-names = "lcd";
>>>> +                       status = "disabled";
>>>> +
>>>> +                       ports {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tcon1_in: port at 0 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <0>;
>>>> +
>>>> +                                       tcon1_in_mixer1: endpoint at 0
>{
>>>> +                                               reg = <0>;
>>>> +                                               remote-endpoint =
>>><&mixer1_out_tcon1>;
>>>> +                                       };
>>>> +
>>>> +                                       tcon1_in_mixer0: endpoint at 1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&mixer0_out_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +
>>>> +                               tcon1_out: port at 1 {
>>>> +                                       #address-cells = <1>;
>>>> +                                       #size-cells = <0>;
>>>> +                                       reg = <1>;
>>>> +
>>>> +                                       tcon1_out_tve0: endpoint at 1
>{
>>>> +                                               reg = <1>;
>>>> +                                               remote-endpoint =
>>><&tve0_in_tcon1>;
>>>> +                                       };
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +
>>>> +               tve0: tv-encoder at 1e00000 {
>>>> +                       compatible =
>"allwinner,sun8i-h3-tv-encoder";
>>>> +                       reg = <0x01e00000 0x1000>;
>>>> +                       clocks = <&ccu CLK_BUS_TVE>, <&ccu
>CLK_TVE>;
>>>> +                       clock-names = "bus", "mod";
>>>> +                       resets = <&ccu RST_BUS_TVE>;
>>>> +                       status = "disabled";
>>>> +
>>>> +                       assigned-clocks = <&ccu CLK_TVE>;
>>>> +                       assigned-clock-parents = <&ccu CLK_PLL_DE>;
>>>> +                       assigned-clock-rates = <216000000>;
>>>> +
>>>> +                       port {
>>>> +                               #address-cells = <1>;
>>>> +                               #size-cells = <0>;
>>>> +
>>>> +                               tve0_in_tcon1: endpoint at 0 {
>>>> +                                       reg = <0>;
>>>> +                                       remote-endpoint =
>>><&tcon1_out_tve0>;
>>>> +                               };
>>>> +                       };
>>>> +               };
>>>> +       };
>>>> +
>>>>         timer {
>>>>                 compatible = "arm,armv7-timer";
>>>>                 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
>>>IRQ_TYPE_LEVEL_LOW)>,
>>>> --
>>>> 2.12.2
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>Groups "linux-sunxi" group.
>>>> To unsubscribe from this group and stop receiving emails from it,
>>>send an email to linux-sunxi+unsubscribe at googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google
>Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it,
>send an email to linux-sunxi+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  7:30                   ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  7:30 UTC (permalink / raw)
  To: icenowy
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 4109 bytes --]

On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
> 在 2017-05-23 20:53,Maxime Ripard 写道:
> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > Hi,
> > > 
> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net>
> > > wrote:
> > > > > Hi,
> > > > >
> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > >
> > > > > electrons.com> 写到:
> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > >> >
> > > > >> >SoCs,
> > > > >> >
> > > > >> >> but with some different points about clocks:
> > > > >> >> - It has a mod clock and a bus clock.
> > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > >> >
> > > > >> >Why?
> > > > >>
> > > > >> It's experiment result by Jernej.
> > > > >>
> > > > >> The clock rates in BSP kernel is also specially designed
> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > >
> > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > unit has to be feed with 216 MHz.
> > > > >
> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > DE2,
> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > >
> > > > > Please note that I don't have any hard evidence to support that, only
> > > > > experimental data. However, only that explanation make sense to me.
> > > > >
> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > base clock. Further experiments are needed to check if there is any
> > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > other proper settings. I plan to do that, but not in very near future.
> > > >
> > > > You only have composite video output, and those are the only 2 standard
> > > > resolutions that make any sense.
> > > 
> > > Right, other resolutions are for VGA.
> > > 
> > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > that H3 TVE
> > > unit is something in between. R40 TVE has a setting to select "up
> > > sample".
> > 
> > That might be just another translation of oversampling :)
> > 
> > I didn't know it could be applied to composite signals though, but I
> > guess this is just another analog signal after all.
> > 
> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > driver on R40
> > > has this setting enabled only for PAL and NTSC and it is always 216
> > > MHz. I
> > > think that H3 may have this hardwired to 216 MHz and this would be
> > > the reason
> > > why 216 MHz is needed.
> > > 
> > > Has anyone else any better explanation?
> > 
> > That's already a pretty good one.
> > 
> > Either way, wether this is upsampling, oversampling or just a
> > pre-divider, this can and should be dealt with in the mode_set
> > callback, and not in the probe.
> 
> I got a better idea -- let TVE driver have the CLK_TVE as an
> input and create a subclock output with divider 16, and feed this
> subclock to TCON lcd-ch1.
> 
> This is a model of the real hardware -- the clock divider is in
> TVE, not TCON.

That's definitely not a good representation of the hardware. There's
one clock, it goes to the TCON, period.

However, the TV encoder has a constraint on that clock rate. This can
be easily implemented using a custom encoder state where you'd set the
multiplier to set on that clock, and the TCON will use it.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  7:30                   ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  7:30 UTC (permalink / raw)
  To: icenowy-h8G6r0blFSE
  Cc: Jernej Škrabec, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 4452 bytes --]

On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> 在 2017-05-23 20:53,Maxime Ripard 写道:
> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > Hi,
> > > 
> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net>
> > > wrote:
> > > > > Hi,
> > > > >
> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > >
> > > > > electrons.com> 写到:
> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > >> >
> > > > >> >SoCs,
> > > > >> >
> > > > >> >> but with some different points about clocks:
> > > > >> >> - It has a mod clock and a bus clock.
> > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > >> >
> > > > >> >Why?
> > > > >>
> > > > >> It's experiment result by Jernej.
> > > > >>
> > > > >> The clock rates in BSP kernel is also specially designed
> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > >
> > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > unit has to be feed with 216 MHz.
> > > > >
> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > DE2,
> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > >
> > > > > Please note that I don't have any hard evidence to support that, only
> > > > > experimental data. However, only that explanation make sense to me.
> > > > >
> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > base clock. Further experiments are needed to check if there is any
> > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > other proper settings. I plan to do that, but not in very near future.
> > > >
> > > > You only have composite video output, and those are the only 2 standard
> > > > resolutions that make any sense.
> > > 
> > > Right, other resolutions are for VGA.
> > > 
> > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > that H3 TVE
> > > unit is something in between. R40 TVE has a setting to select "up
> > > sample".
> > 
> > That might be just another translation of oversampling :)
> > 
> > I didn't know it could be applied to composite signals though, but I
> > guess this is just another analog signal after all.
> > 
> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > driver on R40
> > > has this setting enabled only for PAL and NTSC and it is always 216
> > > MHz. I
> > > think that H3 may have this hardwired to 216 MHz and this would be
> > > the reason
> > > why 216 MHz is needed.
> > > 
> > > Has anyone else any better explanation?
> > 
> > That's already a pretty good one.
> > 
> > Either way, wether this is upsampling, oversampling or just a
> > pre-divider, this can and should be dealt with in the mode_set
> > callback, and not in the probe.
> 
> I got a better idea -- let TVE driver have the CLK_TVE as an
> input and create a subclock output with divider 16, and feed this
> subclock to TCON lcd-ch1.
> 
> This is a model of the real hardware -- the clock divider is in
> TVE, not TCON.

That's definitely not a good representation of the hardware. There's
one clock, it goes to the TCON, period.

However, the TV encoder has a constraint on that clock rate. This can
be easily implemented using a custom encoder state where you'd set the
multiplier to set on that clock, and the TCON will use it.

Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  7:30                   ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
> ? 2017-05-23 20:53?Maxime Ripard ???
> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> > > Hi,
> > > 
> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net>
> > > wrote:
> > > > > Hi,
> > > > >
> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > >
> > > > > electrons.com> ??:
> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > >> >
> > > > >> >SoCs,
> > > > >> >
> > > > >> >> but with some different points about clocks:
> > > > >> >> - It has a mod clock and a bus clock.
> > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > >> >
> > > > >> >Why?
> > > > >>
> > > > >> It's experiment result by Jernej.
> > > > >>
> > > > >> The clock rates in BSP kernel is also specially designed
> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > >
> > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > unit has to be feed with 216 MHz.
> > > > >
> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > DE2,
> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > >
> > > > > Please note that I don't have any hard evidence to support that, only
> > > > > experimental data. However, only that explanation make sense to me.
> > > > >
> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > base clock. Further experiments are needed to check if there is any
> > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > other proper settings. I plan to do that, but not in very near future.
> > > >
> > > > You only have composite video output, and those are the only 2 standard
> > > > resolutions that make any sense.
> > > 
> > > Right, other resolutions are for VGA.
> > > 
> > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > that H3 TVE
> > > unit is something in between. R40 TVE has a setting to select "up
> > > sample".
> > 
> > That might be just another translation of oversampling :)
> > 
> > I didn't know it could be applied to composite signals though, but I
> > guess this is just another analog signal after all.
> > 
> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > driver on R40
> > > has this setting enabled only for PAL and NTSC and it is always 216
> > > MHz. I
> > > think that H3 may have this hardwired to 216 MHz and this would be
> > > the reason
> > > why 216 MHz is needed.
> > > 
> > > Has anyone else any better explanation?
> > 
> > That's already a pretty good one.
> > 
> > Either way, wether this is upsampling, oversampling or just a
> > pre-divider, this can and should be dealt with in the mode_set
> > callback, and not in the probe.
> 
> I got a better idea -- let TVE driver have the CLK_TVE as an
> input and create a subclock output with divider 16, and feed this
> subclock to TCON lcd-ch1.
> 
> This is a model of the real hardware -- the clock divider is in
> TVE, not TCON.

That's definitely not a good representation of the hardware. There's
one clock, it goes to the TCON, period.

However, the TV encoder has a constraint on that clock rate. This can
be easily implemented using a custom encoder state where you'd set the
multiplier to set on that clock, and the TCON will use it.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170524/76babc64/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-24  8:14         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:14 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 4416 bytes --]

On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> >> the connection can be swapped.
> >> 
> >> As we now hardcode the default connection, ignore the bonus endpoint
> >for
> >> the mixer's output and the TCON's input, as they stands for the
> >swapped
> >> connection.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
> >+++++++++++++++++++++++++++++---------
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
> >>  3 files changed, 59 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> index 1dd1948025d2..29bf1325ded6 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
> >device_node *node)
> >>  		of_device_is_compatible(node,
> >"allwinner,sun8i-a33-display-frontend");
> >>  }
> >>  
> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
> >*node)
> >> +{
> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
> >*/
> >> +	return of_device_is_compatible(node,
> >"allwinner,sun8i-h3-de2-mixer0") ||
> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> >> +}
> >> +
> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
> >>  {
> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
> >*dev,
> >>  			}
> >>  		}
> >>  
> >> +		/*
> >> +		 * The second endpoint of the output of a swappable DE2 mixer
> >> +		 * is the TCON after connection swapping.
> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> >> +		 * mixer1->tcon1 connection.
> >> +		 */
> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
> >mixer... skipping\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >>  		/* Walk down our tree */
> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
> >>  
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> index f44a37a5993d..89a215ff2370 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
> >*dev,
> >>   * requested via the get_id function of the engine.
> >>   */
> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
> >*drv,
> >> -						   struct device_node *node)
> >> +						   struct device_node *node,
> >> +						   bool skip_bonus_ep)
> >>  {
> >>  	struct device_node *port, *ep, *remote;
> >>  	struct sunxi_engine *engine;
> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
> >>  		if (!remote)
> >>  			continue;
> >>  
> >> +		if (skip_bonus_ep) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
> >searching engine\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >
> >You don't list the mixers in the tcon's output, why do you need that
> >exactly?
> 
> Mixers are TCONs' input, not output...

Then why are they even parsed? The whole parsing logic in the driver
only searches for output nodes.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-24  8:14         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:14 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4790 bytes --]

On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> >> the connection can be swapped.
> >> 
> >> As we now hardcode the default connection, ignore the bonus endpoint
> >for
> >> the mixer's output and the TCON's input, as they stands for the
> >swapped
> >> connection.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> >> ---
> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
> >+++++++++++++++++++++++++++++---------
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
> >>  3 files changed, 59 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> index 1dd1948025d2..29bf1325ded6 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
> >device_node *node)
> >>  		of_device_is_compatible(node,
> >"allwinner,sun8i-a33-display-frontend");
> >>  }
> >>  
> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
> >*node)
> >> +{
> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
> >*/
> >> +	return of_device_is_compatible(node,
> >"allwinner,sun8i-h3-de2-mixer0") ||
> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> >> +}
> >> +
> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
> >>  {
> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
> >*dev,
> >>  			}
> >>  		}
> >>  
> >> +		/*
> >> +		 * The second endpoint of the output of a swappable DE2 mixer
> >> +		 * is the TCON after connection swapping.
> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> >> +		 * mixer1->tcon1 connection.
> >> +		 */
> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
> >mixer... skipping\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >>  		/* Walk down our tree */
> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
> >>  
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> index f44a37a5993d..89a215ff2370 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
> >*dev,
> >>   * requested via the get_id function of the engine.
> >>   */
> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
> >*drv,
> >> -						   struct device_node *node)
> >> +						   struct device_node *node,
> >> +						   bool skip_bonus_ep)
> >>  {
> >>  	struct device_node *port, *ep, *remote;
> >>  	struct sunxi_engine *engine;
> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
> >>  		if (!remote)
> >>  			continue;
> >>  
> >> +		if (skip_bonus_ep) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
> >searching engine\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >
> >You don't list the mixers in the tcon's output, why do you need that
> >exactly?
> 
> Mixers are TCONs' input, not output...

Then why are they even parsed? The whole parsing logic in the driver
only searches for output nodes.

Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-24  8:14         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:14 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4416 bytes --]

On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> >> the connection can be swapped.
> >> 
> >> As we now hardcode the default connection, ignore the bonus endpoint
> >for
> >> the mixer's output and the TCON's input, as they stands for the
> >swapped
> >> connection.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
> >+++++++++++++++++++++++++++++---------
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
> >>  3 files changed, 59 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> index 1dd1948025d2..29bf1325ded6 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
> >device_node *node)
> >>  		of_device_is_compatible(node,
> >"allwinner,sun8i-a33-display-frontend");
> >>  }
> >>  
> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
> >*node)
> >> +{
> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
> >*/
> >> +	return of_device_is_compatible(node,
> >"allwinner,sun8i-h3-de2-mixer0") ||
> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> >> +}
> >> +
> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
> >>  {
> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
> >*dev,
> >>  			}
> >>  		}
> >>  
> >> +		/*
> >> +		 * The second endpoint of the output of a swappable DE2 mixer
> >> +		 * is the TCON after connection swapping.
> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> >> +		 * mixer1->tcon1 connection.
> >> +		 */
> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
> >mixer... skipping\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >>  		/* Walk down our tree */
> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
> >>  
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> index f44a37a5993d..89a215ff2370 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
> >*dev,
> >>   * requested via the get_id function of the engine.
> >>   */
> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
> >*drv,
> >> -						   struct device_node *node)
> >> +						   struct device_node *node,
> >> +						   bool skip_bonus_ep)
> >>  {
> >>  	struct device_node *port, *ep, *remote;
> >>  	struct sunxi_engine *engine;
> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
> >>  		if (!remote)
> >>  			continue;
> >>  
> >> +		if (skip_bonus_ep) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
> >searching engine\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >
> >You don't list the mixers in the tcon's output, why do you need that
> >exactly?
> 
> Mixers are TCONs' input, not output...

Then why are they even parsed? The whole parsing logic in the driver
only searches for output nodes.

Maxime

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-05-24  8:14         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
> 
> 
> ? 2017?5?20? GMT+08:00 ??1:57:53, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
> >> the connection can be swapped.
> >> 
> >> As we now hardcode the default connection, ignore the bonus endpoint
> >for
> >> the mixer's output and the TCON's input, as they stands for the
> >swapped
> >> connection.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
> >+++++++++++++++++++++++++++++---------
> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
> >>  3 files changed, 59 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> index 1dd1948025d2..29bf1325ded6 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
> >device_node *node)
> >>  		of_device_is_compatible(node,
> >"allwinner,sun8i-a33-display-frontend");
> >>  }
> >>  
> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
> >*node)
> >> +{
> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
> >*/
> >> +	return of_device_is_compatible(node,
> >"allwinner,sun8i-h3-de2-mixer0") ||
> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
> >> +}
> >> +
> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
> >>  {
> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
> >*dev,
> >>  			}
> >>  		}
> >>  
> >> +		/*
> >> +		 * The second endpoint of the output of a swappable DE2 mixer
> >> +		 * is the TCON after connection swapping.
> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
> >> +		 * mixer1->tcon1 connection.
> >> +		 */
> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
> >mixer... skipping\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >>  		/* Walk down our tree */
> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
> >>  
> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> index f44a37a5993d..89a215ff2370 100644
> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
> >*dev,
> >>   * requested via the get_id function of the engine.
> >>   */
> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
> >*drv,
> >> -						   struct device_node *node)
> >> +						   struct device_node *node,
> >> +						   bool skip_bonus_ep)
> >>  {
> >>  	struct device_node *port, *ep, *remote;
> >>  	struct sunxi_engine *engine;
> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
> >>  		if (!remote)
> >>  			continue;
> >>  
> >> +		if (skip_bonus_ep) {
> >> +			struct of_endpoint endpoint;
> >> +
> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
> >> +				continue;
> >> +			}
> >> +
> >> +			if (endpoint.id) {
> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
> >searching engine\n");
> >> +				continue;
> >> +			}
> >> +		}
> >> +
> >
> >You don't list the mixers in the tcon's output, why do you need that
> >exactly?
> 
> Mixers are TCONs' input, not output...

Then why are they even parsed? The whole parsing logic in the driver
only searches for output nodes.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170524/d4efe716/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
  2017-05-19 18:10       ` Icenowy Zheng
  (?)
@ 2017-05-24  8:19         ` Maxime Ripard
  -1 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:19 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]

On Sat, May 20, 2017 at 02:10:35AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月20日 GMT+08:00 上午2:06:16, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> >> As we have already the support for the TV encoder on Allwinner H3,
> >add
> >> the display engine pipeline device tree nodes to its DTSI file.
> >> 
> >> The H5 pipeline has some differences and will be enabled later.
> >> 
> >> The currently-unused mixer0 and tcon0 are also needed, for the
> >> completement of the pipeline.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> >++++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 189 insertions(+)
> >> 
> >> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> >b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> index b36f9f423c39..20172ef92415 100644
> >> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> >> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> @@ -41,6 +41,8 @@
> >>   */
> >>  
> >>  #include "sunxi-h3-h5.dtsi"
> >> +#include <dt-bindings/clock/sun8i-de2.h>
> >> +#include <dt-bindings/reset/sun8i-de2.h>
> >>  
> >>  / {
> >>  	cpus {
> >> @@ -72,6 +74,193 @@
> >>  		};
> >>  	};
> >>  
> >> +	de: display-engine {
> >> +		compatible = "allwinner,sun8i-h3-display-engine";
> >> +		allwinner,pipelines = <&mixer0>,
> >> +				      <&mixer1>;
> >> +		status = "disabled";
> >> +	};
> >> +
> >> +	soc {
> >> +		display_clocks: clock@1000000 {
> >> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> >> +			reg = <0x01000000 0x100000>;
> >> +			clocks = <&ccu CLK_BUS_DE>,
> >> +				 <&ccu CLK_DE>;
> >> +			clock-names = "bus",
> >> +				      "mod";
> >> +			resets = <&ccu RST_BUS_DE>;
> >> +			#clock-cells = <1>;
> >> +			#reset-cells = <1>;
> >> +			assigned-clocks = <&ccu CLK_DE>;
> >> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> >> +			assigned-clock-rates = <432000000>;
> >
> >This shouldn't be set in the DT, but evaluated at runtime when calling
> >clk_set_rate.
> 
> Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
> DE2 mixers' output signal. (Although it seems that SoCs with larger
> plane size will use higher clock.)

So it's the display engine that needs that clock to operate properly?
This is the wrong DT node to set that value then. It should be in the
mixer node, or even better in the mixers' driver.

> And setting it to 432MHz is also needed for properly 216MHz clock to
> TVE.

Just like the parenthood, this can and should be evaluated at runtime.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  8:19         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:19 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, linux-sunxi, linux-kernel, dri-devel, Chen-Yu Tsai,
	Rob Herring, linux-clk, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2748 bytes --]

On Sat, May 20, 2017 at 02:10:35AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月20日 GMT+08:00 上午2:06:16, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> >> As we have already the support for the TV encoder on Allwinner H3,
> >add
> >> the display engine pipeline device tree nodes to its DTSI file.
> >> 
> >> The H5 pipeline has some differences and will be enabled later.
> >> 
> >> The currently-unused mixer0 and tcon0 are also needed, for the
> >> completement of the pipeline.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> >++++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 189 insertions(+)
> >> 
> >> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> >b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> index b36f9f423c39..20172ef92415 100644
> >> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> >> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> @@ -41,6 +41,8 @@
> >>   */
> >>  
> >>  #include "sunxi-h3-h5.dtsi"
> >> +#include <dt-bindings/clock/sun8i-de2.h>
> >> +#include <dt-bindings/reset/sun8i-de2.h>
> >>  
> >>  / {
> >>  	cpus {
> >> @@ -72,6 +74,193 @@
> >>  		};
> >>  	};
> >>  
> >> +	de: display-engine {
> >> +		compatible = "allwinner,sun8i-h3-display-engine";
> >> +		allwinner,pipelines = <&mixer0>,
> >> +				      <&mixer1>;
> >> +		status = "disabled";
> >> +	};
> >> +
> >> +	soc {
> >> +		display_clocks: clock@1000000 {
> >> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> >> +			reg = <0x01000000 0x100000>;
> >> +			clocks = <&ccu CLK_BUS_DE>,
> >> +				 <&ccu CLK_DE>;
> >> +			clock-names = "bus",
> >> +				      "mod";
> >> +			resets = <&ccu RST_BUS_DE>;
> >> +			#clock-cells = <1>;
> >> +			#reset-cells = <1>;
> >> +			assigned-clocks = <&ccu CLK_DE>;
> >> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> >> +			assigned-clock-rates = <432000000>;
> >
> >This shouldn't be set in the DT, but evaluated at runtime when calling
> >clk_set_rate.
> 
> Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
> DE2 mixers' output signal. (Although it seems that SoCs with larger
> plane size will use higher clock.)

So it's the display engine that needs that clock to operate properly?
This is the wrong DT node to set that value then. It should be in the
mixer node, or even better in the mixers' driver.

> And setting it to 432MHz is also needed for properly 216MHz clock to
> TVE.

Just like the parenthood, this can and should be evaluated at runtime.

Maxime

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE
@ 2017-05-24  8:19         ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-24  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 20, 2017 at 02:10:35AM +0800, Icenowy Zheng wrote:
> 
> 
> ? 2017?5?20? GMT+08:00 ??2:06:16, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
> >On Thu, May 18, 2017 at 12:43:53AM +0800, Icenowy Zheng wrote:
> >> As we have already the support for the TV encoder on Allwinner H3,
> >add
> >> the display engine pipeline device tree nodes to its DTSI file.
> >> 
> >> The H5 pipeline has some differences and will be enabled later.
> >> 
> >> The currently-unused mixer0 and tcon0 are also needed, for the
> >> completement of the pipeline.
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  arch/arm/boot/dts/sun8i-h3.dtsi | 189
> >++++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 189 insertions(+)
> >> 
> >> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi
> >b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> index b36f9f423c39..20172ef92415 100644
> >> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> >> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> >> @@ -41,6 +41,8 @@
> >>   */
> >>  
> >>  #include "sunxi-h3-h5.dtsi"
> >> +#include <dt-bindings/clock/sun8i-de2.h>
> >> +#include <dt-bindings/reset/sun8i-de2.h>
> >>  
> >>  / {
> >>  	cpus {
> >> @@ -72,6 +74,193 @@
> >>  		};
> >>  	};
> >>  
> >> +	de: display-engine {
> >> +		compatible = "allwinner,sun8i-h3-display-engine";
> >> +		allwinner,pipelines = <&mixer0>,
> >> +				      <&mixer1>;
> >> +		status = "disabled";
> >> +	};
> >> +
> >> +	soc {
> >> +		display_clocks: clock at 1000000 {
> >> +			compatible = "allwinner,sun8i-a83t-de2-clk";
> >> +			reg = <0x01000000 0x100000>;
> >> +			clocks = <&ccu CLK_BUS_DE>,
> >> +				 <&ccu CLK_DE>;
> >> +			clock-names = "bus",
> >> +				      "mod";
> >> +			resets = <&ccu RST_BUS_DE>;
> >> +			#clock-cells = <1>;
> >> +			#reset-cells = <1>;
> >> +			assigned-clocks = <&ccu CLK_DE>;
> >> +			assigned-clock-parents = <&ccu CLK_PLL_DE>;
> >> +			assigned-clock-rates = <432000000>;
> >
> >This shouldn't be set in the DT, but evaluated at runtime when calling
> >clk_set_rate.
> 
> Nope, DE2 clock doesn't need evalution, as the clock is decoupled with
> DE2 mixers' output signal. (Although it seems that SoCs with larger
> plane size will use higher clock.)

So it's the display engine that needs that clock to operate properly?
This is the wrong DT node to set that value then. It should be in the
mixer node, or even better in the mixers' driver.

> And setting it to 432MHz is also needed for properly 216MHz clock to
> TVE.

Just like the parenthood, this can and should be evaluated at runtime.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170524/68b8e86b/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  8:25                     ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  8:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk



于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
>> 在 2017-05-23 20:53,Maxime Ripard 写道:
>> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> > > Hi,
>> > > 
>> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>napisal(a):
>> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
><jernej.skrabec@siol.net>
>> > > wrote:
>> > > > > Hi,
>> > > > >
>> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > > >
>> > > > > electrons.com> 写到:
>> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>wrote:
>> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > > > >> >
>> > > > >> >SoCs,
>> > > > >> >
>> > > > >> >> but with some different points about clocks:
>> > > > >> >> - It has a mod clock and a bus clock.
>> > > > >> >> - The mod clock must be at a fixed rate to generate
>signal.
>> > > > >> >
>> > > > >> >Why?
>> > > > >>
>> > > > >> It's experiment result by Jernej.
>> > > > >>
>> > > > >> The clock rates in BSP kernel is also specially designed
>> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > > >
>> > > > > My experiments and search through BSP code showed that TVE
>seems to have
>> > > > > additional fixed predivider 8. So if you want to generate 27
>MHz clock,
>> > > > > unit has to be feed with 216 MHz.
>> > > > >
>> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>bit low for
>> > > > > DE2,
>> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>generate 216 MHz.
>> > > > > This clock is then divided by 8 internaly to get final 27
>MHz.
>> > > > >
>> > > > > Please note that I don't have any hard evidence to support
>that, only
>> > > > > experimental data. However, only that explanation make sense
>to me.
>> > > > >
>> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>both use 27 MHz
>> > > > > base clock. Further experiments are needed to check if there
>is any
>> > > > > possibility to have other resolutions by manipulating clocks
>and give
>> > > > > other proper settings. I plan to do that, but not in very
>near future.
>> > > >
>> > > > You only have composite video output, and those are the only 2
>standard
>> > > > resolutions that make any sense.
>> > > 
>> > > Right, other resolutions are for VGA.
>> > > 
>> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>think
>> > > that H3 TVE
>> > > unit is something in between. R40 TVE has a setting to select "up
>> > > sample".
>> > 
>> > That might be just another translation of oversampling :)
>> > 
>> > I didn't know it could be applied to composite signals though, but
>I
>> > guess this is just another analog signal after all.
>> > 
>> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> > > driver on R40
>> > > has this setting enabled only for PAL and NTSC and it is always
>216
>> > > MHz. I
>> > > think that H3 may have this hardwired to 216 MHz and this would
>be
>> > > the reason
>> > > why 216 MHz is needed.
>> > > 
>> > > Has anyone else any better explanation?
>> > 
>> > That's already a pretty good one.
>> > 
>> > Either way, wether this is upsampling, oversampling or just a
>> > pre-divider, this can and should be dealt with in the mode_set
>> > callback, and not in the probe.
>> 
>> I got a better idea -- let TVE driver have the CLK_TVE as an
>> input and create a subclock output with divider 16, and feed this
>> subclock to TCON lcd-ch1.
>> 
>> This is a model of the real hardware -- the clock divider is in
>> TVE, not TCON.
>
>That's definitely not a good representation of the hardware. There's
>one clock, it goes to the TCON, period.

No, I still think it goes to the TVE as:

1. it's named TVE in datasheet.
2. Generating signal with such a low resolution but such
a high dotclock is not a good situation.

>
>However, the TV encoder has a constraint on that clock rate. This can
>be easily implemented using a custom encoder state where you'd set the
>multiplier to set on that clock, and the TCON will use it.
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  8:25                     ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  8:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Jernej Škrabec, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk



于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
>> 在 2017-05-23 20:53,Maxime Ripard 写道:
>> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> > > Hi,
>> > > 
>> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>napisal(a):
>> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
><jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
>> > > wrote:
>> > > > > Hi,
>> > > > >
>> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > > >
>> > > > > electrons.com> 写到:
>> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>wrote:
>> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > > > >> >
>> > > > >> >SoCs,
>> > > > >> >
>> > > > >> >> but with some different points about clocks:
>> > > > >> >> - It has a mod clock and a bus clock.
>> > > > >> >> - The mod clock must be at a fixed rate to generate
>signal.
>> > > > >> >
>> > > > >> >Why?
>> > > > >>
>> > > > >> It's experiment result by Jernej.
>> > > > >>
>> > > > >> The clock rates in BSP kernel is also specially designed
>> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > > >
>> > > > > My experiments and search through BSP code showed that TVE
>seems to have
>> > > > > additional fixed predivider 8. So if you want to generate 27
>MHz clock,
>> > > > > unit has to be feed with 216 MHz.
>> > > > >
>> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>bit low for
>> > > > > DE2,
>> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>generate 216 MHz.
>> > > > > This clock is then divided by 8 internaly to get final 27
>MHz.
>> > > > >
>> > > > > Please note that I don't have any hard evidence to support
>that, only
>> > > > > experimental data. However, only that explanation make sense
>to me.
>> > > > >
>> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>both use 27 MHz
>> > > > > base clock. Further experiments are needed to check if there
>is any
>> > > > > possibility to have other resolutions by manipulating clocks
>and give
>> > > > > other proper settings. I plan to do that, but not in very
>near future.
>> > > >
>> > > > You only have composite video output, and those are the only 2
>standard
>> > > > resolutions that make any sense.
>> > > 
>> > > Right, other resolutions are for VGA.
>> > > 
>> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>think
>> > > that H3 TVE
>> > > unit is something in between. R40 TVE has a setting to select "up
>> > > sample".
>> > 
>> > That might be just another translation of oversampling :)
>> > 
>> > I didn't know it could be applied to composite signals though, but
>I
>> > guess this is just another analog signal after all.
>> > 
>> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> > > driver on R40
>> > > has this setting enabled only for PAL and NTSC and it is always
>216
>> > > MHz. I
>> > > think that H3 may have this hardwired to 216 MHz and this would
>be
>> > > the reason
>> > > why 216 MHz is needed.
>> > > 
>> > > Has anyone else any better explanation?
>> > 
>> > That's already a pretty good one.
>> > 
>> > Either way, wether this is upsampling, oversampling or just a
>> > pre-divider, this can and should be dealt with in the mode_set
>> > callback, and not in the probe.
>> 
>> I got a better idea -- let TVE driver have the CLK_TVE as an
>> input and create a subclock output with divider 16, and feed this
>> subclock to TCON lcd-ch1.
>> 
>> This is a model of the real hardware -- the clock divider is in
>> TVE, not TCON.
>
>That's definitely not a good representation of the hardware. There's
>one clock, it goes to the TCON, period.

No, I still think it goes to the TVE as:

1. it's named TVE in datasheet.
2. Generating signal with such a low resolution but such
a high dotclock is not a good situation.

>
>However, the TV encoder has a constraint on that clock rate. This can
>be easily implemented using a custom encoder state where you'd set the
>multiplier to set on that clock, and the TCON will use it.
>
>Maxime
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24  8:25                     ` Icenowy Zheng
  0 siblings, 0 replies; 159+ messages in thread
From: Icenowy Zheng @ 2017-05-24  8:25 UTC (permalink / raw)
  To: linux-arm-kernel



? 2017?5?24? GMT+08:00 ??3:30:19, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
>On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
>> ? 2017-05-23 20:53?Maxime Ripard ???
>> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
>> > > Hi,
>> > > 
>> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>napisal(a):
>> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
><jernej.skrabec@siol.net>
>> > > wrote:
>> > > > > Hi,
>> > > > >
>> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>napisal(a):
>> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
><maxime.ripard@free-
>> > > > >
>> > > > > electrons.com> ??:
>> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>wrote:
>> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>earlier
>> > > > >> >
>> > > > >> >SoCs,
>> > > > >> >
>> > > > >> >> but with some different points about clocks:
>> > > > >> >> - It has a mod clock and a bus clock.
>> > > > >> >> - The mod clock must be at a fixed rate to generate
>signal.
>> > > > >> >
>> > > > >> >Why?
>> > > > >>
>> > > > >> It's experiment result by Jernej.
>> > > > >>
>> > > > >> The clock rates in BSP kernel is also specially designed
>> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > > >
>> > > > > My experiments and search through BSP code showed that TVE
>seems to have
>> > > > > additional fixed predivider 8. So if you want to generate 27
>MHz clock,
>> > > > > unit has to be feed with 216 MHz.
>> > > > >
>> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>bit low for
>> > > > > DE2,
>> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>generate 216 MHz.
>> > > > > This clock is then divided by 8 internaly to get final 27
>MHz.
>> > > > >
>> > > > > Please note that I don't have any hard evidence to support
>that, only
>> > > > > experimental data. However, only that explanation make sense
>to me.
>> > > > >
>> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>both use 27 MHz
>> > > > > base clock. Further experiments are needed to check if there
>is any
>> > > > > possibility to have other resolutions by manipulating clocks
>and give
>> > > > > other proper settings. I plan to do that, but not in very
>near future.
>> > > >
>> > > > You only have composite video output, and those are the only 2
>standard
>> > > > resolutions that make any sense.
>> > > 
>> > > Right, other resolutions are for VGA.
>> > > 
>> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>think
>> > > that H3 TVE
>> > > unit is something in between. R40 TVE has a setting to select "up
>> > > sample".
>> > 
>> > That might be just another translation of oversampling :)
>> > 
>> > I didn't know it could be applied to composite signals though, but
>I
>> > guess this is just another analog signal after all.
>> > 
>> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> > > driver on R40
>> > > has this setting enabled only for PAL and NTSC and it is always
>216
>> > > MHz. I
>> > > think that H3 may have this hardwired to 216 MHz and this would
>be
>> > > the reason
>> > > why 216 MHz is needed.
>> > > 
>> > > Has anyone else any better explanation?
>> > 
>> > That's already a pretty good one.
>> > 
>> > Either way, wether this is upsampling, oversampling or just a
>> > pre-divider, this can and should be dealt with in the mode_set
>> > callback, and not in the probe.
>> 
>> I got a better idea -- let TVE driver have the CLK_TVE as an
>> input and create a subclock output with divider 16, and feed this
>> subclock to TCON lcd-ch1.
>> 
>> This is a model of the real hardware -- the clock divider is in
>> TVE, not TCON.
>
>That's definitely not a good representation of the hardware. There's
>one clock, it goes to the TCON, period.

No, I still think it goes to the TVE as:

1. it's named TVE in datasheet.
2. Generating signal with such a low resolution but such
a high dotclock is not a good situation.

>
>However, the TV encoder has a constraint on that clock rate. This can
>be easily implemented using a custom encoder state where you'd set the
>multiplier to set on that clock, and the TCON will use it.
>
>Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24 15:23                       ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-24 15:23 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sreda, 24. maj 2017 ob 10:25:46 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> >> 
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> >
> ><jernej.skrabec@siol.net>
> >
> >> > > wrote:
> >> > > > > Hi,
> >> > > > > 
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >
> >napisal(a):
> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> >
> ><maxime.ripard@free-
> >
> >> > > > > electrons.com> 写到:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >
> >earlier
> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >
> >signal.
> >
> >> > > > >> >Why?
> >> > > > >> 
> >> > > > >> It's experiment result by Jernej.
> >> > > > >> 
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > > 
> >> > > > > My experiments and search through BSP code showed that TVE
> >
> >seems to have
> >
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >
> >MHz clock,
> >
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > > 
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >
> >bit low for
> >
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >
> >generate 216 MHz.
> >
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >
> >MHz.
> >
> >> > > > > Please note that I don't have any hard evidence to support
> >
> >that, only
> >
> >> > > > > experimental data. However, only that explanation make sense
> >
> >to me.
> >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >
> >both use 27 MHz
> >
> >> > > > > base clock. Further experiments are needed to check if there
> >
> >is any
> >
> >> > > > > possibility to have other resolutions by manipulating clocks
> >
> >and give
> >
> >> > > > > other proper settings. I plan to do that, but not in very
> >
> >near future.
> >
> >> > > > You only have composite video output, and those are the only 2
> >
> >standard
> >
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >
> >think
> >
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >
> >I
> >
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >
> >216
> >
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >
> >be
> >
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.

If we are talking about HW divider, it is 8 (216 / 27 = 8).

Slightly offtopic, reason why DE2 is hardcoded to 432 might be that for 4K 
resolution you need at least 297 MHz. So next dividable frequency is taken 
(432 MHz). That way you can have 4K HDMI display and composite TV connected at 
the same time, although this sounds a bit weird.

Best regards,
Jernej

> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.
> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.
> 
> >However, the TV encoder has a constraint on that clock rate. This can
> >be easily implemented using a custom encoder state where you'd set the
> >multiplier to set on that clock, and the TCON will use it.
> >
> >Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24 15:23                       ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-24 15:23 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

Hi,

Dne sreda, 24. maj 2017 ob 10:25:46 CEST je Icenowy Zheng napisal(a):
> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard@free-
electrons.com> 写到:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> >> 
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> >
> ><jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
> >
> >> > > wrote:
> >> > > > > Hi,
> >> > > > > 
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >
> >napisal(a):
> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> >
> ><maxime.ripard@free-
> >
> >> > > > > electrons.com> 写到:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >
> >earlier
> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >
> >signal.
> >
> >> > > > >> >Why?
> >> > > > >> 
> >> > > > >> It's experiment result by Jernej.
> >> > > > >> 
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > > 
> >> > > > > My experiments and search through BSP code showed that TVE
> >
> >seems to have
> >
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >
> >MHz clock,
> >
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > > 
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >
> >bit low for
> >
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >
> >generate 216 MHz.
> >
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >
> >MHz.
> >
> >> > > > > Please note that I don't have any hard evidence to support
> >
> >that, only
> >
> >> > > > > experimental data. However, only that explanation make sense
> >
> >to me.
> >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >
> >both use 27 MHz
> >
> >> > > > > base clock. Further experiments are needed to check if there
> >
> >is any
> >
> >> > > > > possibility to have other resolutions by manipulating clocks
> >
> >and give
> >
> >> > > > > other proper settings. I plan to do that, but not in very
> >
> >near future.
> >
> >> > > > You only have composite video output, and those are the only 2
> >
> >standard
> >
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >
> >think
> >
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >
> >I
> >
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >
> >216
> >
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >
> >be
> >
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.

If we are talking about HW divider, it is 8 (216 / 27 = 8).

Slightly offtopic, reason why DE2 is hardcoded to 432 might be that for 4K 
resolution you need at least 297 MHz. So next dividable frequency is taken 
(432 MHz). That way you can have 4K HDMI display and composite TV connected at 
the same time, although this sounds a bit weird.

Best regards,
Jernej

> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.
> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.
> 
> >However, the TV encoder has a constraint on that clock rate. This can
> >be easily implemented using a custom encoder state where you'd set the
> >multiplier to set on that clock, and the TCON will use it.
> >
> >Maxime


-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-24 15:23                       ` Jernej Škrabec
  0 siblings, 0 replies; 159+ messages in thread
From: Jernej Škrabec @ 2017-05-24 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dne sreda, 24. maj 2017 ob 10:25:46 CEST je Icenowy Zheng napisal(a):
> ? 2017?5?24? GMT+08:00 ??3:30:19, Maxime Ripard <maxime.ripard@free-
electrons.com> ??:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
> >> ? 2017-05-23 20:53?Maxime Ripard ???
> >> 
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
> >
> ><jernej.skrabec@siol.net>
> >
> >> > > wrote:
> >> > > > > Hi,
> >> > > > > 
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >
> >napisal(a):
> >> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
> >
> ><maxime.ripard@free-
> >
> >> > > > > electrons.com> ??:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >
> >earlier
> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >
> >signal.
> >
> >> > > > >> >Why?
> >> > > > >> 
> >> > > > >> It's experiment result by Jernej.
> >> > > > >> 
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > > 
> >> > > > > My experiments and search through BSP code showed that TVE
> >
> >seems to have
> >
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >
> >MHz clock,
> >
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > > 
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >
> >bit low for
> >
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >
> >generate 216 MHz.
> >
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >
> >MHz.
> >
> >> > > > > Please note that I don't have any hard evidence to support
> >
> >that, only
> >
> >> > > > > experimental data. However, only that explanation make sense
> >
> >to me.
> >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >
> >both use 27 MHz
> >
> >> > > > > base clock. Further experiments are needed to check if there
> >
> >is any
> >
> >> > > > > possibility to have other resolutions by manipulating clocks
> >
> >and give
> >
> >> > > > > other proper settings. I plan to do that, but not in very
> >
> >near future.
> >
> >> > > > You only have composite video output, and those are the only 2
> >
> >standard
> >
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >
> >think
> >
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >
> >I
> >
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >
> >216
> >
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >
> >be
> >
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.

If we are talking about HW divider, it is 8 (216 / 27 = 8).

Slightly offtopic, reason why DE2 is hardcoded to 432 might be that for 4K 
resolution you need at least 297 MHz. So next dividable frequency is taken 
(432 MHz). That way you can have 4K HDMI display and composite TV connected at 
the same time, although this sounds a bit weird.

Best regards,
Jernej

> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.
> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.
> 
> >However, the TV encoder has a constraint on that clock rate. This can
> >be easily implemented using a custom encoder state where you'd set the
> >multiplier to set on that clock, and the TCON will use it.
> >
> >Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-31 18:43                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-31 18:43 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 4782 bytes --]

On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> ><jernej.skrabec@siol.net>
> >> > > wrote:
> >> > > > > Hi,
> >> > > > >
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >napisal(a):
> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> ><maxime.ripard@free-
> >> > > > >
> >> > > > > electrons.com> 写到:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >earlier
> >> > > > >> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >signal.
> >> > > > >> >
> >> > > > >> >Why?
> >> > > > >>
> >> > > > >> It's experiment result by Jernej.
> >> > > > >>
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > >
> >> > > > > My experiments and search through BSP code showed that TVE
> >seems to have
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >MHz clock,
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > >
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >bit low for
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >generate 216 MHz.
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >MHz.
> >> > > > >
> >> > > > > Please note that I don't have any hard evidence to support
> >that, only
> >> > > > > experimental data. However, only that explanation make sense
> >to me.
> >> > > > >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >both use 27 MHz
> >> > > > > base clock. Further experiments are needed to check if there
> >is any
> >> > > > > possibility to have other resolutions by manipulating clocks
> >and give
> >> > > > > other proper settings. I plan to do that, but not in very
> >near future.
> >> > > >
> >> > > > You only have composite video output, and those are the only 2
> >standard
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >think
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >I
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >216
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >be
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.
> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.

Feel free to come up with a better, more sensible explanation?

> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.

What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
agree on that.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-31 18:43                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-31 18:43 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Jernej Škrabec, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 5176 bytes --]

On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> ><jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
> >> > > wrote:
> >> > > > > Hi,
> >> > > > >
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >napisal(a):
> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> ><maxime.ripard@free-
> >> > > > >
> >> > > > > electrons.com> 写到:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >earlier
> >> > > > >> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >signal.
> >> > > > >> >
> >> > > > >> >Why?
> >> > > > >>
> >> > > > >> It's experiment result by Jernej.
> >> > > > >>
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > >
> >> > > > > My experiments and search through BSP code showed that TVE
> >seems to have
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >MHz clock,
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > >
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >bit low for
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >generate 216 MHz.
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >MHz.
> >> > > > >
> >> > > > > Please note that I don't have any hard evidence to support
> >that, only
> >> > > > > experimental data. However, only that explanation make sense
> >to me.
> >> > > > >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >both use 27 MHz
> >> > > > > base clock. Further experiments are needed to check if there
> >is any
> >> > > > > possibility to have other resolutions by manipulating clocks
> >and give
> >> > > > > other proper settings. I plan to do that, but not in very
> >near future.
> >> > > >
> >> > > > You only have composite video output, and those are the only 2
> >standard
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >think
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >I
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >216
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >be
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.
> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.

Feel free to come up with a better, more sensible explanation?

> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.

What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
agree on that.

Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-05-31 18:43                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-05-31 18:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> 
> 
> ? 2017?5?24? GMT+08:00 ??3:30:19, Maxime Ripard <maxime.ripard@free-electrons.com> ??:
> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
> >> ? 2017-05-23 20:53?Maxime Ripard ???
> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> >> > > Hi,
> >> > > 
> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> >napisal(a):
> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
> ><jernej.skrabec@siol.net>
> >> > > wrote:
> >> > > > > Hi,
> >> > > > >
> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> >napisal(a):
> >> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
> ><maxime.ripard@free-
> >> > > > >
> >> > > > > electrons.com> ??:
> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> >wrote:
> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> >earlier
> >> > > > >> >
> >> > > > >> >SoCs,
> >> > > > >> >
> >> > > > >> >> but with some different points about clocks:
> >> > > > >> >> - It has a mod clock and a bus clock.
> >> > > > >> >> - The mod clock must be at a fixed rate to generate
> >signal.
> >> > > > >> >
> >> > > > >> >Why?
> >> > > > >>
> >> > > > >> It's experiment result by Jernej.
> >> > > > >>
> >> > > > >> The clock rates in BSP kernel is also specially designed
> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> >> > > > >
> >> > > > > My experiments and search through BSP code showed that TVE
> >seems to have
> >> > > > > additional fixed predivider 8. So if you want to generate 27
> >MHz clock,
> >> > > > > unit has to be feed with 216 MHz.
> >> > > > >
> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> >bit low for
> >> > > > > DE2,
> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> >generate 216 MHz.
> >> > > > > This clock is then divided by 8 internaly to get final 27
> >MHz.
> >> > > > >
> >> > > > > Please note that I don't have any hard evidence to support
> >that, only
> >> > > > > experimental data. However, only that explanation make sense
> >to me.
> >> > > > >
> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> >both use 27 MHz
> >> > > > > base clock. Further experiments are needed to check if there
> >is any
> >> > > > > possibility to have other resolutions by manipulating clocks
> >and give
> >> > > > > other proper settings. I plan to do that, but not in very
> >near future.
> >> > > >
> >> > > > You only have composite video output, and those are the only 2
> >standard
> >> > > > resolutions that make any sense.
> >> > > 
> >> > > Right, other resolutions are for VGA.
> >> > > 
> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> >think
> >> > > that H3 TVE
> >> > > unit is something in between. R40 TVE has a setting to select "up
> >> > > sample".
> >> > 
> >> > That might be just another translation of oversampling :)
> >> > 
> >> > I didn't know it could be applied to composite signals though, but
> >I
> >> > guess this is just another analog signal after all.
> >> > 
> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> >> > > driver on R40
> >> > > has this setting enabled only for PAL and NTSC and it is always
> >216
> >> > > MHz. I
> >> > > think that H3 may have this hardwired to 216 MHz and this would
> >be
> >> > > the reason
> >> > > why 216 MHz is needed.
> >> > > 
> >> > > Has anyone else any better explanation?
> >> > 
> >> > That's already a pretty good one.
> >> > 
> >> > Either way, wether this is upsampling, oversampling or just a
> >> > pre-divider, this can and should be dealt with in the mode_set
> >> > callback, and not in the probe.
> >> 
> >> I got a better idea -- let TVE driver have the CLK_TVE as an
> >> input and create a subclock output with divider 16, and feed this
> >> subclock to TCON lcd-ch1.
> >> 
> >> This is a model of the real hardware -- the clock divider is in
> >> TVE, not TCON.
> >
> >That's definitely not a good representation of the hardware. There's
> >one clock, it goes to the TCON, period.
> 
> No, I still think it goes to the TVE as:
> 
> 1. it's named TVE in datasheet.

Feel free to come up with a better, more sensible explanation?

> 2. Generating signal with such a low resolution but such
> a high dotclock is not a good situation.

What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
agree on that.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170531/242eb47e/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-01 14:11                         ` icenowy-h8G6r0blFSE
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy @ 2017-06-01 14:11 UTC (permalink / raw)
  To: maxime.ripard
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

在 2017-06-01 02:43,Maxime Ripard 写道:
> On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
>> 
>> 
>> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard 
>> <maxime.ripard@free-electrons.com> 写到:
>> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
>> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
>> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> >> > > Hi,
>> >> > >
>> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>> >napisal(a):
>> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
>> ><jernej.skrabec@siol.net>
>> >> > > wrote:
>> >> > > > > Hi,
>> >> > > > >
>> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>> >napisal(a):
>> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
>> ><maxime.ripard@free-
>> >> > > > >
>> >> > > > > electrons.com> 写到:
>> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>> >wrote:
>> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>> >earlier
>> >> > > > >> >
>> >> > > > >> >SoCs,
>> >> > > > >> >
>> >> > > > >> >> but with some different points about clocks:
>> >> > > > >> >> - It has a mod clock and a bus clock.
>> >> > > > >> >> - The mod clock must be at a fixed rate to generate
>> >signal.
>> >> > > > >> >
>> >> > > > >> >Why?
>> >> > > > >>
>> >> > > > >> It's experiment result by Jernej.
>> >> > > > >>
>> >> > > > >> The clock rates in BSP kernel is also specially designed
>> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> >> > > > >
>> >> > > > > My experiments and search through BSP code showed that TVE
>> >seems to have
>> >> > > > > additional fixed predivider 8. So if you want to generate 27
>> >MHz clock,
>> >> > > > > unit has to be feed with 216 MHz.
>> >> > > > >
>> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>> >bit low for
>> >> > > > > DE2,
>> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>> >generate 216 MHz.
>> >> > > > > This clock is then divided by 8 internaly to get final 27
>> >MHz.
>> >> > > > >
>> >> > > > > Please note that I don't have any hard evidence to support
>> >that, only
>> >> > > > > experimental data. However, only that explanation make sense
>> >to me.
>> >> > > > >
>> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>> >both use 27 MHz
>> >> > > > > base clock. Further experiments are needed to check if there
>> >is any
>> >> > > > > possibility to have other resolutions by manipulating clocks
>> >and give
>> >> > > > > other proper settings. I plan to do that, but not in very
>> >near future.
>> >> > > >
>> >> > > > You only have composite video output, and those are the only 2
>> >standard
>> >> > > > resolutions that make any sense.
>> >> > >
>> >> > > Right, other resolutions are for VGA.
>> >> > >
>> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>> >think
>> >> > > that H3 TVE
>> >> > > unit is something in between. R40 TVE has a setting to select "up
>> >> > > sample".
>> >> >
>> >> > That might be just another translation of oversampling :)
>> >> >
>> >> > I didn't know it could be applied to composite signals though, but
>> >I
>> >> > guess this is just another analog signal after all.
>> >> >
>> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> >> > > driver on R40
>> >> > > has this setting enabled only for PAL and NTSC and it is always
>> >216
>> >> > > MHz. I
>> >> > > think that H3 may have this hardwired to 216 MHz and this would
>> >be
>> >> > > the reason
>> >> > > why 216 MHz is needed.
>> >> > >
>> >> > > Has anyone else any better explanation?
>> >> >
>> >> > That's already a pretty good one.
>> >> >
>> >> > Either way, wether this is upsampling, oversampling or just a
>> >> > pre-divider, this can and should be dealt with in the mode_set
>> >> > callback, and not in the probe.
>> >>
>> >> I got a better idea -- let TVE driver have the CLK_TVE as an
>> >> input and create a subclock output with divider 16, and feed this
>> >> subclock to TCON lcd-ch1.
>> >>
>> >> This is a model of the real hardware -- the clock divider is in
>> >> TVE, not TCON.
>> >
>> >That's definitely not a good representation of the hardware. There's
>> >one clock, it goes to the TCON, period.
>> 
>> No, I still think it goes to the TVE as:
>> 
>> 1. it's named TVE in datasheet.
> 
> Feel free to come up with a better, more sensible explanation?
> 
>> 2. Generating signal with such a low resolution but such
>> a high dotclock is not a good situation.
> 
> What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> agree on that.

Yes, so I don't think the TCON code should set the clock to any value
rather than 27MHz.

So we should create a clock with divider in TVE, and feed it to TCON.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-01 14:11                         ` icenowy-h8G6r0blFSE
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy-h8G6r0blFSE @ 2017-06-01 14:11 UTC (permalink / raw)
  To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Jernej Škrabec, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

在 2017-06-01 02:43,Maxime Ripard 写道:
> On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
>> 
>> 
>> 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard 
>> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
>> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
>> >> 在 2017-05-23 20:53,Maxime Ripard 写道:
>> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> >> > > Hi,
>> >> > >
>> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>> >napisal(a):
>> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
>> ><jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
>> >> > > wrote:
>> >> > > > > Hi,
>> >> > > > >
>> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>> >napisal(a):
>> >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
>> ><maxime.ripard@free-
>> >> > > > >
>> >> > > > > electrons.com> 写到:
>> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>> >wrote:
>> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>> >earlier
>> >> > > > >> >
>> >> > > > >> >SoCs,
>> >> > > > >> >
>> >> > > > >> >> but with some different points about clocks:
>> >> > > > >> >> - It has a mod clock and a bus clock.
>> >> > > > >> >> - The mod clock must be at a fixed rate to generate
>> >signal.
>> >> > > > >> >
>> >> > > > >> >Why?
>> >> > > > >>
>> >> > > > >> It's experiment result by Jernej.
>> >> > > > >>
>> >> > > > >> The clock rates in BSP kernel is also specially designed
>> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> >> > > > >
>> >> > > > > My experiments and search through BSP code showed that TVE
>> >seems to have
>> >> > > > > additional fixed predivider 8. So if you want to generate 27
>> >MHz clock,
>> >> > > > > unit has to be feed with 216 MHz.
>> >> > > > >
>> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>> >bit low for
>> >> > > > > DE2,
>> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>> >generate 216 MHz.
>> >> > > > > This clock is then divided by 8 internaly to get final 27
>> >MHz.
>> >> > > > >
>> >> > > > > Please note that I don't have any hard evidence to support
>> >that, only
>> >> > > > > experimental data. However, only that explanation make sense
>> >to me.
>> >> > > > >
>> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>> >both use 27 MHz
>> >> > > > > base clock. Further experiments are needed to check if there
>> >is any
>> >> > > > > possibility to have other resolutions by manipulating clocks
>> >and give
>> >> > > > > other proper settings. I plan to do that, but not in very
>> >near future.
>> >> > > >
>> >> > > > You only have composite video output, and those are the only 2
>> >standard
>> >> > > > resolutions that make any sense.
>> >> > >
>> >> > > Right, other resolutions are for VGA.
>> >> > >
>> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>> >think
>> >> > > that H3 TVE
>> >> > > unit is something in between. R40 TVE has a setting to select "up
>> >> > > sample".
>> >> >
>> >> > That might be just another translation of oversampling :)
>> >> >
>> >> > I didn't know it could be applied to composite signals though, but
>> >I
>> >> > guess this is just another analog signal after all.
>> >> >
>> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> >> > > driver on R40
>> >> > > has this setting enabled only for PAL and NTSC and it is always
>> >216
>> >> > > MHz. I
>> >> > > think that H3 may have this hardwired to 216 MHz and this would
>> >be
>> >> > > the reason
>> >> > > why 216 MHz is needed.
>> >> > >
>> >> > > Has anyone else any better explanation?
>> >> >
>> >> > That's already a pretty good one.
>> >> >
>> >> > Either way, wether this is upsampling, oversampling or just a
>> >> > pre-divider, this can and should be dealt with in the mode_set
>> >> > callback, and not in the probe.
>> >>
>> >> I got a better idea -- let TVE driver have the CLK_TVE as an
>> >> input and create a subclock output with divider 16, and feed this
>> >> subclock to TCON lcd-ch1.
>> >>
>> >> This is a model of the real hardware -- the clock divider is in
>> >> TVE, not TCON.
>> >
>> >That's definitely not a good representation of the hardware. There's
>> >one clock, it goes to the TCON, period.
>> 
>> No, I still think it goes to the TVE as:
>> 
>> 1. it's named TVE in datasheet.
> 
> Feel free to come up with a better, more sensible explanation?
> 
>> 2. Generating signal with such a low resolution but such
>> a high dotclock is not a good situation.
> 
> What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> agree on that.

Yes, so I don't think the TCON code should set the clock to any value
rather than 27MHz.

So we should create a clock with divider in TVE, and feed it to TCON.

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-01 14:11                         ` icenowy-h8G6r0blFSE
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy at aosc.io @ 2017-06-01 14:11 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-06-01 02:43?Maxime Ripard ???
> On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
>> 
>> 
>> ? 2017?5?24? GMT+08:00 ??3:30:19, Maxime Ripard 
>> <maxime.ripard@free-electrons.com> ??:
>> >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
>> >> ? 2017-05-23 20:53?Maxime Ripard ???
>> >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
>> >> > > Hi,
>> >> > >
>> >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
>> >napisal(a):
>> >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
>> ><jernej.skrabec@siol.net>
>> >> > > wrote:
>> >> > > > > Hi,
>> >> > > > >
>> >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
>> >napisal(a):
>> >> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
>> ><maxime.ripard@free-
>> >> > > > >
>> >> > > > > electrons.com> ??:
>> >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
>> >wrote:
>> >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
>> >earlier
>> >> > > > >> >
>> >> > > > >> >SoCs,
>> >> > > > >> >
>> >> > > > >> >> but with some different points about clocks:
>> >> > > > >> >> - It has a mod clock and a bus clock.
>> >> > > > >> >> - The mod clock must be at a fixed rate to generate
>> >signal.
>> >> > > > >> >
>> >> > > > >> >Why?
>> >> > > > >>
>> >> > > > >> It's experiment result by Jernej.
>> >> > > > >>
>> >> > > > >> The clock rates in BSP kernel is also specially designed
>> >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> >> > > > >
>> >> > > > > My experiments and search through BSP code showed that TVE
>> >seems to have
>> >> > > > > additional fixed predivider 8. So if you want to generate 27
>> >MHz clock,
>> >> > > > > unit has to be feed with 216 MHz.
>> >> > > > >
>> >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
>> >bit low for
>> >> > > > > DE2,
>> >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
>> >generate 216 MHz.
>> >> > > > > This clock is then divided by 8 internaly to get final 27
>> >MHz.
>> >> > > > >
>> >> > > > > Please note that I don't have any hard evidence to support
>> >that, only
>> >> > > > > experimental data. However, only that explanation make sense
>> >to me.
>> >> > > > >
>> >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
>> >both use 27 MHz
>> >> > > > > base clock. Further experiments are needed to check if there
>> >is any
>> >> > > > > possibility to have other resolutions by manipulating clocks
>> >and give
>> >> > > > > other proper settings. I plan to do that, but not in very
>> >near future.
>> >> > > >
>> >> > > > You only have composite video output, and those are the only 2
>> >standard
>> >> > > > resolutions that make any sense.
>> >> > >
>> >> > > Right, other resolutions are for VGA.
>> >> > >
>> >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
>> >think
>> >> > > that H3 TVE
>> >> > > unit is something in between. R40 TVE has a setting to select "up
>> >> > > sample".
>> >> >
>> >> > That might be just another translation of oversampling :)
>> >> >
>> >> > I didn't know it could be applied to composite signals though, but
>> >I
>> >> > guess this is just another analog signal after all.
>> >> >
>> >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> >> > > driver on R40
>> >> > > has this setting enabled only for PAL and NTSC and it is always
>> >216
>> >> > > MHz. I
>> >> > > think that H3 may have this hardwired to 216 MHz and this would
>> >be
>> >> > > the reason
>> >> > > why 216 MHz is needed.
>> >> > >
>> >> > > Has anyone else any better explanation?
>> >> >
>> >> > That's already a pretty good one.
>> >> >
>> >> > Either way, wether this is upsampling, oversampling or just a
>> >> > pre-divider, this can and should be dealt with in the mode_set
>> >> > callback, and not in the probe.
>> >>
>> >> I got a better idea -- let TVE driver have the CLK_TVE as an
>> >> input and create a subclock output with divider 16, and feed this
>> >> subclock to TCON lcd-ch1.
>> >>
>> >> This is a model of the real hardware -- the clock divider is in
>> >> TVE, not TCON.
>> >
>> >That's definitely not a good representation of the hardware. There's
>> >one clock, it goes to the TCON, period.
>> 
>> No, I still think it goes to the TVE as:
>> 
>> 1. it's named TVE in datasheet.
> 
> Feel free to come up with a better, more sensible explanation?
> 
>> 2. Generating signal with such a low resolution but such
>> a high dotclock is not a good situation.
> 
> What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> agree on that.

Yes, so I don't think the TCON code should set the clock to any value
rather than 27MHz.

So we should create a clock with divider in TVE, and feed it to TCON.

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

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-02 22:21                           ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-02 22:21 UTC (permalink / raw)
  To: icenowy
  Cc: Jernej Škrabec, linux-sunxi, wens, Rob Herring, dri-devel,
	devicetree, linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 6329 bytes --]

On Thu, Jun 01, 2017 at 10:11:14PM +0800, icenowy@aosc.io wrote:
> 在 2017-06-01 02:43,Maxime Ripard 写道:
> > On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> > > 
> > > 
> > > 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard
> > > <maxime.ripard@free-electrons.com> 写到:
> > > >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
> > > >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> > > >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > >> > > Hi,
> > > >> > >
> > > >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> > > >napisal(a):
> > > >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> > > ><jernej.skrabec@siol.net>
> > > >> > > wrote:
> > > >> > > > > Hi,
> > > >> > > > >
> > > >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> > > >napisal(a):
> > > >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> > > ><maxime.ripard@free-
> > > >> > > > >
> > > >> > > > > electrons.com> 写到:
> > > >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> > > >wrote:
> > > >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> > > >earlier
> > > >> > > > >> >
> > > >> > > > >> >SoCs,
> > > >> > > > >> >
> > > >> > > > >> >> but with some different points about clocks:
> > > >> > > > >> >> - It has a mod clock and a bus clock.
> > > >> > > > >> >> - The mod clock must be at a fixed rate to generate
> > > >signal.
> > > >> > > > >> >
> > > >> > > > >> >Why?
> > > >> > > > >>
> > > >> > > > >> It's experiment result by Jernej.
> > > >> > > > >>
> > > >> > > > >> The clock rates in BSP kernel is also specially designed
> > > >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > >> > > > >
> > > >> > > > > My experiments and search through BSP code showed that TVE
> > > >seems to have
> > > >> > > > > additional fixed predivider 8. So if you want to generate 27
> > > >MHz clock,
> > > >> > > > > unit has to be feed with 216 MHz.
> > > >> > > > >
> > > >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> > > >bit low for
> > > >> > > > > DE2,
> > > >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> > > >generate 216 MHz.
> > > >> > > > > This clock is then divided by 8 internaly to get final 27
> > > >MHz.
> > > >> > > > >
> > > >> > > > > Please note that I don't have any hard evidence to support
> > > >that, only
> > > >> > > > > experimental data. However, only that explanation make sense
> > > >to me.
> > > >> > > > >
> > > >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> > > >both use 27 MHz
> > > >> > > > > base clock. Further experiments are needed to check if there
> > > >is any
> > > >> > > > > possibility to have other resolutions by manipulating clocks
> > > >and give
> > > >> > > > > other proper settings. I plan to do that, but not in very
> > > >near future.
> > > >> > > >
> > > >> > > > You only have composite video output, and those are the only 2
> > > >standard
> > > >> > > > resolutions that make any sense.
> > > >> > >
> > > >> > > Right, other resolutions are for VGA.
> > > >> > >
> > > >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> > > >think
> > > >> > > that H3 TVE
> > > >> > > unit is something in between. R40 TVE has a setting to select "up
> > > >> > > sample".
> > > >> >
> > > >> > That might be just another translation of oversampling :)
> > > >> >
> > > >> > I didn't know it could be applied to composite signals though, but
> > > >I
> > > >> > guess this is just another analog signal after all.
> > > >> >
> > > >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > >> > > driver on R40
> > > >> > > has this setting enabled only for PAL and NTSC and it is always
> > > >216
> > > >> > > MHz. I
> > > >> > > think that H3 may have this hardwired to 216 MHz and this would
> > > >be
> > > >> > > the reason
> > > >> > > why 216 MHz is needed.
> > > >> > >
> > > >> > > Has anyone else any better explanation?
> > > >> >
> > > >> > That's already a pretty good one.
> > > >> >
> > > >> > Either way, wether this is upsampling, oversampling or just a
> > > >> > pre-divider, this can and should be dealt with in the mode_set
> > > >> > callback, and not in the probe.
> > > >>
> > > >> I got a better idea -- let TVE driver have the CLK_TVE as an
> > > >> input and create a subclock output with divider 16, and feed this
> > > >> subclock to TCON lcd-ch1.
> > > >>
> > > >> This is a model of the real hardware -- the clock divider is in
> > > >> TVE, not TCON.
> > > >
> > > >That's definitely not a good representation of the hardware. There's
> > > >one clock, it goes to the TCON, period.
> > > 
> > > No, I still think it goes to the TVE as:
> > > 
> > > 1. it's named TVE in datasheet.
> > 
> > Feel free to come up with a better, more sensible explanation?
> > 
> > > 2. Generating signal with such a low resolution but such
> > > a high dotclock is not a good situation.
> > 
> > What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> > agree on that.
> 
> Yes, so I don't think the TCON code should set the clock to any value
> rather than 27MHz.

The pixel clock that matters is what is output on the TV
connector. The intermediate pixel clock don't matter, and in this
case, it seems to be clearly the case that the TCON needs a higher
clock, then let's give it a higher clock.

> So we should create a clock with divider in TVE, and feed it to TCON.

I'm sorry, but this still doesn't make much sense. The clock is
provided by the TCON, and there's a divider in the TVE, it's as simple
as that, unless you can provide some other meaningful explanation.

That the TV encoder feeds a clock that would drive the TCON is already
suspicious, and all the precedent designs indicate that this is not
what is going on. Both the explanation and the design is much simpler
that way.

Sometimes the Occam's razor is a better justification than a label on
a datasheet.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-02 22:21                           ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-02 22:21 UTC (permalink / raw)
  To: icenowy-h8G6r0blFSE
  Cc: Jernej Škrabec, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	wens-jdAy2FN1RRM, Rob Herring, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 6744 bytes --]

On Thu, Jun 01, 2017 at 10:11:14PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> 在 2017-06-01 02:43,Maxime Ripard 写道:
> > On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> > > 
> > > 
> > > 于 2017年5月24日 GMT+08:00 下午3:30:19, Maxime Ripard
> > > <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 写到:
> > > >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> > > >> 在 2017-05-23 20:53,Maxime Ripard 写道:
> > > >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > >> > > Hi,
> > > >> > >
> > > >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> > > >napisal(a):
> > > >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec
> > > ><jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
> > > >> > > wrote:
> > > >> > > > > Hi,
> > > >> > > > >
> > > >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> > > >napisal(a):
> > > >> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard
> > > ><maxime.ripard@free-
> > > >> > > > >
> > > >> > > > > electrons.com> 写到:
> > > >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> > > >wrote:
> > > >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> > > >earlier
> > > >> > > > >> >
> > > >> > > > >> >SoCs,
> > > >> > > > >> >
> > > >> > > > >> >> but with some different points about clocks:
> > > >> > > > >> >> - It has a mod clock and a bus clock.
> > > >> > > > >> >> - The mod clock must be at a fixed rate to generate
> > > >signal.
> > > >> > > > >> >
> > > >> > > > >> >Why?
> > > >> > > > >>
> > > >> > > > >> It's experiment result by Jernej.
> > > >> > > > >>
> > > >> > > > >> The clock rates in BSP kernel is also specially designed
> > > >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > >> > > > >
> > > >> > > > > My experiments and search through BSP code showed that TVE
> > > >seems to have
> > > >> > > > > additional fixed predivider 8. So if you want to generate 27
> > > >MHz clock,
> > > >> > > > > unit has to be feed with 216 MHz.
> > > >> > > > >
> > > >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> > > >bit low for
> > > >> > > > > DE2,
> > > >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> > > >generate 216 MHz.
> > > >> > > > > This clock is then divided by 8 internaly to get final 27
> > > >MHz.
> > > >> > > > >
> > > >> > > > > Please note that I don't have any hard evidence to support
> > > >that, only
> > > >> > > > > experimental data. However, only that explanation make sense
> > > >to me.
> > > >> > > > >
> > > >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> > > >both use 27 MHz
> > > >> > > > > base clock. Further experiments are needed to check if there
> > > >is any
> > > >> > > > > possibility to have other resolutions by manipulating clocks
> > > >and give
> > > >> > > > > other proper settings. I plan to do that, but not in very
> > > >near future.
> > > >> > > >
> > > >> > > > You only have composite video output, and those are the only 2
> > > >standard
> > > >> > > > resolutions that make any sense.
> > > >> > >
> > > >> > > Right, other resolutions are for VGA.
> > > >> > >
> > > >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> > > >think
> > > >> > > that H3 TVE
> > > >> > > unit is something in between. R40 TVE has a setting to select "up
> > > >> > > sample".
> > > >> >
> > > >> > That might be just another translation of oversampling :)
> > > >> >
> > > >> > I didn't know it could be applied to composite signals though, but
> > > >I
> > > >> > guess this is just another analog signal after all.
> > > >> >
> > > >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > >> > > driver on R40
> > > >> > > has this setting enabled only for PAL and NTSC and it is always
> > > >216
> > > >> > > MHz. I
> > > >> > > think that H3 may have this hardwired to 216 MHz and this would
> > > >be
> > > >> > > the reason
> > > >> > > why 216 MHz is needed.
> > > >> > >
> > > >> > > Has anyone else any better explanation?
> > > >> >
> > > >> > That's already a pretty good one.
> > > >> >
> > > >> > Either way, wether this is upsampling, oversampling or just a
> > > >> > pre-divider, this can and should be dealt with in the mode_set
> > > >> > callback, and not in the probe.
> > > >>
> > > >> I got a better idea -- let TVE driver have the CLK_TVE as an
> > > >> input and create a subclock output with divider 16, and feed this
> > > >> subclock to TCON lcd-ch1.
> > > >>
> > > >> This is a model of the real hardware -- the clock divider is in
> > > >> TVE, not TCON.
> > > >
> > > >That's definitely not a good representation of the hardware. There's
> > > >one clock, it goes to the TCON, period.
> > > 
> > > No, I still think it goes to the TVE as:
> > > 
> > > 1. it's named TVE in datasheet.
> > 
> > Feel free to come up with a better, more sensible explanation?
> > 
> > > 2. Generating signal with such a low resolution but such
> > > a high dotclock is not a good situation.
> > 
> > What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> > agree on that.
> 
> Yes, so I don't think the TCON code should set the clock to any value
> rather than 27MHz.

The pixel clock that matters is what is output on the TV
connector. The intermediate pixel clock don't matter, and in this
case, it seems to be clearly the case that the TCON needs a higher
clock, then let's give it a higher clock.

> So we should create a clock with divider in TVE, and feed it to TCON.

I'm sorry, but this still doesn't make much sense. The clock is
provided by the TCON, and there's a divider in the TVE, it's as simple
as that, unless you can provide some other meaningful explanation.

That the TV encoder feeds a clock that would drive the TCON is already
suspicious, and all the precedent designs indicate that this is not
what is going on. Both the explanation and the design is much simpler
that way.

Sometimes the Occam's razor is a better justification than a label on
a datasheet.

Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-02 22:21                           ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-02 22:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 01, 2017 at 10:11:14PM +0800, icenowy at aosc.io wrote:
> ? 2017-06-01 02:43?Maxime Ripard ???
> > On Wed, May 24, 2017 at 04:25:46PM +0800, Icenowy Zheng wrote:
> > > 
> > > 
> > > ? 2017?5?24? GMT+08:00 ??3:30:19, Maxime Ripard
> > > <maxime.ripard@free-electrons.com> ??:
> > > >On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
> > > >> ? 2017-05-23 20:53?Maxime Ripard ???
> > > >> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> > > >> > > Hi,
> > > >> > >
> > > >> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai
> > > >napisal(a):
> > > >> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec
> > > ><jernej.skrabec@siol.net>
> > > >> > > wrote:
> > > >> > > > > Hi,
> > > >> > > > >
> > > >> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng
> > > >napisal(a):
> > > >> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard
> > > ><maxime.ripard@free-
> > > >> > > > >
> > > >> > > > > electrons.com> ??:
> > > >> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng
> > > >wrote:
> > > >> > > > >> >> Allwinner H3 features a TV encoder similar to the one in
> > > >earlier
> > > >> > > > >> >
> > > >> > > > >> >SoCs,
> > > >> > > > >> >
> > > >> > > > >> >> but with some different points about clocks:
> > > >> > > > >> >> - It has a mod clock and a bus clock.
> > > >> > > > >> >> - The mod clock must be at a fixed rate to generate
> > > >signal.
> > > >> > > > >> >
> > > >> > > > >> >Why?
> > > >> > > > >>
> > > >> > > > >> It's experiment result by Jernej.
> > > >> > > > >>
> > > >> > > > >> The clock rates in BSP kernel is also specially designed
> > > >> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > >> > > > >
> > > >> > > > > My experiments and search through BSP code showed that TVE
> > > >seems to have
> > > >> > > > > additional fixed predivider 8. So if you want to generate 27
> > > >MHz clock,
> > > >> > > > > unit has to be feed with 216 MHz.
> > > >> > > > >
> > > >> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a
> > > >bit low for
> > > >> > > > > DE2,
> > > >> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to
> > > >generate 216 MHz.
> > > >> > > > > This clock is then divided by 8 internaly to get final 27
> > > >MHz.
> > > >> > > > >
> > > >> > > > > Please note that I don't have any hard evidence to support
> > > >that, only
> > > >> > > > > experimental data. However, only that explanation make sense
> > > >to me.
> > > >> > > > >
> > > >> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which
> > > >both use 27 MHz
> > > >> > > > > base clock. Further experiments are needed to check if there
> > > >is any
> > > >> > > > > possibility to have other resolutions by manipulating clocks
> > > >and give
> > > >> > > > > other proper settings. I plan to do that, but not in very
> > > >near future.
> > > >> > > >
> > > >> > > > You only have composite video output, and those are the only 2
> > > >standard
> > > >> > > > resolutions that make any sense.
> > > >> > >
> > > >> > > Right, other resolutions are for VGA.
> > > >> > >
> > > >> > > Anyway, I did some more digging in A10 and R40 datasheets. I
> > > >think
> > > >> > > that H3 TVE
> > > >> > > unit is something in between. R40 TVE has a setting to select "up
> > > >> > > sample".
> > > >> >
> > > >> > That might be just another translation of oversampling :)
> > > >> >
> > > >> > I didn't know it could be applied to composite signals though, but
> > > >I
> > > >> > guess this is just another analog signal after all.
> > > >> >
> > > >> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > >> > > driver on R40
> > > >> > > has this setting enabled only for PAL and NTSC and it is always
> > > >216
> > > >> > > MHz. I
> > > >> > > think that H3 may have this hardwired to 216 MHz and this would
> > > >be
> > > >> > > the reason
> > > >> > > why 216 MHz is needed.
> > > >> > >
> > > >> > > Has anyone else any better explanation?
> > > >> >
> > > >> > That's already a pretty good one.
> > > >> >
> > > >> > Either way, wether this is upsampling, oversampling or just a
> > > >> > pre-divider, this can and should be dealt with in the mode_set
> > > >> > callback, and not in the probe.
> > > >>
> > > >> I got a better idea -- let TVE driver have the CLK_TVE as an
> > > >> input and create a subclock output with divider 16, and feed this
> > > >> subclock to TCON lcd-ch1.
> > > >>
> > > >> This is a model of the real hardware -- the clock divider is in
> > > >> TVE, not TCON.
> > > >
> > > >That's definitely not a good representation of the hardware. There's
> > > >one clock, it goes to the TCON, period.
> > > 
> > > No, I still think it goes to the TVE as:
> > > 
> > > 1. it's named TVE in datasheet.
> > 
> > Feel free to come up with a better, more sensible explanation?
> > 
> > > 2. Generating signal with such a low resolution but such
> > > a high dotclock is not a good situation.
> > 
> > What? What do you mean? The pixel clock is 27MHz, I'm pretty sure we
> > agree on that.
> 
> Yes, so I don't think the TCON code should set the clock to any value
> rather than 27MHz.

The pixel clock that matters is what is output on the TV
connector. The intermediate pixel clock don't matter, and in this
case, it seems to be clearly the case that the TCON needs a higher
clock, then let's give it a higher clock.

> So we should create a clock with divider in TVE, and feed it to TCON.

I'm sorry, but this still doesn't make much sense. The clock is
provided by the TCON, and there's a divider in the TVE, it's as simple
as that, unless you can provide some other meaningful explanation.

That the TV encoder feeds a clock that would drive the TCON is already
suspicious, and all the precedent designs indicate that this is not
what is going on. Both the explanation and the design is much simpler
that way.

Sometimes the Occam's razor is a better justification than a label on
a datasheet.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170603/addc1010/attachment.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
  2017-05-24  8:14         ` Maxime Ripard
@ 2017-06-04 14:19           ` icenowy at aosc.io
  -1 siblings, 0 replies; 159+ messages in thread
From: icenowy @ 2017-06-04 14:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Chen-Yu Tsai, dri-devel, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-sunxi,
	linux-kernel-owner

在 2017-05-24 16:14,Maxime Ripard 写道:
> On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
>> 
>> 
>> 于 2017年5月20日 GMT+08:00 上午1:57:53, Maxime Ripard 
>> <maxime.ripard@free-electrons.com> 写到:
>> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
>> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
>> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
>> >> the connection can be swapped.
>> >>
>> >> As we now hardcode the default connection, ignore the bonus endpoint
>> >for
>> >> the mixer's output and the TCON's input, as they stands for the
>> >swapped
>> >> connection.
>> >>
>> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> >> ---
>> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
>> >+++++++++++++++++++++++++++++---------
>> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>> >>  3 files changed, 59 insertions(+), 9 deletions(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> index 1dd1948025d2..29bf1325ded6 100644
>> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
>> >device_node *node)
>> >>  		of_device_is_compatible(node,
>> >"allwinner,sun8i-a33-display-frontend");
>> >>  }
>> >>
>> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
>> >*node)
>> >> +{
>> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
>> >*/
>> >> +	return of_device_is_compatible(node,
>> >"allwinner,sun8i-h3-de2-mixer0") ||
>> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
>> >> +}
>> >> +
>> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>> >>  {
>> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
>> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
>> >*dev,
>> >>  			}
>> >>  		}
>> >>
>> >> +		/*
>> >> +		 * The second endpoint of the output of a swappable DE2 mixer
>> >> +		 * is the TCON after connection swapping.
>> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
>> >> +		 * mixer1->tcon1 connection.
>> >> +		 */
>> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
>> >> +			struct of_endpoint endpoint;
>> >> +
>> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> >> +				continue;
>> >> +			}
>> >> +
>> >> +			if (endpoint.id) {
>> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
>> >mixer... skipping\n");
>> >> +				continue;
>> >> +			}
>> >> +		}
>> >> +
>> >>  		/* Walk down our tree */
>> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>> >>
>> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> index f44a37a5993d..89a215ff2370 100644
>> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
>> >*dev,
>> >>   * requested via the get_id function of the engine.
>> >>   */
>> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
>> >*drv,
>> >> -						   struct device_node *node)
>> >> +						   struct device_node *node,
>> >> +						   bool skip_bonus_ep)
>> >>  {
>> >>  	struct device_node *port, *ep, *remote;
>> >>  	struct sunxi_engine *engine;
>> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
>> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
>> >>  		if (!remote)
>> >>  			continue;
>> >>
>> >> +		if (skip_bonus_ep) {
>> >> +			struct of_endpoint endpoint;
>> >> +
>> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> >> +				continue;
>> >> +			}
>> >> +
>> >> +			if (endpoint.id) {
>> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
>> >searching engine\n");
>> >> +				continue;
>> >> +			}
>> >> +		}
>> >> +
>> >
>> >You don't list the mixers in the tcon's output, why do you need that
>> >exactly?
>> 
>> Mixers are TCONs' input, not output...
> 
> Then why are they even parsed? The whole parsing logic in the driver
> only searches for output nodes.

Here it's really parsing the input node, for searching for a connected
engine.

In the situation of DE1 TCON has only one input endpoint and it must be
the connected backend.

But in the situation of DE2 it has now two input endpoints, and it's
now needed to figure out which connection is used.

> 
> Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2
@ 2017-06-04 14:19           ` icenowy at aosc.io
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy at aosc.io @ 2017-06-04 14:19 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-05-24 16:14?Maxime Ripard ???
> On Sat, May 20, 2017 at 02:00:22AM +0800, Icenowy Zheng wrote:
>> 
>> 
>> ? 2017?5?20? GMT+08:00 ??1:57:53, Maxime Ripard 
>> <maxime.ripard@free-electrons.com> ??:
>> >On Thu, May 18, 2017 at 12:43:46AM +0800, Icenowy Zheng wrote:
>> >> Some SoC's DE2 has two mixers. Defaultly the mixer0 is connected to
>> >> tcon0 and mixer1 is connected to tcon1; however by setting a bit
>> >> the connection can be swapped.
>> >>
>> >> As we now hardcode the default connection, ignore the bonus endpoint
>> >for
>> >> the mixer's output and the TCON's input, as they stands for the
>> >swapped
>> >> connection.
>> >>
>> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> >> ---
>> >>  drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ++++++++++++++++++++++++++
>> >>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 39
>> >+++++++++++++++++++++++++++++---------
>> >>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
>> >>  3 files changed, 59 insertions(+), 9 deletions(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> index 1dd1948025d2..29bf1325ded6 100644
>> >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> >> @@ -173,6 +173,13 @@ static bool sun4i_drv_node_is_frontend(struct
>> >device_node *node)
>> >>  		of_device_is_compatible(node,
>> >"allwinner,sun8i-a33-display-frontend");
>> >>  }
>> >>
>> >> +static bool sun4i_drv_node_is_swappable_de2_mixer(struct device_node
>> >*node)
>> >> +{
>> >> +	/* The V3s has only one mixer-tcon pair, so it's not listed here.
>> >*/
>> >> +	return of_device_is_compatible(node,
>> >"allwinner,sun8i-h3-de2-mixer0") ||
>> >> +		of_device_is_compatible(node, "allwinner,sun8i-h3-de2-mixer1");
>> >> +}
>> >> +
>> >>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>> >>  {
>> >>  	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
>> >> @@ -249,6 +256,26 @@ static int sun4i_drv_add_endpoints(struct device
>> >*dev,
>> >>  			}
>> >>  		}
>> >>
>> >> +		/*
>> >> +		 * The second endpoint of the output of a swappable DE2 mixer
>> >> +		 * is the TCON after connection swapping.
>> >> +		 * Ignore it now, as we now hardcode mixer0->tcon0,
>> >> +		 * mixer1->tcon1 connection.
>> >> +		 */
>> >> +		if (sun4i_drv_node_is_swappable_de2_mixer(node)) {
>> >> +			struct of_endpoint endpoint;
>> >> +
>> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> >> +				continue;
>> >> +			}
>> >> +
>> >> +			if (endpoint.id) {
>> >> +				DRM_DEBUG_DRIVER("Endpoint is an unused connection for DE2
>> >mixer... skipping\n");
>> >> +				continue;
>> >> +			}
>> >> +		}
>> >> +
>> >>  		/* Walk down our tree */
>> >>  		count += sun4i_drv_add_endpoints(dev, match, remote);
>> >>
>> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> index f44a37a5993d..89a215ff2370 100644
>> >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> >> @@ -425,7 +425,8 @@ static int sun4i_tcon_init_regmap(struct device
>> >*dev,
>> >>   * requested via the get_id function of the engine.
>> >>   */
>> >>  static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv
>> >*drv,
>> >> -						   struct device_node *node)
>> >> +						   struct device_node *node,
>> >> +						   bool skip_bonus_ep)
>> >>  {
>> >>  	struct device_node *port, *ep, *remote;
>> >>  	struct sunxi_engine *engine;
>> >> @@ -439,6 +440,20 @@ static struct sunxi_engine
>> >*sun4i_tcon_find_engine(struct sun4i_drv *drv,
>> >>  		if (!remote)
>> >>  			continue;
>> >>
>> >> +		if (skip_bonus_ep) {
>> >> +			struct of_endpoint endpoint;
>> >> +
>> >> +			if (of_graph_parse_endpoint(ep, &endpoint)) {
>> >> +				DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
>> >> +				continue;
>> >> +			}
>> >> +
>> >> +			if (endpoint.id) {
>> >> +				DRM_DEBUG_DRIVER("Skipping bonus mixer->TCON connection when
>> >searching engine\n");
>> >> +				continue;
>> >> +			}
>> >> +		}
>> >> +
>> >
>> >You don't list the mixers in the tcon's output, why do you need that
>> >exactly?
>> 
>> Mixers are TCONs' input, not output...
> 
> Then why are they even parsed? The whole parsing logic in the driver
> only searches for output nodes.

Here it's really parsing the input node, for searching for a connected
engine.

In the situation of DE1 TCON has only one input endpoint and it must be
the connected backend.

But in the situation of DE2 it has now two input endpoints, and it's
now needed to figure out which connection is used.

> 
> Maxime

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
  2017-05-24  7:30                   ` Maxime Ripard
@ 2017-06-04 14:29                     ` icenowy at aosc.io
  -1 siblings, 0 replies; 159+ messages in thread
From: icenowy @ 2017-06-04 14:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, Jernej Škrabec, linux-sunxi, dri-devel,
	linux-kernel, wens, Rob Herring, linux-clk, linux-arm-kernel

在 2017-05-24 15:30,Maxime Ripard 写道:
> On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
>> 在 2017-05-23 20:53,Maxime Ripard 写道:
>> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
>> > > Hi,
>> > >
>> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net>
>> > > wrote:
>> > > > > Hi,
>> > > > >
>> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
>> > > > >
>> > > > > electrons.com> 写到:
>> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> > > > >> >
>> > > > >> >SoCs,
>> > > > >> >
>> > > > >> >> but with some different points about clocks:
>> > > > >> >> - It has a mod clock and a bus clock.
>> > > > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > > > >> >
>> > > > >> >Why?
>> > > > >>
>> > > > >> It's experiment result by Jernej.
>> > > > >>
>> > > > >> The clock rates in BSP kernel is also specially designed
>> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > > >
>> > > > > My experiments and search through BSP code showed that TVE seems to have
>> > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
>> > > > > unit has to be feed with 216 MHz.
>> > > > >
>> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
>> > > > > DE2,
>> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
>> > > > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > > > >
>> > > > > Please note that I don't have any hard evidence to support that, only
>> > > > > experimental data. However, only that explanation make sense to me.
>> > > > >
>> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
>> > > > > base clock. Further experiments are needed to check if there is any
>> > > > > possibility to have other resolutions by manipulating clocks and give
>> > > > > other proper settings. I plan to do that, but not in very near future.
>> > > >
>> > > > You only have composite video output, and those are the only 2 standard
>> > > > resolutions that make any sense.
>> > >
>> > > Right, other resolutions are for VGA.
>> > >
>> > > Anyway, I did some more digging in A10 and R40 datasheets. I think
>> > > that H3 TVE
>> > > unit is something in between. R40 TVE has a setting to select "up
>> > > sample".
>> >
>> > That might be just another translation of oversampling :)
>> >
>> > I didn't know it could be applied to composite signals though, but I
>> > guess this is just another analog signal after all.
>> >
>> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> > > driver on R40
>> > > has this setting enabled only for PAL and NTSC and it is always 216
>> > > MHz. I
>> > > think that H3 may have this hardwired to 216 MHz and this would be
>> > > the reason
>> > > why 216 MHz is needed.
>> > >
>> > > Has anyone else any better explanation?
>> >
>> > That's already a pretty good one.
>> >
>> > Either way, wether this is upsampling, oversampling or just a
>> > pre-divider, this can and should be dealt with in the mode_set
>> > callback, and not in the probe.
>> 
>> I got a better idea -- let TVE driver have the CLK_TVE as an
>> input and create a subclock output with divider 16, and feed this
>> subclock to TCON lcd-ch1.
>> 
>> This is a model of the real hardware -- the clock divider is in
>> TVE, not TCON.
> 
> That's definitely not a good representation of the hardware. There's
> one clock, it goes to the TCON, period.
> 
> However, the TV encoder has a constraint on that clock rate. This can
> be easily implemented using a custom encoder state where you'd set the
> multiplier to set on that clock, and the TCON will use it.

P.S. how to do such a custom state?

Should I do the multiplying in sun4i_tv_mode_to_drm_mode?

> 
> Maxime
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-04 14:29                     ` icenowy at aosc.io
  0 siblings, 0 replies; 159+ messages in thread
From: icenowy at aosc.io @ 2017-06-04 14:29 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-05-24 15:30?Maxime Ripard ???
> On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
>> ? 2017-05-23 20:53?Maxime Ripard ???
>> > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
>> > > Hi,
>> > >
>> > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
>> > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net>
>> > > wrote:
>> > > > > Hi,
>> > > > >
>> > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
>> > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
>> > > > >
>> > > > > electrons.com> ??:
>> > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
>> > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
>> > > > >> >
>> > > > >> >SoCs,
>> > > > >> >
>> > > > >> >> but with some different points about clocks:
>> > > > >> >> - It has a mod clock and a bus clock.
>> > > > >> >> - The mod clock must be at a fixed rate to generate signal.
>> > > > >> >
>> > > > >> >Why?
>> > > > >>
>> > > > >> It's experiment result by Jernej.
>> > > > >>
>> > > > >> The clock rates in BSP kernel is also specially designed
>> > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
>> > > > >
>> > > > > My experiments and search through BSP code showed that TVE seems to have
>> > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
>> > > > > unit has to be feed with 216 MHz.
>> > > > >
>> > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
>> > > > > DE2,
>> > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
>> > > > > This clock is then divided by 8 internaly to get final 27 MHz.
>> > > > >
>> > > > > Please note that I don't have any hard evidence to support that, only
>> > > > > experimental data. However, only that explanation make sense to me.
>> > > > >
>> > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
>> > > > > base clock. Further experiments are needed to check if there is any
>> > > > > possibility to have other resolutions by manipulating clocks and give
>> > > > > other proper settings. I plan to do that, but not in very near future.
>> > > >
>> > > > You only have composite video output, and those are the only 2 standard
>> > > > resolutions that make any sense.
>> > >
>> > > Right, other resolutions are for VGA.
>> > >
>> > > Anyway, I did some more digging in A10 and R40 datasheets. I think
>> > > that H3 TVE
>> > > unit is something in between. R40 TVE has a setting to select "up
>> > > sample".
>> >
>> > That might be just another translation of oversampling :)
>> >
>> > I didn't know it could be applied to composite signals though, but I
>> > guess this is just another analog signal after all.
>> >
>> > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
>> > > driver on R40
>> > > has this setting enabled only for PAL and NTSC and it is always 216
>> > > MHz. I
>> > > think that H3 may have this hardwired to 216 MHz and this would be
>> > > the reason
>> > > why 216 MHz is needed.
>> > >
>> > > Has anyone else any better explanation?
>> >
>> > That's already a pretty good one.
>> >
>> > Either way, wether this is upsampling, oversampling or just a
>> > pre-divider, this can and should be dealt with in the mode_set
>> > callback, and not in the probe.
>> 
>> I got a better idea -- let TVE driver have the CLK_TVE as an
>> input and create a subclock output with divider 16, and feed this
>> subclock to TCON lcd-ch1.
>> 
>> This is a model of the real hardware -- the clock divider is in
>> TVE, not TCON.
> 
> That's definitely not a good representation of the hardware. There's
> one clock, it goes to the TCON, period.
> 
> However, the TV encoder has a constraint on that clock rate. This can
> be easily implemented using a custom encoder state where you'd set the
> multiplier to set on that clock, and the TCON will use it.

P.S. how to do such a custom state?

Should I do the multiplying in sun4i_tv_mode_to_drm_mode?

> 
> Maxime
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-07  7:58                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-07  7:58 UTC (permalink / raw)
  To: icenowy
  Cc: devicetree, Jernej Škrabec, linux-sunxi, dri-devel,
	linux-kernel, wens, Rob Herring, linux-clk, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 4996 bytes --]

On Sun, Jun 04, 2017 at 10:29:29PM +0800, icenowy@aosc.io wrote:
> 在 2017-05-24 15:30,Maxime Ripard 写道:
> > On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy@aosc.io wrote:
> > > 在 2017-05-23 20:53,Maxime Ripard 写道:
> > > > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > > > Hi,
> > > > >
> > > > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec@siol.net>
> > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > > > >
> > > > > > > electrons.com> 写到:
> > > > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > > > >> >
> > > > > > >> >SoCs,
> > > > > > >> >
> > > > > > >> >> but with some different points about clocks:
> > > > > > >> >> - It has a mod clock and a bus clock.
> > > > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > > > >> >
> > > > > > >> >Why?
> > > > > > >>
> > > > > > >> It's experiment result by Jernej.
> > > > > > >>
> > > > > > >> The clock rates in BSP kernel is also specially designed
> > > > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > > > >
> > > > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > > > unit has to be feed with 216 MHz.
> > > > > > >
> > > > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > > > DE2,
> > > > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > > > >
> > > > > > > Please note that I don't have any hard evidence to support that, only
> > > > > > > experimental data. However, only that explanation make sense to me.
> > > > > > >
> > > > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > > > base clock. Further experiments are needed to check if there is any
> > > > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > > > other proper settings. I plan to do that, but not in very near future.
> > > > > >
> > > > > > You only have composite video output, and those are the only 2 standard
> > > > > > resolutions that make any sense.
> > > > >
> > > > > Right, other resolutions are for VGA.
> > > > >
> > > > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > > > that H3 TVE
> > > > > unit is something in between. R40 TVE has a setting to select "up
> > > > > sample".
> > > >
> > > > That might be just another translation of oversampling :)
> > > >
> > > > I didn't know it could be applied to composite signals though, but I
> > > > guess this is just another analog signal after all.
> > > >
> > > > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > > > driver on R40
> > > > > has this setting enabled only for PAL and NTSC and it is always 216
> > > > > MHz. I
> > > > > think that H3 may have this hardwired to 216 MHz and this would be
> > > > > the reason
> > > > > why 216 MHz is needed.
> > > > >
> > > > > Has anyone else any better explanation?
> > > >
> > > > That's already a pretty good one.
> > > >
> > > > Either way, wether this is upsampling, oversampling or just a
> > > > pre-divider, this can and should be dealt with in the mode_set
> > > > callback, and not in the probe.
> > > 
> > > I got a better idea -- let TVE driver have the CLK_TVE as an
> > > input and create a subclock output with divider 16, and feed this
> > > subclock to TCON lcd-ch1.
> > > 
> > > This is a model of the real hardware -- the clock divider is in
> > > TVE, not TCON.
> > 
> > That's definitely not a good representation of the hardware. There's
> > one clock, it goes to the TCON, period.
> > 
> > However, the TV encoder has a constraint on that clock rate. This can
> > be easily implemented using a custom encoder state where you'd set the
> > multiplier to set on that clock, and the TCON will use it.
> 
> P.S. how to do such a custom state?
> 
> Should I do the multiplying in sun4i_tv_mode_to_drm_mode?

You have an example of that in ebd14afe8fa7, but it basically boils
down to:
  - Create a structure subclassing drm_connector_state
  - Adding your own reset and atomic_duplicate_state callback
  - In the atomic_check, change the state to set the pre-divider, and
    then use it in TCON's mode_set.

Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* Re: Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-07  7:58                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-07  7:58 UTC (permalink / raw)
  To: icenowy-h8G6r0blFSE
  Cc: devicetree, Jernej Škrabec,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, dri-devel, linux-kernel,
	wens-jdAy2FN1RRM, Rob Herring, linux-clk, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 5380 bytes --]

On Sun, Jun 04, 2017 at 10:29:29PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> 在 2017-05-24 15:30,Maxime Ripard 写道:
> > On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> > > 在 2017-05-23 20:53,Maxime Ripard 写道:
> > > > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej Škrabec wrote:
> > > > > Hi,
> > > > >
> > > > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > > > On Sat, May 20, 2017 at 2:23 AM, Jernej Škrabec <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
> > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > > > >> 于 2017年5月20日 GMT+08:00 上午2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > > > >
> > > > > > > electrons.com> 写到:
> > > > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > > > >> >
> > > > > > >> >SoCs,
> > > > > > >> >
> > > > > > >> >> but with some different points about clocks:
> > > > > > >> >> - It has a mod clock and a bus clock.
> > > > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > > > >> >
> > > > > > >> >Why?
> > > > > > >>
> > > > > > >> It's experiment result by Jernej.
> > > > > > >>
> > > > > > >> The clock rates in BSP kernel is also specially designed
> > > > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > > > >
> > > > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > > > unit has to be feed with 216 MHz.
> > > > > > >
> > > > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > > > DE2,
> > > > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > > > >
> > > > > > > Please note that I don't have any hard evidence to support that, only
> > > > > > > experimental data. However, only that explanation make sense to me.
> > > > > > >
> > > > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > > > base clock. Further experiments are needed to check if there is any
> > > > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > > > other proper settings. I plan to do that, but not in very near future.
> > > > > >
> > > > > > You only have composite video output, and those are the only 2 standard
> > > > > > resolutions that make any sense.
> > > > >
> > > > > Right, other resolutions are for VGA.
> > > > >
> > > > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > > > that H3 TVE
> > > > > unit is something in between. R40 TVE has a setting to select "up
> > > > > sample".
> > > >
> > > > That might be just another translation of oversampling :)
> > > >
> > > > I didn't know it could be applied to composite signals though, but I
> > > > guess this is just another analog signal after all.
> > > >
> > > > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > > > driver on R40
> > > > > has this setting enabled only for PAL and NTSC and it is always 216
> > > > > MHz. I
> > > > > think that H3 may have this hardwired to 216 MHz and this would be
> > > > > the reason
> > > > > why 216 MHz is needed.
> > > > >
> > > > > Has anyone else any better explanation?
> > > >
> > > > That's already a pretty good one.
> > > >
> > > > Either way, wether this is upsampling, oversampling or just a
> > > > pre-divider, this can and should be dealt with in the mode_set
> > > > callback, and not in the probe.
> > > 
> > > I got a better idea -- let TVE driver have the CLK_TVE as an
> > > input and create a subclock output with divider 16, and feed this
> > > subclock to TCON lcd-ch1.
> > > 
> > > This is a model of the real hardware -- the clock divider is in
> > > TVE, not TCON.
> > 
> > That's definitely not a good representation of the hardware. There's
> > one clock, it goes to the TCON, period.
> > 
> > However, the TV encoder has a constraint on that clock rate. This can
> > be easily implemented using a custom encoder state where you'd set the
> > multiplier to set on that clock, and the TCON will use it.
> 
> P.S. how to do such a custom state?
> 
> Should I do the multiplying in sun4i_tv_mode_to_drm_mode?

You have an example of that in ebd14afe8fa7, but it basically boils
down to:
  - Create a structure subclassing drm_connector_state
  - Adding your own reset and atomic_duplicate_state callback
  - In the atomic_check, change the state to set the pre-divider, and
    then use it in TCON's mode_set.

Maxime

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

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 159+ messages in thread

* [linux-sunxi] Re: [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC
@ 2017-06-07  7:58                       ` Maxime Ripard
  0 siblings, 0 replies; 159+ messages in thread
From: Maxime Ripard @ 2017-06-07  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 04, 2017 at 10:29:29PM +0800, icenowy at aosc.io wrote:
> ? 2017-05-24 15:30?Maxime Ripard ???
> > On Tue, May 23, 2017 at 09:00:59PM +0800, icenowy at aosc.io wrote:
> > > ? 2017-05-23 20:53?Maxime Ripard ???
> > > > On Mon, May 22, 2017 at 07:55:56PM +0200, Jernej ?krabec wrote:
> > > > > Hi,
> > > > >
> > > > > Dne sobota, 20. maj 2017 ob 03:37:53 CEST je Chen-Yu Tsai napisal(a):
> > > > > > On Sat, May 20, 2017 at 2:23 AM, Jernej ?krabec <jernej.skrabec@siol.net>
> > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > Dne petek, 19. maj 2017 ob 20:08:18 CEST je Icenowy Zheng napisal(a):
> > > > > > >> ? 2017?5?20? GMT+08:00 ??2:03:30, Maxime Ripard <maxime.ripard@free-
> > > > > > >
> > > > > > > electrons.com> ??:
> > > > > > >> >On Thu, May 18, 2017 at 12:43:50AM +0800, Icenowy Zheng wrote:
> > > > > > >> >> Allwinner H3 features a TV encoder similar to the one in earlier
> > > > > > >> >
> > > > > > >> >SoCs,
> > > > > > >> >
> > > > > > >> >> but with some different points about clocks:
> > > > > > >> >> - It has a mod clock and a bus clock.
> > > > > > >> >> - The mod clock must be at a fixed rate to generate signal.
> > > > > > >> >
> > > > > > >> >Why?
> > > > > > >>
> > > > > > >> It's experiment result by Jernej.
> > > > > > >>
> > > > > > >> The clock rates in BSP kernel is also specially designed
> > > > > > >> (PLL_DE at 432MHz) in order to be able to feed the TVE.
> > > > > > >
> > > > > > > My experiments and search through BSP code showed that TVE seems to have
> > > > > > > additional fixed predivider 8. So if you want to generate 27 MHz clock,
> > > > > > > unit has to be feed with 216 MHz.
> > > > > > >
> > > > > > > TVE has only one PLL source PLL_DE. And since 216 MHz is a bit low for
> > > > > > > DE2,
> > > > > > > BSP defaults to 432 MHz for PLL_DE and use divider 2 to generate 216 MHz.
> > > > > > > This clock is then divided by 8 internaly to get final 27 MHz.
> > > > > > >
> > > > > > > Please note that I don't have any hard evidence to support that, only
> > > > > > > experimental data. However, only that explanation make sense to me.
> > > > > > >
> > > > > > > BTW, BSP H3/H5 TV driver supports only PAL and NTSC which both use 27 MHz
> > > > > > > base clock. Further experiments are needed to check if there is any
> > > > > > > possibility to have other resolutions by manipulating clocks and give
> > > > > > > other proper settings. I plan to do that, but not in very near future.
> > > > > >
> > > > > > You only have composite video output, and those are the only 2 standard
> > > > > > resolutions that make any sense.
> > > > >
> > > > > Right, other resolutions are for VGA.
> > > > >
> > > > > Anyway, I did some more digging in A10 and R40 datasheets. I think
> > > > > that H3 TVE
> > > > > unit is something in between. R40 TVE has a setting to select "up
> > > > > sample".
> > > >
> > > > That might be just another translation of oversampling :)
> > > >
> > > > I didn't know it could be applied to composite signals though, but I
> > > > guess this is just another analog signal after all.
> > > >
> > > > > Possible settings are 27 MHz, 54 MHz, 108 MHz and 216 MHz. BSP
> > > > > driver on R40
> > > > > has this setting enabled only for PAL and NTSC and it is always 216
> > > > > MHz. I
> > > > > think that H3 may have this hardwired to 216 MHz and this would be
> > > > > the reason
> > > > > why 216 MHz is needed.
> > > > >
> > > > > Has anyone else any better explanation?
> > > >
> > > > That's already a pretty good one.
> > > >
> > > > Either way, wether this is upsampling, oversampling or just a
> > > > pre-divider, this can and should be dealt with in the mode_set
> > > > callback, and not in the probe.
> > > 
> > > I got a better idea -- let TVE driver have the CLK_TVE as an
> > > input and create a subclock output with divider 16, and feed this
> > > subclock to TCON lcd-ch1.
> > > 
> > > This is a model of the real hardware -- the clock divider is in
> > > TVE, not TCON.
> > 
> > That's definitely not a good representation of the hardware. There's
> > one clock, it goes to the TCON, period.
> > 
> > However, the TV encoder has a constraint on that clock rate. This can
> > be easily implemented using a custom encoder state where you'd set the
> > multiplier to set on that clock, and the TCON will use it.
> 
> P.S. how to do such a custom state?
> 
> Should I do the multiplying in sun4i_tv_mode_to_drm_mode?

You have an example of that in ebd14afe8fa7, but it basically boils
down to:
  - Create a structure subclassing drm_connector_state
  - Adding your own reset and atomic_duplicate_state callback
  - In the atomic_check, change the state to set the pre-divider, and
    then use it in TCON's mode_set.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170607/c0bd0814/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 159+ messages in thread

end of thread, other threads:[~2017-06-07  7:58 UTC | newest]

Thread overview: 159+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 16:43 [RFC PATCH 00/11] Support for H3 Composite Output support Icenowy Zheng
2017-05-17 16:43 ` Icenowy Zheng
2017-05-17 16:43 ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 01/11] dt-bindings: update the binding for Allwinner H3 TVE support Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-19 18:02   ` Maxime Ripard
2017-05-19 18:02     ` Maxime Ripard
2017-05-19 18:02     ` Maxime Ripard
2017-05-19 18:02     ` Maxime Ripard
2017-05-19 18:06     ` Icenowy Zheng
2017-05-19 18:06       ` Icenowy Zheng
2017-05-19 18:06       ` Icenowy Zheng
2017-05-19 18:06       ` Icenowy Zheng
2017-05-20  2:01       ` [linux-sunxi] " Chen-Yu Tsai
2017-05-20  2:01         ` Chen-Yu Tsai
2017-05-20  2:01         ` Chen-Yu Tsai
2017-05-17 16:43 ` [RFC PATCH 02/11] drm: sun4i: add support for H3 mixers Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-19 17:47   ` Maxime Ripard
2017-05-19 17:47     ` Maxime Ripard
2017-05-19 17:47     ` Maxime Ripard
2017-05-19 17:47     ` Maxime Ripard
2017-05-19 17:49     ` [linux-sunxi] " Icenowy Zheng
2017-05-19 17:49       ` Icenowy Zheng
2017-05-19 17:49       ` Icenowy Zheng
2017-05-19 17:49       ` Icenowy Zheng
2017-05-19 18:00       ` [linux-sunxi] " Jernej Škrabec
2017-05-19 18:00         ` Jernej Škrabec
2017-05-19 18:00         ` Jernej Škrabec
2017-05-19 18:00         ` Jernej Škrabec
2017-05-17 16:43 ` [RFC PATCH 03/11] drm: sun4i: ignore swapped mixer<->tcon connection for DE2 Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-19 17:57   ` Maxime Ripard
2017-05-19 17:57     ` Maxime Ripard
2017-05-19 17:57     ` Maxime Ripard
2017-05-19 18:00     ` Icenowy Zheng
2017-05-19 18:00       ` Icenowy Zheng
2017-05-19 18:00       ` Icenowy Zheng
2017-05-19 18:00       ` Icenowy Zheng
2017-05-24  8:14       ` Maxime Ripard
2017-05-24  8:14         ` Maxime Ripard
2017-05-24  8:14         ` Maxime Ripard
2017-05-24  8:14         ` Maxime Ripard
2017-06-04 14:19         ` icenowy
2017-06-04 14:19           ` icenowy at aosc.io
2017-05-17 16:43 ` [RFC PATCH 04/11] drm: sun4i: add support for H3's TCON0/1 Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 05/11] drm: sun4i: add compatible for H3 display engine Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 06/11] drm: sun4i: add color space correction support for DE2 mixer Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 20:14   ` [linux-sunxi] " Jernej Škrabec
2017-05-17 20:14     ` Jernej Škrabec
2017-05-17 20:14     ` Jernej Škrabec
2017-05-17 20:14     ` Jernej Škrabec
2017-05-17 16:43 ` [RFC PATCH 07/11] drm: sun4i: add support for the TV encoder in H3 SoC Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-19 18:03   ` Maxime Ripard
2017-05-19 18:03     ` Maxime Ripard
2017-05-19 18:03     ` Maxime Ripard
2017-05-19 18:03     ` Maxime Ripard
2017-05-19 18:08     ` Icenowy Zheng
2017-05-19 18:08       ` Icenowy Zheng
2017-05-19 18:08       ` Icenowy Zheng
2017-05-19 18:08       ` Icenowy Zheng
2017-05-19 18:23       ` [linux-sunxi] " Jernej Škrabec
2017-05-19 18:23         ` Jernej Škrabec
2017-05-19 18:23         ` Jernej Škrabec
2017-05-19 18:23         ` Jernej Škrabec
2017-05-20  1:37         ` [linux-sunxi] " Chen-Yu Tsai
2017-05-20  1:37           ` Chen-Yu Tsai
2017-05-20  1:37           ` Chen-Yu Tsai
2017-05-20  1:37           ` Chen-Yu Tsai
2017-05-22 17:55           ` [linux-sunxi] " Jernej Škrabec
2017-05-22 17:55             ` Jernej Škrabec
2017-05-22 17:55             ` Jernej Škrabec
2017-05-23 12:53             ` [linux-sunxi] " Maxime Ripard
2017-05-23 12:53               ` Maxime Ripard
2017-05-23 12:53               ` Maxime Ripard
2017-05-23 12:56               ` [linux-sunxi] " Icenowy Zheng
2017-05-23 12:56                 ` Icenowy Zheng
2017-05-23 12:56                 ` Icenowy Zheng
2017-05-23 13:00               ` icenowy
2017-05-23 13:00                 ` icenowy at aosc.io
2017-05-24  7:30                 ` Maxime Ripard
2017-05-24  7:30                   ` Maxime Ripard
2017-05-24  7:30                   ` Maxime Ripard
2017-05-24  8:25                   ` [linux-sunxi] " Icenowy Zheng
2017-05-24  8:25                     ` Icenowy Zheng
2017-05-24  8:25                     ` Icenowy Zheng
2017-05-24 15:23                     ` Jernej Škrabec
2017-05-24 15:23                       ` Jernej Škrabec
2017-05-24 15:23                       ` Jernej Škrabec
2017-05-31 18:43                     ` [linux-sunxi] " Maxime Ripard
2017-05-31 18:43                       ` Maxime Ripard
2017-05-31 18:43                       ` Maxime Ripard
2017-06-01 14:11                       ` [linux-sunxi] " icenowy
2017-06-01 14:11                         ` icenowy at aosc.io
2017-06-01 14:11                         ` icenowy-h8G6r0blFSE
2017-06-02 22:21                         ` [linux-sunxi] " Maxime Ripard
2017-06-02 22:21                           ` Maxime Ripard
2017-06-02 22:21                           ` Maxime Ripard
2017-06-04 14:29                   ` [linux-sunxi] " icenowy
2017-06-04 14:29                     ` icenowy at aosc.io
2017-06-07  7:58                     ` Maxime Ripard
2017-06-07  7:58                       ` Maxime Ripard
2017-06-07  7:58                       ` Maxime Ripard
2017-05-17 16:43 ` [RFC PATCH 08/11] clk: sunxi-ng: allow CLK_DE to set CLK_PLL_DE for H3 Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 09/11] clk: sunxi-ng: export " Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 10/11] ARM: sun8i: h3: add display engine pipeline for TVE Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 20:19   ` [linux-sunxi] " Jernej Škrabec
2017-05-17 20:19     ` Jernej Škrabec
2017-05-17 20:19     ` Jernej Škrabec
2017-05-19 18:06   ` Maxime Ripard
2017-05-19 18:06     ` Maxime Ripard
2017-05-19 18:06     ` Maxime Ripard
2017-05-19 18:10     ` [linux-sunxi] " Icenowy Zheng
2017-05-19 18:10       ` Icenowy Zheng
2017-05-19 18:10       ` Icenowy Zheng
2017-05-19 18:10       ` Icenowy Zheng
2017-05-24  8:19       ` [linux-sunxi] " Maxime Ripard
2017-05-24  8:19         ` Maxime Ripard
2017-05-24  8:19         ` Maxime Ripard
2017-05-24  5:24   ` [linux-sunxi] " Chen-Yu Tsai
2017-05-24  5:24     ` Chen-Yu Tsai
2017-05-24  5:24     ` Chen-Yu Tsai
2017-05-24  5:28     ` [linux-sunxi] " Icenowy Zheng
2017-05-24  5:28       ` Icenowy Zheng
2017-05-24  5:28       ` Icenowy Zheng
2017-05-24  5:34       ` Chen-Yu Tsai
2017-05-24  5:34         ` Chen-Yu Tsai
2017-05-24  5:34         ` Chen-Yu Tsai
2017-05-24  5:36         ` [linux-sunxi] " Icenowy Zheng
2017-05-24  5:36           ` Icenowy Zheng
2017-05-24  5:36           ` Icenowy Zheng
2017-05-17 16:43 ` [RFC PATCH 11/11] [DO NOT MERGE] ARM: sun8i: h3: enable TV output on Orange Pi PC Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng
2017-05-17 16:43   ` Icenowy Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.