Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477471 > unrolled thread

[PATCH v2 0/9] drm/sun4i: Introduce A33 display driver

Started byMaxime Ripard <maxime.ripard@free-electrons.com>
First post2016-09-06 16:50 +0200
Last post2016-09-08 22:20 +0200
Articles 13 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/9] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:50 +0200
    [PATCH v2 2/9] drm/sun4i: support A33 tcon Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:50 +0200
      Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon Chen-Yu Tsai <wens@csie.org> - 2016-09-06 17:10 +0200
      Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon Chen-Yu Tsai <wens@csie.org> - 2016-09-06 17:20 +0200
        Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-08 09:30 +0200
    [PATCH v2 1/9] drm/sun4i: support TCONs without channel 1 Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:50 +0200
    [PATCH v2 6/9] drm/panel: Add Netron DY E231732 Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:50 +0200
      Re: [PATCH v2 6/9] drm/panel: Add Netron DY E231732 Chen-Yu Tsai <wens@csie.org> - 2016-09-06 18:10 +0200
    [PATCH v2 4/9] drm/sun4i: Add a DRC driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-06 16:50 +0200
      Re: [PATCH v2 4/9] drm/sun4i: Add a DRC driver Chen-Yu Tsai <wens@csie.org> - 2016-09-06 17:20 +0200
      Re: [linux-sunxi] [PATCH v2 4/9] drm/sun4i: Add a DRC driver Peter Korsgaard <peter@korsgaard.com> - 2016-09-06 22:40 +0200
    Re: [PATCH v2 0/9] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-08 10:20 +0200
    Re: [PATCH v2 0/9] drm/sun4i: Introduce A33 display driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-09-08 22:20 +0200

#1477471 — [PATCH v2 0/9] drm/sun4i: Introduce A33 display driver

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-06 16:50 +0200
Subject[PATCH v2 0/9] drm/sun4i: Introduce A33 display driver
Message-ID<sepRf-3ha-5@gated-at.bofh.it>
Hi everyone,

This serie introduces the support in the sun4i-drm driver for the A33.

Beside the new IPs and special cases for the A33 new IPs, there's
nothing really outstanding, and is now at feature parity with the A13.

This serie is based on my A33 CCU patches posted earlier today here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-September/453208.html

Let me know what you think,
Maxime

Changes from v1:
  - Changed the TCON pins label
  - Changed the TCON compatible as it's different from A23's
  - Merged the SAT into the backend, as it really is part of the same
    block in hardware.
  - Reworded the DRC bindings description
  - Added the backend interrupt to the DT
  - Changed the name of the LCD panel to the actual brand and model
    found on the ribbon

Maxime Ripard (9):
  drm/sun4i: support TCONs without channel 1
  drm/sun4i: support A33 tcon
  drm/sun4i: backend: Handle the SAT
  drm/sun4i: Add a DRC driver
  of: Add vendor prefix for Netron DY
  drm/panel: Add Netron DY E231732
  ARM: sun8i: a33: Add display pipeline
  ARM: sun8i: a23/a33: Add RGB666 pins
  ARM: sun8i: sina33: Enable display

 .../bindings/display/sunxi/sun4i-drm.txt           |  39 +++++-
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/boot/dts/sun8i-a23-a33.dtsi               |  10 ++
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts     |  34 +++++
 arch/arm/boot/dts/sun8i-a33.dtsi                   | 152 +++++++++++++++++++++
 drivers/gpu/drm/panel/panel-simple.c               |  26 ++++
 drivers/gpu/drm/sun4i/Makefile                     |   2 +-
 drivers/gpu/drm/sun4i/sun4i_backend.c              |  61 +++++++++
 drivers/gpu/drm/sun4i/sun4i_backend.h              |   3 +
 drivers/gpu/drm/sun4i/sun4i_drv.c                  |   8 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 |  42 ++++--
 drivers/gpu/drm/sun4i/sun4i_tcon.h                 |   2 +
 drivers/gpu/drm/sun4i/sun6i_drc.c                  | 118 ++++++++++++++++
 13 files changed, 479 insertions(+), 19 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun6i_drc.c

-- 
2.9.3

[toc] | [next] | [standalone]


#1477473 — [PATCH v2 2/9] drm/sun4i: support A33 tcon

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-06 16:50 +0200
Subject[PATCH v2 2/9] drm/sun4i: support A33 tcon
Message-ID<sepRg-3ha-25@gated-at.bofh.it>
In reply to#1477471
The A33 has a significantly different pipeline, with components that differ
too.

Make sure we had compatible for them.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 7 ++++++-
 drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c                             | 8 +++++---
 drivers/gpu/drm/sun4i/sun4i_tcon.c                            | 8 +++++++-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index df8f4aeefe4c..bd3136a5cba5 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -26,7 +26,9 @@ TCON
 The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
 
 Required properties:
- - compatible: value should be "allwinner,sun5i-a13-tcon".
+ - compatible: value must be either:
+   * allwinner,sun5i-a13-tcon
+   * allwinner,sun8i-a33-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:
@@ -59,6 +61,7 @@ system.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-backend
+    * allwinner,sun8i-a33-display-backend
   - reg: base address and size of the memory-mapped region.
   - clocks: phandles to the clocks feeding the frontend and backend
     * ahb: the backend interface clock
@@ -80,6 +83,7 @@ deinterlacing and color space conversion.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-frontend
+    * allwinner,sun8i-a33-display-frontend
   - reg: base address and size of the memory-mapped region.
   - interrupts: interrupt associated to this IP
   - clocks: phandles to the clocks feeding the frontend and backend
@@ -104,6 +108,7 @@ extra node.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun5i-a13-display-engine
+    * allwinner,sun8i-a33-display-engine
 
   - allwinner,pipelines: list of phandle to the display engine
     frontends available.
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 3ab560450a82..9bfd2e45fceb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -345,6 +345,7 @@ static int sun4i_backend_remove(struct platform_device *pdev)
 
 static const struct of_device_id sun4i_backend_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-display-backend" },
+	{ .compatible = "allwinner,sun8i-a33-display-backend" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_backend_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 942f62e2441c..c4d03c1b6db8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -199,13 +199,14 @@ static const struct component_master_ops sun4i_drv_master_ops = {
 
 static bool sun4i_drv_node_is_frontend(struct device_node *node)
 {
-	return of_device_is_compatible(node,
-				       "allwinner,sun5i-a13-display-frontend");
+	return of_device_is_compatible(node, "allwinner,sun5i-a13-display-frontend") ||
+		of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
 }
 
 static bool sun4i_drv_node_is_tcon(struct device_node *node)
 {
-	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon");
+	return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
+		of_device_is_compatible(node, "allwinner,sun8i-a33-tcon");
 }
 
 static int compare_of(struct device *dev, void *data)
@@ -320,6 +321,7 @@ static int sun4i_drv_remove(struct platform_device *pdev)
 
 static const struct of_device_id sun4i_drv_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-display-engine" },
+	{ .compatible = "allwinner,sun8i-a33-display-engine" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_drv_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index fde6af1230d2..cadacb517f95 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -488,8 +488,13 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	tcon->drm = drm;
 	tcon->dev = dev;
 
-	if (of_device_is_compatible(dev->of_node, "allwinner,sun5i-a13-tcon"))
+	if (of_device_is_compatible(dev->of_node, "allwinner,sun5i-a13-tcon")) {
 		tcon->has_mux = true;
+		tcon->has_channel_1 = true;
+	} else {
+		tcon->has_mux = false;
+		tcon->has_channel_1 = false;
+	}
 
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
@@ -585,6 +590,7 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
 
 static const struct of_device_id sun4i_tcon_of_table[] = {
 	{ .compatible = "allwinner,sun5i-a13-tcon" },
+	{ .compatible = "allwinner,sun8i-a33-tcon" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1477486 — Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon

FromChen-Yu Tsai <wens@csie.org>
Date2016-09-06 17:10 +0200
SubjectRe: [PATCH v2 2/9] drm/sun4i: support A33 tcon
Message-ID<seqaB-3Da-1@gated-at.bofh.it>
In reply to#1477473
On Tue, Sep 6, 2016 at 10:46 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The A33 has a significantly different pipeline, with components that differ
> too.
>
> Make sure we had compatible for them.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

> ---
>  Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 7 ++++++-
>  drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
>  drivers/gpu/drm/sun4i/sun4i_drv.c                             | 8 +++++---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c                            | 8 +++++++-
>  4 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> index df8f4aeefe4c..bd3136a5cba5 100644
> --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> @@ -26,7 +26,9 @@ TCON
>  The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
>
>  Required properties:
> - - compatible: value should be "allwinner,sun5i-a13-tcon".
> + - compatible: value must be either:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun8i-a33-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:
> @@ -59,6 +61,7 @@ system.
>  Required properties:
>    - compatible: value must be one of:
>      * allwinner,sun5i-a13-display-backend
> +    * allwinner,sun8i-a33-display-backend
>    - reg: base address and size of the memory-mapped region.
>    - clocks: phandles to the clocks feeding the frontend and backend
>      * ahb: the backend interface clock
> @@ -80,6 +83,7 @@ deinterlacing and color space conversion.
>  Required properties:
>    - compatible: value must be one of:
>      * allwinner,sun5i-a13-display-frontend
> +    * allwinner,sun8i-a33-display-frontend
>    - reg: base address and size of the memory-mapped region.
>    - interrupts: interrupt associated to this IP
>    - clocks: phandles to the clocks feeding the frontend and backend
> @@ -104,6 +108,7 @@ extra node.
>  Required properties:
>    - compatible: value must be one of:
>      * allwinner,sun5i-a13-display-engine
> +    * allwinner,sun8i-a33-display-engine
>
>    - allwinner,pipelines: list of phandle to the display engine
>      frontends available.
> diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
> index 3ab560450a82..9bfd2e45fceb 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_backend.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
> @@ -345,6 +345,7 @@ static int sun4i_backend_remove(struct platform_device *pdev)
>
>  static const struct of_device_id sun4i_backend_of_table[] = {
>         { .compatible = "allwinner,sun5i-a13-display-backend" },
> +       { .compatible = "allwinner,sun8i-a33-display-backend" },
>         { }
>  };
>  MODULE_DEVICE_TABLE(of, sun4i_backend_of_table);
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 942f62e2441c..c4d03c1b6db8 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -199,13 +199,14 @@ static const struct component_master_ops sun4i_drv_master_ops = {
>
>  static bool sun4i_drv_node_is_frontend(struct device_node *node)
>  {
> -       return of_device_is_compatible(node,
> -                                      "allwinner,sun5i-a13-display-frontend");
> +       return of_device_is_compatible(node, "allwinner,sun5i-a13-display-frontend") ||
> +               of_device_is_compatible(node, "allwinner,sun8i-a33-display-frontend");
>  }
>
>  static bool sun4i_drv_node_is_tcon(struct device_node *node)
>  {
> -       return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon");
> +       return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
> +               of_device_is_compatible(node, "allwinner,sun8i-a33-tcon");
>  }

The list is going to grow to about 6 entries or so... I wonder if there is
a better way. :(

>  static int compare_of(struct device *dev, void *data)
> @@ -320,6 +321,7 @@ static int sun4i_drv_remove(struct platform_device *pdev)
>
>  static const struct of_device_id sun4i_drv_of_table[] = {
>         { .compatible = "allwinner,sun5i-a13-display-engine" },
> +       { .compatible = "allwinner,sun8i-a33-display-engine" },
>         { }
>  };
>  MODULE_DEVICE_TABLE(of, sun4i_drv_of_table);
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index fde6af1230d2..cadacb517f95 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -488,8 +488,13 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
>         tcon->drm = drm;
>         tcon->dev = dev;
>
> -       if (of_device_is_compatible(dev->of_node, "allwinner,sun5i-a13-tcon"))
> +       if (of_device_is_compatible(dev->of_node, "allwinner,sun5i-a13-tcon")) {
>                 tcon->has_mux = true;
> +               tcon->has_channel_1 = true;
> +       } else {
> +               tcon->has_mux = false;
> +               tcon->has_channel_1 = false;
> +       }
>
>         tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
>         if (IS_ERR(tcon->lcd_rst)) {
> @@ -585,6 +590,7 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
>
>  static const struct of_device_id sun4i_tcon_of_table[] = {
>         { .compatible = "allwinner,sun5i-a13-tcon" },
> +       { .compatible = "allwinner,sun8i-a33-tcon" },
>         { }
>  };
>  MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
> --
> 2.9.3
>

[toc] | [prev] | [next] | [standalone]


#1477497 — Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon

FromChen-Yu Tsai <wens@csie.org>
Date2016-09-06 17:20 +0200
SubjectRe: [PATCH v2 2/9] drm/sun4i: support A33 tcon
Message-ID<seqkh-3Gd-9@gated-at.bofh.it>
In reply to#1477473
On Tue, Sep 6, 2016 at 10:46 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The A33 has a significantly different pipeline, with components that differ
> too.
>
> Make sure we had compatible for them.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 7 ++++++-
>  drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
>  drivers/gpu/drm/sun4i/sun4i_drv.c                             | 8 +++++---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c                            | 8 +++++++-
>  4 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> index df8f4aeefe4c..bd3136a5cba5 100644
> --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> @@ -26,7 +26,9 @@ TCON
>  The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
>
>  Required properties:
> - - compatible: value should be "allwinner,sun5i-a13-tcon".
> + - compatible: value must be either:
> +   * allwinner,sun5i-a13-tcon
> +   * allwinner,sun8i-a33-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:

You should probably put a note saying the A33 only needs 2 clocks.
You can keep my ack after fixing it.

ChenYu

[toc] | [prev] | [next] | [standalone]


#1478862 — Re: [PATCH v2 2/9] drm/sun4i: support A33 tcon

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-08 09:30 +0200
SubjectRe: [PATCH v2 2/9] drm/sun4i: support A33 tcon
Message-ID<sf1Wx-2Ly-9@gated-at.bofh.it>
In reply to#1477497

[Multipart message — attachments visible in raw view] — view raw

On Tue, Sep 06, 2016 at 11:16:33PM +0800, Chen-Yu Tsai wrote:
> On Tue, Sep 6, 2016 at 10:46 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > The A33 has a significantly different pipeline, with components that differ
> > too.
> >
> > Make sure we had compatible for them.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 7 ++++++-
> >  drivers/gpu/drm/sun4i/sun4i_backend.c                         | 1 +
> >  drivers/gpu/drm/sun4i/sun4i_drv.c                             | 8 +++++---
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c                            | 8 +++++++-
> >  4 files changed, 19 insertions(+), 5 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > index df8f4aeefe4c..bd3136a5cba5 100644
> > --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > @@ -26,7 +26,9 @@ TCON
> >  The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
> >
> >  Required properties:
> > - - compatible: value should be "allwinner,sun5i-a13-tcon".
> > + - compatible: value must be either:
> > +   * allwinner,sun5i-a13-tcon
> > +   * allwinner,sun8i-a33-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:
> 
> You should probably put a note saying the A33 only needs 2 clocks.
> You can keep my ack after fixing it.

I did while applying, thanks!
Maxime

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

[toc] | [prev] | [next] | [standalone]


#1477474 — [PATCH v2 1/9] drm/sun4i: support TCONs without channel 1

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-06 16:50 +0200
Subject[PATCH v2 1/9] drm/sun4i: support TCONs without channel 1
Message-ID<sepRg-3ha-27@gated-at.bofh.it>
In reply to#1477471
Some Allwinner SoCs, such as the A33, have a variation of the TCON that
doesn't have a second channel (or it is not wired to anything).

Make sure we can handle that case.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 34 +++++++++++++++++++++-------------
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 9180e7e7b551..fde6af1230d2 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -59,11 +59,13 @@ void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
 				   SUN4I_TCON0_CTL_TCON_ENABLE, 0);
 		clk_disable_unprepare(tcon->dclk);
-	} else if (channel == 1) {
-		regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
-				   SUN4I_TCON1_CTL_TCON_ENABLE, 0);
-		clk_disable_unprepare(tcon->sclk1);
+		return;
 	}
+
+	WARN_ON(!tcon->has_channel_1);
+	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
+			   SUN4I_TCON1_CTL_TCON_ENABLE, 0);
+	clk_disable_unprepare(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
@@ -75,12 +77,14 @@ void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 				   SUN4I_TCON0_CTL_TCON_ENABLE,
 				   SUN4I_TCON0_CTL_TCON_ENABLE);
 		clk_prepare_enable(tcon->dclk);
-	} else if (channel == 1) {
-		regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
-				   SUN4I_TCON1_CTL_TCON_ENABLE,
-				   SUN4I_TCON1_CTL_TCON_ENABLE);
-		clk_prepare_enable(tcon->sclk1);
+		return;
 	}
+
+	WARN_ON(!tcon->has_channel_1);
+	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
+			   SUN4I_TCON1_CTL_TCON_ENABLE,
+			   SUN4I_TCON1_CTL_TCON_ENABLE);
+	clk_prepare_enable(tcon->sclk1);
 }
 EXPORT_SYMBOL(sun4i_tcon_channel_enable);
 
@@ -198,6 +202,8 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
 	u8 clk_delay;
 	u32 val;
 
+	WARN_ON(!tcon->has_channel_1);
+
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
 	regmap_update_bits(tcon->regs, SUN4I_TCON1_CTL_REG,
@@ -321,10 +327,12 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 		return PTR_ERR(tcon->sclk0);
 	}
 
-	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");
-		return PTR_ERR(tcon->sclk1);
+	if (tcon->has_channel_1) {
+		tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
+		if (IS_ERR(tcon->sclk1)) {
+			dev_err(dev, "Couldn't get the TCON channel 1 clock\n");
+			return PTR_ERR(tcon->sclk1);
+		}
 	}
 
 	return sun4i_dclk_create(dev, tcon);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 100bfa093277..12bd48925f4d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -164,6 +164,8 @@ struct sun4i_tcon {
 	bool				has_mux;
 
 	struct drm_panel		*panel;
+
+	bool				has_channel_1;
 };
 
 struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1477480 — [PATCH v2 6/9] drm/panel: Add Netron DY E231732

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-06 16:50 +0200
Subject[PATCH v2 6/9] drm/panel: Add Netron DY E231732
Message-ID<sepRg-3ha-41@gated-at.bofh.it>
In reply to#1477471
The E231732 is a 7" panel with a resolution of 800x480.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/panel/panel-simple.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 85143d1b9b31..85e988b51fbe 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1136,6 +1136,29 @@ static const struct panel_desc nec_nl4827hc19_05b = {
 	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 };
 
+static const struct drm_display_mode netron_dy_e231732_mode = {
+	.clock = 66000,
+	.hdisplay = 1024,
+	.hsync_start = 1024 + 160,
+	.hsync_end = 1024 + 160 + 70,
+	.htotal = 1024 + 160 + 70 + 90,
+	.vdisplay = 600,
+	.vsync_start = 600 + 127,
+	.vsync_end = 600 + 127 + 20,
+	.vtotal = 600 + 127 + 20 + 3,
+	.vrefresh = 60,
+};
+
+static const struct panel_desc netron_dy_e231732 = {
+	.modes = &netron_dy_e231732_mode,
+	.num_modes = 1,
+	.size = {
+		.width = 154,
+		.height = 87,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+};
+
 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
 	.pixelclock = { 30000000, 30000000, 40000000 },
 	.hactive = { 800, 800, 800 },
@@ -1644,6 +1667,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "shelly,sca07010-bfn-lnn",
 		.data = &shelly_sca07010_bfn_lnn,
 	}, {
+		.compatible = "netron-dy,e231732",
+		.data = &netron_dy_e231732,
+	}, {
 		.compatible = "starry,kr122ea0sra",
 		.data = &starry_kr122ea0sra,
 	}, {
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1477574 — Re: [PATCH v2 6/9] drm/panel: Add Netron DY E231732

FromChen-Yu Tsai <wens@csie.org>
Date2016-09-06 18:10 +0200
SubjectRe: [PATCH v2 6/9] drm/panel: Add Netron DY E231732
Message-ID<ser6G-4cc-27@gated-at.bofh.it>
In reply to#1477480
Hi,

On Tue, Sep 6, 2016 at 10:46 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The E231732 is a 7" panel with a resolution of 800x480.

From what I could make out of an archived version of Netron's website
(it's unreachable from my place), they are a manufacturer of printed
ribbon cables, not LCD panels. This is probably a no-go.

On the side, my A23 tablet's LCD ribbon cable only had a model
name, which led me to multiple Aliexpress entries.

ChenYu

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 85143d1b9b31..85e988b51fbe 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -1136,6 +1136,29 @@ static const struct panel_desc nec_nl4827hc19_05b = {
>         .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
>  };
>
> +static const struct drm_display_mode netron_dy_e231732_mode = {
> +       .clock = 66000,
> +       .hdisplay = 1024,
> +       .hsync_start = 1024 + 160,
> +       .hsync_end = 1024 + 160 + 70,
> +       .htotal = 1024 + 160 + 70 + 90,
> +       .vdisplay = 600,
> +       .vsync_start = 600 + 127,
> +       .vsync_end = 600 + 127 + 20,
> +       .vtotal = 600 + 127 + 20 + 3,
> +       .vrefresh = 60,
> +};
> +
> +static const struct panel_desc netron_dy_e231732 = {
> +       .modes = &netron_dy_e231732_mode,
> +       .num_modes = 1,
> +       .size = {
> +               .width = 154,
> +               .height = 87,
> +       },
> +       .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
> +};
> +
>  static const struct display_timing okaya_rs800480t_7x0gp_timing = {
>         .pixelclock = { 30000000, 30000000, 40000000 },
>         .hactive = { 800, 800, 800 },
> @@ -1644,6 +1667,9 @@ static const struct of_device_id platform_of_match[] = {
>                 .compatible = "shelly,sca07010-bfn-lnn",
>                 .data = &shelly_sca07010_bfn_lnn,
>         }, {
> +               .compatible = "netron-dy,e231732",
> +               .data = &netron_dy_e231732,
> +       }, {
>                 .compatible = "starry,kr122ea0sra",
>                 .data = &starry_kr122ea0sra,
>         }, {
> --
> 2.9.3
>

[toc] | [prev] | [next] | [standalone]


#1477481 — [PATCH v2 4/9] drm/sun4i: Add a DRC driver

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-06 16:50 +0200
Subject[PATCH v2 4/9] drm/sun4i: Add a DRC driver
Message-ID<sepRh-3ha-47@gated-at.bofh.it>
In reply to#1477471
The A33 pipeline also has a component called DRC. Even though its exact
features and programming model is not known (or documented), it needs to
be clocked for the pipeline to carry the video signal all the way.

Add a minimal driver for it that just claim the needed resources for the
pipeline to operate properly.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 .../bindings/display/sunxi/sun4i-drm.txt           |  24 +++++
 drivers/gpu/drm/sun4i/Makefile                     |   2 +-
 drivers/gpu/drm/sun4i/sun6i_drc.c                  | 118 +++++++++++++++++++++
 3 files changed, 143 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun6i_drc.c

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index d3529f72ca91..2b8a216790cb 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -51,6 +51,30 @@ Required properties:
   second the block connected to the TCON channel 1 (usually the TV
   encoder)
 
+DRC
+---
+
+The DRC (Dynamic Range Controller), found in the latest Allwinner SoCs
+(A31, A23, A33), allows to dynamically adjust pixel
+brightness/contrast based on histogram measurements for LCD content
+adaptive backlight control.
+
+
+Required properties:
+  - compatible: value must be one of:
+    * allwinner,sun8i-a33-drc
+  - reg: base address and size of the memory-mapped region.
+  - interrupts: interrupt associated to this IP
+  - clocks: phandles to the clocks feeding the DRC
+    * ahb: the DRC interface clock
+    * mod: the DRC module clock
+    * ram: the DRC DRAM clock
+  - clock-names: the clock names mentioned above
+  - resets: phandles to the reset line driving the DRC
+
+- ports: A ports node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt. The
+  first port should be the input endpoints, the second one the outputs
 
 Display Engine Backend
 ----------------------
diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index 58cd55149827..d625a82a6e5f 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -9,5 +9,5 @@ sun4i-tcon-y += sun4i_dotclock.o
 
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i-drm.o sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i_backend.o
-
+obj-$(CONFIG_DRM_SUN4I)		+= sun6i_drc.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i_tv.o
diff --git a/drivers/gpu/drm/sun4i/sun6i_drc.c b/drivers/gpu/drm/sun4i/sun6i_drc.c
new file mode 100644
index 000000000000..bf6d846d8132
--- /dev/null
+++ b/drivers/gpu/drm/sun4i/sun6i_drc.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 Free Electrons
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include <linux/clk.h>
+#include <linux/component.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+
+struct sun6i_drc {
+	struct clk		*bus_clk;
+	struct clk		*mod_clk;
+	struct reset_control	*reset;
+};
+
+static int sun6i_drc_bind(struct device *dev, struct device *master,
+			 void *data)
+{
+	struct sun6i_drc *drc;
+	int ret;
+
+	drc = devm_kzalloc(dev, sizeof(*drc), GFP_KERNEL);
+	if (!drc)
+		return -ENOMEM;
+	dev_set_drvdata(dev, drc);
+
+	drc->reset = devm_reset_control_get(dev, NULL);
+	if (IS_ERR(drc->reset)) {
+		dev_err(dev, "Couldn't get our reset line\n");
+		return PTR_ERR(drc->reset);
+	}
+
+	ret = reset_control_deassert(drc->reset);
+	if (ret) {
+		dev_err(dev, "Couldn't deassert our reset line\n");
+		return ret;
+	}
+
+	drc->bus_clk = devm_clk_get(dev, "ahb");
+	if (IS_ERR(drc->bus_clk)) {
+		dev_err(dev, "Couldn't get our bus clock\n");
+		ret = PTR_ERR(drc->bus_clk);
+		goto err_assert_reset;
+	}
+	clk_prepare_enable(drc->bus_clk);
+
+	drc->mod_clk = devm_clk_get(dev, "mod");
+	if (IS_ERR(drc->mod_clk)) {
+		dev_err(dev, "Couldn't get our mod clock\n");
+		ret = PTR_ERR(drc->mod_clk);
+		goto err_disable_bus_clk;
+	}
+	clk_prepare_enable(drc->mod_clk);
+
+	return 0;
+
+err_disable_bus_clk:
+	clk_disable_unprepare(drc->bus_clk);
+err_assert_reset:
+	reset_control_assert(drc->reset);
+	return ret;
+}
+
+static void sun6i_drc_unbind(struct device *dev, struct device *master,
+			    void *data)
+{
+	struct sun6i_drc *drc = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(drc->mod_clk);
+	clk_disable_unprepare(drc->bus_clk);
+	reset_control_assert(drc->reset);
+}
+
+static struct component_ops sun6i_drc_ops = {
+	.bind	= sun6i_drc_bind,
+	.unbind	= sun6i_drc_unbind,
+};
+
+static int sun6i_drc_probe(struct platform_device *pdev)
+{
+	return component_add(&pdev->dev, &sun6i_drc_ops);
+}
+
+static int sun6i_drc_remove(struct platform_device *pdev)
+{
+	component_del(&pdev->dev, &sun6i_drc_ops);
+
+	return 0;
+}
+
+static const struct of_device_id sun6i_drc_of_table[] = {
+	{ .compatible = "allwinner,sun8i-a33-drc" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sun6i_drc_of_table);
+
+static struct platform_driver sun6i_drc_platform_driver = {
+	.probe		= sun6i_drc_probe,
+	.remove		= sun6i_drc_remove,
+	.driver		= {
+		.name		= "sun6i-drc",
+		.of_match_table	= sun6i_drc_of_table,
+	},
+};
+module_platform_driver(sun6i_drc_platform_driver);
+
+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
+MODULE_DESCRIPTION("Allwinner A31 Dynamic Range Control (DRC) Driver");
+MODULE_LICENSE("GPL");
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1477501 — Re: [PATCH v2 4/9] drm/sun4i: Add a DRC driver

FromChen-Yu Tsai <wens@csie.org>
Date2016-09-06 17:20 +0200
SubjectRe: [PATCH v2 4/9] drm/sun4i: Add a DRC driver
Message-ID<seqki-3Gd-17@gated-at.bofh.it>
In reply to#1477481
On Tue, Sep 6, 2016 at 10:46 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The A33 pipeline also has a component called DRC. Even though its exact
> features and programming model is not known (or documented), it needs to
> be clocked for the pipeline to carry the video signal all the way.
>
> Add a minimal driver for it that just claim the needed resources for the
> pipeline to operate properly.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

[toc] | [prev] | [next] | [standalone]


#1477808 — Re: [linux-sunxi] [PATCH v2 4/9] drm/sun4i: Add a DRC driver

FromPeter Korsgaard <peter@korsgaard.com>
Date2016-09-06 22:40 +0200
SubjectRe: [linux-sunxi] [PATCH v2 4/9] drm/sun4i: Add a DRC driver
Message-ID<sevjX-6Pj-7@gated-at.bofh.it>
In reply to#1477481
>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

 > The A33 pipeline also has a component called DRC. Even though its exact
 > features and programming model is not known (or documented), it needs to
 > be clocked for the pipeline to carry the video signal all the way.

 > Add a minimal driver for it that just claim the needed resources for the
 > pipeline to operate properly.

 > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Peter Korsgaard <peter@korsgaard.com>

-- 
Bye, Peter Korsgaard

[toc] | [prev] | [next] | [standalone]


#1478905

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-08 10:20 +0200
Message-ID<sf2IW-3lF-5@gated-at.bofh.it>
In reply to#1477471

[Multipart message — attachments visible in raw view] — view raw

On Tue, Sep 06, 2016 at 04:46:11PM +0200, Maxime Ripard wrote:
> Hi everyone,
> 
> This serie introduces the support in the sun4i-drm driver for the A33.
> 
> Beside the new IPs and special cases for the A33 new IPs, there's
> nothing really outstanding, and is now at feature parity with the A13.
> 
> This serie is based on my A33 CCU patches posted earlier today here:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2016-September/453208.html
> 
> Let me know what you think,
> Maxime

Merged the patches 1-4.

Maxime

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

[toc] | [prev] | [next] | [standalone]


#1479484

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-09-08 22:20 +0200
Message-ID<sfdXH-20B-7@gated-at.bofh.it>
In reply to#1477471

[Multipart message — attachments visible in raw view] — view raw

On Tue, Sep 06, 2016 at 04:46:11PM +0200, Maxime Ripard wrote:
> Hi everyone,
> 
> This serie introduces the support in the sun4i-drm driver for the A33.
> 
> Beside the new IPs and special cases for the A33 new IPs, there's
> nothing really outstanding, and is now at feature parity with the A13.
> 
> This serie is based on my A33 CCU patches posted earlier today here:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2016-September/453208.html
> 
> Let me know what you think,
> Maxime

And I applied the patches 7 and 8.

We'll figure the panel stuff later.

Maxime

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web