@@ -17,6 +17,25 @@
#define NAME_SIZE 32
+static int skl_hdmi_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct skl_hda_private *ctx = snd_soc_card_get_drvdata(rtd->card);
+ struct snd_soc_dai *dai = rtd->codec_dai;
+
+ /*
+ * Setup a device_link between machine device and HDMI codec device.
+ * The machine device is the consumer and the HDMI codec device is
+ * the supplier. With this setting, we can make sure that the audio
+ * domain in display power will be always turned on before operating
+ * on the HDMI audio codec registers.
+ */
+ if (!ctx->link)
+ ctx->link = device_link_add(rtd->card->dev, dai->dev,
+ DL_FLAG_RPM_ACTIVE);
+
+ return 0;
+}
+
int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device)
{
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
@@ -48,6 +67,7 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
.cpu_dai_name = "iDisp1 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi1",
+ .init = skl_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
@@ -57,6 +77,7 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
.cpu_dai_name = "iDisp2 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi2",
+ .init = skl_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
@@ -66,6 +87,7 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
.cpu_dai_name = "iDisp3 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi3",
+ .init = skl_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
@@ -29,6 +29,7 @@ struct skl_hda_private {
int pcm_count;
int dai_index;
const char *platform_name;
+ struct device_link *link;
};
extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
@@ -166,8 +166,20 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
return devm_snd_soc_register_card(&pdev->dev, &hda_soc_card);
}
+static int skl_hda_audio_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+ struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
+
+ if (ctx->link)
+ device_link_del(ctx->link);
+
+ return 0;
+}
+
static struct platform_driver skl_hda_audio = {
.probe = skl_hda_audio_probe,
+ .remove = skl_hda_audio_remove,
.driver = {
.name = "skl_hda_dsp_generic",
.pm = &snd_soc_pm_ops,