linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
@ 2020-01-02  0:28 Sam McNally
  2020-01-02 18:48 ` [alsa-devel] " Pierre-Louis Bossart
  0 siblings, 1 reply; 3+ messages in thread
From: Sam McNally @ 2020-01-02  0:28 UTC (permalink / raw)
  To: LKML
  Cc: Sam McNally, Jaroslav Kysela, Liam Girdwood, alsa-devel,
	Bard Liao, Sathya Prakash M R, Mark Brown, Cezary Rojewski,
	Kuninori Morimoto, Pierre-Louis Bossart, Takashi Iwai,
	Jairaj Arava, Xun Zhang, Jie Yang, Kai Vehmanen,
	Sathyanarayana Nujella

Some members of the Google_Hatch family include a rt5682, but not a
speaker amp. When a speaker amp is also present, it matches MX98357A
as well, resulting in the quirk_data field in the snd_soc_acpi_mach
being non-null. When only the rt5682 is present, quirk_data is left
null.

The sof_rt5682 driver's DMI data matching identifies that a speaker amp
is present for all Google_Hatch family devices. Detect cases where there
is no speaker amp by checking for a null quirk_data in the
snd_soc_acpi_mach and remove the speaker amp bit in that case.

Signed-off-by: Sam McNally <sammc@chromium.org>
---

 sound/soc/intel/boards/sof_rt5682.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index ad8a2b4bc709..8a13231dee15 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -603,6 +603,14 @@ static int sof_audio_probe(struct platform_device *pdev)
 
 	dmi_check_system(sof_rt5682_quirk_table);
 
+	mach = (&pdev->dev)->platform_data;
+
+	/* A speaker amp might not be present when the quirk claims one is.
+	 * Detect this via whether the machine driver match includes quirk_data.
+	 */
+	if ((sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data)
+		sof_rt5682_quirk &= ~SOF_SPEAKER_AMP_PRESENT;
+
 	if (soc_intel_is_byt() || soc_intel_is_cht()) {
 		is_legacy_cpu = 1;
 		dmic_be_num = 0;
@@ -663,7 +671,6 @@ static int sof_audio_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
 
 	sof_audio_card_rt5682.dev = &pdev->dev;
-	mach = (&pdev->dev)->platform_data;
 
 	/* set platform name for each dailink */
 	ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_rt5682,
-- 
2.24.1.735.g03f4e72817-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
  2020-01-02  0:28 [PATCH] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one Sam McNally
@ 2020-01-02 18:48 ` Pierre-Louis Bossart
  2020-01-03  0:20   ` Sam McNally
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre-Louis Bossart @ 2020-01-02 18:48 UTC (permalink / raw)
  To: Sam McNally, LKML
  Cc: Jaroslav Kysela, Liam Girdwood, alsa-devel, Bard Liao,
	Sathya Prakash M R, Mark Brown, Cezary Rojewski,
	Kuninori Morimoto, Takashi Iwai, Jairaj Arava, Xun Zhang,
	Jie Yang, Kai Vehmanen, Sathyanarayana Nujella



On 1/1/20 6:28 PM, Sam McNally wrote:
> Some members of the Google_Hatch family include a rt5682, but not a
> speaker amp. When a speaker amp is also present, it matches MX98357A
> as well, resulting in the quirk_data field in the snd_soc_acpi_mach
> being non-null. When only the rt5682 is present, quirk_data is left
> null.

Sorry, I don't get this last sentence.

There is a single entry for 10EC5682 in sound-acpi-intel-glk-match.c and 
quirk_data is assigned - thus can never be NULL.

I wonder if your Chrome kernel has an extra entry in 
snd_soc_acpi_intel_glk_machines[] ? What I am missing?

> 
> The sof_rt5682 driver's DMI data matching identifies that a speaker amp
> is present for all Google_Hatch family devices. Detect cases where there
> is no speaker amp by checking for a null quirk_data in the
> snd_soc_acpi_mach and remove the speaker amp bit in that case.
> 
> Signed-off-by: Sam McNally <sammc@chromium.org>
> ---
> 
>   sound/soc/intel/boards/sof_rt5682.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index ad8a2b4bc709..8a13231dee15 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -603,6 +603,14 @@ static int sof_audio_probe(struct platform_device *pdev)
>   
>   	dmi_check_system(sof_rt5682_quirk_table);
>   
> +	mach = (&pdev->dev)->platform_data;
> +
> +	/* A speaker amp might not be present when the quirk claims one is.
> +	 * Detect this via whether the machine driver match includes quirk_data.
> +	 */
> +	if ((sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data)
> +		sof_rt5682_quirk &= ~SOF_SPEAKER_AMP_PRESENT;
> +
>   	if (soc_intel_is_byt() || soc_intel_is_cht()) {
>   		is_legacy_cpu = 1;
>   		dmic_be_num = 0;
> @@ -663,7 +671,6 @@ static int sof_audio_probe(struct platform_device *pdev)
>   	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
>   
>   	sof_audio_card_rt5682.dev = &pdev->dev;
> -	mach = (&pdev->dev)->platform_data;
>   
>   	/* set platform name for each dailink */
>   	ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_rt5682,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
  2020-01-02 18:48 ` [alsa-devel] " Pierre-Louis Bossart
@ 2020-01-03  0:20   ` Sam McNally
  0 siblings, 0 replies; 3+ messages in thread
From: Sam McNally @ 2020-01-03  0:20 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: LKML, Jaroslav Kysela, Liam Girdwood, alsa-devel, Bard Liao,
	Sathya Prakash M R, Mark Brown, Cezary Rojewski,
	Kuninori Morimoto, Takashi Iwai, Jairaj Arava, Xun Zhang,
	Jie Yang, Kai Vehmanen, Sathyanarayana Nujella

On Fri, 3 Jan 2020 at 08:18, Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
>
>
> On 1/1/20 6:28 PM, Sam McNally wrote:
> > Some members of the Google_Hatch family include a rt5682, but not a
> > speaker amp. When a speaker amp is also present, it matches MX98357A
> > as well, resulting in the quirk_data field in the snd_soc_acpi_mach
> > being non-null. When only the rt5682 is present, quirk_data is left
> > null.
>
> Sorry, I don't get this last sentence.
>
> There is a single entry for 10EC5682 in sound-acpi-intel-glk-match.c and
> quirk_data is assigned - thus can never be NULL.
>
> I wonder if your Chrome kernel has an extra entry in
> snd_soc_acpi_intel_glk_machines[] ? What I am missing?
>

I was referring to the duplicate 10EC5682 entries in
snd_soc_acpi_intel_cml_machines[]. Sorry for the confusion. I'll send
a new version with those details in the description.

> >
> > The sof_rt5682 driver's DMI data matching identifies that a speaker amp
> > is present for all Google_Hatch family devices. Detect cases where there
> > is no speaker amp by checking for a null quirk_data in the
> > snd_soc_acpi_mach and remove the speaker amp bit in that case.
> >
> > Signed-off-by: Sam McNally <sammc@chromium.org>
> > ---
> >
> >   sound/soc/intel/boards/sof_rt5682.c | 9 ++++++++-
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> > index ad8a2b4bc709..8a13231dee15 100644
> > --- a/sound/soc/intel/boards/sof_rt5682.c
> > +++ b/sound/soc/intel/boards/sof_rt5682.c
> > @@ -603,6 +603,14 @@ static int sof_audio_probe(struct platform_device *pdev)
> >
> >       dmi_check_system(sof_rt5682_quirk_table);
> >
> > +     mach = (&pdev->dev)->platform_data;
> > +
> > +     /* A speaker amp might not be present when the quirk claims one is.
> > +      * Detect this via whether the machine driver match includes quirk_data.
> > +      */
> > +     if ((sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data)
> > +             sof_rt5682_quirk &= ~SOF_SPEAKER_AMP_PRESENT;
> > +
> >       if (soc_intel_is_byt() || soc_intel_is_cht()) {
> >               is_legacy_cpu = 1;
> >               dmic_be_num = 0;
> > @@ -663,7 +671,6 @@ static int sof_audio_probe(struct platform_device *pdev)
> >       INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
> >
> >       sof_audio_card_rt5682.dev = &pdev->dev;
> > -     mach = (&pdev->dev)->platform_data;
> >
> >       /* set platform name for each dailink */
> >       ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_rt5682,
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-03  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02  0:28 [PATCH] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one Sam McNally
2020-01-02 18:48 ` [alsa-devel] " Pierre-Louis Bossart
2020-01-03  0:20   ` Sam McNally

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).