All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: linux-amlogic@lists.infradead.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	jbrunet@baylibre.com, narmstrong@baylibre.com,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH 0/6] clk: meson8b: video clock tree fixes and making it mutable
Date: Wed, 14 Jul 2021 01:25:04 +0200	[thread overview]
Message-ID: <20210713232510.3057750-1-martin.blumenstingl@googlemail.com> (raw)

The first two patches in this series are small fixes before we can
actually make the video clock tree mutable. One patch adds
CLK_SET_RATE_NO_REPARENT for better rate control and the other adds
a missing clock gate.

The third and fourth patch are targeting the HDMI PLL. Add the known
working M/N combinations. Also this PLL has some special "doubling"
setting, which is calculated like this:
  OUTPUT = (IN * M / N + FRAC) * 2
Since not all register bits are known we use a copy of the 2970/2975MHz
magic register values from the vendor driver.

The fifth patch makes the clocks in the video clock tree mutable. The
final patch in this series exports the clocks needed for rate control.

For reference, this is the .dts definition for the Meson8b VPU. The
code for the VPU driver is unfortunately not ready for upstreaming yet.
However, I have tested with all resolutions my monitor supports and the
clock settings are all applied correctly.
    vpu: vpu@100000 {
      compatible = "amlogic,meson8b-vpu";

      reg = <0x100000 0x10000>;
      reg-names = "vpu";

      interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;

      amlogic,canvas = <&canvas>;
      amlogic,hhi-sysctrl = <&hhi>;

      /*
       * The VCLK{,2}_IN path always needs to derived from
       * the CLKID_VID_PLL_FINAL_DIV so other clocks like
       * MPLL1 are not used (MPLL1 is reserved for audio
       * purposes).
       */
      assigned-clocks = <&clkc CLKID_VCLK_IN_SEL>,
                        <&clkc CLKID_VCLK2_IN_SEL>;
      assigned-clock-parents = <&clkc CLKID_VID_PLL_FINAL_DIV>,
                               <&clkc CLKID_VID_PLL_FINAL_DIV>;

      clocks = <&clkc CLKID_VPU_INTR>,
               <&clkc CLKID_HDMI_INTR_SYNC>,
               <&clkc CLKID_GCLK_VENCI_INT>,
               <&clkc CLKID_HDMI_PLL_HDMI_OUT>,
               <&clkc CLKID_HDMI_TX_PIXEL>,
               <&clkc CLKID_CTS_ENCP>,
               <&clkc CLKID_CTS_ENCI>,
               <&clkc CLKID_CTS_ENCT>,
               <&clkc CLKID_CTS_ENCL>,
               <&clkc CLKID_CTS_VDAC0>;
      clock-names = "vpu_intr",
                    "hdmi_intr_sync",
                    "venci_int",
                    "tmds",
                    "hdmi_tx_pixel",
                    "cts_encp",
                    "cts_enci",
                    "cts_enct",
                    "cts_encl",
                    "cts_vdac0";

      resets = <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST>;
      reset-names = "vid_pll_pre",
                    "vid_pll_post",
                    "vid_pll_soft_pre",
                    "vid_pll_soft_post";

      power-domains = <&pwrc PWRC_MESON8_VPU_ID>;

      nvmem-cells = <&cvbs_trimming>;
      nvmem-cell-names = "cvbs_trimming";

      #address-cells = <1>;
      #size-cells = <0>;

      #sound-dai-cells = <0>;
      sound-name-prefix = "HDMITX";

      /* CVBS VDAC output port */
      cvbs_vdac_port: port@0 {
        reg = <0>;
      };

      /* HDMI-TX output port */
      hdmi_tx_port: port@1 {
        reg = <1>;

        hdmi_tx_out: endpoint {
          remote-endpoint = <&hdmi_tx_in>;
        };
      };
    };


Martin Blumenstingl (6):
  clk: meson: meson8b: Use CLK_SET_RATE_NO_REPARENT for vclk{,2}_in_sel
  clk: meson: meson8b: Add the vid_pll_lvds_en gate clock
  clk: meson: meson8b: Add the HDMI PLL M/N parameters
  clk: meson: meson8b: Initialize the HDMI PLL registers
  clk: meson: meson8b: Make the video clock trees mutable
  clk: meson: meson8b: Export the video clocks

 drivers/clk/meson/meson8b.c              | 163 +++++++++++++++++------
 drivers/clk/meson/meson8b.h              |  26 ++--
 include/dt-bindings/clock/meson8b-clkc.h |  10 ++
 3 files changed, 143 insertions(+), 56 deletions(-)

-- 
2.32.0


WARNING: multiple messages have this Message-ID (diff)
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: linux-amlogic@lists.infradead.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	jbrunet@baylibre.com, narmstrong@baylibre.com,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH 0/6] clk: meson8b: video clock tree fixes and making it mutable
Date: Wed, 14 Jul 2021 01:25:04 +0200	[thread overview]
Message-ID: <20210713232510.3057750-1-martin.blumenstingl@googlemail.com> (raw)

The first two patches in this series are small fixes before we can
actually make the video clock tree mutable. One patch adds
CLK_SET_RATE_NO_REPARENT for better rate control and the other adds
a missing clock gate.

The third and fourth patch are targeting the HDMI PLL. Add the known
working M/N combinations. Also this PLL has some special "doubling"
setting, which is calculated like this:
  OUTPUT = (IN * M / N + FRAC) * 2
Since not all register bits are known we use a copy of the 2970/2975MHz
magic register values from the vendor driver.

The fifth patch makes the clocks in the video clock tree mutable. The
final patch in this series exports the clocks needed for rate control.

For reference, this is the .dts definition for the Meson8b VPU. The
code for the VPU driver is unfortunately not ready for upstreaming yet.
However, I have tested with all resolutions my monitor supports and the
clock settings are all applied correctly.
    vpu: vpu@100000 {
      compatible = "amlogic,meson8b-vpu";

      reg = <0x100000 0x10000>;
      reg-names = "vpu";

      interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;

      amlogic,canvas = <&canvas>;
      amlogic,hhi-sysctrl = <&hhi>;

      /*
       * The VCLK{,2}_IN path always needs to derived from
       * the CLKID_VID_PLL_FINAL_DIV so other clocks like
       * MPLL1 are not used (MPLL1 is reserved for audio
       * purposes).
       */
      assigned-clocks = <&clkc CLKID_VCLK_IN_SEL>,
                        <&clkc CLKID_VCLK2_IN_SEL>;
      assigned-clock-parents = <&clkc CLKID_VID_PLL_FINAL_DIV>,
                               <&clkc CLKID_VID_PLL_FINAL_DIV>;

      clocks = <&clkc CLKID_VPU_INTR>,
               <&clkc CLKID_HDMI_INTR_SYNC>,
               <&clkc CLKID_GCLK_VENCI_INT>,
               <&clkc CLKID_HDMI_PLL_HDMI_OUT>,
               <&clkc CLKID_HDMI_TX_PIXEL>,
               <&clkc CLKID_CTS_ENCP>,
               <&clkc CLKID_CTS_ENCI>,
               <&clkc CLKID_CTS_ENCT>,
               <&clkc CLKID_CTS_ENCL>,
               <&clkc CLKID_CTS_VDAC0>;
      clock-names = "vpu_intr",
                    "hdmi_intr_sync",
                    "venci_int",
                    "tmds",
                    "hdmi_tx_pixel",
                    "cts_encp",
                    "cts_enci",
                    "cts_enct",
                    "cts_encl",
                    "cts_vdac0";

      resets = <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST>;
      reset-names = "vid_pll_pre",
                    "vid_pll_post",
                    "vid_pll_soft_pre",
                    "vid_pll_soft_post";

      power-domains = <&pwrc PWRC_MESON8_VPU_ID>;

      nvmem-cells = <&cvbs_trimming>;
      nvmem-cell-names = "cvbs_trimming";

      #address-cells = <1>;
      #size-cells = <0>;

      #sound-dai-cells = <0>;
      sound-name-prefix = "HDMITX";

      /* CVBS VDAC output port */
      cvbs_vdac_port: port@0 {
        reg = <0>;
      };

      /* HDMI-TX output port */
      hdmi_tx_port: port@1 {
        reg = <1>;

        hdmi_tx_out: endpoint {
          remote-endpoint = <&hdmi_tx_in>;
        };
      };
    };


Martin Blumenstingl (6):
  clk: meson: meson8b: Use CLK_SET_RATE_NO_REPARENT for vclk{,2}_in_sel
  clk: meson: meson8b: Add the vid_pll_lvds_en gate clock
  clk: meson: meson8b: Add the HDMI PLL M/N parameters
  clk: meson: meson8b: Initialize the HDMI PLL registers
  clk: meson: meson8b: Make the video clock trees mutable
  clk: meson: meson8b: Export the video clocks

 drivers/clk/meson/meson8b.c              | 163 +++++++++++++++++------
 drivers/clk/meson/meson8b.h              |  26 ++--
 include/dt-bindings/clock/meson8b-clkc.h |  10 ++
 3 files changed, 143 insertions(+), 56 deletions(-)

-- 
2.32.0


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

WARNING: multiple messages have this Message-ID (diff)
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: linux-amlogic@lists.infradead.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	jbrunet@baylibre.com, narmstrong@baylibre.com,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH 0/6] clk: meson8b: video clock tree fixes and making it mutable
Date: Wed, 14 Jul 2021 01:25:04 +0200	[thread overview]
Message-ID: <20210713232510.3057750-1-martin.blumenstingl@googlemail.com> (raw)

The first two patches in this series are small fixes before we can
actually make the video clock tree mutable. One patch adds
CLK_SET_RATE_NO_REPARENT for better rate control and the other adds
a missing clock gate.

The third and fourth patch are targeting the HDMI PLL. Add the known
working M/N combinations. Also this PLL has some special "doubling"
setting, which is calculated like this:
  OUTPUT = (IN * M / N + FRAC) * 2
Since not all register bits are known we use a copy of the 2970/2975MHz
magic register values from the vendor driver.

The fifth patch makes the clocks in the video clock tree mutable. The
final patch in this series exports the clocks needed for rate control.

For reference, this is the .dts definition for the Meson8b VPU. The
code for the VPU driver is unfortunately not ready for upstreaming yet.
However, I have tested with all resolutions my monitor supports and the
clock settings are all applied correctly.
    vpu: vpu@100000 {
      compatible = "amlogic,meson8b-vpu";

      reg = <0x100000 0x10000>;
      reg-names = "vpu";

      interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;

      amlogic,canvas = <&canvas>;
      amlogic,hhi-sysctrl = <&hhi>;

      /*
       * The VCLK{,2}_IN path always needs to derived from
       * the CLKID_VID_PLL_FINAL_DIV so other clocks like
       * MPLL1 are not used (MPLL1 is reserved for audio
       * purposes).
       */
      assigned-clocks = <&clkc CLKID_VCLK_IN_SEL>,
                        <&clkc CLKID_VCLK2_IN_SEL>;
      assigned-clock-parents = <&clkc CLKID_VID_PLL_FINAL_DIV>,
                               <&clkc CLKID_VID_PLL_FINAL_DIV>;

      clocks = <&clkc CLKID_VPU_INTR>,
               <&clkc CLKID_HDMI_INTR_SYNC>,
               <&clkc CLKID_GCLK_VENCI_INT>,
               <&clkc CLKID_HDMI_PLL_HDMI_OUT>,
               <&clkc CLKID_HDMI_TX_PIXEL>,
               <&clkc CLKID_CTS_ENCP>,
               <&clkc CLKID_CTS_ENCI>,
               <&clkc CLKID_CTS_ENCT>,
               <&clkc CLKID_CTS_ENCL>,
               <&clkc CLKID_CTS_VDAC0>;
      clock-names = "vpu_intr",
                    "hdmi_intr_sync",
                    "venci_int",
                    "tmds",
                    "hdmi_tx_pixel",
                    "cts_encp",
                    "cts_enci",
                    "cts_enct",
                    "cts_encl",
                    "cts_vdac0";

      resets = <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE>,
               <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST>;
      reset-names = "vid_pll_pre",
                    "vid_pll_post",
                    "vid_pll_soft_pre",
                    "vid_pll_soft_post";

      power-domains = <&pwrc PWRC_MESON8_VPU_ID>;

      nvmem-cells = <&cvbs_trimming>;
      nvmem-cell-names = "cvbs_trimming";

      #address-cells = <1>;
      #size-cells = <0>;

      #sound-dai-cells = <0>;
      sound-name-prefix = "HDMITX";

      /* CVBS VDAC output port */
      cvbs_vdac_port: port@0 {
        reg = <0>;
      };

      /* HDMI-TX output port */
      hdmi_tx_port: port@1 {
        reg = <1>;

        hdmi_tx_out: endpoint {
          remote-endpoint = <&hdmi_tx_in>;
        };
      };
    };


Martin Blumenstingl (6):
  clk: meson: meson8b: Use CLK_SET_RATE_NO_REPARENT for vclk{,2}_in_sel
  clk: meson: meson8b: Add the vid_pll_lvds_en gate clock
  clk: meson: meson8b: Add the HDMI PLL M/N parameters
  clk: meson: meson8b: Initialize the HDMI PLL registers
  clk: meson: meson8b: Make the video clock trees mutable
  clk: meson: meson8b: Export the video clocks

 drivers/clk/meson/meson8b.c              | 163 +++++++++++++++++------
 drivers/clk/meson/meson8b.h              |  26 ++--
 include/dt-bindings/clock/meson8b-clkc.h |  10 ++
 3 files changed, 143 insertions(+), 56 deletions(-)

-- 
2.32.0


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

             reply	other threads:[~2021-07-13 23:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 23:25 Martin Blumenstingl [this message]
2021-07-13 23:25 ` [PATCH 0/6] clk: meson8b: video clock tree fixes and making it mutable Martin Blumenstingl
2021-07-13 23:25 ` Martin Blumenstingl
2021-07-13 23:25 ` [PATCH 1/6] clk: meson: meson8b: Use CLK_SET_RATE_NO_REPARENT for vclk{,2}_in_sel Martin Blumenstingl
2021-07-13 23:25   ` [PATCH 1/6] clk: meson: meson8b: Use CLK_SET_RATE_NO_REPARENT for vclk{, 2}_in_sel Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25 ` [PATCH 2/6] clk: meson: meson8b: Add the vid_pll_lvds_en gate clock Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25 ` [PATCH 3/6] clk: meson: meson8b: Add the HDMI PLL M/N parameters Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-09-23 12:22   ` Jerome Brunet
2021-09-23 12:22     ` Jerome Brunet
2021-09-23 12:22     ` Jerome Brunet
2021-07-13 23:25 ` [PATCH 4/6] clk: meson: meson8b: Initialize the HDMI PLL registers Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25 ` [PATCH 5/6] clk: meson: meson8b: Make the video clock trees mutable Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25 ` [PATCH 6/6] clk: meson: meson8b: Export the video clocks Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-07-13 23:25   ` Martin Blumenstingl
2021-09-23 12:28 ` [PATCH 0/6] clk: meson8b: video clock tree fixes and making it mutable Jerome Brunet
2021-09-23 12:28   ` Jerome Brunet
2021-09-23 12:28   ` Jerome Brunet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210713232510.3057750-1-martin.blumenstingl@googlemail.com \
    --to=martin.blumenstingl@googlemail.com \
    --cc=jbrunet@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.