diff mbox series

[09/12] ASoC: intel: kbl_rt5663_max98927 add device_link to HDMI audio

Message ID 1554975299-25343-10-git-send-email-libin.yang@intel.com (mailing list archive)
State New, archived
Headers show
Series ASoC: intel: add device_link to HDMI audio | expand

Commit Message

Yang, Libin April 11, 2019, 9:34 a.m. UTC
From: Libin Yang <libin.yang@intel.com>

In resume from S3, HDAC HDMI codec driver dapm event callback may be
operated before HDMI codec driver turns on the display audio power
domain because of the contest between display driver and hdmi codec driver.

This patch adds the device_link between kbl_rt5663_max98927 machine device
(consumer) and hdmi codec device (supplier) to make sure the sequence is
always correct.

Signed-off-by: Libin Yang <libin.yang@intel.com>
---
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c
index d714752..6e23461 100644
--- a/sound/soc/intel/boards/kbl_rt5663_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c
@@ -31,6 +31,7 @@ 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
+#include "hdac_hdmi_common.h"
 
 #define KBL_REALTEK_CODEC_DAI "rt5663-aif"
 #define KBL_MAXIM_CODEC_DAI "max98927-aif1"
@@ -53,6 +54,7 @@  struct kbl_rt5663_private {
 	struct list_head hdmi_pcm_list;
 	struct clk *mclk;
 	struct clk *sclk;
+	struct device_link *link;
 };
 
 enum {
@@ -336,7 +338,8 @@  static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 
 	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
 
-	return 0;
+	/* Setup a device_link between machine device and HDMI codec device. */
+	return hdac_hdmi_add_device_link(rtd->card->dev, dai->dev, &ctx->link);
 }
 
 static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
@@ -1033,8 +1036,17 @@  static const struct platform_device_id kbl_board_ids[] = {
 	{ }
 };
 
+static int kabylake_audio_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(card);
+
+	return hdac_hdmi_del_device_link(&ctx->link);
+}
+
 static struct platform_driver kabylake_audio = {
 	.probe = kabylake_audio_probe,
+	.remove = kabylake_audio_remove,
 	.driver = {
 		.name = "kbl_rt5663_m98927",
 		.pm = &snd_soc_pm_ops,