* [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP
@ 2025-07-18 10:11 Shengjiu Wang
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
` (3 more replies)
0 siblings, 4 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-18 10:11 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
Add HDMI PAI driver on i.MX8MP to make HDMI audio function fully work.
Shengjiu Wang (4):
drm/bridge: dw-hdmi: Add function to get plat_data
drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
arm64: dts: imx8mp: Add hdmi parallel audio interface node
.../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++
.../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 ++++++++
arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 +
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 26 +++-
drivers/gpu/drm/bridge/imx/Kconfig | 7 +
drivers/gpu/drm/bridge/imx/Makefile | 1 +
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 ++++++++++++++++++
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 +
include/drm/bridge/dw_hdmi.h | 7 +
9 files changed, 258 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
--
2.34.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data
2025-07-18 10:11 [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP Shengjiu Wang
@ 2025-07-18 10:11 ` Shengjiu Wang
2025-07-18 16:15 ` Frank Li
2025-07-22 7:39 ` Liu Ying
2025-07-18 10:11 ` [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface Shengjiu Wang
` (2 subsequent siblings)
3 siblings, 2 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-18 10:11 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
The enable_audio() and disable_audio() callback pointers are in
plat_data structure, and the audio device driver needs to get plat_data
for assign these pointers. So add a function to export plat_data
structure.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
include/drm/bridge/dw_hdmi.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 76c6570e2a85..3dfa42178f6c 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -198,6 +198,12 @@ struct dw_hdmi {
enum drm_connector_status last_connector_result;
};
+const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi)
+{
+ return hdmi->plat_data;
+}
+EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data);
+
#define HDMI_IH_PHY_STAT0_RX_SENSE \
(HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \
HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3)
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 6a46baa0737c..a56a3519a22a 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -208,4 +208,5 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
+const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi);
#endif /* __IMX_HDMI_H__ */
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-18 10:11 [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP Shengjiu Wang
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
@ 2025-07-18 10:11 ` Shengjiu Wang
2025-07-18 11:50 ` Alexander Stein
2025-07-22 8:49 ` Liu Ying
2025-07-18 10:11 ` [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI Shengjiu Wang
2025-07-18 10:11 ` [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node Shengjiu Wang
3 siblings, 2 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-18 10:11 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
This IP block is found in the HDMI subsystem of the i.MX8MP SoC.
Data received from the audio subsystem can have an arbitrary component
ordering. The HTX_PAI block has integrated muxing options to select which
sections of the 32-bit input data word will be mapped to each IEC60958
field. The HTX_PAI_FIELD_CTRL register contains mux selects to
individually select P,C,U,V,Data, and Preamble.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
drivers/gpu/drm/bridge/imx/Kconfig | 7 +
drivers/gpu/drm/bridge/imx/Makefile | 1 +
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 +++++++++++++++++++
include/drm/bridge/dw_hdmi.h | 6 +
4 files changed, 148 insertions(+)
create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig
index 9a480c6abb85..d95fa84a8dcd 100644
--- a/drivers/gpu/drm/bridge/imx/Kconfig
+++ b/drivers/gpu/drm/bridge/imx/Kconfig
@@ -24,6 +24,13 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE
Choose this to enable support for the internal HDMI encoder found
on the i.MX8MP SoC.
+config DRM_IMX8MP_HDMI_PAI
+ tristate "Freescale i.MX8MP HDMI PAI bridge support"
+ depends on OF
+ help
+ Choose this to enable support for the internal HDMI TX Parallel
+ Audio Interface found on the Freescale i.MX8MP SoC.
+
config DRM_IMX8MP_HDMI_PVI
tristate "Freescale i.MX8MP HDMI PVI bridge support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile
index dd5d48584806..8d01fda25451 100644
--- a/drivers/gpu/drm/bridge/imx/Makefile
+++ b/drivers/gpu/drm/bridge/imx/Makefile
@@ -1,6 +1,7 @@
obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
+obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
new file mode 100644
index 000000000000..f09ee2622e57
--- /dev/null
+++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <drm/bridge/dw_hdmi.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+
+#define HTX_PAI_CTRL 0x00
+#define HTX_PAI_CTRL_EXT 0x04
+#define HTX_PAI_FIELD_CTRL 0x08
+#define HTX_PAI_STAT 0x0c
+#define HTX_PAI_IRQ_NOMASK 0x10
+#define HTX_PAI_IRQ_MASKED 0x14
+#define HTX_PAI_IRQ_MASK 0x18
+
+#define CTRL_ENABLE BIT(0)
+
+#define CTRL_EXT_WTMK_HIGH_MASK GENMASK(31, 24)
+#define CTRL_EXT_WTMK_HIGH (0x3 << 24)
+#define CTRL_EXT_WTMK_LOW_MASK GENMASK(23, 16)
+#define CTRL_EXT_WTMK_LOW (0x3 << 16)
+#define CTRL_EXT_NUM_CH_MASK GENMASK(10, 8)
+#define CTRL_EXT_NUM_CH_SHIFT 8
+
+#define FIELD_CTRL_B_FILT BIT(31)
+#define FIELD_CTRL_PARITY_EN BIT(30)
+#define FIELD_CTRL_END_SEL BIT(29)
+#define FIELD_CTRL_PRE_SEL GENMASK(28, 24)
+#define FIELD_CTRL_PRE_SEL_SHIFT 24
+#define FIELD_CTRL_D_SEL GENMASK(23, 20)
+#define FIELD_CTRL_D_SEL_SHIFT 20
+#define FIELD_CTRL_V_SEL GENMASK(19, 15)
+#define FIELD_CTRL_V_SEL_SHIFT 15
+#define FIELD_CTRL_U_SEL GENMASK(14, 10)
+#define FIELD_CTRL_U_SEL_SHIFT 10
+#define FIELD_CTRL_C_SEL GENMASK(9, 5)
+#define FIELD_CTRL_C_SEL_SHIFT 5
+#define FIELD_CTRL_P_SEL GENMASK(4, 0)
+#define FIELD_CTRL_P_SEL_SHIFT 0
+
+struct imx8mp_hdmi_pai {
+ struct device *dev;
+ void __iomem *base;
+};
+
+static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
+ int width, int rate, int non_pcm)
+{
+ const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
+ struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
+ int val;
+
+ /* PAI set */
+ val = CTRL_EXT_WTMK_HIGH | CTRL_EXT_WTMK_LOW;
+ val |= ((channel - 1) << CTRL_EXT_NUM_CH_SHIFT);
+ writel(val, hdmi_pai->base + HTX_PAI_CTRL_EXT);
+
+ /* IEC60958 format */
+ val = 31 << FIELD_CTRL_P_SEL_SHIFT;
+ val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
+ val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
+ val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
+ val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
+ val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
+
+ writel(val, hdmi_pai->base + HTX_PAI_FIELD_CTRL);
+ /* PAI start running */
+ writel(CTRL_ENABLE, hdmi_pai->base + HTX_PAI_CTRL);
+}
+
+static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
+{
+ const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
+ struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
+
+ /* Stop PAI */
+ writel(0, hdmi_pai->base + HTX_PAI_CTRL);
+}
+
+static int imx8mp_hdmi_pai_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct dw_hdmi_plat_data *plat_data;
+ struct imx8mp_hdmi_pai *hdmi_pai;
+ struct device_node *remote;
+ struct platform_device *hdmi_tx;
+ struct resource *res;
+
+ hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
+ if (!hdmi_pai)
+ return -ENOMEM;
+
+ hdmi_pai->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+ if (IS_ERR(hdmi_pai->base))
+ return PTR_ERR(hdmi_pai->base);
+
+ hdmi_pai->dev = dev;
+
+ remote = of_graph_get_remote_node(pdev->dev.of_node, 0, -1);
+ if (!remote)
+ return -EINVAL;
+
+ hdmi_tx = of_find_device_by_node(remote);
+ if (!hdmi_tx)
+ return -EINVAL;
+
+ plat_data = platform_get_drvdata(hdmi_tx);
+ plat_data->enable_audio = imx8mp_hdmi_pai_enable;
+ plat_data->disable_audio = imx8mp_hdmi_pai_disable;
+ plat_data->priv_audio = hdmi_pai;
+
+ return 0;
+}
+
+static const struct of_device_id imx8mp_hdmi_pai_of_table[] = {
+ { .compatible = "fsl,imx8mp-hdmi-pai" },
+ { /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx8mp_hdmi_pai_of_table);
+
+static struct platform_driver imx8mp_hdmi_pai_platform_driver = {
+ .probe = imx8mp_hdmi_pai_probe,
+ .driver = {
+ .name = "imx8mp-hdmi-pai",
+ .of_match_table = imx8mp_hdmi_pai_of_table,
+ },
+};
+module_platform_driver(imx8mp_hdmi_pai_platform_driver);
+
+MODULE_DESCRIPTION("i.MX8MP HDMI PAI driver");
+MODULE_LICENSE("GPL");
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index a56a3519a22a..9ca70ce80cc5 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -143,6 +143,12 @@ struct dw_hdmi_plat_data {
const struct drm_display_info *info,
const struct drm_display_mode *mode);
+ /*
+ * priv_audio is specially used for additional audio device to get
+ * driver data through this dw_hdmi_plat_data.
+ */
+ void *priv_audio;
+
/* Platform-specific audio enable/disable (optional) */
void (*enable_audio)(struct dw_hdmi *hdmi, int channel,
int width, int rate, int non_pcm);
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-18 10:11 [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP Shengjiu Wang
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
2025-07-18 10:11 ` [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface Shengjiu Wang
@ 2025-07-18 10:11 ` Shengjiu Wang
2025-07-18 16:25 ` Frank Li
2025-07-22 7:17 ` Liu Ying
2025-07-18 10:11 ` [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node Shengjiu Wang
3 siblings, 2 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-18 10:11 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
Add binding for the i.MX8MP HDMI parallel Audio interface block.
As this port is linked to imx8mp-hdmi-tx, add port@2 in
fsl,imx8mp-hdmi-tx.yaml document.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
.../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
.../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
index 05442d437755..cf810b277557 100644
--- a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
@@ -49,9 +49,14 @@ properties:
$ref: /schemas/graph.yaml#/properties/port
description: HDMI output port
+ port@2:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: Parallel audio input port
+
required:
- port@0
- port@1
+ - port@2
required:
- compatible
@@ -98,5 +103,13 @@ examples:
remote-endpoint = <&hdmi0_con>;
};
};
+
+ port@2 {
+ reg = <2>;
+
+ endpoint {
+ remote-endpoint = <&pai_to_hdmi_tx>;
+ };
+ };
};
};
diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
new file mode 100644
index 000000000000..d2d723935032
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pai.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP HDMI Parallel Audio Interface
+
+maintainers:
+ - Shengjiu Wang <shengjiu.wang@nxp.com>
+
+description:
+ The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that acts as the
+ bridge between the Audio Subsystem to the HDMI TX Controller.
+
+properties:
+ compatible:
+ const: fsl,imx8mp-hdmi-pai
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ power-domains:
+ maxItems: 1
+
+ port:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: Output to the HDMI TX controller.
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - power-domains
+ - port
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/power/imx8mp-power.h>
+
+ hdmi@32fc4800 {
+ compatible = "fsl,imx8mp-hdmi-pai";
+ reg = <0x32fc4800 0x800>;
+ interrupt-parent = <&irqsteer_hdmi>;
+ interrupts = <14>;
+ power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
+
+ port {
+
+ pai_to_hdmi_tx: endpoint {
+ remote-endpoint = <&hdmi_tx_from_pai>;
+ };
+ };
+ };
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node
2025-07-18 10:11 [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP Shengjiu Wang
` (2 preceding siblings ...)
2025-07-18 10:11 ` [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI Shengjiu Wang
@ 2025-07-18 10:11 ` Shengjiu Wang
2025-07-18 16:30 ` Frank Li
3 siblings, 1 reply; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-18 10:11 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
Correct the register map of hdmi_pvi, which is overlapped with the
hdmi_pai device.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 +++
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 26 +++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
index c0cc5611048e..cc9351a5bd65 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
@@ -442,6 +442,10 @@ &flexcan2 {
status = "disabled";/* can2 pin conflict with pdm */
};
+&hdmi_pai {
+ status = "okay";
+};
+
&hdmi_pvi {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index bb24dba7338e..6e5a41f46309 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -2063,7 +2063,7 @@ irqsteer_hdmi: interrupt-controller@32fc2000 {
hdmi_pvi: display-bridge@32fc4000 {
compatible = "fsl,imx8mp-hdmi-pvi";
- reg = <0x32fc4000 0x1000>;
+ reg = <0x32fc4000 0x800>;
interrupt-parent = <&irqsteer_hdmi>;
interrupts = <12>;
power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>;
@@ -2089,6 +2089,22 @@ pvi_to_hdmi_tx: endpoint {
};
};
+ hdmi_pai: hdmi@32fc4800 {
+ compatible = "fsl,imx8mp-hdmi-pai";
+ reg = <0x32fc4800 0x800>;
+ interrupt-parent = <&irqsteer_hdmi>;
+ interrupts = <14>;
+ power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
+ status = "disabled";
+
+ port {
+
+ pai_to_hdmi_tx: endpoint {
+ remote-endpoint = <&hdmi_tx_from_pai>;
+ };
+ };
+ };
+
lcdif3: display-controller@32fc6000 {
compatible = "fsl,imx8mp-lcdif";
reg = <0x32fc6000 0x1000>;
@@ -2140,6 +2156,14 @@ port@1 {
reg = <1>;
/* Point endpoint to the HDMI connector */
};
+
+ port@2 {
+ reg = <2>;
+
+ hdmi_tx_from_pai: endpoint {
+ remote-endpoint = <&pai_to_hdmi_tx>;
+ };
+ };
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-18 10:11 ` [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface Shengjiu Wang
@ 2025-07-18 11:50 ` Alexander Stein
2025-07-21 3:41 ` Shengjiu Wang
2025-07-22 8:49 ` Liu Ying
1 sibling, 1 reply; 22+ messages in thread
From: Alexander Stein @ 2025-07-18 11:50 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
Cc: Shengjiu Wang
Hi,
thanks for sending this path.
Am Freitag, 18. Juli 2025, 12:11:48 CEST schrieb Shengjiu Wang:
> The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
> This IP block is found in the HDMI subsystem of the i.MX8MP SoC.
>
> Data received from the audio subsystem can have an arbitrary component
> ordering. The HTX_PAI block has integrated muxing options to select which
> sections of the 32-bit input data word will be mapped to each IEC60958
> field. The HTX_PAI_FIELD_CTRL register contains mux selects to
> individually select P,C,U,V,Data, and Preamble.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> drivers/gpu/drm/bridge/imx/Kconfig | 7 +
> drivers/gpu/drm/bridge/imx/Makefile | 1 +
> drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 +++++++++++++++++++
> include/drm/bridge/dw_hdmi.h | 6 +
> 4 files changed, 148 insertions(+)
> create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
>
> diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig
> index 9a480c6abb85..d95fa84a8dcd 100644
> --- a/drivers/gpu/drm/bridge/imx/Kconfig
> +++ b/drivers/gpu/drm/bridge/imx/Kconfig
> @@ -24,6 +24,13 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE
> Choose this to enable support for the internal HDMI encoder found
> on the i.MX8MP SoC.
>
> +config DRM_IMX8MP_HDMI_PAI
> + tristate "Freescale i.MX8MP HDMI PAI bridge support"
> + depends on OF
> + help
> + Choose this to enable support for the internal HDMI TX Parallel
> + Audio Interface found on the Freescale i.MX8MP SoC.
> +
> config DRM_IMX8MP_HDMI_PVI
> tristate "Freescale i.MX8MP HDMI PVI bridge support"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile
> index dd5d48584806..8d01fda25451 100644
> --- a/drivers/gpu/drm/bridge/imx/Makefile
> +++ b/drivers/gpu/drm/bridge/imx/Makefile
> @@ -1,6 +1,7 @@
> obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
> obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
> obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
> +obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
> obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
> obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
> obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
> diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> new file mode 100644
> index 000000000000..f09ee2622e57
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> @@ -0,0 +1,134 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#include <drm/bridge/dw_hdmi.h>
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +
> +#define HTX_PAI_CTRL 0x00
> +#define HTX_PAI_CTRL_EXT 0x04
> +#define HTX_PAI_FIELD_CTRL 0x08
> +#define HTX_PAI_STAT 0x0c
> +#define HTX_PAI_IRQ_NOMASK 0x10
> +#define HTX_PAI_IRQ_MASKED 0x14
> +#define HTX_PAI_IRQ_MASK 0x18
> +
> +#define CTRL_ENABLE BIT(0)
> +
> +#define CTRL_EXT_WTMK_HIGH_MASK GENMASK(31, 24)
> +#define CTRL_EXT_WTMK_HIGH (0x3 << 24)
> +#define CTRL_EXT_WTMK_LOW_MASK GENMASK(23, 16)
> +#define CTRL_EXT_WTMK_LOW (0x3 << 16)
> +#define CTRL_EXT_NUM_CH_MASK GENMASK(10, 8)
> +#define CTRL_EXT_NUM_CH_SHIFT 8
> +
> +#define FIELD_CTRL_B_FILT BIT(31)
> +#define FIELD_CTRL_PARITY_EN BIT(30)
> +#define FIELD_CTRL_END_SEL BIT(29)
> +#define FIELD_CTRL_PRE_SEL GENMASK(28, 24)
> +#define FIELD_CTRL_PRE_SEL_SHIFT 24
> +#define FIELD_CTRL_D_SEL GENMASK(23, 20)
> +#define FIELD_CTRL_D_SEL_SHIFT 20
> +#define FIELD_CTRL_V_SEL GENMASK(19, 15)
> +#define FIELD_CTRL_V_SEL_SHIFT 15
> +#define FIELD_CTRL_U_SEL GENMASK(14, 10)
> +#define FIELD_CTRL_U_SEL_SHIFT 10
> +#define FIELD_CTRL_C_SEL GENMASK(9, 5)
> +#define FIELD_CTRL_C_SEL_SHIFT 5
> +#define FIELD_CTRL_P_SEL GENMASK(4, 0)
> +#define FIELD_CTRL_P_SEL_SHIFT 0
> +
> +struct imx8mp_hdmi_pai {
> + struct device *dev;
> + void __iomem *base;
> +};
> +
> +static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
> + int width, int rate, int non_pcm)
> +{
> + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> + int val;
> +
> + /* PAI set */
> + val = CTRL_EXT_WTMK_HIGH | CTRL_EXT_WTMK_LOW;
> + val |= ((channel - 1) << CTRL_EXT_NUM_CH_SHIFT);
> + writel(val, hdmi_pai->base + HTX_PAI_CTRL_EXT);
> +
> + /* IEC60958 format */
> + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
> + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
> + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
> + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
> + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
> + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
You can use FIELD_PREP_CONST() for these shifts as the GENMASK are
already available.
But where do these numbers come from? I can see that downstream kernel
sets these bits depending on audio config being passed.
> +
> + writel(val, hdmi_pai->base + HTX_PAI_FIELD_CTRL);
> + /* PAI start running */
> + writel(CTRL_ENABLE, hdmi_pai->base + HTX_PAI_CTRL);
> +}
> +
> +static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
> +{
> + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> +
> + /* Stop PAI */
> + writel(0, hdmi_pai->base + HTX_PAI_CTRL);
> +}
> +
> +static int imx8mp_hdmi_pai_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct dw_hdmi_plat_data *plat_data;
> + struct imx8mp_hdmi_pai *hdmi_pai;
> + struct device_node *remote;
> + struct platform_device *hdmi_tx;
> + struct resource *res;
> +
> + hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
> + if (!hdmi_pai)
> + return -ENOMEM;
> +
> + hdmi_pai->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> + if (IS_ERR(hdmi_pai->base))
> + return PTR_ERR(hdmi_pai->base);
> +
> + hdmi_pai->dev = dev;
> +
> + remote = of_graph_get_remote_node(pdev->dev.of_node, 0, -1);
> + if (!remote)
> + return -EINVAL;
> +
> + hdmi_tx = of_find_device_by_node(remote);
> + if (!hdmi_tx)
> + return -EINVAL;
> +
> + plat_data = platform_get_drvdata(hdmi_tx);
How do you ensure hdmi_tx has been probed so that drvdata is set?
Also hdmi_tx needs to be dropped.
> + plat_data->enable_audio = imx8mp_hdmi_pai_enable;
> + plat_data->disable_audio = imx8mp_hdmi_pai_disable;
> + plat_data->priv_audio = hdmi_pai;
How do you connect this device to aud2htx?
Best regards,
Alexander
> +
> + return 0;
> +}
> +
> +static const struct of_device_id imx8mp_hdmi_pai_of_table[] = {
> + { .compatible = "fsl,imx8mp-hdmi-pai" },
> + { /* Sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, imx8mp_hdmi_pai_of_table);
> +
> +static struct platform_driver imx8mp_hdmi_pai_platform_driver = {
> + .probe = imx8mp_hdmi_pai_probe,
> + .driver = {
> + .name = "imx8mp-hdmi-pai",
> + .of_match_table = imx8mp_hdmi_pai_of_table,
> + },
> +};
> +module_platform_driver(imx8mp_hdmi_pai_platform_driver);
> +
> +MODULE_DESCRIPTION("i.MX8MP HDMI PAI driver");
> +MODULE_LICENSE("GPL");
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index a56a3519a22a..9ca70ce80cc5 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -143,6 +143,12 @@ struct dw_hdmi_plat_data {
> const struct drm_display_info *info,
> const struct drm_display_mode *mode);
>
> + /*
> + * priv_audio is specially used for additional audio device to get
> + * driver data through this dw_hdmi_plat_data.
> + */
> + void *priv_audio;
> +
> /* Platform-specific audio enable/disable (optional) */
> void (*enable_audio)(struct dw_hdmi *hdmi, int channel,
> int width, int rate, int non_pcm);
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
@ 2025-07-18 16:15 ` Frank Li
2025-07-21 3:24 ` Shengjiu Wang
2025-07-22 7:39 ` Liu Ying
1 sibling, 1 reply; 22+ messages in thread
From: Frank Li @ 2025-07-18 16:15 UTC (permalink / raw)
To: Shengjiu Wang
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
On Fri, Jul 18, 2025 at 06:11:47PM +0800, Shengjiu Wang wrote:
> The enable_audio() and disable_audio() callback pointers are in
> plat_data structure, and the audio device driver needs to get plat_data
> for assign these pointers. So add a function to export plat_data
> structure.
drm/bridge: dw-hdmi: Add API dw_hdmi_to_plat_data() to get plat_data
Add API dw_hdmi_to_plat_data() to fetch plat_data because audo device
driver needs it to enabe(disable)_audio().
Frank
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
> include/drm/bridge/dw_hdmi.h | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 76c6570e2a85..3dfa42178f6c 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -198,6 +198,12 @@ struct dw_hdmi {
> enum drm_connector_status last_connector_result;
> };
>
> +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi)
> +{
> + return hdmi->plat_data;
> +}
> +EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data);
> +
> #define HDMI_IH_PHY_STAT0_RX_SENSE \
> (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \
> HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3)
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index 6a46baa0737c..a56a3519a22a 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -208,4 +208,5 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
>
> bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
>
> +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi);
> #endif /* __IMX_HDMI_H__ */
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-18 10:11 ` [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI Shengjiu Wang
@ 2025-07-18 16:25 ` Frank Li
2025-07-21 3:26 ` Shengjiu Wang
2025-07-22 7:17 ` Liu Ying
1 sibling, 1 reply; 22+ messages in thread
From: Frank Li @ 2025-07-18 16:25 UTC (permalink / raw)
To: Shengjiu Wang
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
On Fri, Jul 18, 2025 at 06:11:49PM +0800, Shengjiu Wang wrote:
Subject needn't said binding again.
dt-bindings: display: imx: add HDMI PAI for i.MX8MP
> Add binding for the i.MX8MP HDMI parallel Audio interface block.
Need empty line between two paragraph
> As this port is linked to imx8mp-hdmi-tx, add port@2 in
> fsl,imx8mp-hdmi-tx.yaml document.
In fsl,imx8mp-hdmi-tx.yaml, add port@2 that linked to imx8mp-hdmi-tx (
look like pai_to_hdmi_tx?)
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> .../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
> .../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
> 2 files changed, 74 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> index 05442d437755..cf810b277557 100644
> --- a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> @@ -49,9 +49,14 @@ properties:
> $ref: /schemas/graph.yaml#/properties/port
> description: HDMI output port
>
> + port@2:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Parallel audio input port
> +
> required:
> - port@0
> - port@1
> + - port@2
Are you sure it is required? It may cause may dtb check warning.
>
> required:
> - compatible
> @@ -98,5 +103,13 @@ examples:
> remote-endpoint = <&hdmi0_con>;
> };
> };
> +
> + port@2 {
> + reg = <2>;
> +
> + endpoint {
> + remote-endpoint = <&pai_to_hdmi_tx>;
> + };
> + };
> };
> };
> diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> new file mode 100644
> index 000000000000..d2d723935032
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pai.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale i.MX8MP HDMI Parallel Audio Interface
> +
> +maintainers:
> + - Shengjiu Wang <shengjiu.wang@nxp.com>
> +
> +description:
> + The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that acts as the
> + bridge between the Audio Subsystem to the HDMI TX Controller.
remove "a digital module that acts as the"
Frank
> +
> +properties:
> + compatible:
> + const: fsl,imx8mp-hdmi-pai
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + power-domains:
> + maxItems: 1
> +
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Output to the HDMI TX controller.
> + unevaluatedProperties: false
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - power-domains
> + - port
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/power/imx8mp-power.h>
> +
> + hdmi@32fc4800 {
> + compatible = "fsl,imx8mp-hdmi-pai";
> + reg = <0x32fc4800 0x800>;
> + interrupt-parent = <&irqsteer_hdmi>;
> + interrupts = <14>;
> + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> +
> + port {
> +
> + pai_to_hdmi_tx: endpoint {
> + remote-endpoint = <&hdmi_tx_from_pai>;
> + };
> + };
> + };
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node
2025-07-18 10:11 ` [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node Shengjiu Wang
@ 2025-07-18 16:30 ` Frank Li
2025-07-21 3:28 ` Shengjiu Wang
0 siblings, 1 reply; 22+ messages in thread
From: Frank Li @ 2025-07-18 16:30 UTC (permalink / raw)
To: Shengjiu Wang
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, shengjiu.wang
On Fri, Jul 18, 2025 at 06:11:50PM +0800, Shengjiu Wang wrote:
> The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
Remove " a digital module that acts as the" is more straightforward.
>
> Correct the register map of hdmi_pvi, which is overlapped with the
> hdmi_pai device.
Shrink register map size of hdmi_pvi to avoid overlapped hdmi_pai device.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 +++
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 26 +++++++++++++++++++-
> 2 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> index c0cc5611048e..cc9351a5bd65 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> @@ -442,6 +442,10 @@ &flexcan2 {
> status = "disabled";/* can2 pin conflict with pdm */
> };
>
> +&hdmi_pai {
> + status = "okay";
> +};
> +
> &hdmi_pvi {
> status = "okay";
> };
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> index bb24dba7338e..6e5a41f46309 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> @@ -2063,7 +2063,7 @@ irqsteer_hdmi: interrupt-controller@32fc2000 {
>
> hdmi_pvi: display-bridge@32fc4000 {
> compatible = "fsl,imx8mp-hdmi-pvi";
> - reg = <0x32fc4000 0x1000>;
> + reg = <0x32fc4000 0x800>;
> interrupt-parent = <&irqsteer_hdmi>;
> interrupts = <12>;
> power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>;
> @@ -2089,6 +2089,22 @@ pvi_to_hdmi_tx: endpoint {
> };
> };
>
> + hdmi_pai: hdmi@32fc4800 {
commit message it is bridge device, maybe audio-bridge is good node name
Frank
> + compatible = "fsl,imx8mp-hdmi-pai";
> + reg = <0x32fc4800 0x800>;
> + interrupt-parent = <&irqsteer_hdmi>;
> + interrupts = <14>;
> + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> + status = "disabled";
> +
> + port {
> +
> + pai_to_hdmi_tx: endpoint {
> + remote-endpoint = <&hdmi_tx_from_pai>;
> + };
> + };
> + };
> +
> lcdif3: display-controller@32fc6000 {
> compatible = "fsl,imx8mp-lcdif";
> reg = <0x32fc6000 0x1000>;
> @@ -2140,6 +2156,14 @@ port@1 {
> reg = <1>;
> /* Point endpoint to the HDMI connector */
> };
> +
> + port@2 {
> + reg = <2>;
> +
> + hdmi_tx_from_pai: endpoint {
> + remote-endpoint = <&pai_to_hdmi_tx>;
> + };
> + };
> };
> };
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data
2025-07-18 16:15 ` Frank Li
@ 2025-07-21 3:24 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-21 3:24 UTC (permalink / raw)
To: Frank Li
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
victor.liu, shawnguo, s.hauer, kernel, festevam, imx,
linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel, devicetree,
l.stach
On Sat, Jul 19, 2025 at 12:15 AM Frank Li <Frank.li@nxp.com> wrote:
>
> On Fri, Jul 18, 2025 at 06:11:47PM +0800, Shengjiu Wang wrote:
> > The enable_audio() and disable_audio() callback pointers are in
> > plat_data structure, and the audio device driver needs to get plat_data
> > for assign these pointers. So add a function to export plat_data
> > structure.
>
> drm/bridge: dw-hdmi: Add API dw_hdmi_to_plat_data() to get plat_data
>
> Add API dw_hdmi_to_plat_data() to fetch plat_data because audo device
> driver needs it to enabe(disable)_audio().
Thanks for comments. will update it to the next version.
best regards
Shengjiu Wang
>
> Frank
>
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
> > include/drm/bridge/dw_hdmi.h | 1 +
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > index 76c6570e2a85..3dfa42178f6c 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > @@ -198,6 +198,12 @@ struct dw_hdmi {
> > enum drm_connector_status last_connector_result;
> > };
> >
> > +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi)
> > +{
> > + return hdmi->plat_data;
> > +}
> > +EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data);
> > +
> > #define HDMI_IH_PHY_STAT0_RX_SENSE \
> > (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \
> > HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3)
> > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> > index 6a46baa0737c..a56a3519a22a 100644
> > --- a/include/drm/bridge/dw_hdmi.h
> > +++ b/include/drm/bridge/dw_hdmi.h
> > @@ -208,4 +208,5 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
> >
> > bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
> >
> > +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi);
> > #endif /* __IMX_HDMI_H__ */
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-18 16:25 ` Frank Li
@ 2025-07-21 3:26 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-21 3:26 UTC (permalink / raw)
To: Frank Li
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
victor.liu, shawnguo, s.hauer, kernel, festevam, imx,
linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel, devicetree,
l.stach
On Sat, Jul 19, 2025 at 12:25 AM Frank Li <Frank.li@nxp.com> wrote:
>
> On Fri, Jul 18, 2025 at 06:11:49PM +0800, Shengjiu Wang wrote:
>
> Subject needn't said binding again.
>
> dt-bindings: display: imx: add HDMI PAI for i.MX8MP
>
> > Add binding for the i.MX8MP HDMI parallel Audio interface block.
>
> Need empty line between two paragraph
Ok.
>
> > As this port is linked to imx8mp-hdmi-tx, add port@2 in
> > fsl,imx8mp-hdmi-tx.yaml document.
>
> In fsl,imx8mp-hdmi-tx.yaml, add port@2 that linked to imx8mp-hdmi-tx (
> look like pai_to_hdmi_tx?)
yes, linked to pai_to_hdmi_tx.
>
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > .../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
> > .../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
> > 2 files changed, 74 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > index 05442d437755..cf810b277557 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > @@ -49,9 +49,14 @@ properties:
> > $ref: /schemas/graph.yaml#/properties/port
> > description: HDMI output port
> >
> > + port@2:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Parallel audio input port
> > +
> > required:
> > - port@0
> > - port@1
> > + - port@2
>
> Are you sure it is required? It may cause may dtb check warning.
yes, it is required.
>
> >
> > required:
> > - compatible
> > @@ -98,5 +103,13 @@ examples:
> > remote-endpoint = <&hdmi0_con>;
> > };
> > };
> > +
> > + port@2 {
> > + reg = <2>;
> > +
> > + endpoint {
> > + remote-endpoint = <&pai_to_hdmi_tx>;
> > + };
> > + };
> > };
> > };
> > diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> > new file mode 100644
> > index 000000000000..d2d723935032
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> > @@ -0,0 +1,61 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pai.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Freescale i.MX8MP HDMI Parallel Audio Interface
> > +
> > +maintainers:
> > + - Shengjiu Wang <shengjiu.wang@nxp.com>
> > +
> > +description:
> > + The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that acts as the
> > + bridge between the Audio Subsystem to the HDMI TX Controller.
>
> remove "a digital module that acts as the"
Ok, will update it in the next version.
best regards
Shengjiu Wang
>
> Frank
>
> > +
> > +properties:
> > + compatible:
> > + const: fsl,imx8mp-hdmi-pai
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > + power-domains:
> > + maxItems: 1
> > +
> > + port:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Output to the HDMI TX controller.
> > + unevaluatedProperties: false
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - interrupts
> > + - power-domains
> > + - port
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/interrupt-controller/irq.h>
> > + #include <dt-bindings/power/imx8mp-power.h>
> > +
> > + hdmi@32fc4800 {
> > + compatible = "fsl,imx8mp-hdmi-pai";
> > + reg = <0x32fc4800 0x800>;
> > + interrupt-parent = <&irqsteer_hdmi>;
> > + interrupts = <14>;
> > + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> > +
> > + port {
> > +
> > + pai_to_hdmi_tx: endpoint {
> > + remote-endpoint = <&hdmi_tx_from_pai>;
> > + };
> > + };
> > + };
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node
2025-07-18 16:30 ` Frank Li
@ 2025-07-21 3:28 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-21 3:28 UTC (permalink / raw)
To: Frank Li
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
victor.liu, shawnguo, s.hauer, kernel, festevam, imx,
linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel, devicetree,
l.stach
On Sat, Jul 19, 2025 at 12:30 AM Frank Li <Frank.li@nxp.com> wrote:
>
> On Fri, Jul 18, 2025 at 06:11:50PM +0800, Shengjiu Wang wrote:
> > The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> > acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
>
> Remove " a digital module that acts as the" is more straightforward.
>
> >
> > Correct the register map of hdmi_pvi, which is overlapped with the
> > hdmi_pai device.
>
> Shrink register map size of hdmi_pvi to avoid overlapped hdmi_pai device.
Ok, will update them in next version.
>
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 +++
> > arch/arm64/boot/dts/freescale/imx8mp.dtsi | 26 +++++++++++++++++++-
> > 2 files changed, 29 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > index c0cc5611048e..cc9351a5bd65 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > @@ -442,6 +442,10 @@ &flexcan2 {
> > status = "disabled";/* can2 pin conflict with pdm */
> > };
> >
> > +&hdmi_pai {
> > + status = "okay";
> > +};
> > +
> > &hdmi_pvi {
> > status = "okay";
> > };
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > index bb24dba7338e..6e5a41f46309 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > @@ -2063,7 +2063,7 @@ irqsteer_hdmi: interrupt-controller@32fc2000 {
> >
> > hdmi_pvi: display-bridge@32fc4000 {
> > compatible = "fsl,imx8mp-hdmi-pvi";
> > - reg = <0x32fc4000 0x1000>;
> > + reg = <0x32fc4000 0x800>;
> > interrupt-parent = <&irqsteer_hdmi>;
> > interrupts = <12>;
> > power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>;
> > @@ -2089,6 +2089,22 @@ pvi_to_hdmi_tx: endpoint {
> > };
> > };
> >
> > + hdmi_pai: hdmi@32fc4800 {
>
> commit message it is bridge device, maybe audio-bridge is good node name
Ok, will use audio-bridge.
best regards
Shengjiu Wang
>
> Frank
> > + compatible = "fsl,imx8mp-hdmi-pai";
> > + reg = <0x32fc4800 0x800>;
> > + interrupt-parent = <&irqsteer_hdmi>;
> > + interrupts = <14>;
> > + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> > + status = "disabled";
> > +
> > + port {
> > +
> > + pai_to_hdmi_tx: endpoint {
> > + remote-endpoint = <&hdmi_tx_from_pai>;
> > + };
> > + };
> > + };
> > +
> > lcdif3: display-controller@32fc6000 {
> > compatible = "fsl,imx8mp-lcdif";
> > reg = <0x32fc6000 0x1000>;
> > @@ -2140,6 +2156,14 @@ port@1 {
> > reg = <1>;
> > /* Point endpoint to the HDMI connector */
> > };
> > +
> > + port@2 {
> > + reg = <2>;
> > +
> > + hdmi_tx_from_pai: endpoint {
> > + remote-endpoint = <&pai_to_hdmi_tx>;
> > + };
> > + };
> > };
> > };
> >
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-18 11:50 ` Alexander Stein
@ 2025-07-21 3:41 ` Shengjiu Wang
2025-07-22 7:52 ` Liu Ying
0 siblings, 1 reply; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-21 3:41 UTC (permalink / raw)
To: Alexander Stein
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, victor.liu, shawnguo, s.hauer, kernel,
festevam, imx, linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel,
devicetree, l.stach, Shengjiu Wang
On Fri, Jul 18, 2025 at 7:51 PM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> Hi,
>
> thanks for sending this path.
>
> Am Freitag, 18. Juli 2025, 12:11:48 CEST schrieb Shengjiu Wang:
> > The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> > acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
> > This IP block is found in the HDMI subsystem of the i.MX8MP SoC.
> >
> > Data received from the audio subsystem can have an arbitrary component
> > ordering. The HTX_PAI block has integrated muxing options to select which
> > sections of the 32-bit input data word will be mapped to each IEC60958
> > field. The HTX_PAI_FIELD_CTRL register contains mux selects to
> > individually select P,C,U,V,Data, and Preamble.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > drivers/gpu/drm/bridge/imx/Kconfig | 7 +
> > drivers/gpu/drm/bridge/imx/Makefile | 1 +
> > drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 +++++++++++++++++++
> > include/drm/bridge/dw_hdmi.h | 6 +
> > 4 files changed, 148 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> >
> > diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig
> > index 9a480c6abb85..d95fa84a8dcd 100644
> > --- a/drivers/gpu/drm/bridge/imx/Kconfig
> > +++ b/drivers/gpu/drm/bridge/imx/Kconfig
> > @@ -24,6 +24,13 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE
> > Choose this to enable support for the internal HDMI encoder found
> > on the i.MX8MP SoC.
> >
> > +config DRM_IMX8MP_HDMI_PAI
> > + tristate "Freescale i.MX8MP HDMI PAI bridge support"
> > + depends on OF
> > + help
> > + Choose this to enable support for the internal HDMI TX Parallel
> > + Audio Interface found on the Freescale i.MX8MP SoC.
> > +
> > config DRM_IMX8MP_HDMI_PVI
> > tristate "Freescale i.MX8MP HDMI PVI bridge support"
> > depends on OF
> > diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile
> > index dd5d48584806..8d01fda25451 100644
> > --- a/drivers/gpu/drm/bridge/imx/Makefile
> > +++ b/drivers/gpu/drm/bridge/imx/Makefile
> > @@ -1,6 +1,7 @@
> > obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
> > obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
> > obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
> > +obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
> > obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
> > obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
> > obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
> > diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> > new file mode 100644
> > index 000000000000..f09ee2622e57
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> > @@ -0,0 +1,134 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2025 NXP
> > + */
> > +
> > +#include <drm/bridge/dw_hdmi.h>
> > +#include <linux/module.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +
> > +#define HTX_PAI_CTRL 0x00
> > +#define HTX_PAI_CTRL_EXT 0x04
> > +#define HTX_PAI_FIELD_CTRL 0x08
> > +#define HTX_PAI_STAT 0x0c
> > +#define HTX_PAI_IRQ_NOMASK 0x10
> > +#define HTX_PAI_IRQ_MASKED 0x14
> > +#define HTX_PAI_IRQ_MASK 0x18
> > +
> > +#define CTRL_ENABLE BIT(0)
> > +
> > +#define CTRL_EXT_WTMK_HIGH_MASK GENMASK(31, 24)
> > +#define CTRL_EXT_WTMK_HIGH (0x3 << 24)
> > +#define CTRL_EXT_WTMK_LOW_MASK GENMASK(23, 16)
> > +#define CTRL_EXT_WTMK_LOW (0x3 << 16)
> > +#define CTRL_EXT_NUM_CH_MASK GENMASK(10, 8)
> > +#define CTRL_EXT_NUM_CH_SHIFT 8
> > +
> > +#define FIELD_CTRL_B_FILT BIT(31)
> > +#define FIELD_CTRL_PARITY_EN BIT(30)
> > +#define FIELD_CTRL_END_SEL BIT(29)
> > +#define FIELD_CTRL_PRE_SEL GENMASK(28, 24)
> > +#define FIELD_CTRL_PRE_SEL_SHIFT 24
> > +#define FIELD_CTRL_D_SEL GENMASK(23, 20)
> > +#define FIELD_CTRL_D_SEL_SHIFT 20
> > +#define FIELD_CTRL_V_SEL GENMASK(19, 15)
> > +#define FIELD_CTRL_V_SEL_SHIFT 15
> > +#define FIELD_CTRL_U_SEL GENMASK(14, 10)
> > +#define FIELD_CTRL_U_SEL_SHIFT 10
> > +#define FIELD_CTRL_C_SEL GENMASK(9, 5)
> > +#define FIELD_CTRL_C_SEL_SHIFT 5
> > +#define FIELD_CTRL_P_SEL GENMASK(4, 0)
> > +#define FIELD_CTRL_P_SEL_SHIFT 0
> > +
> > +struct imx8mp_hdmi_pai {
> > + struct device *dev;
> > + void __iomem *base;
> > +};
> > +
> > +static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
> > + int width, int rate, int non_pcm)
> > +{
> > + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> > + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> > + int val;
> > +
> > + /* PAI set */
> > + val = CTRL_EXT_WTMK_HIGH | CTRL_EXT_WTMK_LOW;
> > + val |= ((channel - 1) << CTRL_EXT_NUM_CH_SHIFT);
> > + writel(val, hdmi_pai->base + HTX_PAI_CTRL_EXT);
> > +
> > + /* IEC60958 format */
> > + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
> > + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
> > + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
> > + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
> > + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
> > + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
>
> You can use FIELD_PREP_CONST() for these shifts as the GENMASK are
> already available.
Ok.
> But where do these numbers come from? I can see that downstream kernel
> sets these bits depending on audio config being passed.
These numbers are defined in standard IEC958 spec.
The implementation in downstream kernel may not good enough, which can't
distinguish between the raw PCM and IEC958 PCM. Even raw PCM can work,
but in RM, the supported format is IEC958.
So later we need to update the aud2htx driver to only support IEC958 format.
Make the alignment between PAI driver and aud2htx driver.
>
> > +
> > + writel(val, hdmi_pai->base + HTX_PAI_FIELD_CTRL);
> > + /* PAI start running */
> > + writel(CTRL_ENABLE, hdmi_pai->base + HTX_PAI_CTRL);
> > +}
> > +
> > +static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
> > +{
> > + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> > + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> > +
> > + /* Stop PAI */
> > + writel(0, hdmi_pai->base + HTX_PAI_CTRL);
> > +}
> > +
> > +static int imx8mp_hdmi_pai_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct dw_hdmi_plat_data *plat_data;
> > + struct imx8mp_hdmi_pai *hdmi_pai;
> > + struct device_node *remote;
> > + struct platform_device *hdmi_tx;
> > + struct resource *res;
> > +
> > + hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
> > + if (!hdmi_pai)
> > + return -ENOMEM;
> > +
> > + hdmi_pai->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> > + if (IS_ERR(hdmi_pai->base))
> > + return PTR_ERR(hdmi_pai->base);
> > +
> > + hdmi_pai->dev = dev;
> > +
> > + remote = of_graph_get_remote_node(pdev->dev.of_node, 0, -1);
> > + if (!remote)
> > + return -EINVAL;
> > +
> > + hdmi_tx = of_find_device_by_node(remote);
> > + if (!hdmi_tx)
> > + return -EINVAL;
> > +
> > + plat_data = platform_get_drvdata(hdmi_tx);
>
> How do you ensure hdmi_tx has been probed so that drvdata is set?
> Also hdmi_tx needs to be dropped.
Good catch. need to update to
hdmi_tx = of_find_device_by_node(remote);
of_node_put(remote);
if (!hdmi_tx)
return -ENODEV;
plat_data = platform_get_drvdata(hdmi_tx);
put_device(&hdmi_tx->dev);
if (!plat_data)
return -EPROBE_DEFER;
>
> > + plat_data->enable_audio = imx8mp_hdmi_pai_enable;
> > + plat_data->disable_audio = imx8mp_hdmi_pai_disable;
> > + plat_data->priv_audio = hdmi_pai;
>
> How do you connect this device to aud2htx?
aud2htx -> hdmi_codec -> dw-hdmi-gp-audio
hdmi_codec is sound/soc/codecs/hdmi-codec.c
gp-audio will call this plat_data->enable(disable)_audio().
So need to register the plat_data->enable(disable)_audio in this driver.
Best regards
Shengjiu Wang
>
> Best regards,
> Alexander
>
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id imx8mp_hdmi_pai_of_table[] = {
> > + { .compatible = "fsl,imx8mp-hdmi-pai" },
> > + { /* Sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, imx8mp_hdmi_pai_of_table);
> > +
> > +static struct platform_driver imx8mp_hdmi_pai_platform_driver = {
> > + .probe = imx8mp_hdmi_pai_probe,
> > + .driver = {
> > + .name = "imx8mp-hdmi-pai",
> > + .of_match_table = imx8mp_hdmi_pai_of_table,
> > + },
> > +};
> > +module_platform_driver(imx8mp_hdmi_pai_platform_driver);
> > +
> > +MODULE_DESCRIPTION("i.MX8MP HDMI PAI driver");
> > +MODULE_LICENSE("GPL");
> > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> > index a56a3519a22a..9ca70ce80cc5 100644
> > --- a/include/drm/bridge/dw_hdmi.h
> > +++ b/include/drm/bridge/dw_hdmi.h
> > @@ -143,6 +143,12 @@ struct dw_hdmi_plat_data {
> > const struct drm_display_info *info,
> > const struct drm_display_mode *mode);
> >
> > + /*
> > + * priv_audio is specially used for additional audio device to get
> > + * driver data through this dw_hdmi_plat_data.
> > + */
> > + void *priv_audio;
> > +
> > /* Platform-specific audio enable/disable (optional) */
> > void (*enable_audio)(struct dw_hdmi *hdmi, int channel,
> > int width, int rate, int non_pcm);
> >
>
>
> --
> TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
> Amtsgericht München, HRB 105018
> Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
> http://www.tq-group.com/
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-18 10:11 ` [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI Shengjiu Wang
2025-07-18 16:25 ` Frank Li
@ 2025-07-22 7:17 ` Liu Ying
2025-07-23 7:39 ` Shengjiu Wang
1 sibling, 1 reply; 22+ messages in thread
From: Liu Ying @ 2025-07-22 7:17 UTC (permalink / raw)
To: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach, shengjiu.wang
Hi Shengjiu,
On 07/18/2025, Shengjiu Wang wrote:
> Add binding for the i.MX8MP HDMI parallel Audio interface block.
> As this port is linked to imx8mp-hdmi-tx, add port@2 in
> fsl,imx8mp-hdmi-tx.yaml document.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> .../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
> .../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
> 2 files changed, 74 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
Usually, to add a new driver, a DT binding patch comes first.
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> index 05442d437755..cf810b277557 100644
> --- a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> @@ -49,9 +49,14 @@ properties:
> $ref: /schemas/graph.yaml#/properties/port
> description: HDMI output port
>
> + port@2:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Parallel audio input port
> +
> required:
> - port@0
> - port@1
> + - port@2
Can port@2 be optional?
Note that video output can work with only port@0 and port@1.
>
> required:
> - compatible
> @@ -98,5 +103,13 @@ examples:
> remote-endpoint = <&hdmi0_con>;
> };
> };
> +
> + port@2 {
> + reg = <2>;
> +
> + endpoint {
> + remote-endpoint = <&pai_to_hdmi_tx>;
> + };
> + };
> };
> };
> diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> new file mode 100644
> index 000000000000..d2d723935032
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pai.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale i.MX8MP HDMI Parallel Audio Interface
> +
> +maintainers:
> + - Shengjiu Wang <shengjiu.wang@nxp.com>
> +
> +description:
> + The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that acts as the
> + bridge between the Audio Subsystem to the HDMI TX Controller.
> +
> +properties:
In i.MX8MP TRM, HTX_PAI block diagram mentions an APB interface.
Does it mean a clock is needed?
> + compatible:
> + const: fsl,imx8mp-hdmi-pai
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + power-domains:
> + maxItems: 1
> +
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Output to the HDMI TX controller.
> + unevaluatedProperties: false
Why do you need this line?
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - power-domains
> + - port
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
Unused. Drop.
> + #include <dt-bindings/power/imx8mp-power.h>
> +
> + hdmi@32fc4800 {
> + compatible = "fsl,imx8mp-hdmi-pai";
> + reg = <0x32fc4800 0x800>;
> + interrupt-parent = <&irqsteer_hdmi>;
> + interrupts = <14>;
> + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> +
> + port {
> +
Drop this blank line.
> + pai_to_hdmi_tx: endpoint {
> + remote-endpoint = <&hdmi_tx_from_pai>;
> + };
> + };
> + };
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
2025-07-18 16:15 ` Frank Li
@ 2025-07-22 7:39 ` Liu Ying
2025-07-23 7:36 ` Shengjiu Wang
1 sibling, 1 reply; 22+ messages in thread
From: Liu Ying @ 2025-07-22 7:39 UTC (permalink / raw)
To: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach, shengjiu.wang
Hi Shengjiu,
On 07/18/2025, Shengjiu Wang wrote:
> The enable_audio() and disable_audio() callback pointers are in
> plat_data structure, and the audio device driver needs to get plat_data
> for assign these pointers. So add a function to export plat_data
{enable,disable}_audio pointers are directly assigned to plat_data in patch 2,
instead of using dw_hdmi_to_plat_data(). dw_hdmi_to_plat_data() is only
used in patch 2 to get hdmi_pai pointer through pdata->priv_audio.
const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> structure.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
> include/drm/bridge/dw_hdmi.h | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 76c6570e2a85..3dfa42178f6c 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -198,6 +198,12 @@ struct dw_hdmi {
> enum drm_connector_status last_connector_result;
> };
>
> +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi)
> +{
> + return hdmi->plat_data;
> +}
> +EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data);
> +
> #define HDMI_IH_PHY_STAT0_RX_SENSE \
> (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \
> HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3)
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index 6a46baa0737c..a56a3519a22a 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -208,4 +208,5 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
>
> bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
>
> +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi);
Nit: Add a blank line as it was here.
> #endif /* __IMX_HDMI_H__ */
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-21 3:41 ` Shengjiu Wang
@ 2025-07-22 7:52 ` Liu Ying
2025-07-23 7:40 ` Shengjiu Wang
0 siblings, 1 reply; 22+ messages in thread
From: Liu Ying @ 2025-07-22 7:52 UTC (permalink / raw)
To: Shengjiu Wang, Alexander Stein
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, lumag, dianders, cristian.ciocaltea, luca.ceresoli,
dri-devel, linux-kernel, shawnguo, s.hauer, kernel, festevam, imx,
linux-arm-kernel, robh, krzk+dt, conor+dt, p.zabel, devicetree,
l.stach, Shengjiu Wang
Hi Shengjiu,
On 07/21/2025, Shengjiu Wang wrote:
> On Fri, Jul 18, 2025 at 7:51 PM Alexander Stein
> <alexander.stein@ew.tq-group.com> wrote:
[...]
>> Am Freitag, 18. Juli 2025, 12:11:48 CEST schrieb Shengjiu Wang:
[...]
>>> + /* IEC60958 format */
>>> + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
>>> + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
>>> + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
>>> + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
>>> + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
>>> + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
[...]
>> But where do these numbers come from? I can see that downstream kernel
>> sets these bits depending on audio config being passed.
>
> These numbers are defined in standard IEC958 spec.
Can these be defined by macros, even in a certain common header file,
include/sound/asoundef.h?
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-18 10:11 ` [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface Shengjiu Wang
2025-07-18 11:50 ` Alexander Stein
@ 2025-07-22 8:49 ` Liu Ying
2025-07-23 7:45 ` Shengjiu Wang
1 sibling, 1 reply; 22+ messages in thread
From: Liu Ying @ 2025-07-22 8:49 UTC (permalink / raw)
To: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach, shengjiu.wang
Hi Shengjiu,
On 07/18/2025, Shengjiu Wang wrote:
> The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
> This IP block is found in the HDMI subsystem of the i.MX8MP SoC.
>
> Data received from the audio subsystem can have an arbitrary component
> ordering. The HTX_PAI block has integrated muxing options to select which
> sections of the 32-bit input data word will be mapped to each IEC60958
> field. The HTX_PAI_FIELD_CTRL register contains mux selects to
> individually select P,C,U,V,Data, and Preamble.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> drivers/gpu/drm/bridge/imx/Kconfig | 7 +
> drivers/gpu/drm/bridge/imx/Makefile | 1 +
> drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 +++++++++++++++++++
> include/drm/bridge/dw_hdmi.h | 6 +
> 4 files changed, 148 insertions(+)
> create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
>
> diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig
> index 9a480c6abb85..d95fa84a8dcd 100644
> --- a/drivers/gpu/drm/bridge/imx/Kconfig
> +++ b/drivers/gpu/drm/bridge/imx/Kconfig
> @@ -24,6 +24,13 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE
> Choose this to enable support for the internal HDMI encoder found
> on the i.MX8MP SoC.
>
> +config DRM_IMX8MP_HDMI_PAI
> + tristate "Freescale i.MX8MP HDMI PAI bridge support"
> + depends on OF
> + help
> + Choose this to enable support for the internal HDMI TX Parallel
> + Audio Interface found on the Freescale i.MX8MP SoC.
Should DRM_IMX8MP_DW_HDMI_BRIDGE imply DRM_IMX8MP_HDMI_PAI as it implies
DRM_IMX8MP_HDMI_PVI and PHY_FSL_SAMSUNG_HDMI_PHY?
> +
> config DRM_IMX8MP_HDMI_PVI
> tristate "Freescale i.MX8MP HDMI PVI bridge support"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile
> index dd5d48584806..8d01fda25451 100644
> --- a/drivers/gpu/drm/bridge/imx/Makefile
> +++ b/drivers/gpu/drm/bridge/imx/Makefile
> @@ -1,6 +1,7 @@
> obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
> obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
> obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
> +obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
> obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
> obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
> obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
> diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> new file mode 100644
> index 000000000000..f09ee2622e57
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> @@ -0,0 +1,134 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#include <drm/bridge/dw_hdmi.h>
Usually, linux/*.h header files come before drm/*.h header files.
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +
> +#define HTX_PAI_CTRL 0x00
> +#define HTX_PAI_CTRL_EXT 0x04
> +#define HTX_PAI_FIELD_CTRL 0x08
> +#define HTX_PAI_STAT 0x0c
> +#define HTX_PAI_IRQ_NOMASK 0x10
> +#define HTX_PAI_IRQ_MASKED 0x14
> +#define HTX_PAI_IRQ_MASK 0x18
The above 4 registers are unused. Drop.
> +
> +#define CTRL_ENABLE BIT(0)
Drop CTRL_ prefix. Same for the other bits/fields.
Define this bit under register HTX_PAI_CTRL. Same for bits/fields of
the other registers.
> +
> +#define CTRL_EXT_WTMK_HIGH_MASK GENMASK(31, 24)
> +#define CTRL_EXT_WTMK_HIGH (0x3 << 24)
Add a parameter for the macro and use FIELD_PREP.
Same for WTMK_LOW and NUM_CH.
#define WTMK_HIGH(n) FIELD_PREP(WTMK_HIGH_MASK, (n))
> +#define CTRL_EXT_WTMK_LOW_MASK GENMASK(23, 16)
> +#define CTRL_EXT_WTMK_LOW (0x3 << 16)
> +#define CTRL_EXT_NUM_CH_MASK GENMASK(10, 8)
> +#define CTRL_EXT_NUM_CH_SHIFT 8
This is not needed if FIELD_PREP is used.
> +
> +#define FIELD_CTRL_B_FILT BIT(31)
> +#define FIELD_CTRL_PARITY_EN BIT(30)
> +#define FIELD_CTRL_END_SEL BIT(29)
> +#define FIELD_CTRL_PRE_SEL GENMASK(28, 24)
> +#define FIELD_CTRL_PRE_SEL_SHIFT 24
> +#define FIELD_CTRL_D_SEL GENMASK(23, 20)
> +#define FIELD_CTRL_D_SEL_SHIFT 20
> +#define FIELD_CTRL_V_SEL GENMASK(19, 15)
> +#define FIELD_CTRL_V_SEL_SHIFT 15
> +#define FIELD_CTRL_U_SEL GENMASK(14, 10)
> +#define FIELD_CTRL_U_SEL_SHIFT 10
> +#define FIELD_CTRL_C_SEL GENMASK(9, 5)
> +#define FIELD_CTRL_C_SEL_SHIFT 5
> +#define FIELD_CTRL_P_SEL GENMASK(4, 0)
> +#define FIELD_CTRL_P_SEL_SHIFT 0
> +
> +struct imx8mp_hdmi_pai {
> + struct device *dev;
> + void __iomem *base;
> +};
> +
> +static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
> + int width, int rate, int non_pcm)
> +{
> + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> + int val;
> +
> + /* PAI set */
/* PAI set control extended */
> + val = CTRL_EXT_WTMK_HIGH | CTRL_EXT_WTMK_LOW;
> + val |= ((channel - 1) << CTRL_EXT_NUM_CH_SHIFT);
> + writel(val, hdmi_pai->base + HTX_PAI_CTRL_EXT);
Can you use regmap API?
> +
> + /* IEC60958 format */
> + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
> + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
> + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
> + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
> + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
> + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
> +
Nit: remove this blank line.
> + writel(val, hdmi_pai->base + HTX_PAI_FIELD_CTRL);
Nit: add a blank line here.
> + /* PAI start running */
> + writel(CTRL_ENABLE, hdmi_pai->base + HTX_PAI_CTRL);
> +}
> +
> +static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
> +{
> + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> +
> + /* Stop PAI */
> + writel(0, hdmi_pai->base + HTX_PAI_CTRL);
> +}
> +
> +static int imx8mp_hdmi_pai_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct dw_hdmi_plat_data *plat_data;
> + struct imx8mp_hdmi_pai *hdmi_pai;
> + struct device_node *remote;
> + struct platform_device *hdmi_tx;
> + struct resource *res;
> +
> + hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
> + if (!hdmi_pai)
> + return -ENOMEM;
> +
> + hdmi_pai->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> + if (IS_ERR(hdmi_pai->base))
> + return PTR_ERR(hdmi_pai->base);
> +
> + hdmi_pai->dev = dev;
> +
> + remote = of_graph_get_remote_node(pdev->dev.of_node, 0, -1);
> + if (!remote)
> + return -EINVAL;
> +
> + hdmi_tx = of_find_device_by_node(remote);
> + if (!hdmi_tx)
> + return -EINVAL;
> +
> + plat_data = platform_get_drvdata(hdmi_tx);
> + plat_data->enable_audio = imx8mp_hdmi_pai_enable;
> + plat_data->disable_audio = imx8mp_hdmi_pai_disable;
{enable,disable}_audio callbacks could be set too late...
You are trying to probe this driver after imx8mp_hdmi_tx is probed,
i.e., after dw_hdmi_probe() is called in imx8mp_dw_hdmi_probe().
Note that after dw_hdmi_probe() is called, the audio device could be
functional soon, while this probe is called asynchronously.
Also, what if imx8mp_hdmi_pai module is removed while imx8mp_hdmi_tx
is running? Leaking {enable,disable}_audio callbacks?
I think that you may try to use component helper to take imx8mp_hdmi_tx
as an aggregate driver and this driver as a component driver. After
the component is bound, you may set {enable,disable}_audio callbacks
in imx8mp_hdmi_tx before calling dw_hdmi_probe().
And, you need to export imx8mp_hdmi_pai_{enable,disable} symbols.
> + plat_data->priv_audio = hdmi_pai;
> +
> + return 0;
> +}
> +
> +static const struct of_device_id imx8mp_hdmi_pai_of_table[] = {
> + { .compatible = "fsl,imx8mp-hdmi-pai" },
> + { /* Sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, imx8mp_hdmi_pai_of_table);
> +
> +static struct platform_driver imx8mp_hdmi_pai_platform_driver = {
> + .probe = imx8mp_hdmi_pai_probe,
> + .driver = {
> + .name = "imx8mp-hdmi-pai",
> + .of_match_table = imx8mp_hdmi_pai_of_table,
> + },
> +};
> +module_platform_driver(imx8mp_hdmi_pai_platform_driver);
> +
> +MODULE_DESCRIPTION("i.MX8MP HDMI PAI driver");
> +MODULE_LICENSE("GPL");
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index a56a3519a22a..9ca70ce80cc5 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -143,6 +143,12 @@ struct dw_hdmi_plat_data {
> const struct drm_display_info *info,
> const struct drm_display_mode *mode);
>
> + /*
> + * priv_audio is specially used for additional audio device to get
> + * driver data through this dw_hdmi_plat_data.
> + */
> + void *priv_audio;
> +
> /* Platform-specific audio enable/disable (optional) */
> void (*enable_audio)(struct dw_hdmi *hdmi, int channel,
> int width, int rate, int non_pcm);
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data
2025-07-22 7:39 ` Liu Ying
@ 2025-07-23 7:36 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-23 7:36 UTC (permalink / raw)
To: Liu Ying
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach
On Tue, Jul 22, 2025 at 3:38 PM Liu Ying <victor.liu@nxp.com> wrote:
>
> Hi Shengjiu,
>
> On 07/18/2025, Shengjiu Wang wrote:
> > The enable_audio() and disable_audio() callback pointers are in
> > plat_data structure, and the audio device driver needs to get plat_data
> > for assign these pointers. So add a function to export plat_data
>
> {enable,disable}_audio pointers are directly assigned to plat_data in patch 2,
> instead of using dw_hdmi_to_plat_data(). dw_hdmi_to_plat_data() is only
> used in patch 2 to get hdmi_pai pointer through pdata->priv_audio.
>
> const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
>
will update this commit message.
> > structure.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
> > include/drm/bridge/dw_hdmi.h | 1 +
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > index 76c6570e2a85..3dfa42178f6c 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > @@ -198,6 +198,12 @@ struct dw_hdmi {
> > enum drm_connector_status last_connector_result;
> > };
> >
> > +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi)
> > +{
> > + return hdmi->plat_data;
> > +}
> > +EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data);
> > +
> > #define HDMI_IH_PHY_STAT0_RX_SENSE \
> > (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \
> > HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3)
> > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> > index 6a46baa0737c..a56a3519a22a 100644
> > --- a/include/drm/bridge/dw_hdmi.h
> > +++ b/include/drm/bridge/dw_hdmi.h
> > @@ -208,4 +208,5 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
> >
> > bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
> >
> > +const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi);
>
> Nit: Add a blank line as it was here.
will add blank line
best regards
Shengjiu Wang
>
> > #endif /* __IMX_HDMI_H__ */
>
> --
> Regards,
> Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-22 7:17 ` Liu Ying
@ 2025-07-23 7:39 ` Shengjiu Wang
2025-07-23 9:01 ` Liu Ying
0 siblings, 1 reply; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-23 7:39 UTC (permalink / raw)
To: Liu Ying
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach
On Tue, Jul 22, 2025 at 3:16 PM Liu Ying <victor.liu@nxp.com> wrote:
>
> Hi Shengjiu,
>
> On 07/18/2025, Shengjiu Wang wrote:
> > Add binding for the i.MX8MP HDMI parallel Audio interface block.
> > As this port is linked to imx8mp-hdmi-tx, add port@2 in
> > fsl,imx8mp-hdmi-tx.yaml document.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > .../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
> > .../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
> > 2 files changed, 74 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
>
> Usually, to add a new driver, a DT binding patch comes first.
ok, will move it to first patch
>
> >
> > diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > index 05442d437755..cf810b277557 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
> > @@ -49,9 +49,14 @@ properties:
> > $ref: /schemas/graph.yaml#/properties/port
> > description: HDMI output port
> >
> > + port@2:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Parallel audio input port
> > +
> > required:
> > - port@0
> > - port@1
> > + - port@2
>
> Can port@2 be optional?
> Note that video output can work with only port@0 and port@1.
yes, it can be optional
>
> >
> > required:
> > - compatible
> > @@ -98,5 +103,13 @@ examples:
> > remote-endpoint = <&hdmi0_con>;
> > };
> > };
> > +
> > + port@2 {
> > + reg = <2>;
> > +
> > + endpoint {
> > + remote-endpoint = <&pai_to_hdmi_tx>;
> > + };
> > + };
> > };
> > };
> > diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> > new file mode 100644
> > index 000000000000..d2d723935032
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
> > @@ -0,0 +1,61 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pai.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Freescale i.MX8MP HDMI Parallel Audio Interface
> > +
> > +maintainers:
> > + - Shengjiu Wang <shengjiu.wang@nxp.com>
> > +
> > +description:
> > + The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that acts as the
> > + bridge between the Audio Subsystem to the HDMI TX Controller.
> > +
> > +properties:
>
> In i.MX8MP TRM, HTX_PAI block diagram mentions an APB interface.
> Does it mean a clock is needed?
The APB clock is bound with the power domain, so no need to add it here.
>
> > + compatible:
> > + const: fsl,imx8mp-hdmi-pai
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > + power-domains:
> > + maxItems: 1
> > +
> > + port:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Output to the HDMI TX controller.
> > + unevaluatedProperties: false
>
> Why do you need this line?
per my understanding, this line can be added or removed.
>
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - interrupts
> > + - power-domains
> > + - port
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/interrupt-controller/irq.h>
>
> Unused. Drop.
Ok.
>
> > + #include <dt-bindings/power/imx8mp-power.h>
> > +
> > + hdmi@32fc4800 {
> > + compatible = "fsl,imx8mp-hdmi-pai";
> > + reg = <0x32fc4800 0x800>;
> > + interrupt-parent = <&irqsteer_hdmi>;
> > + interrupts = <14>;
> > + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PAI>;
> > +
> > + port {
> > +
>
> Drop this blank line.
Ok.
Best regards
Shengjiu Wang
>
> > + pai_to_hdmi_tx: endpoint {
> > + remote-endpoint = <&hdmi_tx_from_pai>;
> > + };
> > + };
> > + };
>
> --
> Regards,
> Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-22 7:52 ` Liu Ying
@ 2025-07-23 7:40 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-23 7:40 UTC (permalink / raw)
To: Liu Ying
Cc: Alexander Stein, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach, Shengjiu Wang
On Tue, Jul 22, 2025 at 3:50 PM Liu Ying <victor.liu@nxp.com> wrote:
>
> Hi Shengjiu,
>
> On 07/21/2025, Shengjiu Wang wrote:
> > On Fri, Jul 18, 2025 at 7:51 PM Alexander Stein
> > <alexander.stein@ew.tq-group.com> wrote:
>
> [...]
>
> >> Am Freitag, 18. Juli 2025, 12:11:48 CEST schrieb Shengjiu Wang:
>
> [...]
>
> >>> + /* IEC60958 format */
> >>> + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
> >>> + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
> >>> + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
> >>> + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
> >>> + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
> >>> + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
>
> [...]
>
> >> But where do these numbers come from? I can see that downstream kernel
> >> sets these bits depending on audio config being passed.
> >
> > These numbers are defined in standard IEC958 spec.
>
> Can these be defined by macros, even in a certain common header file,
> include/sound/asoundef.h?
yes, then will include ALSA maintainer for the change.
>
> --
> Regards,
> Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface
2025-07-22 8:49 ` Liu Ying
@ 2025-07-23 7:45 ` Shengjiu Wang
0 siblings, 0 replies; 22+ messages in thread
From: Shengjiu Wang @ 2025-07-23 7:45 UTC (permalink / raw)
To: Liu Ying
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach
On Tue, Jul 22, 2025 at 4:47 PM Liu Ying <victor.liu@nxp.com> wrote:
>
> Hi Shengjiu,
>
> On 07/18/2025, Shengjiu Wang wrote:
> > The HDMI TX Parallel Audio Interface (HTX_PAI) is a digital module that
> > acts as the bridge between the Audio Subsystem to the HDMI TX Controller.
> > This IP block is found in the HDMI subsystem of the i.MX8MP SoC.
> >
> > Data received from the audio subsystem can have an arbitrary component
> > ordering. The HTX_PAI block has integrated muxing options to select which
> > sections of the 32-bit input data word will be mapped to each IEC60958
> > field. The HTX_PAI_FIELD_CTRL register contains mux selects to
> > individually select P,C,U,V,Data, and Preamble.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > drivers/gpu/drm/bridge/imx/Kconfig | 7 +
> > drivers/gpu/drm/bridge/imx/Makefile | 1 +
> > drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 134 +++++++++++++++++++
> > include/drm/bridge/dw_hdmi.h | 6 +
> > 4 files changed, 148 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> >
> > diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig
> > index 9a480c6abb85..d95fa84a8dcd 100644
> > --- a/drivers/gpu/drm/bridge/imx/Kconfig
> > +++ b/drivers/gpu/drm/bridge/imx/Kconfig
> > @@ -24,6 +24,13 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE
> > Choose this to enable support for the internal HDMI encoder found
> > on the i.MX8MP SoC.
> >
> > +config DRM_IMX8MP_HDMI_PAI
> > + tristate "Freescale i.MX8MP HDMI PAI bridge support"
> > + depends on OF
> > + help
> > + Choose this to enable support for the internal HDMI TX Parallel
> > + Audio Interface found on the Freescale i.MX8MP SoC.
>
> Should DRM_IMX8MP_DW_HDMI_BRIDGE imply DRM_IMX8MP_HDMI_PAI as it implies
> DRM_IMX8MP_HDMI_PVI and PHY_FSL_SAMSUNG_HDMI_PHY?
yes.
>
> > +
> > config DRM_IMX8MP_HDMI_PVI
> > tristate "Freescale i.MX8MP HDMI PVI bridge support"
> > depends on OF
> > diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile
> > index dd5d48584806..8d01fda25451 100644
> > --- a/drivers/gpu/drm/bridge/imx/Makefile
> > +++ b/drivers/gpu/drm/bridge/imx/Makefile
> > @@ -1,6 +1,7 @@
> > obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
> > obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
> > obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
> > +obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
> > obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
> > obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
> > obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
> > diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> > new file mode 100644
> > index 000000000000..f09ee2622e57
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
> > @@ -0,0 +1,134 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2025 NXP
> > + */
> > +
> > +#include <drm/bridge/dw_hdmi.h>
>
> Usually, linux/*.h header files come before drm/*.h header files.
>
> > +#include <linux/module.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +
> > +#define HTX_PAI_CTRL 0x00
> > +#define HTX_PAI_CTRL_EXT 0x04
> > +#define HTX_PAI_FIELD_CTRL 0x08
> > +#define HTX_PAI_STAT 0x0c
> > +#define HTX_PAI_IRQ_NOMASK 0x10
> > +#define HTX_PAI_IRQ_MASKED 0x14
> > +#define HTX_PAI_IRQ_MASK 0x18
>
> The above 4 registers are unused. Drop.
>
> > +
> > +#define CTRL_ENABLE BIT(0)
>
> Drop CTRL_ prefix. Same for the other bits/fields.
>
> Define this bit under register HTX_PAI_CTRL. Same for bits/fields of
> the other registers.
Ok, will update them.
>
> > +
> > +#define CTRL_EXT_WTMK_HIGH_MASK GENMASK(31, 24)
> > +#define CTRL_EXT_WTMK_HIGH (0x3 << 24)
>
> Add a parameter for the macro and use FIELD_PREP.
> Same for WTMK_LOW and NUM_CH.
>
> #define WTMK_HIGH(n) FIELD_PREP(WTMK_HIGH_MASK, (n))
>
> > +#define CTRL_EXT_WTMK_LOW_MASK GENMASK(23, 16)
> > +#define CTRL_EXT_WTMK_LOW (0x3 << 16)
> > +#define CTRL_EXT_NUM_CH_MASK GENMASK(10, 8)
> > +#define CTRL_EXT_NUM_CH_SHIFT 8
>
> This is not needed if FIELD_PREP is used.
>
> > +
> > +#define FIELD_CTRL_B_FILT BIT(31)
> > +#define FIELD_CTRL_PARITY_EN BIT(30)
> > +#define FIELD_CTRL_END_SEL BIT(29)
> > +#define FIELD_CTRL_PRE_SEL GENMASK(28, 24)
> > +#define FIELD_CTRL_PRE_SEL_SHIFT 24
> > +#define FIELD_CTRL_D_SEL GENMASK(23, 20)
> > +#define FIELD_CTRL_D_SEL_SHIFT 20
> > +#define FIELD_CTRL_V_SEL GENMASK(19, 15)
> > +#define FIELD_CTRL_V_SEL_SHIFT 15
> > +#define FIELD_CTRL_U_SEL GENMASK(14, 10)
> > +#define FIELD_CTRL_U_SEL_SHIFT 10
> > +#define FIELD_CTRL_C_SEL GENMASK(9, 5)
> > +#define FIELD_CTRL_C_SEL_SHIFT 5
> > +#define FIELD_CTRL_P_SEL GENMASK(4, 0)
> > +#define FIELD_CTRL_P_SEL_SHIFT 0
> > +
> > +struct imx8mp_hdmi_pai {
> > + struct device *dev;
> > + void __iomem *base;
> > +};
> > +
> > +static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
> > + int width, int rate, int non_pcm)
> > +{
> > + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> > + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> > + int val;
> > +
> > + /* PAI set */
>
> /* PAI set control extended */
>
> > + val = CTRL_EXT_WTMK_HIGH | CTRL_EXT_WTMK_LOW;
> > + val |= ((channel - 1) << CTRL_EXT_NUM_CH_SHIFT);
> > + writel(val, hdmi_pai->base + HTX_PAI_CTRL_EXT);
>
> Can you use regmap API?
yes.
>
> > +
> > + /* IEC60958 format */
> > + val = 31 << FIELD_CTRL_P_SEL_SHIFT;
> > + val |= 30 << FIELD_CTRL_C_SEL_SHIFT;
> > + val |= 29 << FIELD_CTRL_U_SEL_SHIFT;
> > + val |= 28 << FIELD_CTRL_V_SEL_SHIFT;
> > + val |= 4 << FIELD_CTRL_D_SEL_SHIFT;
> > + val |= 0 << FIELD_CTRL_PRE_SEL_SHIFT;
> > +
>
> Nit: remove this blank line.
>
> > + writel(val, hdmi_pai->base + HTX_PAI_FIELD_CTRL);
>
> Nit: add a blank line here.
>
> > + /* PAI start running */
> > + writel(CTRL_ENABLE, hdmi_pai->base + HTX_PAI_CTRL);
> > +}
> > +
> > +static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
> > +{
> > + const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
> > + struct imx8mp_hdmi_pai *hdmi_pai = (struct imx8mp_hdmi_pai *)pdata->priv_audio;
> > +
> > + /* Stop PAI */
> > + writel(0, hdmi_pai->base + HTX_PAI_CTRL);
> > +}
> > +
> > +static int imx8mp_hdmi_pai_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct dw_hdmi_plat_data *plat_data;
> > + struct imx8mp_hdmi_pai *hdmi_pai;
> > + struct device_node *remote;
> > + struct platform_device *hdmi_tx;
> > + struct resource *res;
> > +
> > + hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
> > + if (!hdmi_pai)
> > + return -ENOMEM;
> > +
> > + hdmi_pai->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> > + if (IS_ERR(hdmi_pai->base))
> > + return PTR_ERR(hdmi_pai->base);
> > +
> > + hdmi_pai->dev = dev;
> > +
> > + remote = of_graph_get_remote_node(pdev->dev.of_node, 0, -1);
> > + if (!remote)
> > + return -EINVAL;
> > +
> > + hdmi_tx = of_find_device_by_node(remote);
> > + if (!hdmi_tx)
> > + return -EINVAL;
> > +
> > + plat_data = platform_get_drvdata(hdmi_tx);
> > + plat_data->enable_audio = imx8mp_hdmi_pai_enable;
> > + plat_data->disable_audio = imx8mp_hdmi_pai_disable;
>
> {enable,disable}_audio callbacks could be set too late...
> You are trying to probe this driver after imx8mp_hdmi_tx is probed,
> i.e., after dw_hdmi_probe() is called in imx8mp_dw_hdmi_probe().
> Note that after dw_hdmi_probe() is called, the audio device could be
> functional soon, while this probe is called asynchronously.
>
> Also, what if imx8mp_hdmi_pai module is removed while imx8mp_hdmi_tx
> is running? Leaking {enable,disable}_audio callbacks?
>
> I think that you may try to use component helper to take imx8mp_hdmi_tx
> as an aggregate driver and this driver as a component driver. After
> the component is bound, you may set {enable,disable}_audio callbacks
> in imx8mp_hdmi_tx before calling dw_hdmi_probe().
> And, you need to export imx8mp_hdmi_pai_{enable,disable} symbols.
yes, will use component helper. with component helper, we can assign
the {enable, disable}_audio in .bind() callback, not matter which driver
probe first.
best regards
Shengjiu Wang
>
> > + plat_data->priv_audio = hdmi_pai;
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id imx8mp_hdmi_pai_of_table[] = {
> > + { .compatible = "fsl,imx8mp-hdmi-pai" },
> > + { /* Sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, imx8mp_hdmi_pai_of_table);
> > +
> > +static struct platform_driver imx8mp_hdmi_pai_platform_driver = {
> > + .probe = imx8mp_hdmi_pai_probe,
> > + .driver = {
> > + .name = "imx8mp-hdmi-pai",
> > + .of_match_table = imx8mp_hdmi_pai_of_table,
> > + },
> > +};
> > +module_platform_driver(imx8mp_hdmi_pai_platform_driver);
> > +
> > +MODULE_DESCRIPTION("i.MX8MP HDMI PAI driver");
> > +MODULE_LICENSE("GPL");
> > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> > index a56a3519a22a..9ca70ce80cc5 100644
> > --- a/include/drm/bridge/dw_hdmi.h
> > +++ b/include/drm/bridge/dw_hdmi.h
> > @@ -143,6 +143,12 @@ struct dw_hdmi_plat_data {
> > const struct drm_display_info *info,
> > const struct drm_display_mode *mode);
> >
> > + /*
> > + * priv_audio is specially used for additional audio device to get
> > + * driver data through this dw_hdmi_plat_data.
> > + */
> > + void *priv_audio;
> > +
> > /* Platform-specific audio enable/disable (optional) */
> > void (*enable_audio)(struct dw_hdmi *hdmi, int channel,
> > int width, int rate, int non_pcm);
>
> --
> Regards,
> Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI
2025-07-23 7:39 ` Shengjiu Wang
@ 2025-07-23 9:01 ` Liu Ying
0 siblings, 0 replies; 22+ messages in thread
From: Liu Ying @ 2025-07-23 9:01 UTC (permalink / raw)
To: Shengjiu Wang
Cc: Shengjiu Wang, andrzej.hajda, neil.armstrong, rfoss,
Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, lumag, dianders,
cristian.ciocaltea, luca.ceresoli, dri-devel, linux-kernel,
shawnguo, s.hauer, kernel, festevam, imx, linux-arm-kernel, robh,
krzk+dt, conor+dt, p.zabel, devicetree, l.stach
On 07/23/2025, Shengjiu Wang wrote:
> On Tue, Jul 22, 2025 at 3:16 PM Liu Ying <victor.liu@nxp.com> wrote:
>>
>> Hi Shengjiu,
>>
>> On 07/18/2025, Shengjiu Wang wrote:
>>> Add binding for the i.MX8MP HDMI parallel Audio interface block.
>>> As this port is linked to imx8mp-hdmi-tx, add port@2 in
>>> fsl,imx8mp-hdmi-tx.yaml document.
>>>
>>> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
>>> ---
>>> .../display/bridge/fsl,imx8mp-hdmi-tx.yaml | 13 ++++
>>> .../display/imx/fsl,imx8mp-hdmi-pai.yaml | 61 +++++++++++++++++++
>>> 2 files changed, 74 insertions(+)
>>> create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pai.yaml
[...]
>>> +properties:
>>
>> In i.MX8MP TRM, HTX_PAI block diagram mentions an APB interface.
>> Does it mean a clock is needed?
>
> The APB clock is bound with the power domain, so no need to add it here.
That depends on OS's power domain driver implementation.
From DT's point of view, the APB clock should be a property here.
>
>>
>>> + compatible:
>>> + const: fsl,imx8mp-hdmi-pai
>>> +
>>> + reg:
>>> + maxItems: 1
>>> +
>>> + interrupts:
>>> + maxItems: 1
>>> +
>>> + power-domains:
>>> + maxItems: 1
>>> +
>>> + port:
>>> + $ref: /schemas/graph.yaml#/properties/port
>>> + description: Output to the HDMI TX controller.
>>> + unevaluatedProperties: false
>>
>> Why do you need this line?
>
> per my understanding, this line can be added or removed.
I'd choose to drop it :)
[...]
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-07-23 8:59 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 10:11 [PATCH 0/4] drm/bridge: imx: Add HDMI PAI driver on i.MX8MP Shengjiu Wang
2025-07-18 10:11 ` [PATCH 1/4] drm/bridge: dw-hdmi: Add function to get plat_data Shengjiu Wang
2025-07-18 16:15 ` Frank Li
2025-07-21 3:24 ` Shengjiu Wang
2025-07-22 7:39 ` Liu Ying
2025-07-23 7:36 ` Shengjiu Wang
2025-07-18 10:11 ` [PATCH 2/4] drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface Shengjiu Wang
2025-07-18 11:50 ` Alexander Stein
2025-07-21 3:41 ` Shengjiu Wang
2025-07-22 7:52 ` Liu Ying
2025-07-23 7:40 ` Shengjiu Wang
2025-07-22 8:49 ` Liu Ying
2025-07-23 7:45 ` Shengjiu Wang
2025-07-18 10:11 ` [PATCH 3/4] dt-bindings: display: imx: add binding for i.MX8MP HDMI PAI Shengjiu Wang
2025-07-18 16:25 ` Frank Li
2025-07-21 3:26 ` Shengjiu Wang
2025-07-22 7:17 ` Liu Ying
2025-07-23 7:39 ` Shengjiu Wang
2025-07-23 9:01 ` Liu Ying
2025-07-18 10:11 ` [PATCH 4/4] arm64: dts: imx8mp: Add hdmi parallel audio interface node Shengjiu Wang
2025-07-18 16:30 ` Frank Li
2025-07-21 3:28 ` Shengjiu Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).