Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18095809ybl; Thu, 2 Jan 2020 18:24:51 -0800 (PST) X-Google-Smtp-Source: APXvYqyPGpyC+WndHsnNU1SzsU+URTL9yNfvV5SnWPerdhhTPqLxL4xe+SSu5Lqt3nlub5DiBg5x X-Received: by 2002:a05:6830:22e2:: with SMTP id t2mr97841226otc.129.1578018291272; Thu, 02 Jan 2020 18:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578018291; cv=none; d=google.com; s=arc-20160816; b=rqCxLhSvymEYR+m/DAyvTWAS+YcPQOylPMgHbI5zKsPY5VN42/r6wUktrdsR7cafoe 2xcrNHvWmAraasfh1XLxjVt53sMWPNaDe5Twp/B5fQcWwkOTv8gto32+KR4FGWP1Iev6 6l/4kDsWmj0nVNdCqdQOD+FjfG8RBHV3w2m3YtPXObSr5KPiSBHaAVoMAm2XW3HnQkmT FkL0Gm8BoWeKypekff1j4USpUUA0hEjGFiGsFjCW7nsY7TSmk1CUdzKWmdWRgnqGbdtW XngjUJcN8O+VXQhvb5FHnOzKaLEZo12U+oIgsznSaleE+dSRFMuBfFxnYWwnSO7MtyR7 jsOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=44afsi2h0AX2ChuPvdQmjyzqUfRi2gy0yM0Oh7YBMug=; b=NtEDndwl1u0gp4a4otvy8w67mUukEQY8cAtdYzhgcZV7LB9tRxC/ElkXRdmtFcjFOY KpRJ/FkE6YSUcd3cRbAAX24GUxEo9LjOeQSTS70qX1j9AaGVOau7khilzwTXYe9pKsgs 4Rp0CeW/QF2TQHRbnannIZg9BKLs24zUsSZsIVbUSHNWciA4ZLoMN1GoOuTRUq3x5arH HY2Z+xO6Xaz5yI1NT/eVOsOiicZCRthUp7WrMyVylegVcwu79av3rP7wuWyVrx8/n4fW uJ6ms0yuZ69YbQJ8FJZX7ayzR9kGDgv6L0pscCLj5aXVjLK4l9doHCtXFZGkOFbJyOC4 rkbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si30812127oti.93.2020.01.02.18.24.38; Thu, 02 Jan 2020 18:24:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbgACCX7 (ORCPT + 99 others); Thu, 2 Jan 2020 21:23:59 -0500 Received: from mga04.intel.com ([192.55.52.120]:52631 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726089AbgACCX7 (ORCPT ); Thu, 2 Jan 2020 21:23:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 18:23:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,389,1571727600"; d="scan'208";a="231982388" Received: from lavazque-mobl.amr.corp.intel.com (HELO [10.255.86.75]) ([10.255.86.75]) by orsmga002.jf.intel.com with ESMTP; 02 Jan 2020 18:23:56 -0800 Subject: Re: [PATCH v3] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one. To: Sam McNally , LKML Cc: Jaroslav Kysela , Liam Girdwood , alsa-devel@alsa-project.org, Bard Liao , Sathya Prakash M R , Mark Brown , Cezary Rojewski , Kuninori Morimoto , Takashi Iwai , Xun Zhang , Jie Yang , Sathyanarayana Nujella References: <20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid> From: Pierre-Louis Bossart Message-ID: Date: Thu, 2 Jan 2020 20:23:56 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/2/20 7:50 PM, Sam McNally wrote: > Some members of the Google_Hatch family include a rt5682 jack codec, but > no speaker amplifier. This uses the same driver (sof_rt5682) as a > combination of rt5682 jack codec and max98357a speaker amplifier. Within > the sof_rt5682 driver, these cases are not currently distinguishable, > relying on a DMI quirk to decide the configuration. This causes an > incorrect configuration when only the rt5682 is present on a > Google_Hatch device. > > For CML, the jack codec is used as the primary key when matching, > with a possible speaker amplifier described in quirk_data. The two cases > of interest are the second and third 10EC5682 entries in > snd_soc_acpi_intel_cml_machines[]. The second entry matches the > combination of rt5682 and max98357a, resulting in the quirk_data field > in the snd_soc_acpi_mach being non-null, pointing at > max98357a_spk_codecs, the snd_soc_acpi_codecs for the matched speaker > amplifier. The third entry matches just the rt5682, resulting in a null > quirk_data. > > The sof_rt5682 driver's DMI data matching identifies that a speaker > amplifier is present for all Google_Hatch family devices. Detect cases > where there is no speaker amplifier by checking for a null quirk_data in > the snd_soc_acpi_mach and remove the speaker amplifier bit in that case. > > Signed-off-by: Sam McNally thanks, this is a great explanation Acked-by: Pierre-Louis Bossart > --- > > Changes in v3: > - Rewrote commit message to refer to correct > snd_soc_acpi_intel_cml_machines[] entries and better describe the > change > > Changes in v2: > - Added details about the relevant ACPI matches to the description > > 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, >