Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/bridge: imx8mp-hdmi-pai: enable PM runtime

There is an audio channel shift issue with multi channel case - the
channel order is correct for the first run, but the channel order is
shifted for the second run. The fix method is to reset the PAI interface
at the end of playback.

The reset can be handled by PM runtime, so enable PM runtime.

Fixes: 0205fae6327a ("drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Link: https://lore.kernel.org/r/20260130080910.3532724-1-shengjiu.wang@nxp.com

authored by

Shengjiu Wang and committed by
Liu Ying
40b24d9c 0e0c8f4d

+15
+15
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
··· 8 8 #include <linux/module.h> 9 9 #include <linux/of_platform.h> 10 10 #include <linux/platform_device.h> 11 + #include <linux/pm_runtime.h> 11 12 #include <linux/regmap.h> 12 13 #include <drm/bridge/dw_hdmi.h> 13 14 #include <sound/asoundef.h> ··· 34 33 35 34 struct imx8mp_hdmi_pai { 36 35 struct regmap *regmap; 36 + struct device *dev; 37 37 }; 38 38 39 39 static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel, ··· 44 42 const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi); 45 43 struct imx8mp_hdmi_pai *hdmi_pai = pdata->priv_audio; 46 44 int val; 45 + 46 + if (pm_runtime_resume_and_get(hdmi_pai->dev) < 0) 47 + return; 47 48 48 49 /* PAI set control extended */ 49 50 val = WTMK_HIGH(3) | WTMK_LOW(3); ··· 90 85 91 86 /* Stop PAI */ 92 87 regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL, 0); 88 + 89 + pm_runtime_put_sync(hdmi_pai->dev); 93 90 } 94 91 95 92 static const struct regmap_config imx8mp_hdmi_pai_regmap_config = { ··· 108 101 struct imx8mp_hdmi_pai *hdmi_pai; 109 102 struct resource *res; 110 103 void __iomem *base; 104 + int ret; 111 105 112 106 hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL); 113 107 if (!hdmi_pai) ··· 128 120 plat_data->enable_audio = imx8mp_hdmi_pai_enable; 129 121 plat_data->disable_audio = imx8mp_hdmi_pai_disable; 130 122 plat_data->priv_audio = hdmi_pai; 123 + 124 + hdmi_pai->dev = dev; 125 + ret = devm_pm_runtime_enable(dev); 126 + if (ret < 0) { 127 + dev_err(dev, "failed to enable PM runtime: %d\n", ret); 128 + return ret; 129 + } 131 130 132 131 return 0; 133 132 }