From: Takashi Iwai Subject: Re: [PATCH] ASoC: cAVS: add device_link to HDMI audio Date: Mon, 08 Apr 2019 14:35:14 +0200 Message-ID: References: <1554686513-7770-1-git-send-email-libin.yang@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 07168F89610 for ; Mon, 8 Apr 2019 14:35:14 +0200 (CEST) In-Reply-To: <1554686513-7770-1-git-send-email-libin.yang@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: libin.yang@intel.com Cc: alsa-devel@alsa-project.org, broonie@kernel.org, pierre-louis.bossart@linux.intel.com List-Id: alsa-devel@alsa-project.org On Mon, 08 Apr 2019 03:21:53 +0200, libin.yang@intel.com wrote: > > From: Libin Yang > > 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 cAVS generic machine device > (consumer) and hdmi codec device (supplier) to make sure the sequence is > always correct. > > Signed-off-by: Libin Yang Looks good to me. Maybe it's worth to put a brief comment in skl_hdmi_init() why this device link is needed, though. Feel free to take my ack: Reviewed-by: Takashi Iwai thanks, Takashi > --- > sound/soc/intel/boards/skl_hda_dsp_common.c | 15 +++++++++++++++ > sound/soc/intel/boards/skl_hda_dsp_common.h | 1 + > sound/soc/intel/boards/skl_hda_dsp_generic.c | 12 ++++++++++++ > 3 files changed, 28 insertions(+) > > diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.c b/sound/soc/intel/boards/skl_hda_dsp_common.c > index 9b30c0e..01c8937 100644 > --- a/sound/soc/intel/boards/skl_hda_dsp_common.c > +++ b/sound/soc/intel/boards/skl_hda_dsp_common.c > @@ -17,6 +17,18 @@ > > #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; > + > + 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 +60,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, > .trigger[0] = SND_SOC_DPCM_TRIGGER_POST, > @@ -58,6 +71,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, > .trigger[0] = SND_SOC_DPCM_TRIGGER_POST, > @@ -68,6 +82,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, > .trigger[0] = SND_SOC_DPCM_TRIGGER_POST, > diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h > index 87c50af..df5cc6b 100644 > --- a/sound/soc/intel/boards/skl_hda_dsp_common.h > +++ b/sound/soc/intel/boards/skl_hda_dsp_common.h > @@ -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]; > diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c > index b9a21e6..ceca11e 100644 > --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c > +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c > @@ -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, > -- > 2.7.4 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel >