Skip to contentSkip to conversation

arm64: dts: amlogic: handle hdmi system clock

PATCH Applied Jerome Brunet 2 participants 6 messages Jun 26, 2024 – Jun 28, 2024

Subsystems (2)
lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

cover arm64: dts: amlogic: handle hdmi system clock

This patchset adds the setup of the HDMI system clock for HDMI Tx.

This is another step in cleaning HDMI Tx and its direct usage of HHI register space. Eventually, this will help remove component usage from the Amlogic display drivers.

Jerome Brunet (2):
arm64: dts: amlogic: gx: correct hdmi clocks
arm64: dts: amlogic: setup hdmi system clock

 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 5 +++++
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi       | 9 +++++++--
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi        | 9 +++++++--
 3 files changed, 19 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 arm64: dts: amlogic: gx: correct hdmi clocks

The clocks provided to HDMI tx are not consistent between gx and g12:
* gx receives the peripheral clock as 'isfr' while g12 receives it as 'iahb'
* g12 gets the HDMI system clock as 'isfr' but gx does not even get it. It surely needs that clock since the driver is directly poking around the clock controller's registers for that clock.

Align gx SoCs with g12 and provide:
* the HDMI peripheral clock as 'iahb'
* the HDMI system clock as 'isfr'

Fixes 6939db7e0dbf ("ARM64: dts: meson-gx: Add support for HDMI output")
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 4 ++--
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +2 -2
index d8a386c31914..041c37b809f2 100644
@@ -311,8 +311,8 @@ &hdmi_tx {
 		 <&reset RESET_HDMI_SYSTEM_RESET>,
 		 <&reset RESET_HDMI_TX>;
 	reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
-	clocks = <&clkc CLKID_HDMI_PCLK>,
-		 <&clkc CLKID_CLK81>,
+	clocks = <&clkc CLKID_HDMI>,
+		 <&clkc CLKID_HDMI_PCLK>,
 		 <&clkc CLKID_GCLK_VENCI_INT0>;
 	clock-names = "isfr", "iahb", "venci";
 	power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +2 -2
index 82386feb5177..067108800a58 100644
@@ -323,8 +323,8 @@ &hdmi_tx {
 		 <&reset RESET_HDMI_SYSTEM_RESET>,
 		 <&reset RESET_HDMI_TX>;
 	reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
-	clocks = <&clkc CLKID_HDMI_PCLK>,
-		 <&clkc CLKID_CLK81>,
+	clocks = <&clkc CLKID_HDMI>,
+		 <&clkc CLKID_HDMI_PCLK>,
 		 <&clkc CLKID_GCLK_VENCI_INT0>;
 	clock-names = "isfr", "iahb", "venci";
 	power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH 2/2 arm64: dts: amlogic: setup hdmi system clock

In reply to Jerome Brunet

HDMI Tx needs the system clock set on the xtal rate.
This clock is managed by the main clock controller of the related SoCs.

Currently 2 part of the display drivers race to setup the HDMI system clock by directly poking the controller register. The clock API should be used to setup the rate instead.

Use assigned-clock to setup the HDMI system clock.

Fixes 6939db7e0dbf ("ARM64: dts: meson-gx: Add support for HDMI output")
---
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 5 +++++
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi       | 5 +++++
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi        | 5 +++++
 3 files changed, 15 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +5 -0
index 354f3c722b04..0c425af3174d 100644
@@ -215,6 +215,11 @@ hdmi_tx: hdmi-tx@0 {
 				#sound-dai-cells = <0>;
 				status = "disabled";
 
+				assigned-clocks = <&clkc CLKID_HDMI_SEL>,
+						  <&clkc CLKID_HDMI>;
+				assigned-clock-parents = <&xtal>, <0>;
+				assigned-clock-rates = <0>, <24000000>;
+
 				/* VPU VENC Input */
 				hdmi_tx_venc_port: port@0 {
 					reg = <0>;
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +5 -0
index 041c37b809f2..ed00e67e6923 100644
@@ -316,6 +316,11 @@ &hdmi_tx {
 		 <&clkc CLKID_GCLK_VENCI_INT0>;
 	clock-names = "isfr", "iahb", "venci";
 	power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
+
+	assigned-clocks = <&clkc CLKID_HDMI_SEL>,
+			  <&clkc CLKID_HDMI>;
+	assigned-clock-parents = <&xtal>, <0>;
+	assigned-clock-rates = <0>, <24000000>;
 };
 
 &sysctrl {
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +5 -0
index 067108800a58..f58d1790de1c 100644
@@ -328,6 +328,11 @@ &hdmi_tx {
 		 <&clkc CLKID_GCLK_VENCI_INT0>;
 	clock-names = "isfr", "iahb", "venci";
 	power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
+
+	assigned-clocks = <&clkc CLKID_HDMI_SEL>,
+			  <&clkc CLKID_HDMI>;
+	assigned-clock-parents = <&xtal>, <0>;
+	assigned-clock-rates = <0>, <24000000>;
 };
 
 &sysctrl {
Signature · 1 line
2.43.0
maintainer
#3 lore raw
In reply to Jerome Brunet

Hi,

Quoted 5 lines · Jerome Brunet

This patchset adds the setup of the HDMI system clock for HDMI Tx.

This is another step in cleaning HDMI Tx and its direct usage of HHI register space. Eventually, this will help remove component usage from the Amlogic display drivers.

Thanks,

Beware we will need to keep old DT with new kernel functional for a while, do removal of component & HHI in meson_dw_hdmi would need to wait for multiple kernel releases.

A migration step would be to add a phandle to hhi right now, so we can drop components earlier, then in a second time add a proper PHY and then mark the hhi reg as deprecated.

Neil

Quoted 10 lines

Jerome Brunet (2):
arm64: dts: amlogic: gx: correct hdmi clocks
arm64: dts: amlogic: setup hdmi system clock

  arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 5 +++++
  arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi       | 9 +++++++--
  arch/arm64/boot/dts/amlogic/meson-gxl.dtsi        | 9 +++++++--
  3 files changed, 19 insertions(+), 4 deletions(-)
author reviewer
#4 lore raw
Quoted 8 lines · Neil Armstrong

Hi,

Quoted 4 lines · Jerome Brunet

This patchset adds the setup of the HDMI system clock for HDMI Tx. This is another step in cleaning HDMI Tx and its direct usage of HHI register space. Eventually, this will help remove component usage from the Amlogic display drivers.

Quoted 5 lines

Thanks,

Beware we will need to keep old DT with new kernel functional for a while, do removal of component & HHI in meson_dw_hdmi would need to wait for multiple kernel releases.

Oh, I'm aware of the pain DT backward compatibility will be on this one. Situation is slightly more complex than the PWM ...

I'm not sure how keeping support both for the 'legacy HHI direct access' and 'modern API and region' approaches will look like. It's likely to be a mess.

What I posted so far are things I'm sure of and will not cause issue. When I get to the controversial stuff, I'll post an RFC first.

Quoted 4 lines

A migration step would be to add a phandle to hhi right now, so we can drop components earlier, then in a second time add a proper PHY and then mark the hhi reg as deprecated.

Giving the hhi syscon to HDMI-Tx is solving half the problem. IMO, HDMI-TX should just get the HDMI PHY register space in HHI. Indeed that could be added now as well, without causing issue to the existing DTs and drivers.

The display drivers should not directly poke in the HHI bus, nor should it have access to the whole bus.

If we are going to take the pain of fixing the DT interface, better do it once and for all.

The 2 main HHI offenders are HDMI-Tx and vclk:
* HDMI-TX: I've got the that mostly sorted out, for an RFC at least.
* Vclk: Here it is more a matter CCF usage that HHI
* The HDMI pll could use the regular DCO/mult-range driver from what I can see
* The vclk display would need to get the DCO clock along with all the ODs/divider handle. Without rate propagation, it would be free to recreate the setups it needs. I don't have the full list and I did not spend much time on this yet but that's the idea.

Quoted 11 lines

Neil

Quoted 8 lines

Jerome Brunet (2):
arm64: dts: amlogic: gx: correct hdmi clocks
arm64: dts: amlogic: setup hdmi system clock

  arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 5 +++++
  arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi       | 9 +++++++--
  arch/arm64/boot/dts/amlogic/meson-gxl.dtsi        | 9 +++++++--
  3 files changed, 19 insertions(+), 4 deletions(-)
Signature · 1 line
Jerome
maintainer Applied
#5 lore raw
In reply to Jerome Brunet

Hi,

Quoted 11 lines · Jerome Brunet

This patchset adds the setup of the HDMI system clock for HDMI Tx.

This is another step in cleaning HDMI Tx and its direct usage of HHI register space. Eventually, this will help remove component usage from the Amlogic display drivers.

Jerome Brunet (2):
arm64: dts: amlogic: gx: correct hdmi clocks
arm64: dts: amlogic: setup hdmi system clock

[...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.11/arm64-dt)

[1/2] arm64: dts: amlogic: gx: correct hdmi clocks

      https://git.kernel.org/amlogic/c/0602ba0dcd0e76067a0b7543e92b2de3fb231073
[2/2] arm64: dts: amlogic: setup hdmi system clock
      https://git.kernel.org/amlogic/c/1443b6ea806dfcdcee6c894784332c9c947ac319

These changes has been applied on the intermediate git tree [1].

The v6.11/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers for inclusion in their intermediate git branches in order to be sent to Linus during the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate kernel and as soon they appear on the Linux master branch they will be backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3], people are encouraged testing these pre-release kernels and report issues on the relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signature · 1 line
Neil