* [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver
@ 2026-11-17 19:33 Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
This series moves the Amlogic Meson HDMI TX PHY handling (covering GXBB,
GXL, GXM, and G12A SoCs) out of the meson_dw_hdmi DRM driver and into a
dedicated generic PHY driver.
Until now, meson_dw_hdmi directly manipulated the HHI system controller
registers (HHI_HDMI_PHY_CNTL0..5) to configure analog parameters, toggle
resets, and manage power states, as well as manually ungating HDMI
clocks and power domains already described in the DT.
By extracting this logic into a standalone PHY driver under
drivers/phy/amlogic/:
- Hardware representation in the DT is cleaner, modeling the HDMI TX PHY
as a child node of the HHI syscon referenced via standard "phys" and
"phy-names" properties.
- The DRM bridge driver relies on the standard generic PHY API
(phy_init, phy_configure, phy_power_on/off, phy_exit) rather than
touching syscon registers directly.
- Legacy DTs lacking the "phys" property remain supported via a
temporary fallback helper (meson_hdmi_phy_create_legacy) to preserve
backward compatibility to be removed on next phase of component
removal.
Overview of the series:
- Patches 1-3: Fix compatible matching in meson-gx-hhi-sysctrl bindings,
add the new amlogic,meson-hdmi-tx-phy DT schema, and allow the
"hdmi-phy" child node under the HHI syscon.
- Patch 4: Add the new Meson HDMI TX PHY driver implementing the HDMI
PHY configuration ops, along with the temporary legacy creation
helper.
- Patch 5: Document the optional "phys" and "phy-names" properties in
the amlogic,meson-dw-hdmi binding.
- Patches 6-7: Clean up manual HHI clock/power-domain writes in
meson_dw_hdmi (relying on runtime PM instead) and convert the driver
to use the generic PHY framework.
- Patches 8-10: Add the "hdmi-phy" child node and wire up the "phys"
phandle for G12, GXBB, and GXL Device Trees.
Tested on:
- Khadas VIM1 (GXL)
- dtbs_check and dt_binding_check run cleanly with no new warnings.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
Ronald Claveau (10):
dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals
dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding
dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node
phy: amlogic: Add Meson HDMI TX PHY driver
dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names
drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup
drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
arm64: dts: amlogic: Add HDMI TX PHY node for G12
arm64: dts: amlogic: Add HDMI TX PHY node for GXBB
arm64: dts: amlogic: Add HDMI TX PHY node for GXL
.../bindings/display/amlogic,meson-dw-hdmi.yaml | 8 +
.../bindings/phy/amlogic,meson-hdmi-tx-phy.yaml | 33 +++
.../soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml | 43 ++-
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 7 +
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 7 +
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +
drivers/gpu/drm/meson/Kconfig | 1 +
drivers/gpu/drm/meson/meson_dw_hdmi.c | 203 ++++++--------
drivers/phy/amlogic/Kconfig | 11 +
drivers/phy/amlogic/Makefile | 1 +
drivers/phy/amlogic/phy-meson-hdmi-tx.c | 309 +++++++++++++++++++++
include/linux/phy/phy-meson-hdmi-tx.h | 19 ++
12 files changed, 513 insertions(+), 136 deletions(-)
---
base-commit: 6d582d78fad9d828e575ca0cdcff8ea47a77220b
change-id: 20261115-meson-drm-create-hdmitx-phy-4ac40a654d09
Best regards,
--
Ronald Claveau <linux-kernel-dev@aliel.fr>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 02/10] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding Ronald Claveau via B4 Relay
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
The conditional schemas select on "compatible" with a bare enum. On a
list such as:
compatible = "amlogic,meson-gx-hhi-sysctrl", "syscon", "simple-mfd";
an enum applied to the whole array only matches single-entry lists, so
the if: blocks never match as intended and the per-variant constraints
are not applied reliably.
Wrap the enums in "contains" so that the conditions match on any entry
of the compatible list.
Doing so exposes the "phy" child node of "amlogic,meson-gx-hhi-sysctrl":
it was forbidden (phy: false), but some DT legitimately describe an
"amlogic,g12a-mipi-dphy-analog" PHY node under this system controller,
which resulted in dtbs_check warnings such as:
system-controller@0 (amlogic,meson-gx-hhi-sysctrl): False schema does
not allow {'compatible': ['amlogic,g12a-mipi-dphy-analog'],
'#phy-cells': 0, ...}
Allow the phy child node for amlogic,meson-gx-hhi-sysctrl by referencing
the amlogic,g12a-mipi-dphy-analog binding instead of rejecting it.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
.../soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml | 32 +++++++++++++---------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
index f3a85c67ce8a..285edac4c082 100644
--- a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
+++ b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
@@ -40,8 +40,9 @@ allOf:
- if:
properties:
compatible:
- enum:
- - amlogic,meson-hhi-sysctrl
+ contains:
+ enum:
+ - amlogic,meson-hhi-sysctrl
then:
properties:
clock-controller:
@@ -53,9 +54,10 @@ allOf:
- if:
properties:
compatible:
- enum:
- - amlogic,meson-gx-hhi-sysctrl
- - amlogic,meson-axg-hhi-sysctrl
+ contains:
+ enum:
+ - amlogic,meson-gx-hhi-sysctrl
+ - amlogic,meson-axg-hhi-sysctrl
then:
properties:
clock-controller:
@@ -67,9 +69,10 @@ allOf:
- if:
properties:
compatible:
- enum:
- - amlogic,meson-gx-ao-sysctrl
- - amlogic,meson-axg-ao-sysctrl
+ contains:
+ enum:
+ - amlogic,meson-gx-ao-sysctrl
+ - amlogic,meson-axg-ao-sysctrl
then:
properties:
clock-controller:
@@ -81,17 +84,20 @@ allOf:
- if:
properties:
compatible:
- enum:
- - amlogic,meson-gx-hhi-sysctrl
+ contains:
+ enum:
+ - amlogic,meson-gx-hhi-sysctrl
then:
properties:
- phy: false
+ phy:
+ $ref: /schemas/phy/amlogic,g12a-mipi-dphy-analog.yaml
- if:
properties:
compatible:
- enum:
- - amlogic,meson-axg-hhi-sysctrl
+ contains:
+ enum:
+ - amlogic,meson-axg-hhi-sysctrl
then:
properties:
phy:
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 02/10] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
Add a YAML binding for the HDMI TX PHY found on Amlogic Meson SoCs.
It covers the GXBB, GXL and G12A variants, which are described by
their own compatible strings:
- amlogic,meson-gxbb-hdmi-tx-phy
- amlogic,meson-gxl-hdmi-tx-phy
- amlogic,meson-g12a-hdmi-tx-phy
The PHY is a child of the HHI system controller.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
.../bindings/phy/amlogic,meson-hdmi-tx-phy.yaml | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/amlogic,meson-hdmi-tx-phy.yaml b/Documentation/devicetree/bindings/phy/amlogic,meson-hdmi-tx-phy.yaml
new file mode 100644
index 000000000000..c5dd1036c375
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/amlogic,meson-hdmi-tx-phy.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/amlogic,meson-hdmi-tx-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic HDMI TX PHY
+
+maintainers:
+ - Ronald Claveau <linux-kernel-dev@aliel.fr>
+
+properties:
+ compatible:
+ enum:
+ - amlogic,meson-gxbb-hdmi-tx-phy
+ - amlogic,meson-gxl-hdmi-tx-phy
+ - amlogic,meson-g12a-hdmi-tx-phy
+
+ "#phy-cells":
+ const: 0
+
+required:
+ - compatible
+ - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ hdmi-phy {
+ compatible = "amlogic,meson-gxbb-hdmi-tx-phy";
+ #phy-cells = <0>;
+ };
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 02/10] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:39 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
` (6 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
The HDMI TX PHY found on Amlogic Meson SoCs is a child of the HHI
system controller.
Add an optional "hdmi-phy" child node referencing the
amlogic,meson-hdmi-tx-phy binding, and add it to the example.
The node is forbidden for the other system controller variants.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
.../bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
index 285edac4c082..97e47592aff2 100644
--- a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
+++ b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
@@ -36,6 +36,9 @@ properties:
phy:
type: object
+ hdmi-phy:
+ $ref: /schemas/phy/amlogic,meson-hdmi-tx-phy.yaml
+
allOf:
- if:
properties:
@@ -50,6 +53,7 @@ allOf:
pinctrl: false
phy: false
+ hdmi-phy: false
- if:
properties:
@@ -80,6 +84,7 @@ allOf:
power-controller: false
phy: false
+ hdmi-phy: false
- if:
properties:
@@ -104,6 +109,7 @@ allOf:
oneOf:
- $ref: /schemas/phy/amlogic,g12a-mipi-dphy-analog.yaml
- $ref: /schemas/phy/amlogic,meson-axg-mipi-pcie-analog.yaml
+ hdmi-phy: false
required:
- compatible
@@ -155,6 +161,11 @@ examples:
clocks = <&clk_vpu>, <&clk_vapb>;
clock-names = "vpu", "vapb";
};
+
+ hdmi-phy {
+ compatible = "amlogic,meson-g12a-hdmi-tx-phy";
+ #phy-cells = <0>;
+ };
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (2 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:58 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 05/10] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names Ronald Claveau via B4 Relay
` (5 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
Add a PHY driver for the HDMI TX PHY found on Amlogic GXBB, GXL, GXM
and G12A SoCs. The PHY is controlled through the HHI_HDMI_PHY_CNTL0..5
registers of the HHI system controller, of which the PHY node is a
child, so the regmap is obtained from the parent syscon.
The driver implements the generic PHY API with the HDMI configuration
options: .validate() accepts only 8 bpc and a TMDS character rate
covered by the per-SoC table, .configure() programs the analog
settings matching that rate, and .power_on()/.power_off() handle the
reset sequence and the return to the initial state.
The per-SoC register values and rate thresholds are taken from the
existing HDMI TX code, so that the PHY handling can be moved out of the
display driver.
For DTs that do not provide a "phys" property on the HDMI TX node,
export meson_hdmi_phy_create_legacy() so that the display driver can
still create the PHY itself. It is marked as deprecated and will be
removed together with the fallback in meson_dw_hdmi.c.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/phy/amlogic/Kconfig | 11 ++
drivers/phy/amlogic/Makefile | 1 +
drivers/phy/amlogic/phy-meson-hdmi-tx.c | 309 ++++++++++++++++++++++++++++++++
include/linux/phy/phy-meson-hdmi-tx.h | 19 ++
4 files changed, 340 insertions(+)
diff --git a/drivers/phy/amlogic/Kconfig b/drivers/phy/amlogic/Kconfig
index ce7ba3eb2a8e..14fcde8d88bc 100644
--- a/drivers/phy/amlogic/Kconfig
+++ b/drivers/phy/amlogic/Kconfig
@@ -105,3 +105,14 @@ config PHY_MESON_AXG_MIPI_DPHY
Enable this to support the Meson MIPI DPHY found in Meson AXG
SoCs.
If unsure, say N.
+
+config PHY_MESON_HDMI_TX
+ tristate "Meson HDMI TX PHY driver"
+ depends on ARCH_MESON || COMPILE_TEST
+ depends on OF
+ select GENERIC_PHY
+ select MFD_SYSCON
+ help
+ Enable this to support the HDMI TX PHY found on Amlogic
+ GXBB, GXL, GXM and G12A SoCs.
+ If unsure, say N.
diff --git a/drivers/phy/amlogic/Makefile b/drivers/phy/amlogic/Makefile
index 91e3b9790c03..fa7165700a93 100644
--- a/drivers/phy/amlogic/Makefile
+++ b/drivers/phy/amlogic/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_PHY_MESON_G12A_MIPI_DPHY_ANALOG) += phy-meson-g12a-mipi-dphy-analog
obj-$(CONFIG_PHY_MESON_AXG_PCIE) += phy-meson-axg-pcie.o
obj-$(CONFIG_PHY_MESON_AXG_MIPI_PCIE_ANALOG) += phy-meson-axg-mipi-pcie-analog.o
obj-$(CONFIG_PHY_MESON_AXG_MIPI_DPHY) += phy-meson-axg-mipi-dphy.o
+obj-$(CONFIG_PHY_MESON_HDMI_TX) += phy-meson-hdmi-tx.o
diff --git a/drivers/phy/amlogic/phy-meson-hdmi-tx.c b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
new file mode 100644
index 000000000000..69833a080dc3
--- /dev/null
+++ b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
@@ -0,0 +1,309 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Amlogic Meson HDMI TX PHY driver (GXBB / GXL / GXM / G12A)
+ *
+ * Copyright (C) 2026 Ronald Claveau <linux-kernel-dev@aliel.fr>
+ *
+ * Based on meson_dw_hdmi.c:
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
+ */
+
+#include <linux/delay.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/phy/phy.h>
+#include <linux/phy/phy-hdmi.h>
+#include <linux/phy/phy-meson-hdmi-tx.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 */
+#define HHI_HDMI_PHY_CNTL1 0x3a4 /* 0xe9 */
+#define PHY_CNTL1_INIT 0x03900000
+#define PHY_INVERT BIT(17)
+#define PHY_CNTL1_CTRL_MASK GENMASK(3, 0)
+#define PHY_CNTL1_RESET 0xf /* enable + software reset */
+#define PHY_CNTL1_UNRESET 0xe /* enable + unreset */
+#define HHI_HDMI_PHY_CNTL2 0x3a8 /* 0xea */
+#define HHI_HDMI_PHY_CNTL3 0x3ac /* 0xeb */
+#define HHI_HDMI_PHY_CNTL4 0x3b0 /* 0xec */
+#define HHI_HDMI_PHY_CNTL5 0x3b4 /* 0xed */
+
+/* The code resets the PHY 3 times in a row */
+#define PHY_RESET_COUNT 3
+
+struct meson_hdmi_phy_rate {
+ unsigned int min_rate; /* TMDS character rate, in Hz */
+ u32 cntl0;
+ u32 cntl3;
+ u32 cntl5; /* only used if has_cntl5 */
+};
+
+struct meson_hdmi_phy_data {
+ const struct meson_hdmi_phy_rate *rates;
+ unsigned int num_rates;
+ bool has_cntl5;
+ u32 cntl0_init;
+ u32 cntl1_init;
+};
+
+struct meson_hdmi_phy {
+ struct regmap *hhi;
+ const struct meson_hdmi_phy_data *data;
+};
+
+/* GXBB */
+static const struct meson_hdmi_phy_rate gxbb_rates[] = {
+ /* 5.94Gbps, 3.7125Gbps */
+ { 371250000, 0x33353245, 0x2100115b },
+ /* 2.97Gbps */
+ { 297000000, 0x33634283, 0xb000115b },
+ /* 1.485Gbps, and below */
+ { 0, 0x33632122, 0x2000115b },
+};
+
+/* GXL / GXM */
+static const struct meson_hdmi_phy_rate gxl_rates[] = {
+ /* 5.94Gbps, 3.7125Gbps */
+ { 371250000, 0x333d3282, 0x2136315b },
+ /* 2.97Gbps */
+ { 297000000, 0x33303382, 0x2036315b },
+ /* 1.485Gbps */
+ { 148500000, 0x33303362, 0x2016315b },
+ /* 742.5Mbps, and below */
+ { 0, 0x33604142, 0x0016315b },
+};
+
+/* G12A */
+static const struct meson_hdmi_phy_rate g12a_rates[] = {
+ /* 5.94Gbps, 3.7125Gbps */
+ { 371250000, 0x37eb65c4, 0x2ab0ff3b, 0x0000080b },
+ /* 2.97Gbps */
+ { 297000000, 0x33eb6262, 0x2ab0ff3b, 0x00000003 },
+ /* 1.485Gbps, and below */
+ { 0, 0x33eb4242, 0x2ab0ff3b, 0x00000003 },
+};
+
+static const struct meson_hdmi_phy_data gxbb_data = {
+ .rates = gxbb_rates,
+ .num_rates = ARRAY_SIZE(gxbb_rates),
+ .cntl0_init = 0x0,
+ .cntl1_init = PHY_CNTL1_INIT | PHY_INVERT,
+};
+
+static const struct meson_hdmi_phy_data gxl_data = {
+ .rates = gxl_rates,
+ .num_rates = ARRAY_SIZE(gxl_rates),
+ .cntl0_init = 0x0,
+ .cntl1_init = PHY_CNTL1_INIT,
+};
+
+static const struct meson_hdmi_phy_data g12a_data = {
+ .rates = g12a_rates,
+ .num_rates = ARRAY_SIZE(g12a_rates),
+ .has_cntl5 = true,
+ .cntl0_init = 0x000b4242, /* Bandgap */
+ .cntl1_init = PHY_CNTL1_INIT,
+};
+
+static const struct meson_hdmi_phy_rate *
+meson_hdmi_phy_find_rate(const struct meson_hdmi_phy_data *data, u64 rate)
+{
+ unsigned int i;
+
+ for (i = 0; i < data->num_rates; i++)
+ if (rate >= data->rates[i].min_rate)
+ return &data->rates[i];
+
+ return NULL;
+}
+
+/* Fallback to init mode: CNTL1 first, then CNTL0 (order matters) */
+static void meson_hdmi_phy_set_init_state(struct meson_hdmi_phy *priv)
+{
+ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, priv->data->cntl1_init);
+ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, priv->data->cntl0_init);
+}
+
+static int meson_hdmi_phy_init(struct phy *phy)
+{
+ struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
+
+ meson_hdmi_phy_set_init_state(priv);
+
+ return 0;
+}
+
+static int meson_hdmi_phy_configure(struct phy *phy,
+ union phy_configure_opts *opts)
+{
+ struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
+ const struct meson_hdmi_phy_rate *r;
+
+ r = meson_hdmi_phy_find_rate(priv->data, opts->hdmi.tmds_char_rate);
+ if (!r)
+ return -EINVAL;
+
+ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, r->cntl0);
+ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, r->cntl3);
+ if (priv->data->has_cntl5)
+ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL5, r->cntl5);
+
+ /* Disable clock, fifo, fifo_wr */
+ regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
+ PHY_CNTL1_CTRL_MASK, 0);
+
+ return 0;
+}
+
+static int meson_hdmi_phy_validate(struct phy *phy, enum phy_mode mode,
+ int submode, union phy_configure_opts *opts)
+{
+ struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
+
+ if (mode != PHY_MODE_HDMI)
+ return -EINVAL;
+
+ if (opts->hdmi.bpc != 8)
+ return -EINVAL;
+
+ if (!meson_hdmi_phy_find_rate(priv->data, opts->hdmi.tmds_char_rate))
+ return -EINVAL;
+
+ return 0;
+}
+
+static int meson_hdmi_phy_power_on(struct phy *phy)
+{
+ struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
+ int i;
+
+ /* Reset PHY 3 times in a row */
+ for (i = 0; i < PHY_RESET_COUNT; i++) {
+ /* Enable and software reset */
+ regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
+ PHY_CNTL1_CTRL_MASK, PHY_CNTL1_RESET);
+ fsleep(2000);
+
+ /* Enable and unreset */
+ regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
+ PHY_CNTL1_CTRL_MASK, PHY_CNTL1_UNRESET);
+ fsleep(2000);
+ }
+
+ return 0;
+}
+
+static int meson_hdmi_phy_power_off(struct phy *phy)
+{
+ struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
+
+ meson_hdmi_phy_set_init_state(priv);
+
+ return 0;
+}
+
+static const struct phy_ops meson_hdmi_phy_ops = {
+ .init = meson_hdmi_phy_init,
+ .configure = meson_hdmi_phy_configure,
+ .validate = meson_hdmi_phy_validate,
+ .power_on = meson_hdmi_phy_power_on,
+ .power_off = meson_hdmi_phy_power_off,
+ .owner = THIS_MODULE,
+};
+
+static struct phy *meson_hdmi_phy_alloc(struct device *dev,
+ struct regmap *hhi,
+ const struct meson_hdmi_phy_data *data)
+{
+ struct meson_hdmi_phy *priv;
+ struct phy *phy;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return ERR_PTR(-ENOMEM);
+
+ priv->hhi = hhi;
+ priv->data = data;
+
+ phy = devm_phy_create(dev, NULL, &meson_hdmi_phy_ops);
+ if (IS_ERR(phy))
+ return phy;
+
+ phy_set_drvdata(phy, priv);
+
+ return phy;
+}
+
+/*
+ * DEPRECATED: only for DTs without a "phys" property on the HDMI TX node.
+ * Remove together with the fallback in meson_dw_hdmi.c.
+ */
+struct phy *meson_hdmi_phy_create_legacy(struct device *dev,
+ struct regmap *hhi,
+ enum meson_hdmi_phy_soc soc)
+{
+ static const struct meson_hdmi_phy_data *const soc_data[] = {
+ [MESON_HDMI_PHY_GXBB] = &gxbb_data,
+ [MESON_HDMI_PHY_GXL] = &gxl_data,
+ [MESON_HDMI_PHY_G12A] = &g12a_data,
+ };
+
+ if (soc >= ARRAY_SIZE(soc_data))
+ return ERR_PTR(-EINVAL);
+
+ return meson_hdmi_phy_alloc(dev, hhi, soc_data[soc]);
+}
+EXPORT_SYMBOL_GPL(meson_hdmi_phy_create_legacy);
+
+static int meson_hdmi_phy_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct phy_provider *provider;
+ struct regmap *hhi;
+ struct phy *phy;
+ const struct meson_hdmi_phy_data *data;
+
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -EINVAL;
+
+ /* The PHY node is a child of the HHI syscon */
+ hhi = syscon_node_to_regmap(dev->of_node->parent);
+ if (IS_ERR(hhi))
+ return dev_err_probe(dev, PTR_ERR(hhi),
+ "failed to get HHI regmap\n");
+
+ phy = meson_hdmi_phy_alloc(dev, hhi, data);
+ if (IS_ERR(phy))
+ return dev_err_probe(dev, PTR_ERR(phy),
+ "failed to create PHY\n");
+
+ provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+
+ return PTR_ERR_OR_ZERO(provider);
+}
+
+static const struct of_device_id meson_hdmi_phy_of_match[] = {
+ { .compatible = "amlogic,meson-gxbb-hdmi-tx-phy", .data = &gxbb_data },
+ { .compatible = "amlogic,meson-gxl-hdmi-tx-phy", .data = &gxl_data },
+ { .compatible = "amlogic,meson-g12a-hdmi-tx-phy", .data = &g12a_data },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, meson_hdmi_phy_of_match);
+
+static struct platform_driver meson_hdmi_phy_driver = {
+ .probe = meson_hdmi_phy_probe,
+ .driver = {
+ .name = "meson-hdmi-tx-phy",
+ .of_match_table = meson_hdmi_phy_of_match,
+ },
+};
+module_platform_driver(meson_hdmi_phy_driver);
+
+MODULE_AUTHOR("Ronald Claveau <linux-kernel-dev@aliel.fr>");
+MODULE_DESCRIPTION("Amlogic Meson HDMI TX PHY driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/phy/phy-meson-hdmi-tx.h b/include/linux/phy/phy-meson-hdmi-tx.h
new file mode 100644
index 000000000000..fe76a5f7efdb
--- /dev/null
+++ b/include/linux/phy/phy-meson-hdmi-tx.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __PHY_MESON_HDMI_TX_H
+#define __PHY_MESON_HDMI_TX_H
+
+struct device;
+struct regmap;
+
+enum meson_hdmi_phy_soc {
+ MESON_HDMI_PHY_GXBB,
+ MESON_HDMI_PHY_GXL, /* GXL and GXM */
+ MESON_HDMI_PHY_G12A,
+};
+
+/* DEPRECATED: compat for DTs without "phys" on the HDMI TX node */
+struct phy *meson_hdmi_phy_create_legacy(struct device *dev,
+ struct regmap *hhi,
+ enum meson_hdmi_phy_soc soc);
+
+#endif /* __PHY_MESON_HDMI_TX_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 05/10] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (3 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
The HDMI TX PHY now has its own binding and driver. Describe the link
between the HDMI TX controller and its PHY with a "phys" property
holding a single phandle, named "hdmi" through "phy-names", and update
the example accordingly.
The properties are optional so that existing DT, which do not describe
the PHY, keep validating; the driver falls back to creating the PHY
itself in that case.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
.../devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml
index 416fe263ac92..5a033fec21b0 100644
--- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml
@@ -108,6 +108,12 @@ properties:
sound-name-prefix: true
+ phys:
+ maxItems: 1
+
+ phy-names:
+ const: hdmi
+
required:
- compatible
- reg
@@ -136,6 +142,8 @@ examples:
power-domains = <&pd_vpu>;
#address-cells = <1>;
#size-cells = <0>;
+ phys = <&hdmi_tx_phy>;
+ phy-names = "hdmi";
/* VPU VENC Input */
hdmi_tx_venc_port: port@0 {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (4 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 05/10] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 20:11 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
` (3 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
meson_dw_hdmi_init() programs two HHI registers by hand: the HDMI clock
mux/divider/gate (HHI_HDMI_CLK_CNTL) and the HDMITX memory power-down
bits (HHI_MEM_PD_REG0). Both are already covered by resources described
in the DT:
- the HDMI clock is selected and rated through assigned-clocks
(CLKID_HDMI_SEL parented to xtal, CLKID_HDMI at 24 MHz), and gated
through the "isfr" clock, which the driver already enables at bind
time;
- the memory power-down bits are handled by the VPU power domain
referenced by "power-domains".
Remove the open-coded register writes. Take an explicit runtime PM
reference in probe and release it on removal, so that the domain is
guaranteed to be on for the lifetime of the device.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/gpu/drm/meson/meson_dw_hdmi.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index eb33c70f29c3..20a821936b3a 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -12,6 +12,7 @@
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
@@ -102,8 +103,6 @@
#define HDMITX_DWC_CTRL_REG 0x18
/* HHI Registers */
-#define HHI_MEM_PD_REG0 0x100 /* 0x40 */
-#define HHI_HDMI_CLK_CNTL 0x1cc /* 0x73 */
#define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 */
#define HHI_HDMI_PHY_CNTL1 0x3a4 /* 0xe9 */
#define PHY_CNTL1_INIT 0x03900000
@@ -599,12 +598,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
{
struct meson_drm *priv = meson_dw_hdmi->priv;
- /* Enable clocks */
- regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100);
-
- /* Bring HDMITX MEM output of power down */
- regmap_update_bits(priv->hhi, HHI_MEM_PD_REG0, 0xff << 8, 0);
-
/* Reset HDMITX APB & TX & PHY */
reset_control_reset(meson_dw_hdmi->hdmitx_apb);
reset_control_reset(meson_dw_hdmi->hdmitx_ctrl);
@@ -829,9 +822,29 @@ static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
return 0;
}
+static void meson_dw_hdmi_pm_put(void *dev)
+{
+ pm_runtime_put_sync(dev);
+}
+
static int meson_dw_hdmi_probe(struct platform_device *pdev)
{
- return component_add(&pdev->dev, &meson_dw_hdmi_ops);
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to power on HDMI TX\n");
+
+ ret = devm_add_action_or_reset(dev, meson_dw_hdmi_pm_put, dev);
+ if (ret)
+ return ret;
+
+ return component_add(dev, &meson_dw_hdmi_ops);
}
static void meson_dw_hdmi_remove(struct platform_device *pdev)
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (5 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 20:03 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 08/10] arm64: dts: amlogic: Add HDMI TX PHY node for G12 Ronald Claveau via B4 Relay
` (2 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
The HDMI TX PHY registers (HHI_HDMI_PHY_CNTL0..5) were programmed
directly from this driver, with per-SoC tables selected by compatible
string. A dedicated PHY driver now exists, so use it through the
generic PHY API instead:
- phy_init() replaces the initial CNTL0/CNTL1 programming,
- phy_configure() replaces meson_hdmi_phy_setup_mode(), the TMDS
character rate being derived from the (possibly 4:2:0 halved) pixel
clock, with 8 bpc as before,
- phy_power_on() replaces the three successive PHY resets,
- phy_power_off() replaces the fallback to the initial state in
dw_hdmi_phy_disable().
The "hdmi" PHY is looked up through the "phys" property of the HDMI TX
node. Device trees that do not provide it keep working: in that case
the PHY is created by this driver through
meson_hdmi_phy_create_legacy(), using a per-SoC identifier replacing the
former cntl0_init/cntl1_init fields, and a warning is printed. This
fallback is deprecated and will be removed once all device trees have
been converted.
meson_dw_hdmi_init() can now fail, so propagate its return value from
probe and resume. Select PHY_MESON_HDMI_TX in Kconfig since the driver
now depends on it, including for the legacy path.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/gpu/drm/meson/Kconfig | 1 +
drivers/gpu/drm/meson/meson_dw_hdmi.c | 172 ++++++++++++----------------------
2 files changed, 59 insertions(+), 114 deletions(-)
diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
index 417f79829cf8..60bdbddaf5d0 100644
--- a/drivers/gpu/drm/meson/Kconfig
+++ b/drivers/gpu/drm/meson/Kconfig
@@ -19,6 +19,7 @@ config DRM_MESON_DW_HDMI
depends on DRM_MESON
default y if DRM_MESON
select DRM_DW_HDMI
+ select PHY_MESON_HDMI_TX
imply DRM_DW_HDMI_I2S_AUDIO
config DRM_MESON_DW_MIPI_DSI
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 20a821936b3a..f28cc1e6ee1d 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -11,6 +11,8 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
+#include <linux/phy/phy.h>
+#include <linux/phy/phy-meson-hdmi-tx.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
@@ -102,16 +104,6 @@
#define HDMITX_DWC_DATA_REG 0x14
#define HDMITX_DWC_CTRL_REG 0x18
-/* HHI Registers */
-#define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 */
-#define HHI_HDMI_PHY_CNTL1 0x3a4 /* 0xe9 */
-#define PHY_CNTL1_INIT 0x03900000
-#define PHY_INVERT BIT(17)
-#define HHI_HDMI_PHY_CNTL2 0x3a8 /* 0xea */
-#define HHI_HDMI_PHY_CNTL3 0x3ac /* 0xeb */
-#define HHI_HDMI_PHY_CNTL4 0x3b0 /* 0xec */
-#define HHI_HDMI_PHY_CNTL5 0x3b4 /* 0xed */
-
static DEFINE_SPINLOCK(reg_lock);
enum meson_venc_source {
@@ -131,8 +123,7 @@ struct meson_dw_hdmi_data {
unsigned int addr);
void (*dwc_write)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data);
- u32 cntl0_init;
- u32 cntl1_init;
+ enum meson_hdmi_phy_soc phy_soc; /* legacy PHY only */
};
struct meson_dw_hdmi {
@@ -147,6 +138,8 @@ struct meson_dw_hdmi {
u32 irq_stat;
struct dw_hdmi *hdmi;
struct drm_bridge *bridge;
+ struct phy *phy;
+ bool legacy_phy;
};
static inline int dw_hdmi_is_compatible(struct meson_dw_hdmi *dw_hdmi,
@@ -273,87 +266,6 @@ static inline void dw_hdmi_g12a_dwc_write(struct meson_dw_hdmi *dw_hdmi,
/* Bridge */
-/* Setup PHY bandwidth modes */
-static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi,
- const struct drm_display_mode *mode,
- bool mode_is_420)
-{
- struct meson_drm *priv = dw_hdmi->priv;
- unsigned int pixel_clock = mode->clock;
-
- /* For 420, pixel clock is half unlike venc clock */
- if (mode_is_420) pixel_clock /= 2;
-
- if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
- dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi")) {
- if (pixel_clock >= 371250) {
- /* 5.94Gbps, 3.7125Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x333d3282);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2136315b);
- } else if (pixel_clock >= 297000) {
- /* 2.97Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33303382);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2036315b);
- } else if (pixel_clock >= 148500) {
- /* 1.485Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33303362);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2016315b);
- } else {
- /* 742.5Mbps, and below */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33604142);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x0016315b);
- }
- } else if (dw_hdmi_is_compatible(dw_hdmi,
- "amlogic,meson-gxbb-dw-hdmi")) {
- if (pixel_clock >= 371250) {
- /* 5.94Gbps, 3.7125Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33353245);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2100115b);
- } else if (pixel_clock >= 297000) {
- /* 2.97Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33634283);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0xb000115b);
- } else {
- /* 1.485Gbps, and below */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33632122);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2000115b);
- }
- } else if (dw_hdmi_is_compatible(dw_hdmi,
- "amlogic,meson-g12a-dw-hdmi")) {
- if (pixel_clock >= 371250) {
- /* 5.94Gbps, 3.7125Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x37eb65c4);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2ab0ff3b);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL5, 0x0000080b);
- } else if (pixel_clock >= 297000) {
- /* 2.97Gbps */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33eb6262);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2ab0ff3b);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL5, 0x00000003);
- } else {
- /* 1.485Gbps, and below */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33eb4242);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2ab0ff3b);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL5, 0x00000003);
- }
- }
-}
-
-static inline void meson_dw_hdmi_phy_reset(struct meson_dw_hdmi *dw_hdmi)
-{
- struct meson_drm *priv = dw_hdmi->priv;
-
- /* Enable and software reset */
- regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0xf);
-
- mdelay(2);
-
- /* Enable and unreset */
- regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0xe);
-
- mdelay(2);
-}
-
static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
const struct drm_display_info *display,
const struct drm_display_mode *mode)
@@ -364,6 +276,9 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
unsigned int wr_clk =
readl_relaxed(priv->io_base + _REG(VPU_HDMI_SETTING));
bool mode_is_420 = false;
+ unsigned int pixel_clock = mode->clock;
+ union phy_configure_opts opts = {};
+ int ret;
DRM_DEBUG_DRIVER("\"%s\" div%d\n", mode->name,
mode->clock > 340000 ? 40 : 10);
@@ -392,19 +307,22 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_CNTL, 0x2);
/* Setup PHY parameters */
- meson_hdmi_phy_setup_mode(dw_hdmi, mode, mode_is_420);
-
- /* Disable clock, fifo, fifo_wr */
- regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
+ if (mode_is_420)
+ pixel_clock /= 2;
+ opts.hdmi.tmds_char_rate = (u64)pixel_clock * 1000;
+ opts.hdmi.bpc = 8;
+ ret = phy_configure(dw_hdmi->phy, &opts);
+ if (ret)
+ return ret;
dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
msleep(100);
/* Reset PHY 3 times in a row */
- meson_dw_hdmi_phy_reset(dw_hdmi);
- meson_dw_hdmi_phy_reset(dw_hdmi);
- meson_dw_hdmi_phy_reset(dw_hdmi);
+ ret = phy_power_on(dw_hdmi->phy);
+ if (ret)
+ return ret;
/* Temporary Disable VENC video stream */
if (priv->venc.hdmi_use_enci)
@@ -443,13 +361,11 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi,
void *data)
{
struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data;
- struct meson_drm *priv = dw_hdmi->priv;
DRM_DEBUG_DRIVER("\n");
/* Fallback to init mode */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, dw_hdmi->data->cntl1_init);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, dw_hdmi->data->cntl0_init);
+ phy_power_off(dw_hdmi->phy);
}
static enum drm_connector_status dw_hdmi_read_hpd(struct dw_hdmi *hdmi,
@@ -572,8 +488,7 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_gxbb_data = {
.top_write = dw_hdmi_top_write,
.dwc_read = dw_hdmi_dwc_read,
.dwc_write = dw_hdmi_dwc_write,
- .cntl0_init = 0x0,
- .cntl1_init = PHY_CNTL1_INIT | PHY_INVERT,
+ .phy_soc = MESON_HDMI_PHY_GXBB,
};
static const struct meson_dw_hdmi_data meson_dw_hdmi_gxl_data = {
@@ -581,8 +496,7 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_gxl_data = {
.top_write = dw_hdmi_top_write,
.dwc_read = dw_hdmi_dwc_read,
.dwc_write = dw_hdmi_dwc_write,
- .cntl0_init = 0x0,
- .cntl1_init = PHY_CNTL1_INIT,
+ .phy_soc = MESON_HDMI_PHY_GXL,
};
static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
@@ -590,13 +504,13 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
.top_write = dw_hdmi_g12a_top_write,
.dwc_read = dw_hdmi_g12a_dwc_read,
.dwc_write = dw_hdmi_g12a_dwc_write,
- .cntl0_init = 0x000b4242, /* Bandgap */
- .cntl1_init = PHY_CNTL1_INIT,
+ .phy_soc = MESON_HDMI_PHY_G12A,
};
-static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
+static int meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
{
struct meson_drm *priv = meson_dw_hdmi->priv;
+ int ret;
/* Reset HDMITX APB & TX & PHY */
reset_control_reset(meson_dw_hdmi->hdmitx_apb);
@@ -624,8 +538,9 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
/* Setup PHY */
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
+ ret = phy_init(meson_dw_hdmi->phy);
+ if (ret)
+ return ret;
/* Enable HDMI-TX Interrupt */
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
@@ -634,6 +549,7 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_MASKN,
HDMITX_TOP_INTR_CORE);
+ return 0;
}
static void meson_disable_clk(void *data)
@@ -746,7 +662,26 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
return ret;
}
- meson_dw_hdmi_init(meson_dw_hdmi);
+ meson_dw_hdmi->phy = devm_phy_optional_get(dev, "hdmi");
+ if (IS_ERR(meson_dw_hdmi->phy))
+ return dev_err_probe(dev, PTR_ERR(meson_dw_hdmi->phy),
+ "failed to get HDMI PHY\n");
+
+ if (!meson_dw_hdmi->phy) {
+ /* DEPRECATED: DT without "phys" */
+ dev_warn(dev, "missing \"phys\", using legacy HDMI PHY\n");
+ meson_dw_hdmi->phy = meson_hdmi_phy_create_legacy(dev, priv->hhi,
+ meson_dw_hdmi->data->phy_soc);
+ if (IS_ERR(meson_dw_hdmi->phy))
+ return dev_err_probe(dev, PTR_ERR(meson_dw_hdmi->phy),
+ "failed to create legacy HDMI PHY\n");
+
+ meson_dw_hdmi->legacy_phy = true;
+ }
+
+ ret = meson_dw_hdmi_init(meson_dw_hdmi);
+ if (ret)
+ return ret;
/* Bridge / Connector */
@@ -784,6 +719,10 @@ static void meson_dw_hdmi_unbind(struct device *dev, struct device *master,
struct platform_device *pdev = to_platform_device(dev);
int irq = platform_get_irq(pdev, 0);
+ phy_exit(meson_dw_hdmi->phy);
+ if (meson_dw_hdmi->legacy_phy)
+ devm_phy_destroy(dev, meson_dw_hdmi->phy);
+
devm_free_irq(dev, irq, meson_dw_hdmi);
dw_hdmi_unbind(meson_dw_hdmi->hdmi);
drm_bridge_put(meson_dw_hdmi->bridge);
@@ -801,6 +740,8 @@ static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
if (!meson_dw_hdmi)
return 0;
+ phy_exit(meson_dw_hdmi->phy);
+
/* Reset TOP */
meson_dw_hdmi->data->top_write(meson_dw_hdmi,
HDMITX_TOP_SW_RESET, 0);
@@ -811,11 +752,14 @@ static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
{
struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
+ int ret;
if (!meson_dw_hdmi)
return 0;
- meson_dw_hdmi_init(meson_dw_hdmi);
+ ret = meson_dw_hdmi_init(meson_dw_hdmi);
+ if (ret)
+ return ret;
dw_hdmi_resume(meson_dw_hdmi->hdmi);
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 08/10] arm64: dts: amlogic: Add HDMI TX PHY node for G12
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (6 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 09/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 10/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
Describe the HDMI TX PHY as a child of the HHI system controller, with
the amlogic,meson-g12a-hdmi-tx-phy compatible and reference
it from the HDMI TX node through "phys" and "phy-names".
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index 3135566df880..17d80b8139d6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -210,6 +210,8 @@ hdmi_tx: hdmi-tx@0 {
<&clkc CLKID_HTX_PCLK>,
<&clkc CLKID_VPU_INTR>;
clock-names = "isfr", "iahb", "venci";
+ phys = <&hdmi_tx_phy>;
+ phy-names = "hdmi";
#address-cells = <1>;
#size-cells = <0>;
#sound-dai-cells = <0>;
@@ -1683,6 +1685,11 @@ mipi_analog_dphy: phy {
#phy-cells = <0>;
status = "disabled";
};
+
+ hdmi_tx_phy: hdmi-phy {
+ compatible = "amlogic,meson-g12a-hdmi-tx-phy";
+ #phy-cells = <0>;
+ };
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 09/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (7 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 08/10] arm64: dts: amlogic: Add HDMI TX PHY node for G12 Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 10/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
Describe the HDMI TX PHY as a child of the HHI system controller, with
the amlogic,meson-gxbb-hdmi-tx-phy compatible and reference
it from the HDMI TX node through "phys" and "phy-names".
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 5c2fe9dc4f80..1dfd5f6d0f68 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -316,6 +316,8 @@ &hdmi_tx {
<&clkc CLKID_GCLK_VENCI_INT0>;
clock-names = "isfr", "iahb", "venci";
power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
+ phys = <&hdmi_tx_phy>;
+ phy-names = "hdmi";
assigned-clocks = <&clkc CLKID_HDMI_SEL>,
<&clkc CLKID_HDMI>;
@@ -330,6 +332,11 @@ clkc: clock-controller {
clocks = <&xtal>;
clock-names = "xtal";
};
+
+ hdmi_tx_phy: hdmi-phy {
+ compatible = "amlogic,meson-gxbb-hdmi-tx-phy";
+ #phy-cells = <0>;
+ };
};
&hwrng {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXL
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
` (8 preceding siblings ...)
2026-11-17 19:33 ` [PATCH 09/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
@ 2026-11-17 19:33 ` Ronald Claveau via B4 Relay
9 siblings, 0 replies; 15+ messages in thread
From: Ronald Claveau via B4 Relay @ 2026-11-17 19:33 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Vinod Koul,
Manivannan Sadhasivam, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-phy, dri-devel, Ronald Claveau
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
Describe the HDMI TX PHY as a child of the HHI system controller, with
the amlogic,meson-gxl-hdmi-tx-phy compatible and reference
it from the HDMI TX node through "phys" and "phy-names".
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index f257fe3860f7..77d4e6b5b850 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -328,6 +328,8 @@ &hdmi_tx {
<&clkc CLKID_GCLK_VENCI_INT0>;
clock-names = "isfr", "iahb", "venci";
power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
+ phys = <&hdmi_tx_phy>;
+ phy-names = "hdmi";
assigned-clocks = <&clkc CLKID_HDMI_SEL>,
<&clkc CLKID_HDMI>;
@@ -342,6 +344,11 @@ clkc: clock-controller {
clocks = <&xtal>;
clock-names = "xtal";
};
+
+ hdmi_tx_phy: hdmi-phy {
+ compatible = "amlogic,meson-gxl-hdmi-tx-phy";
+ #phy-cells = <0>;
+ };
};
&hwrng {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node
2026-11-17 19:33 ` [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
@ 2026-11-17 19:39 ` sashiko-bot
0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-11-17 19:39 UTC (permalink / raw)
To: Ronald Claveau
Cc: devicetree, linux-amlogic, linux-phy, dri-devel, robh, conor+dt,
neil.armstrong, vkoul, olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: soc: amlogic: unwieldy conditionals in
meson-gx-hhi-sysctrl.yaml
--
commit 2922cae8c47e87d6a0fd71e91e4a07690e4d0f66
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node
This commit adds an optional hdmi-phy child node to the Amlogic Meson
system controller binding for amlogic,meson-gx-hhi-sysctrl and forbids it
on the other system controller variants.
> diff --git a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
> index 285edac4c0821..97e47592aff2e 100644
> --- a/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
> +++ b/Documentation/devicetree/bindings/soc/amlogic/amlogic,meson-gx-hhi-sysctrl.yaml
> @@ -36,6 +36,9 @@ properties:
> phy:
> type: object
>
> + hdmi-phy:
> + $ref: /schemas/phy/amlogic,meson-hdmi-tx-phy.yaml
> +
> allOf:
> - if:
> properties:
> @@ -50,6 +53,7 @@ allOf:
>
> pinctrl: false
> phy: false
> + hdmi-phy: false
>
> - if:
> properties:
> @@ -80,6 +84,7 @@ allOf:
>
> power-controller: false
> phy: false
> + hdmi-phy: false
>
> - if:
> properties:
> @@ -104,6 +109,7 @@ allOf:
> oneOf:
> - $ref: /schemas/phy/amlogic,g12a-mipi-dphy-analog.yaml
> - $ref: /schemas/phy/amlogic,meson-axg-mipi-pcie-analog.yaml
> + hdmi-phy: false
[Severity: Low]
Would it make sense to split these system controller variants into
separate schema documents instead of adding more per-compatible
exclusions here?
This schema covers five system controller compatibles across different SoC
families and register blocks (HHI and AO), where nearly every child node
property (clock-controller, power-controller, pinctrl, phy, and now
hdmi-phy) differs across variants and has to be overridden or forbidden in
overlapping allOf if-then branches.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-meson-drm-create-hdmitx-phy-v1-0-9e0ac931381c@aliel.fr?part=3
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver
2026-11-17 19:33 ` [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
@ 2026-11-17 19:58 ` sashiko-bot
0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-11-17 19:58 UTC (permalink / raw)
To: Ronald Claveau
Cc: devicetree, linux-amlogic, linux-phy, dri-devel, robh, conor+dt,
neil.armstrong, vkoul, olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] phy: amlogic: broken rate and submode check in
meson_hdmi_phy_validate()
--
commit 0bf49ea77c864cdcf7af96e59e1ffba5194d9636
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
phy: amlogic: Add Meson HDMI TX PHY driver
This commit adds a generic PHY driver for the HDMI TX PHY on Amlogic GXBB,
GXL, GXM, and G12A SoCs, along with a legacy helper for device trees
lacking a "phys" property.
> diff --git a/drivers/phy/amlogic/phy-meson-hdmi-tx.c b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
> new file mode 100644
> index 0000000000000..69833a080dc35
> --- /dev/null
> +++ b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
[ ... ]
> +/* GXBB */
> +static const struct meson_hdmi_phy_rate gxbb_rates[] = {
> + /* 5.94Gbps, 3.7125Gbps */
> + { 371250000, 0x33353245, 0x2100115b },
> + /* 2.97Gbps */
> + { 297000000, 0x33634283, 0xb000115b },
> + /* 1.485Gbps, and below */
> + { 0, 0x33632122, 0x2000115b },
> +};
[ ... ]
> +static const struct meson_hdmi_phy_rate *
> +meson_hdmi_phy_find_rate(const struct meson_hdmi_phy_data *data, u64 rate)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < data->num_rates; i++)
> + if (rate >= data->rates[i].min_rate)
> + return &data->rates[i];
> +
> + return NULL;
> +}
[ ... ]
> +static int meson_hdmi_phy_validate(struct phy *phy, enum phy_mode mode,
> + int submode, union phy_configure_opts *opts)
> +{
> + struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
> +
> + if (mode != PHY_MODE_HDMI)
> + return -EINVAL;
> +
> + if (opts->hdmi.bpc != 8)
> + return -EINVAL;
> +
> + if (!meson_hdmi_phy_find_rate(priv->data, opts->hdmi.tmds_char_rate))
> + return -EINVAL;
> +
> + return 0;
> +}
[Severity: Medium]
Can meson_hdmi_phy_find_rate() ever return NULL here?
Every per-SoC rate table ends with an entry where min_rate is 0, and rate
is an unsigned u64, so rate >= data->rates[i].min_rate is always true on
the final entry. That makes the NULL return and the callers' NULL checks
in meson_hdmi_phy_validate() and meson_hdmi_phy_configure() dead code, and
meson_hdmi_phy_validate() accepts any tmds_char_rate value (including 0 Hz
or rates above the 594 MHz hardware limit).
In addition, meson_hdmi_phy_validate() does not check that submode is
PHY_HDMI_MODE_TMDS before reading opts->hdmi.tmds_char_rate, which shares
an anonymous union with opts->hdmi.frl when submode is PHY_HDMI_MODE_FRL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-meson-drm-create-hdmitx-phy-v1-0-9e0ac931381c@aliel.fr?part=4
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
2026-11-17 19:33 ` [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
@ 2026-11-17 20:03 ` sashiko-bot
0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-11-17 20:03 UTC (permalink / raw)
To: Ronald Claveau
Cc: devicetree, linux-amlogic, linux-phy, dri-devel, robh, conor+dt,
neil.armstrong, vkoul, olteanv
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/meson: dw-hdmi: suspend/resume order breaks PHY state and
HDMI output
- [Medium] drm/meson: dw-hdmi: missing phy_exit() on dw_hdmi_probe()
failure
- [Medium] drm/meson: dw-hdmi: premature PHY teardown in
meson_dw_hdmi_unbind()
--
commit 91e31ad4e0b36171e791e7c0487c9a4c66b12b31
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
This commit converts meson_dw_hdmi from direct HHI_HDMI_PHY_CNTL0..5
register writes to the generic PHY API, with a legacy fallback when the
device tree lacks a "phys" property.
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 20a821936b3af..f28cc1e6ee1df 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
[ ... ]
> @@ -590,13 +504,13 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
> .top_write = dw_hdmi_g12a_top_write,
> .dwc_read = dw_hdmi_g12a_dwc_read,
> .dwc_write = dw_hdmi_g12a_dwc_write,
> - .cntl0_init = 0x000b4242, /* Bandgap */
> - .cntl1_init = PHY_CNTL1_INIT,
> + .phy_soc = MESON_HDMI_PHY_G12A,
> };
>
> -static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> +static int meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> {
> struct meson_drm *priv = meson_dw_hdmi->priv;
> + int ret;
>
> /* Reset HDMITX APB & TX & PHY */
> reset_control_reset(meson_dw_hdmi->hdmitx_apb);
> @@ -624,8 +538,9 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
>
> /* Setup PHY */
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
> + ret = phy_init(meson_dw_hdmi->phy);
> + if (ret)
> + return ret;
>
> /* Enable HDMI-TX Interrupt */
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
> @@ -634,6 +549,7 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_MASKN,
> HDMITX_TOP_INTR_CORE);
>
> + return 0;
> }
>
> static void meson_disable_clk(void *data)
> @@ -746,7 +662,26 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
> return ret;
> }
>
> - meson_dw_hdmi_init(meson_dw_hdmi);
> + meson_dw_hdmi->phy = devm_phy_optional_get(dev, "hdmi");
> + if (IS_ERR(meson_dw_hdmi->phy))
> + return dev_err_probe(dev, PTR_ERR(meson_dw_hdmi->phy),
> + "failed to get HDMI PHY\n");
> +
> + if (!meson_dw_hdmi->phy) {
> + /* DEPRECATED: DT without "phys" */
> + dev_warn(dev, "missing \"phys\", using legacy HDMI PHY\n");
> + meson_dw_hdmi->phy = meson_hdmi_phy_create_legacy(dev, priv->hhi,
> + meson_dw_hdmi->data->phy_soc);
> + if (IS_ERR(meson_dw_hdmi->phy))
> + return dev_err_probe(dev, PTR_ERR(meson_dw_hdmi->phy),
> + "failed to create legacy HDMI PHY\n");
> +
> + meson_dw_hdmi->legacy_phy = true;
> + }
> +
> + ret = meson_dw_hdmi_init(meson_dw_hdmi);
> + if (ret)
> + return ret;
>
> /* Bridge / Connector */
[Severity: Medium]
Does meson_dw_hdmi_bind() leak a phy_init() reference if dw_hdmi_probe()
fails later in this function (for example with -EPROBE_DEFER when the DDC
I2C bus is not ready)?
When the PHY comes from the external PHY provider, devres cleanup on a
failed component bind only calls phy_put(), leaving phy->init_count at 1.
On the next bind attempt, meson_dw_hdmi_init() resets hdmitx_phy and calls
phy_init(), which sees init_count > 0 and skips phy->ops->init(), leaving
HHI_HDMI_PHY_CNTL0 and HHI_HDMI_PHY_CNTL1 uninitialized after the hardware
reset.
> @@ -784,6 +719,10 @@ static void meson_dw_hdmi_unbind(struct device *dev, struct device *master,
> struct platform_device *pdev = to_platform_device(dev);
> int irq = platform_get_irq(pdev, 0);
>
> + phy_exit(meson_dw_hdmi->phy);
> + if (meson_dw_hdmi->legacy_phy)
> + devm_phy_destroy(dev, meson_dw_hdmi->phy);
> +
> devm_free_irq(dev, irq, meson_dw_hdmi);
> dw_hdmi_unbind(meson_dw_hdmi->hdmi);
> drm_bridge_put(meson_dw_hdmi->bridge);
[Severity: Medium]
Can tearing down meson_dw_hdmi->phy before devm_free_irq() and
dw_hdmi_unbind() cause a use-after-free in dw_hdmi_top_thread_irq()?
CPU0 CPU1
meson_dw_hdmi_unbind()
phy_exit(meson_dw_hdmi->phy)
devm_phy_destroy(..., meson_dw_hdmi->phy)
dw_hdmi_top_thread_irq()
dw_hdmi_setup_rx_sense()
...
dw_hdmi_phy_init()
phy_configure(dw_hdmi->phy, ...)
<-- use-after-free
devm_free_irq(...)
dw_hdmi_unbind(...)
In the legacy PHY path, devm_phy_destroy() immediately unregisters and
frees meson_dw_hdmi->phy while the threaded HPD interrupt handler is still
active and can invoke dw_hdmi_phy_init() or dw_hdmi_phy_disable(). Even
with a DT PHY, HPD handling or dw_hdmi_unbind() can access the PHY after
phy_exit(). Should phy_exit() and devm_phy_destroy() run after
devm_free_irq() and dw_hdmi_unbind()?
> @@ -801,6 +740,8 @@ static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
> if (!meson_dw_hdmi)
> return 0;
>
> + phy_exit(meson_dw_hdmi->phy);
> +
> /* Reset TOP */
> meson_dw_hdmi->data->top_write(meson_dw_hdmi,
> HDMITX_TOP_SW_RESET, 0);
> @@ -811,11 +752,14 @@ static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
> static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
> {
> struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
> + int ret;
>
> if (!meson_dw_hdmi)
> return 0;
>
> - meson_dw_hdmi_init(meson_dw_hdmi);
> + ret = meson_dw_hdmi_init(meson_dw_hdmi);
> + if (ret)
> + return ret;
>
> dw_hdmi_resume(meson_dw_hdmi->hdmi);
[Severity: High]
Does calling phy_exit() in meson_dw_hdmi_pm_suspend() and phy_init() in
meson_dw_hdmi_pm_resume() break HDMI output across system suspend/resume?
Because the HDMI TX platform device sits after the VPU master device on
dpm_list (both from DT node order and because devm_phy_optional_get() adds
a stateless device link to the PHY that reorders the consumer to the tail
of dpm_list), system suspend runs meson_dw_hdmi_pm_suspend() before
meson_drv_pm_suspend(), and system resume runs meson_drv_pm_resume()
before meson_dw_hdmi_pm_resume().
On suspend, meson_dw_hdmi_pm_suspend() calls phy_exit() while the PHY is
still powered on, before meson_drv_pm_suspend() ->
drm_mode_config_helper_suspend() -> dw_hdmi_phy_disable() calls
phy_power_off().
On resume, meson_drv_pm_resume() -> drm_mode_config_helper_resume() ->
dw_hdmi_phy_init() calls phy_configure() and phy_power_on() while
phy->init_count is still 0. Then meson_dw_hdmi_pm_resume() runs
meson_dw_hdmi_init(), which resets hdmitx_phy and calls phy_init(); since
phy->power_count > phy->init_count, phy_init() warns ("phy_power_on was
called before phy_init") and runs meson_hdmi_phy_init(), overwriting
HHI_HDMI_PHY_CNTL0 and HHI_HDMI_PHY_CNTL1 with cntl0_init and cntl1_init
and clobbering the mode that meson_drv_pm_resume() just configured and
powered on.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-meson-drm-create-hdmitx-phy-v1-0-9e0ac931381c@aliel.fr?part=7
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup
2026-11-17 19:33 ` [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
@ 2026-11-17 20:11 ` sashiko-bot
0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-11-17 20:11 UTC (permalink / raw)
To: Ronald Claveau
Cc: devicetree, linux-amlogic, linux-phy, dri-devel, robh, conor+dt,
neil.armstrong, vkoul, olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/meson: dw-hdmi: skipped HDMITX mem PD power-up in
meson_dw_hdmi_init()
--
commit c8e782099f758bf635402705a20f57d7df9682a7
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup
This commit removes the direct HHI_HDMI_CLK_CNTL and HHI_MEM_PD_REG0
register writes in meson_dw_hdmi_init() and takes a runtime PM reference
in meson_dw_hdmi_probe() to power on the VPU power domain.
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index eb33c70f29c31..20a821936b3af 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
[ ... ]
> @@ -599,12 +598,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> {
> struct meson_drm *priv = meson_dw_hdmi->priv;
>
> - /* Enable clocks */
> - regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100);
> -
> - /* Bring HDMITX MEM output of power down */
> - regmap_update_bits(priv->hhi, HHI_MEM_PD_REG0, 0xff << 8, 0);
> -
> /* Reset HDMITX APB & TX & PHY */
> reset_control_reset(meson_dw_hdmi->hdmitx_apb);
> reset_control_reset(meson_dw_hdmi->hdmitx_ctrl);
> @@ -829,9 +822,29 @@ static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
> return 0;
> }
>
> +static void meson_dw_hdmi_pm_put(void *dev)
> +{
> + pm_runtime_put_sync(dev);
> +}
> +
> static int meson_dw_hdmi_probe(struct platform_device *pdev)
> {
> - return component_add(&pdev->dev, &meson_dw_hdmi_ops);
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + return ret;
> +
> + ret = pm_runtime_resume_and_get(dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to power on HDMI TX\n");
[Severity: High]
Can dropping the HHI_MEM_PD_REG0 write leave the HDMITX memory powered
down when the bootloader turns on the top-level VPU domain without
enabling HDMI?
In the VPU power domain driver, pwrc_ee_is_powered_off() only checks the
top-level AO sleep bit and does not check HHI_MEM_PD_REG0[15:8]. When
the top-level VPU domain is already powered on at boot,
meson_ee_pwrc_init_domain() registers the genpd as already on without
calling meson_ee_pwrc_on():
drivers/pmdomain/amlogic/meson-ee-pwrc.c:meson_ee_pwrc_init_domain() {
...
if (dom->num_clks && dom->desc.is_powered_off && !dom->desc.is_powered_off(dom)) {
ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
if (ret)
return ret;
dom->base.flags = GENPD_FLAG_ALWAYS_ON;
ret = pm_genpd_init(&dom->base, NULL, false);
if (ret)
return ret;
}
...
}
Because the genpd is initialized in the ON state with
GENPD_FLAG_ALWAYS_ON, pm_runtime_resume_and_get() is a no-op and
meson_ee_pwrc_on() never runs to clear HHI_MEM_PD_REG0[15:8], leaving
HDMITX memory powered down when meson_dw_hdmi_init() and dw_hdmi_probe()
access the controller.
In addition, power-domains and assigned-clocks are optional in the
amlogic,meson-dw-hdmi binding and were only added to in-tree DTs in
v6.11, so dropping the HHI_HDMI_CLK_CNTL and HHI_MEM_PD_REG0 writes also
regresses older DTBs (where meson_vclk_set() only configures
HHI_HDMI_CLK_CNTL later at atomic_enable time) and builds with CONFIG_PM
disabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-meson-drm-create-hdmitx-phy-v1-0-9e0ac931381c@aliel.fr?part=6
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-11-17 20:11 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 02/10] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
2026-11-17 19:39 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
2026-11-17 19:58 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 05/10] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
2026-11-17 20:11 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
2026-11-17 20:03 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 08/10] arm64: dts: amlogic: Add HDMI TX PHY node for G12 Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 09/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 10/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox