Skip to content

Commit 40b24d9

Browse files
TE-N-ShengjiuWangLiu Ying
authored andcommitted
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: 0205fae ("drm/bridge: imx: add driver for HDMI TX Parallel Audio Interface") Signed-off-by: Shengjiu Wang <[email protected]> Reviewed-by: Liu Ying <[email protected]> Signed-off-by: Liu Ying <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0e0c8f4 commit 40b24d9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/module.h>
99
#include <linux/of_platform.h>
1010
#include <linux/platform_device.h>
11+
#include <linux/pm_runtime.h>
1112
#include <linux/regmap.h>
1213
#include <drm/bridge/dw_hdmi.h>
1314
#include <sound/asoundef.h>
@@ -33,6 +34,7 @@
3334

3435
struct imx8mp_hdmi_pai {
3536
struct regmap *regmap;
37+
struct device *dev;
3638
};
3739

3840
static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
@@ -43,6 +45,9 @@ static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
4345
struct imx8mp_hdmi_pai *hdmi_pai = pdata->priv_audio;
4446
int val;
4547

48+
if (pm_runtime_resume_and_get(hdmi_pai->dev) < 0)
49+
return;
50+
4651
/* PAI set control extended */
4752
val = WTMK_HIGH(3) | WTMK_LOW(3);
4853
val |= NUM_CH(channel);
@@ -85,6 +90,8 @@ static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
8590

8691
/* Stop PAI */
8792
regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL, 0);
93+
94+
pm_runtime_put_sync(hdmi_pai->dev);
8895
}
8996

9097
static const struct regmap_config imx8mp_hdmi_pai_regmap_config = {
@@ -101,6 +108,7 @@ static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void
101108
struct imx8mp_hdmi_pai *hdmi_pai;
102109
struct resource *res;
103110
void __iomem *base;
111+
int ret;
104112

105113
hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
106114
if (!hdmi_pai)
@@ -121,6 +129,13 @@ static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void
121129
plat_data->disable_audio = imx8mp_hdmi_pai_disable;
122130
plat_data->priv_audio = hdmi_pai;
123131

132+
hdmi_pai->dev = dev;
133+
ret = devm_pm_runtime_enable(dev);
134+
if (ret < 0) {
135+
dev_err(dev, "failed to enable PM runtime: %d\n", ret);
136+
return ret;
137+
}
138+
124139
return 0;
125140
}
126141

0 commit comments

Comments
 (0)