All of lore.kernel.org
 help / color / mirror / Atom feed
From: libin.yang@intel.com
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: tiwai@suse.de, libin.yang@intel.com,
	pierre-louis.bossart@linux.intel.com
Subject: [PATCH 11/12] ASoC: intel: skl_nau88l25_max98357a add device_link to HDMI audio
Date: Thu, 11 Apr 2019 17:34:58 +0800	[thread overview]
Message-ID: <1554975299-25343-12-git-send-email-libin.yang@intel.com> (raw)
In-Reply-To: <1554975299-25343-1-git-send-email-libin.yang@intel.com>

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 skl_nau88l25_max98357a 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/skl_nau88l25_max98357a.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/boards/skl_nau88l25_max98357a.c b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
index 0922106..38d599b 100644
--- a/sound/soc/intel/boards/skl_nau88l25_max98357a.c
+++ b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
@@ -24,6 +24,7 @@
 #include <sound/soc-acpi.h>
 #include "../../codecs/nau8825.h"
 #include "../../codecs/hdac_hdmi.h"
+#include "hdac_hdmi_common.h"
 
 #define SKL_NUVOTON_CODEC_DAI	"nau8825-hifi"
 #define SKL_MAXIM_CODEC_DAI "HiFi"
@@ -42,6 +43,7 @@ struct skl_hdmi_pcm {
 
 struct skl_nau8825_private {
 	struct list_head hdmi_pcm_list;
+	struct device_link *link;
 };
 
 enum {
@@ -202,7 +204,8 @@ static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
 
 	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 skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
@@ -220,7 +223,8 @@ static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 
 	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 skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
@@ -238,7 +242,8 @@ static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 
 	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 skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
@@ -666,8 +671,17 @@ static const struct platform_device_id skl_board_ids[] = {
 	{ }
 };
 
+static int skylake_audio_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(card);
+
+	return hdac_hdmi_del_device_link(&ctx->link);
+}
+
 static struct platform_driver skylake_audio = {
 	.probe = skylake_audio_probe,
+	.remove = skylake_audio_remove,
 	.driver = {
 		.name = "skl_n88l25_m98357a",
 		.pm = &snd_soc_pm_ops,
-- 
2.7.4

  parent reply	other threads:[~2019-04-11  9:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  9:34 [PATCH 00/12] ASoC: intel: add device_link to HDMI audio libin.yang
2019-04-11  9:34 ` [PATCH 01/12] ASoC: intel: skl_hda_dsp_generic: " libin.yang
2019-04-11  9:34 ` [PATCH 02/12] ASoC: intel: boards: define some general functions for hdac_hdmi libin.yang
2019-04-11  9:34 ` [PATCH 03/12] ASoC: intel: bxt_da7219_max98357a: add device_link to HDMI audio libin.yang
2019-04-11  9:34 ` [PATCH 04/12] ASoC: intel: bxt_rt298: " libin.yang
2019-04-11  9:34 ` [PATCH 05/12] ASoC: intel: glk_rt5682_max98357a: " libin.yang
2019-04-11  9:34 ` [PATCH 06/12] ASoC: intel: kbl_da7219_max98357a: " libin.yang
2019-04-11  9:34 ` [PATCH 07/12] ASoC: intel: kbl_da7219_max98927: " libin.yang
2019-04-11  9:34 ` [PATCH 08/12] ASoC: intel: kbl_rt5660: " libin.yang
2019-04-11  9:34 ` [PATCH 09/12] ASoC: intel: kbl_rt5663_max98927 " libin.yang
2019-04-11  9:34 ` [PATCH 10/12] ASoC: intel: kbl_rt5663_rt5514_max98927 " libin.yang
2019-04-11  9:34 ` libin.yang [this message]
2019-04-11  9:34 ` [PATCH 12/12] ASoC: intel: skl_nau88l25_ssm4567 " libin.yang
2019-04-11 10:09 ` [PATCH 00/12] ASoC: intel: " Takashi Iwai
2019-04-11 12:24   ` Yang, Libin
2019-04-11 12:33     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554975299-25343-12-git-send-email-libin.yang@intel.com \
    --to=libin.yang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.