Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18070246ybl; Thu, 2 Jan 2020 17:52:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwTQJelprmnQ3gxAskAg2ucJ081mM6KyU1lzqvDWHYFwV44YrPJyGyS/cdm462GIhKO96cp X-Received: by 2002:a05:6830:1141:: with SMTP id x1mr21858858otq.120.1578016356958; Thu, 02 Jan 2020 17:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578016356; cv=none; d=google.com; s=arc-20160816; b=keOiPyWy1VSW9U1ulLW3UEouNiDEbiWCt8b+rZgRfCDvzQel8EuL+TYVheZDrqIWAm 2qBAS103XkJzVUYI5LiABaQxBaC2e1rgzfv+ms+VYmEiB/GopJFqxvD4BtRFd1Kebeus fhl6YJz+8JpuTMxkSop1akOlCsC/49MVL7ws5c9DozjWusxcQ7u0Wydas8TfvCwzsqeD DBsIfyNljunPTNlLRRSTwUpH9DF0qOXtKguv/8lSmVgWi+nXw9WT3EAGgLw8BU5F5tQp 11TdvtWwrdHYBizi7irBgNRzRTSw5bAIJy2jO0F0pSCoefyY8eM6ex/Ln5L02hClK+h+ Qu2Q== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=oFTLxb+41MiC6n43bMNpqAO7uKgmJzv0ZXWHejH9m18=; b=MNs61bMuFB+T3zIx/AY3RfmQwuKJ+zHIbMtGuPo/t8o5Sd2GO9XsD+hzguxs4jQP+f 5eO4qZnYIidfSJ/8QhGN/YSAVUAgC7gOSLzrOuEGu08/z36ldu7Z0F1Ff+tjL0NDm2ya ljNYT6O6piRH2EuTxnp2CgvfREBcDX3w2RztjcdcKbq5Yo1PXOIeB02mL6BngKSq9w7Y DRB+QM3ZXOzgfWaOK52pt/KRwss0Jypgu3AHmVZa7+p8zdxoj0363DPVuuQ8nMWgq9F5 R16c2b/h5KtRCJO+AtEsYr5Mz6hfwnh5X2lWx23/q5SYASgOlHFdkGNxVoNzAEsaMLN5 NxcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="YSfQMQ/7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w131si28297489oif.240.2020.01.02.17.52.25; Thu, 02 Jan 2020 17:52:36 -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; dkim=pass header.i=@chromium.org header.s=google header.b="YSfQMQ/7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbgACBud (ORCPT + 99 others); Thu, 2 Jan 2020 20:50:33 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43031 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgACBud (ORCPT ); Thu, 2 Jan 2020 20:50:33 -0500 Received: by mail-pg1-f195.google.com with SMTP id k197so22727978pga.10 for ; Thu, 02 Jan 2020 17:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oFTLxb+41MiC6n43bMNpqAO7uKgmJzv0ZXWHejH9m18=; b=YSfQMQ/7HsvcZuI9w3YxL0DB09qW6t/OjZDQNJZIen6innJmL4MxOUs4PgU+ocq129 n4fW7DsI5CDnlPI2L0nmRVwm08tq/uxZM91HkVK6qySZ5HpUljW07ZAoQsrDgveAhT0I Gt29Z9I9segAMg3662EoldgBLZxMqmtKXCk0s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oFTLxb+41MiC6n43bMNpqAO7uKgmJzv0ZXWHejH9m18=; b=Urkc9/AWmeMTSvt7TuC9B8T4xgPuQ4m7arnt0ZQkDgOS4vFvWUNKTv+WITh8gJZ1t8 n00at5f+cezGn/ZUFdsnv13oCFgABgeGqNG9QXObjcOuowLEMjU3ITrl71Y7gITFw7SU jcqhZwCYC2jZAJgF85xeb/tvVyqgRM0drp8O+aQLnN3Mi6CIH5gTKpKMHlOu+5ighOom rHAUGvKRE+52bD/rIJlHGkwspmFf+Jy/HRTFI7p7aTNWg+UHQ7v+1JPBn07kexGTWbXz DqGlev0VYqseGLoFyF3uChNxsPkJTx/YyyCCun5MYTW63XSE0ozSyZueU4z+hD0gVL4I 0U/w== X-Gm-Message-State: APjAAAWEl3q2qji3/ylZ2ludy6WmG2Fy2T2BZyoF2StnxzWjkbC4dogD l3eq67C0foU6j4diak1v3aVuggZ9anM= X-Received: by 2002:aa7:940e:: with SMTP id x14mr73933464pfo.42.1578016232045; Thu, 02 Jan 2020 17:50:32 -0800 (PST) Received: from localhost ([2401:fa00:9:15:c479:b58e:61d1:15d5]) by smtp.gmail.com with ESMTPSA id z4sm12377658pjn.29.2020.01.02.17.50.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jan 2020 17:50:31 -0800 (PST) From: Sam McNally To: LKML Cc: Sam McNally , Jaroslav Kysela , Liam Girdwood , alsa-devel@alsa-project.org, Bard Liao , Sathya Prakash M R , Mark Brown , Cezary Rojewski , Kuninori Morimoto , Pierre-Louis Bossart , Takashi Iwai , Xun Zhang , Jie Yang , Sathyanarayana Nujella Subject: [PATCH v3] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one. Date: Fri, 3 Jan 2020 12:50:19 +1100 Message-Id: <20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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, -- 2.24.1.735.g03f4e72817-goog