diff mbox series

ASoC: intel/skl/hda - fix probe regression on systems without i915

Message ID 20200714132804.3638221-1-kai.vehmanen@linux.intel.com (mailing list archive)
State Accepted
Commit ffc6d45d96f07a32700cb6b7be2d3459e63c255a
Headers show
Series ASoC: intel/skl/hda - fix probe regression on systems without i915 | expand

Commit Message

Kai Vehmanen July 14, 2020, 1:28 p.m. UTC
Starting in commit cbc7a6b5a87a ("ASoC: soc-card: add
snd_soc_card_add_dai_link()"), error value from ASoc add_dai_link() is
no longer ignored.

The generic HDA machine driver relied on the old semantics to disable
i915 HDMI/DP audio codec at runtime. If no display codec was present,
add_dai_link() returned an error, but this was ignored and rest of the
card was successfully probed.

Fix the problem by changing the machine driver add_dai_link() to not
return an error in this case.

Fixes: cbc7a6b5a87a ("ASoC: soc-card: add snd_soc_card_add_dai_link()")
BugLink: https://github.com/thesofproject/linux/issues/2261
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
---

Notes:
    base broonie/for-5.8 at commit 12eb3ad0638c ("ASoC: rt286: fix unexpected interrupt happens")

 sound/soc/intel/boards/skl_hda_dsp_common.h  |  1 +
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

Comments

Mark Brown July 22, 2020, 1:44 p.m. UTC | #1
On Tue, 14 Jul 2020 16:28:04 +0300, Kai Vehmanen wrote:
> Starting in commit cbc7a6b5a87a ("ASoC: soc-card: add
> snd_soc_card_add_dai_link()"), error value from ASoc add_dai_link() is
> no longer ignored.
> 
> The generic HDA machine driver relied on the old semantics to disable
> i915 HDMI/DP audio codec at runtime. If no display codec was present,
> add_dai_link() returned an error, but this was ignored and rest of the
> card was successfully probed.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: intel/skl/hda - fix probe regression on systems without i915
      commit: ffc6d45d96f07a32700cb6b7be2d3459e63c255a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Kai Vehmanen Aug. 27, 2020, 7:14 a.m. UTC | #2
Hi,

+stable

On Wed, 22 Jul 2020, Mark Brown wrote:
> Applied to
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
[...]
> 
> [1/1] ASoC: intel/skl/hda - fix probe regression on systems without i915
>       commit: ffc6d45d96f07a32700cb6b7be2d3459e63c255a

please apply this to stable kernels as well. Without the patch, audio is 
broken with 5.8.x on many laptops (with Intel audio and non-Intel 
graphics). One more recent bug filed:
https://github.com/thesofproject/sof/issues/3345

This does _not_ affect 5.7.x and older, plus already fixed in 5.9-rc.

Br, Kai
Sasha Levin Aug. 27, 2020, 2:49 p.m. UTC | #3
On Thu, Aug 27, 2020 at 10:14:18AM +0300, Kai Vehmanen wrote:
>Hi,
>
>+stable
>
>On Wed, 22 Jul 2020, Mark Brown wrote:
>> Applied to
>>
>>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
>[...]
>>
>> [1/1] ASoC: intel/skl/hda - fix probe regression on systems without i915
>>       commit: ffc6d45d96f07a32700cb6b7be2d3459e63c255a
>
>please apply this to stable kernels as well. Without the patch, audio is
>broken with 5.8.x on many laptops (with Intel audio and non-Intel
>graphics). One more recent bug filed:
>https://github.com/thesofproject/sof/issues/3345
>
>This does _not_ affect 5.7.x and older, plus already fixed in 5.9-rc.

Applied to 5.8, thanks!
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h
index 507750ef67f3..4b0b3959182e 100644
--- a/sound/soc/intel/boards/skl_hda_dsp_common.h
+++ b/sound/soc/intel/boards/skl_hda_dsp_common.h
@@ -33,6 +33,7 @@  struct skl_hda_private {
 	int dai_index;
 	const char *platform_name;
 	bool common_hdmi_codec_drv;
+	bool idisp_codec;
 };
 
 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 79c8947f840b..ca4900036ead 100644
--- a/sound/soc/intel/boards/skl_hda_dsp_generic.c
+++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c
@@ -79,6 +79,9 @@  skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
 	link->platforms->name = ctx->platform_name;
 	link->nonatomic = 1;
 
+	if (!ctx->idisp_codec)
+		return 0;
+
 	if (strstr(link->name, "HDMI")) {
 		ret = skl_hda_hdmi_add_pcm(card, ctx->pcm_count);
 
@@ -118,19 +121,20 @@  static char hda_soc_components[30];
 static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
 {
 	struct snd_soc_card *card = &hda_soc_card;
+	struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
 	struct snd_soc_dai_link *dai_link;
-	u32 codec_count, codec_mask, idisp_mask;
+	u32 codec_count, codec_mask;
 	int i, num_links, num_route;
 
 	codec_mask = mach_params->codec_mask;
 	codec_count = hweight_long(codec_mask);
-	idisp_mask = codec_mask & IDISP_CODEC_MASK;
+	ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);
 
 	if (!codec_count || codec_count > 2 ||
-	    (codec_count == 2 && !idisp_mask))
+	    (codec_count == 2 && !ctx->idisp_codec))
 		return -EINVAL;
 
-	if (codec_mask == idisp_mask) {
+	if (codec_mask == IDISP_CODEC_MASK) {
 		/* topology with iDisp as the only HDA codec */
 		num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT;
 		num_route = IDISP_ROUTE_COUNT;
@@ -152,7 +156,7 @@  static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
 		num_route = ARRAY_SIZE(skl_hda_map);
 		card->dapm_widgets = skl_hda_widgets;
 		card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
-		if (!idisp_mask) {
+		if (!ctx->idisp_codec) {
 			for (i = 0; i < IDISP_DAI_COUNT; i++) {
 				skl_hda_be_dai_links[i].codecs = dummy_codec;
 				skl_hda_be_dai_links[i].num_codecs =
@@ -211,6 +215,8 @@  static int skl_hda_audio_probe(struct platform_device *pdev)
 	if (!mach)
 		return -EINVAL;
 
+	snd_soc_card_set_drvdata(&hda_soc_card, ctx);
+
 	ret = skl_hda_fill_card_info(&mach->mach_params);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n");
@@ -223,7 +229,6 @@  static int skl_hda_audio_probe(struct platform_device *pdev)
 	ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv;
 
 	hda_soc_card.dev = &pdev->dev;
-	snd_soc_card_set_drvdata(&hda_soc_card, ctx);
 
 	if (mach->mach_params.dmic_num > 0) {
 		snprintf(hda_soc_components, sizeof(hda_soc_components),