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


Groups > linux.kernel > #1594016 > unrolled thread

[PATCH 0/15] drm: sun4i: Add support for the HDMI controller

Started byMaxime Ripard <maxime.ripard@free-electrons.com>
First post2017-03-07 10:10 +0100
Last post2017-03-08 04:50 +0100
Articles 20 on this page of 31 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/15] drm: sun4i: Add support for the HDMI controller Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:10 +0100
    [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:20 +0100
      Re: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation Chen-Yu Tsai <wens@csie.org> - 2017-03-08 05:40 +0100
        Re: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch  calculation Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-08 23:00 +0100
    [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:20 +0100
      Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite Chen-Yu Tsai <wens@csie.org> - 2017-03-08 05:10 +0100
        Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite Stefan Monnier <monnier@iro.umontreal.ca> - 2017-03-08 06:00 +0100
        Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-09 12:00 +0100
          Re: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on  only for composite Chen-Yu Tsai <wens@csie.org> - 2017-03-09 12:40 +0100
            Re: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on  only for composite Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-09 16:00 +0100
    [PATCH 8/15] drm/sun4i: tcon: Add channel debug Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:20 +0100
      Re: [PATCH 8/15] drm/sun4i: tcon: Add channel debug Chen-Yu Tsai <wens@csie.org> - 2017-03-08 05:00 +0100
    [PATCH 9/15] drm/sun4i: tcon: Pass the encoder to the mode set functions Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:20 +0100
    [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:20 +0100
      Re: [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI Chen-Yu Tsai <wens@csie.org> - 2017-03-08 04:50 +0100
    [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:30 +0100
      Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI  controller node Chen-Yu Tsai <wens@csie.org> - 2017-03-08 05:10 +0100
        Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI  controller node Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-09 12:10 +0100
          Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI  controller node Chen-Yu Tsai <wens@csie.org> - 2017-03-09 12:20 +0100
    [PATCH 2/15] clk: sunxi-ng: Pass the parent and a pointer to the clocks round rate Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
    [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
      Re: [PATCH 1/15] clk: divider: Make divider_round_rate take the  parent clock Stephen Boyd <sboyd@codeaurora.org> - 2017-03-07 15:20 +0100
        Re: [PATCH 1/15] clk: divider: Make divider_round_rate take the  parent clock Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-09 12:20 +0100
    [PATCH 12/15] drm/sun4i: tcon: multiply the vtotal when not in interlace Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
      Re: [PATCH 12/15] drm/sun4i: tcon: multiply the vtotal when not in interlace Chen-Yu Tsai <wens@csie.org> - 2017-03-07 11:10 +0100
        Re: [PATCH 12/15] drm/sun4i: tcon: multiply the vtotal when not in  interlace Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-09 12:20 +0100
    [PATCH 13/15] drm/sun4i: Add HDMI support Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
    [PATCH 7/15] dt-bindings: display: sun4i: Add allwinner,tcon-channel property Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
      Re: [PATCH 7/15] dt-bindings: display: sun4i: Add allwinner,tcon-channel  property Chen-Yu Tsai <wens@csie.org> - 2017-03-08 04:50 +0100
    [PATCH 6/15] dt-bindings: display: sun4i: Add HDMI display bindings Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-03-07 10:40 +0100
      Re: [PATCH 6/15] dt-bindings: display: sun4i: Add HDMI display bindings Chen-Yu Tsai <wens@csie.org> - 2017-03-08 04:50 +0100

Page 1 of 2  [1] 2  Next page →


#1594016 — [PATCH 0/15] drm: sun4i: Add support for the HDMI controller

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:10 +0100
Subject[PATCH 0/15] drm: sun4i: Add support for the HDMI controller
Message-ID<tiji2-5io-9@gated-at.bofh.it>
Hi,

Here is an attempt at getting the HDMI controller running.

This HDMI controller is found on a number of old Allwinner SoCs (A10, A10s,
A20, A31).

This driver only supports for now the A10s because it was an easy target,
being very close to the A13 that is already supported by our DRM driver.

There's nothing out of the extraordinary there, except maybe the clock
setup. All the internal clocks (TMDS, DDC) have been modeled using the
common clock framework, the TMDS clock being the parent of the DDC one.

While this might sound overkill, other SoC have a different, external
source for the DDC clock, which will be easier to support through the clock
framework.

It's still a bit rough around the edges, as it doesn't work for all the
modes. This will need to be fixed before being merged obviously.

The IP also supports audio (through an already supported i2s controller,
and some missing configuration in the HDMI controller) and CEC. Both will
come eventually.

Let me know what you think!
Maxime

Maxime Ripard (15):
  clk: divider: Make divider_round_rate take the parent clock
  clk: sunxi-ng: Pass the parent and a pointer to the clocks round rate
  clk: sunxi-ng: div: Switch to divider_round_rate
  clk: sunxi-ng: mux: Don't just rely on the parent for CLK_SET_RATE_PARENT
  clk: sunxi-ng: sun5i: Export video PLLs
  dt-bindings: display: sun4i: Add HDMI display bindings
  dt-bindings: display: sun4i: Add allwinner,tcon-channel property
  drm/sun4i: tcon: Add channel debug
  drm/sun4i: tcon: Pass the encoder to the mode set functions
  drm/sun4i: tcon: Switch mux on only for composite
  drm/sun4i: tcon: Fix tcon channel 1 backporch calculation
  drm/sun4i: tcon: multiply the vtotal when not in interlace
  drm/sun4i: Add HDMI support
  ARM: sun5i: a10s: Add the HDMI controller node
  ARM: sun5i: a10s-olinuxino: Enable HDMI

 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt |  32 +-
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts              |  12 +-
 arch/arm/boot/dts/sun5i-a10s.dtsi                             |  34 +-
 arch/arm/boot/dts/sun5i.dtsi                                  |   1 +-
 drivers/clk/clk-divider.c                                     |  18 +-
 drivers/clk/hisilicon/clkdivider-hi6220.c                     |   5 +-
 drivers/clk/meson/clk-cpu.c                                   |   5 +-
 drivers/clk/nxp/clk-lpc32xx.c                                 |   5 +-
 drivers/clk/qcom/clk-alpha-pll.c                              |   5 +-
 drivers/clk/qcom/clk-regmap-divider.c                         |   3 +-
 drivers/clk/sunxi-ng/ccu-sun5i.h                              |   6 +-
 drivers/clk/sunxi-ng/ccu_div.c                                |  28 +-
 drivers/clk/sunxi-ng/ccu_mp.c                                 |   7 +-
 drivers/clk/sunxi-ng/ccu_mult.c                               |  11 +-
 drivers/clk/sunxi-ng/ccu_mux.c                                |  22 +-
 drivers/clk/sunxi-ng/ccu_mux.h                                |   3 +-
 drivers/clk/sunxi-ng/ccu_nkm.c                                |   7 +-
 drivers/gpu/drm/sun4i/Makefile                                |   5 +-
 drivers/gpu/drm/sun4i/sun4i_hdmi.h                            | 124 ++-
 drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c                    | 128 ++-
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c                        | 449 +++++++-
 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c                   | 236 ++++-
 drivers/gpu/drm/sun4i/sun4i_rgb.c                             |   2 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c                            |  25 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h                            |   4 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c                              |   2 +-
 drivers/rtc/rtc-ac100.c                                       |   6 +-
 include/dt-bindings/clock/sun5i-ccu.h                         |   3 +-
 include/linux/clk-provider.h                                  |   5 +-
 29 files changed, 1103 insertions(+), 90 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi.h
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c

base-commit: d1bee31b9da7222c6be3248d1f3b087e8cc9004c
-- 
git-series 0.8.11

[toc] | [next] | [standalone]


#1594021 — [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:20 +0100
Subject[PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation
Message-ID<tijrH-5mG-3@gated-at.bofh.it>
In reply to#1594016
It seems like what's called a backporch in the datasheet is actually the
backporch plus the sync period. Fix that in our driver.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 93249c5ab1e4..e44217fb4f6f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -240,15 +240,14 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 		     SUN4I_TCON1_BASIC2_Y(mode->crtc_vdisplay));
 
 	/* Set horizontal display timings */
-	bp = mode->crtc_htotal - mode->crtc_hsync_end;
+	bp = mode->crtc_htotal - mode->crtc_hsync_start;
 	DRM_DEBUG_DRIVER("Setting horizontal total %d, backporch %d\n",
 			 mode->htotal, bp);
 	regmap_write(tcon->regs, SUN4I_TCON1_BASIC3_REG,
 		     SUN4I_TCON1_BASIC3_H_TOTAL(mode->crtc_htotal) |
 		     SUN4I_TCON1_BASIC3_H_BACKPORCH(bp));
 
-	/* Set vertical display timings */
-	bp = mode->crtc_vtotal - mode->crtc_vsync_end;
+	bp = mode->crtc_vtotal - mode->crtc_vsync_start;
 	DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
 			 mode->vtotal, bp);
 	regmap_write(tcon->regs, SUN4I_TCON1_BASIC4_REG,
-- 
git-series 0.8.11

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


#1594846 — Re: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-08 05:40 +0100
SubjectRe: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation
Message-ID<tiByh-1ee-7@gated-at.bofh.it>
In reply to#1594021
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> It seems like what's called a backporch in the datasheet is actually the
> backporch plus the sync period. Fix that in our driver.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index 93249c5ab1e4..e44217fb4f6f 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -240,15 +240,14 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
>                      SUN4I_TCON1_BASIC2_Y(mode->crtc_vdisplay));
>
>         /* Set horizontal display timings */
> -       bp = mode->crtc_htotal - mode->crtc_hsync_end;
> +       bp = mode->crtc_htotal - mode->crtc_hsync_start;
>         DRM_DEBUG_DRIVER("Setting horizontal total %d, backporch %d\n",
>                          mode->htotal, bp);
>         regmap_write(tcon->regs, SUN4I_TCON1_BASIC3_REG,
>                      SUN4I_TCON1_BASIC3_H_TOTAL(mode->crtc_htotal) |
>                      SUN4I_TCON1_BASIC3_H_BACKPORCH(bp));
>
> -       /* Set vertical display timings */

Why remove the comment?

Otherwise,

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

> -       bp = mode->crtc_vtotal - mode->crtc_vsync_end;
> +       bp = mode->crtc_vtotal - mode->crtc_vsync_start;
>         DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
>                          mode->vtotal, bp);
>         regmap_write(tcon->regs, SUN4I_TCON1_BASIC4_REG,
> --
> git-series 0.8.11

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


#1595544 — Re: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-08 23:00 +0100
SubjectRe: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation
Message-ID<tiRMK-3Y7-21@gated-at.bofh.it>
In reply to#1594846

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

On Wed, Mar 08, 2017 at 12:25:59PM +0800, Chen-Yu Tsai wrote:
> On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > It seems like what's called a backporch in the datasheet is actually the
> > backporch plus the sync period. Fix that in our driver.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index 93249c5ab1e4..e44217fb4f6f 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -240,15 +240,14 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
> >                      SUN4I_TCON1_BASIC2_Y(mode->crtc_vdisplay));
> >
> >         /* Set horizontal display timings */
> > -       bp = mode->crtc_htotal - mode->crtc_hsync_end;
> > +       bp = mode->crtc_htotal - mode->crtc_hsync_start;
> >         DRM_DEBUG_DRIVER("Setting horizontal total %d, backporch %d\n",
> >                          mode->htotal, bp);
> >         regmap_write(tcon->regs, SUN4I_TCON1_BASIC3_REG,
> >                      SUN4I_TCON1_BASIC3_H_TOTAL(mode->crtc_htotal) |
> >                      SUN4I_TCON1_BASIC3_H_BACKPORCH(bp));
> >
> > -       /* Set vertical display timings */
> 
> Why remove the comment?

I have no idea :)

This will be fixed. Thanks!
Maxime

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

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


#1594022 — [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:20 +0100
Subject[PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tijrI-5mG-15@gated-at.bofh.it>
In reply to#1594016
Even though that mux is undocumented, it seems like it needs to be set to 1
when using composite, and 0 when using HDMI.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index d2335f109601..93249c5ab1e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -268,11 +268,16 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 			   SUN4I_TCON_GCTL_IOMAP_MASK,
 			   SUN4I_TCON_GCTL_IOMAP_TCON1);
 
+	if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
+		val = 1;
+	else
+		val = 0;
+
 	/*
 	 * FIXME: Undocumented bits
 	 */
 	if (tcon->quirks->has_unknown_mux)
-		regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
+		regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val);
 }
 EXPORT_SYMBOL(sun4i_tcon1_mode_set);
 
-- 
git-series 0.8.11

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


#1594833 — Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-08 05:10 +0100
SubjectRe: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tiB5f-12i-1@gated-at.bofh.it>
In reply to#1594022
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Even though that mux is undocumented, it seems like it needs to be set to 1
> when using composite, and 0 when using HDMI.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index d2335f109601..93249c5ab1e4 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -268,11 +268,16 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
>                            SUN4I_TCON_GCTL_IOMAP_MASK,
>                            SUN4I_TCON_GCTL_IOMAP_TCON1);
>
> +       if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
> +               val = 1;
> +       else
> +               val = 0;
> +
>         /*
>          * FIXME: Undocumented bits
>          */
>         if (tcon->quirks->has_unknown_mux)
> -               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
> +               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val);

We might want to do this the other way around, i.e. exporting

    int sun4i_tcon_mux_set(struct drm_device *drm, int encoder_type,
                           int pipeline)

and have downstream encoders call it. For the A31, the mux is not exclusively
used for channel 1; there is a mux setting for MIPI DSI as well, but AFAIK
DSI is connected to channel 0.

Additionally, the mux registers are only valid in the first TCON, meaning
it must available be active in 2 pipeline chips. It's also why we'd pass
"struct drm_device *" instead of "struct sun4i_tcon *".


Regards
ChenYu

>  }
>  EXPORT_SYMBOL(sun4i_tcon1_mode_set);
>
> --
> git-series 0.8.11

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


#1594854 — Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromStefan Monnier <monnier@iro.umontreal.ca>
Date2017-03-08 06:00 +0100
SubjectRe: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tiBRE-1o7-25@gated-at.bofh.it>
In reply to#1594833
>> +       if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
>> +               val = 1;
>> +       else
>> +               val = 0;

Isn't this better written as

           val = (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC);


-- Stefan

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


#1595913 — Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-09 12:00 +0100
SubjectRe: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tj3XA-43h-17@gated-at.bofh.it>
In reply to#1594833

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

On Wed, Mar 08, 2017 at 11:51:39AM +0800, Chen-Yu Tsai wrote:
> On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Even though that mux is undocumented, it seems like it needs to be set to 1
> > when using composite, and 0 when using HDMI.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index d2335f109601..93249c5ab1e4 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -268,11 +268,16 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
> >                            SUN4I_TCON_GCTL_IOMAP_MASK,
> >                            SUN4I_TCON_GCTL_IOMAP_TCON1);
> >
> > +       if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
> > +               val = 1;
> > +       else
> > +               val = 0;
> > +
> >         /*
> >          * FIXME: Undocumented bits
> >          */
> >         if (tcon->quirks->has_unknown_mux)
> > -               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
> > +               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val);
> 
> We might want to do this the other way around, i.e. exporting
> 
>     int sun4i_tcon_mux_set(struct drm_device *drm, int encoder_type,
>                            int pipeline)
> 
> and have downstream encoders call it. For the A31, the mux is not exclusively
> used for channel 1; there is a mux setting for MIPI DSI as well, but AFAIK
> DSI is connected to channel 0.

We could make it part of sun4i_tcon_channel_enable too, though. What
do you think?

> Additionally, the mux registers are only valid in the first TCON, meaning
> it must available be active in 2 pipeline chips. It's also why we'd pass
> "struct drm_device *" instead of "struct sun4i_tcon *".

Hmmmm. That's going to be tricky to support. Has this been confirmed
somehow? Is the register used for something else on TCON1?

Thanks,
Maxime

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

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


#1595951 — Re: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-09 12:40 +0100
SubjectRe: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tj4Ai-4xS-15@gated-at.bofh.it>
In reply to#1595913
On Thu, Mar 9, 2017 at 6:58 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Wed, Mar 08, 2017 at 11:51:39AM +0800, Chen-Yu Tsai wrote:
>> On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > Even though that mux is undocumented, it seems like it needs to be set to 1
>> > when using composite, and 0 when using HDMI.
>> >
>> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> > ---
>> >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++-
>> >  1 file changed, 6 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> > index d2335f109601..93249c5ab1e4 100644
>> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> > @@ -268,11 +268,16 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
>> >                            SUN4I_TCON_GCTL_IOMAP_MASK,
>> >                            SUN4I_TCON_GCTL_IOMAP_TCON1);
>> >
>> > +       if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
>> > +               val = 1;
>> > +       else
>> > +               val = 0;
>> > +
>> >         /*
>> >          * FIXME: Undocumented bits
>> >          */
>> >         if (tcon->quirks->has_unknown_mux)
>> > -               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
>> > +               regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val);
>>
>> We might want to do this the other way around, i.e. exporting
>>
>>     int sun4i_tcon_mux_set(struct drm_device *drm, int encoder_type,
>>                            int pipeline)
>>
>> and have downstream encoders call it. For the A31, the mux is not exclusively
>> used for channel 1; there is a mux setting for MIPI DSI as well, but AFAIK
>> DSI is connected to channel 0.
>
> We could make it part of sun4i_tcon_channel_enable too, though. What
> do you think?

We still need some way of figuring out what mux value to set for those
cases. Let's keep your solution for now. We can work on it later when
we have an actual use case to deal with.

>
>> Additionally, the mux registers are only valid in the first TCON, meaning
>> it must available be active in 2 pipeline chips. It's also why we'd pass
>> "struct drm_device *" instead of "struct sun4i_tcon *".
>
> Hmmmm. That's going to be tricky to support. Has this been confirmed
> somehow? Is the register used for something else on TCON1?

At this point, the only reference is Allwinner's kernel, and the old 3.4
kernel for A10/A20. I could try getting HDMI working on the A31 to get
some real results.

FWIW, the registers do not seem to be aliased across the two TCONs.

Regards
ChenYu

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


#1596129 — Re: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-09 16:00 +0100
SubjectRe: [linux-sunxi] Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite
Message-ID<tj7HQ-6AN-21@gated-at.bofh.it>
In reply to#1595951

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

On Thu, Mar 09, 2017 at 07:31:27PM +0800, Chen-Yu Tsai wrote:
> >> Additionally, the mux registers are only valid in the first TCON, meaning
> >> it must available be active in 2 pipeline chips. It's also why we'd pass
> >> "struct drm_device *" instead of "struct sun4i_tcon *".
> >
> > Hmmmm. That's going to be tricky to support. Has this been confirmed
> > somehow? Is the register used for something else on TCON1?
> 
> At this point, the only reference is Allwinner's kernel, and the old 3.4
> kernel for A10/A20. I could try getting HDMI working on the A31 to get
> some real results.
> 
> FWIW, the registers do not seem to be aliased across the two TCONs.

Then maybe we don't need to care, and we can just always write to the
mux?

Maxime

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

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


#1594025 — [PATCH 8/15] drm/sun4i: tcon: Add channel debug

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:20 +0100
Subject[PATCH 8/15] drm/sun4i: tcon: Add channel debug
Message-ID<tijrI-5mG-23@gated-at.bofh.it>
In reply to#1594016
While all functions have debug logs, the channel enable and disable are not
logged. Make sure this is the case.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++++
 1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 505520baa585..7461ae107e54 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -55,6 +55,8 @@ EXPORT_SYMBOL(sun4i_tcon_enable);
 
 void sun4i_tcon_channel_disable(struct sun4i_tcon *tcon, int channel)
 {
+	DRM_DEBUG_DRIVER("Disabling TCON channel %d\n", channel);
+
 	/* Disable the TCON's channel */
 	if (channel == 0) {
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
@@ -72,6 +74,8 @@ EXPORT_SYMBOL(sun4i_tcon_channel_disable);
 
 void sun4i_tcon_channel_enable(struct sun4i_tcon *tcon, int channel)
 {
+	DRM_DEBUG_DRIVER("Enabling TCON channel %d\n", channel);
+
 	/* Enable the TCON's channel */
 	if (channel == 0) {
 		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
-- 
git-series 0.8.11

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


#1594831 — Re: [PATCH 8/15] drm/sun4i: tcon: Add channel debug

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-08 05:00 +0100
SubjectRe: [PATCH 8/15] drm/sun4i: tcon: Add channel debug
Message-ID<tiAVz-JT-3@gated-at.bofh.it>
In reply to#1594025
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> While all functions have debug logs, the channel enable and disable are not
> logged. Make sure this is the case.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

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

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


#1594029 — [PATCH 9/15] drm/sun4i: tcon: Pass the encoder to the mode set functions

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:20 +0100
Subject[PATCH 9/15] drm/sun4i: tcon: Pass the encoder to the mode set functions
Message-ID<tijrJ-5mG-29@gated-at.bofh.it>
In reply to#1594016
The mode set function need some changes based on which encoder is being
used. Make sure we can differentiate between our encoders by passing the
encoder structure asking for the mode set.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c  | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++--
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 4 ++--
 drivers/gpu/drm/sun4i/sun4i_tv.c   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 1147451eb993..1d4a59a44d04 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -173,7 +173,7 @@ static void sun4i_rgb_encoder_mode_set(struct drm_encoder *encoder,
 	struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
 	struct sun4i_tcon *tcon = rgb->tcon;
 
-	sun4i_tcon0_mode_set(tcon, mode);
+	sun4i_tcon0_mode_set(tcon, encoder, mode);
 
 	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 7461ae107e54..d2335f109601 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -127,7 +127,7 @@ static int sun4i_tcon_get_clk_delay(struct drm_display_mode *mode,
 	return delay;
 }
 
-void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
+void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 			  struct drm_display_mode *mode)
 {
 	unsigned int bp, hsync, vsync;
@@ -200,7 +200,7 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 }
 EXPORT_SYMBOL(sun4i_tcon0_mode_set);
 
-void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
+void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 			  struct drm_display_mode *mode)
 {
 	unsigned int bp, hsync, vsync;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index f636343a935d..95b7e76eb1f8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -190,9 +190,9 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable);
 /* Mode Related Controls */
 void sun4i_tcon_switch_interlace(struct sun4i_tcon *tcon,
 				 bool enable);
-void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
+void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 			  struct drm_display_mode *mode);
-void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
+void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 			  struct drm_display_mode *mode);
 
 #endif /* __SUN4I_TCON_H__ */
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 32ed5fdf0c4d..2d36df092a6a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -389,7 +389,7 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
 	struct sun4i_tcon *tcon = drv->tcon;
 	const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode);
 
-	sun4i_tcon1_mode_set(tcon, mode);
+	sun4i_tcon1_mode_set(tcon, encoder, mode);
 
 	/* Enable and map the DAC to the output */
 	regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG,
-- 
git-series 0.8.11

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


#1594030 — [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:20 +0100
Subject[PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI
Message-ID<tijrJ-5mG-31@gated-at.bofh.it>
In reply to#1594016
The A10s Olinuxino has an HDMI connector. Make sure we can use it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
index baee64d61f6d..3102c27b04df 100644
--- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -77,6 +77,10 @@
 	};
 };
 
+&be0 {
+	status = "okay";
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -92,6 +96,10 @@
 	status = "okay";
 };
 
+&hdmi0 {
+	status = "okay";
+};
+
 &i2c0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c0_pins_a>;
@@ -249,6 +257,10 @@
 	status = "okay";
 };
 
+&tcon0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
git-series 0.8.11

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


#1594827 — Re: [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-08 04:50 +0100
SubjectRe: [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI
Message-ID<tiALT-GB-9@gated-at.bofh.it>
In reply to#1594030
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The A10s Olinuxino has an HDMI connector. Make sure we can use it.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

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

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


#1594034 — [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:30 +0100
Subject[PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node
Message-ID<tijBo-5s7-7@gated-at.bofh.it>
In reply to#1594016
The A10s has an HDMI controller connected to the second TCON channel. Add
it to our DT.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/sun5i-a10s.dtsi | 34 ++++++++++++++++++++++++++++++++-
 arch/arm/boot/dts/sun5i.dtsi      |  1 +-
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 074485782a4a..3482c9d2b120 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -72,7 +72,33 @@
 		};
 	};
 
+	display-engine {
+		compatible = "allwinner,sun5i-a10s-display-engine",
+			     "allwinner,sun5i-a13-display-engine";
+		allwinner,pipelines = <&fe0>;
+	};
+
 	soc@01c00000 {
+		hdmi0: hdmi@01c16000 {
+			compatible = "allwinner,sun5i-a10s-hdmi";
+			reg = <0x01c16000 0x1000>;
+			clocks = <&ccu CLK_AHB_HDMI>, <&ccu CLK_HDMI>,
+				 <&ccu CLK_PLL_VIDEO0_2X>,
+				 <&ccu CLK_PLL_VIDEO1_2X>;
+			clock-names = "ahb", "mod", "pll-0", "pll-1";
+			status = "disabled";
+
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				hdmi0_in_tcon0: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&tcon0_out_hdmi0>;
+				};
+			};
+		};
+
 		pwm: pwm@01c20e00 {
 			compatible = "allwinner,sun5i-a10s-pwm";
 			reg = <0x01c20e00 0xc>;
@@ -129,3 +155,11 @@
 
 &sram_a {
 };
+
+&tcon0_out {
+	tcon0_out_hdmi0: endpoint@2 {
+		reg = <2>;
+		remote-endpoint = <&hdmi0_in_tcon0>;
+		allwinner,tcon-channel = <1>;
+	};
+};
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index f3b6e19244f9..3d009b2aa42a 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -273,6 +273,7 @@
 					tcon0_out_tve0: endpoint@1 {
 						reg = <1>;
 						remote-endpoint = <&tve0_in_tcon0>;
+						allwinner,tcon-channel = <1>;
 					};
 				};
 			};
-- 
git-series 0.8.11

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


#1594835 — Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-08 05:10 +0100
SubjectRe: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node
Message-ID<tiB5f-12i-5@gated-at.bofh.it>
In reply to#1594034
Hi,

On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The A10s has an HDMI controller connected to the second TCON channel. Add
> it to our DT.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  arch/arm/boot/dts/sun5i-a10s.dtsi | 34 ++++++++++++++++++++++++++++++++-
>  arch/arm/boot/dts/sun5i.dtsi      |  1 +-
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
> index 074485782a4a..3482c9d2b120 100644
> --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
> +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
> @@ -72,7 +72,33 @@
>                 };
>         };
>
> +       display-engine {
> +               compatible = "allwinner,sun5i-a10s-display-engine",
> +                            "allwinner,sun5i-a13-display-engine";
> +               allwinner,pipelines = <&fe0>;
> +       };
> +
>         soc@01c00000 {
> +               hdmi0: hdmi@01c16000 {

Nit: is the 0 suffix needed? I don't see any indication that there is
a second controller.

> +                       compatible = "allwinner,sun5i-a10s-hdmi";
> +                       reg = <0x01c16000 0x1000>;
> +                       clocks = <&ccu CLK_AHB_HDMI>, <&ccu CLK_HDMI>,
> +                                <&ccu CLK_PLL_VIDEO0_2X>,
> +                                <&ccu CLK_PLL_VIDEO1_2X>;
> +                       clock-names = "ahb", "mod", "pll-0", "pll-1";
> +                       status = "disabled";
> +
> +                       port {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +
> +                               hdmi0_in_tcon0: endpoint@0 {
> +                                       reg = <0>;
> +                                       remote-endpoint = <&tcon0_out_hdmi0>;
> +                               };
> +                       };
> +               };
> +
>                 pwm: pwm@01c20e00 {
>                         compatible = "allwinner,sun5i-a10s-pwm";
>                         reg = <0x01c20e00 0xc>;
> @@ -129,3 +155,11 @@
>
>  &sram_a {
>  };
> +
> +&tcon0_out {
> +       tcon0_out_hdmi0: endpoint@2 {
> +               reg = <2>;
> +               remote-endpoint = <&hdmi0_in_tcon0>;
> +               allwinner,tcon-channel = <1>;
> +       };
> +};
> diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
> index f3b6e19244f9..3d009b2aa42a 100644
> --- a/arch/arm/boot/dts/sun5i.dtsi
> +++ b/arch/arm/boot/dts/sun5i.dtsi
> @@ -273,6 +273,7 @@
>                                         tcon0_out_tve0: endpoint@1 {
>                                                 reg = <1>;
>                                                 remote-endpoint = <&tve0_in_tcon0>;
> +                                               allwinner,tcon-channel = <1>;

This looks like a separate patch, probably following the binding change?

Regards
ChenYu

>                                         };
>                                 };
>                         };
> --
> git-series 0.8.11
>
> --
> 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.

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


#1595931 — Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-09 12:10 +0100
SubjectRe: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node
Message-ID<tj47g-4lW-25@gated-at.bofh.it>
In reply to#1594835

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

1;4601;0c
On Wed, Mar 08, 2017 at 11:35:39AM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > The A10s has an HDMI controller connected to the second TCON channel. Add
> > it to our DT.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  arch/arm/boot/dts/sun5i-a10s.dtsi | 34 ++++++++++++++++++++++++++++++++-
> >  arch/arm/boot/dts/sun5i.dtsi      |  1 +-
> >  2 files changed, 35 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
> > index 074485782a4a..3482c9d2b120 100644
> > --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
> > +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
> > @@ -72,7 +72,33 @@
> >                 };
> >         };
> >
> > +       display-engine {
> > +               compatible = "allwinner,sun5i-a10s-display-engine",
> > +                            "allwinner,sun5i-a13-display-engine";
> > +               allwinner,pipelines = <&fe0>;
> > +       };
> > +
> >         soc@01c00000 {
> > +               hdmi0: hdmi@01c16000 {
> 
> Nit: is the 0 suffix needed? I don't see any indication that there is
> a second controller.
> 
> > +                       compatible = "allwinner,sun5i-a10s-hdmi";
> > +                       reg = <0x01c16000 0x1000>;
> > +                       clocks = <&ccu CLK_AHB_HDMI>, <&ccu CLK_HDMI>,
> > +                                <&ccu CLK_PLL_VIDEO0_2X>,
> > +                                <&ccu CLK_PLL_VIDEO1_2X>;
> > +                       clock-names = "ahb", "mod", "pll-0", "pll-1";
> > +                       status = "disabled";
> > +
> > +                       port {
> > +                               #address-cells = <1>;
> > +                               #size-cells = <0>;
> > +
> > +                               hdmi0_in_tcon0: endpoint@0 {
> > +                                       reg = <0>;
> > +                                       remote-endpoint = <&tcon0_out_hdmi0>;
> > +                               };
> > +                       };
> > +               };
> > +
> >                 pwm: pwm@01c20e00 {
> >                         compatible = "allwinner,sun5i-a10s-pwm";
> >                         reg = <0x01c20e00 0xc>;
> > @@ -129,3 +155,11 @@
> >
> >  &sram_a {
> >  };
> > +
> > +&tcon0_out {
> > +       tcon0_out_hdmi0: endpoint@2 {
> > +               reg = <2>;
> > +               remote-endpoint = <&hdmi0_in_tcon0>;
> > +               allwinner,tcon-channel = <1>;
> > +       };
> > +};
> > diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
> > index f3b6e19244f9..3d009b2aa42a 100644
> > --- a/arch/arm/boot/dts/sun5i.dtsi
> > +++ b/arch/arm/boot/dts/sun5i.dtsi
> > @@ -273,6 +273,7 @@
> >                                         tcon0_out_tve0: endpoint@1 {
> >                                                 reg = <1>;
> >                                                 remote-endpoint = <&tve0_in_tcon0>;
> > +                                               allwinner,tcon-channel = <1>;
> 
> This looks like a separate patch, probably following the binding
> change?

I don't know, the binding says that without anything specified, reg
would be used. I was assuming that we only needed it once we had the
new endpoint to make it consistent, therefore it didn't need an extra
patch.

But I can definitely create one if you want.
Maxime

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

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


#1595938 — Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node

FromChen-Yu Tsai <wens@csie.org>
Date2017-03-09 12:20 +0100
SubjectRe: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node
Message-ID<tj4gW-4pf-3@gated-at.bofh.it>
In reply to#1595931
On Thu, Mar 9, 2017 at 6:59 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> 1;4601;0c
> On Wed, Mar 08, 2017 at 11:35:39AM +0800, Chen-Yu Tsai wrote:
>> Hi,
>>
>> On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > The A10s has an HDMI controller connected to the second TCON channel. Add
>> > it to our DT.
>> >
>> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> > ---
>> >  arch/arm/boot/dts/sun5i-a10s.dtsi | 34 ++++++++++++++++++++++++++++++++-
>> >  arch/arm/boot/dts/sun5i.dtsi      |  1 +-
>> >  2 files changed, 35 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
>> > index 074485782a4a..3482c9d2b120 100644
>> > --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
>> > +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
>> > @@ -72,7 +72,33 @@
>> >                 };
>> >         };
>> >
>> > +       display-engine {
>> > +               compatible = "allwinner,sun5i-a10s-display-engine",
>> > +                            "allwinner,sun5i-a13-display-engine";
>> > +               allwinner,pipelines = <&fe0>;
>> > +       };
>> > +
>> >         soc@01c00000 {
>> > +               hdmi0: hdmi@01c16000 {
>>
>> Nit: is the 0 suffix needed? I don't see any indication that there is
>> a second controller.
>>
>> > +                       compatible = "allwinner,sun5i-a10s-hdmi";
>> > +                       reg = <0x01c16000 0x1000>;
>> > +                       clocks = <&ccu CLK_AHB_HDMI>, <&ccu CLK_HDMI>,
>> > +                                <&ccu CLK_PLL_VIDEO0_2X>,
>> > +                                <&ccu CLK_PLL_VIDEO1_2X>;
>> > +                       clock-names = "ahb", "mod", "pll-0", "pll-1";
>> > +                       status = "disabled";
>> > +
>> > +                       port {
>> > +                               #address-cells = <1>;
>> > +                               #size-cells = <0>;
>> > +
>> > +                               hdmi0_in_tcon0: endpoint@0 {
>> > +                                       reg = <0>;
>> > +                                       remote-endpoint = <&tcon0_out_hdmi0>;
>> > +                               };
>> > +                       };
>> > +               };
>> > +
>> >                 pwm: pwm@01c20e00 {
>> >                         compatible = "allwinner,sun5i-a10s-pwm";
>> >                         reg = <0x01c20e00 0xc>;
>> > @@ -129,3 +155,11 @@
>> >
>> >  &sram_a {
>> >  };
>> > +
>> > +&tcon0_out {
>> > +       tcon0_out_hdmi0: endpoint@2 {
>> > +               reg = <2>;
>> > +               remote-endpoint = <&hdmi0_in_tcon0>;
>> > +               allwinner,tcon-channel = <1>;
>> > +       };
>> > +};
>> > diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
>> > index f3b6e19244f9..3d009b2aa42a 100644
>> > --- a/arch/arm/boot/dts/sun5i.dtsi
>> > +++ b/arch/arm/boot/dts/sun5i.dtsi
>> > @@ -273,6 +273,7 @@
>> >                                         tcon0_out_tve0: endpoint@1 {
>> >                                                 reg = <1>;
>> >                                                 remote-endpoint = <&tve0_in_tcon0>;
>> > +                                               allwinner,tcon-channel = <1>;
>>
>> This looks like a separate patch, probably following the binding
>> change?
>
> I don't know, the binding says that without anything specified, reg
> would be used. I was assuming that we only needed it once we had the
> new endpoint to make it consistent, therefore it didn't need an extra
> patch.
>
> But I can definitely create one if you want.

It just seems a bit out of place, that's all. Mentioning it in the
commit message would be good enough for me.

ChenYu

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

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


#1594041 — [PATCH 2/15] clk: sunxi-ng: Pass the parent and a pointer to the clocks round rate

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-03-07 10:40 +0100
Subject[PATCH 2/15] clk: sunxi-ng: Pass the parent and a pointer to the clocks round rate
Message-ID<tijL3-5vy-1@gated-at.bofh.it>
In reply to#1594016
The clocks might need to modify their parent clocks. In order to make that
possible, give them access to the parent clock being evaluated, and to a
pointer to the parent rate so that they can modify it if needed.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu_div.c  |  7 ++++---
 drivers/clk/sunxi-ng/ccu_mp.c   |  7 ++++---
 drivers/clk/sunxi-ng/ccu_mult.c | 11 ++++++-----
 drivers/clk/sunxi-ng/ccu_mux.c  |  8 +++++---
 drivers/clk/sunxi-ng/ccu_mux.h  |  3 ++-
 drivers/clk/sunxi-ng/ccu_nkm.c  |  7 ++++---
 6 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c
index 92855c2b30bb..7f8b06e38636 100644
--- a/drivers/clk/sunxi-ng/ccu_div.c
+++ b/drivers/clk/sunxi-ng/ccu_div.c
@@ -14,7 +14,8 @@
 #include "ccu_div.h"
 
 static unsigned long ccu_div_round_rate(struct ccu_mux_internal *mux,
-					unsigned long parent_rate,
+					struct clk_hw *parent,
+					unsigned long *parent_rate,
 					unsigned long rate,
 					void *data)
 {
@@ -26,10 +27,10 @@ static unsigned long ccu_div_round_rate(struct ccu_mux_internal *mux,
 	 * several parents, while we might be called to evaluate
 	 * several different parents.
 	 */
-	val = divider_get_val(rate, parent_rate, cd->div.table, cd->div.width,
+	val = divider_get_val(rate, *parent_rate, cd->div.table, cd->div.width,
 			      cd->div.flags);
 
-	return divider_recalc_rate(&cd->common.hw, parent_rate, val,
+	return divider_recalc_rate(&cd->common.hw, *parent_rate, val,
 				   cd->div.table, cd->div.flags);
 }
 
diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
index b583f186a804..de02e6c386d8 100644
--- a/drivers/clk/sunxi-ng/ccu_mp.c
+++ b/drivers/clk/sunxi-ng/ccu_mp.c
@@ -41,7 +41,8 @@ static void ccu_mp_find_best(unsigned long parent, unsigned long rate,
 }
 
 static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux,
-				       unsigned long parent_rate,
+				       struct clk_hw *hw,
+				       unsigned long *parent_rate,
 				       unsigned long rate,
 				       void *data)
 {
@@ -52,9 +53,9 @@ static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux,
 	max_m = cmp->m.max ?: 1 << cmp->m.width;
 	max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1);
 
-	ccu_mp_find_best(parent_rate, rate, max_m, max_p, &m, &p);
+	ccu_mp_find_best(*parent_rate, rate, max_m, max_p, &m, &p);
 
-	return parent_rate / p / m;
+	return *parent_rate / p / m;
 }
 
 static void ccu_mp_disable(struct clk_hw *hw)
diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
index 8724c01171b1..76d17162366f 100644
--- a/drivers/clk/sunxi-ng/ccu_mult.c
+++ b/drivers/clk/sunxi-ng/ccu_mult.c
@@ -33,9 +33,10 @@ static void ccu_mult_find_best(unsigned long parent, unsigned long rate,
 }
 
 static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux,
-					unsigned long parent_rate,
-					unsigned long rate,
-					void *data)
+					 struct clk_hw *parent,
+					 unsigned long *parent_rate,
+					 unsigned long rate,
+					 void *data)
 {
 	struct ccu_mult *cm = data;
 	struct _ccu_mult _cm;
@@ -47,9 +48,9 @@ static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux,
 	else
 		_cm.max = (1 << cm->mult.width) + cm->mult.offset - 1;
 
-	ccu_mult_find_best(parent_rate, rate, &_cm);
+	ccu_mult_find_best(*parent_rate, rate, &_cm);
 
-	return parent_rate * _cm.mult;
+	return *parent_rate * _cm.mult;
 }
 
 static void ccu_mult_disable(struct clk_hw *hw)
diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
index c6bb1f523232..bae735e252b6 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.c
+++ b/drivers/clk/sunxi-ng/ccu_mux.c
@@ -61,7 +61,8 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
 				  struct ccu_mux_internal *cm,
 				  struct clk_rate_request *req,
 				  unsigned long (*round)(struct ccu_mux_internal *,
-							 unsigned long,
+							 struct clk_hw *,
+							 unsigned long *,
 							 unsigned long,
 							 void *),
 				  void *data)
@@ -80,7 +81,8 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
 		ccu_mux_helper_adjust_parent_for_prediv(common, cm, -1,
 							&adj_parent_rate);
 
-		best_rate = round(cm, adj_parent_rate, req->rate, data);
+		best_rate = round(cm, best_parent, &adj_parent_rate,
+				  req->rate, data);
 
 		goto out;
 	}
@@ -109,7 +111,7 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
 		ccu_mux_helper_adjust_parent_for_prediv(common, cm, i,
 							&adj_parent_rate);
 
-		tmp_rate = round(cm, adj_parent_rate, req->rate, data);
+		tmp_rate = round(cm, parent, &adj_parent_rate, req->rate, data);
 		if (tmp_rate == req->rate) {
 			best_parent = parent;
 			best_parent_rate = parent_rate;
diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h
index 47aba3a48245..4be56eee2bfd 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.h
+++ b/drivers/clk/sunxi-ng/ccu_mux.h
@@ -86,7 +86,8 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
 				  struct ccu_mux_internal *cm,
 				  struct clk_rate_request *req,
 				  unsigned long (*round)(struct ccu_mux_internal *,
-							 unsigned long,
+							 struct clk_hw *,
+							 unsigned long *,
 							 unsigned long,
 							 void *),
 				  void *data);
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
index 71f81e95a061..c5e010eb5991 100644
--- a/drivers/clk/sunxi-ng/ccu_nkm.c
+++ b/drivers/clk/sunxi-ng/ccu_nkm.c
@@ -102,7 +102,8 @@ static unsigned long ccu_nkm_recalc_rate(struct clk_hw *hw,
 }
 
 static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
-					unsigned long parent_rate,
+					struct clk_hw *hw,
+					unsigned long *parent_rate,
 					unsigned long rate,
 					void *data)
 {
@@ -116,9 +117,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
 	_nkm.min_m = 1;
 	_nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
 
-	ccu_nkm_find_best(parent_rate, rate, &_nkm);
+	ccu_nkm_find_best(*parent_rate, rate, &_nkm);
 
-	return parent_rate * _nkm.n * _nkm.k / _nkm.m;
+	return *parent_rate * _nkm.n * _nkm.k / _nkm.m;
 }
 
 static int ccu_nkm_determine_rate(struct clk_hw *hw,
-- 
git-series 0.8.11

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


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web