Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1590627ybv; Thu, 20 Feb 2020 23:52:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzd58SqXtV06ASEsvjLbNYeXqPyKlCALb4rUcqEX8OCqwakhCqQGmx8aHhMwLxnKsr0itum X-Received: by 2002:aca:cdd0:: with SMTP id d199mr920621oig.49.1582271563996; Thu, 20 Feb 2020 23:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582271563; cv=none; d=google.com; s=arc-20160816; b=iU8Twy/t/tm5d1kLszXHxOXuO3eGq8gOjpprfcYVQRRb0CrNVu9kWerLUAap9tf3Z7 uVUewm/glkyvI3gzcEVbdWF4bH0gxQGDDZCA4l3o10ttgsRRXImdCnlvVu5EkQ8ifQHa s3fDZQidgoKYNerE2n9+RGAYqXTfZZM8ZIeKOUmx2xxWoNZxwcTKe3DlFPxLj32eArR8 mSFUReRN7haxGxtlPBgMgymsqIzcCYuy1b1mrEUgwJ0f2LgIdyO4ukZeuNQEABPnL7/j WLWQxjP6EZydmC4KBrjjVcb/Ne83kpIAAg8r2ehbj7GbBpHyRl+dyhNdfy4Vp/aw6nyI tpSQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MdoSHqWC7PxkwKfn38O+jDozLJvUPbDdrh/1DgfDPuw=; b=Fr7rgeYx738irdscGWoJ3KPx5QpbF3zV4rXGLW3hxrX9X0qmXY/XHFKsZqjNGHyg7N 7mcjuQ1EVvP9cXQFpr60CqVkme90Gukjk8GSq0GzYKXM8W55MBPmJcxQ1s4GJ85DwTX4 L554GBDuzUVdCgVhejuvA8mZO4OhsEge4N/tt9HFCRejOkOaSQwfEedkMW2CVR4fQW/L Z845+/op6YoLjfwWzZQN4RDyZ33z/X/0XKEBsplwPPE/GalcpzpQmmCieKYzNnHCRjVt /laHtaA0xoLJeLH6mwg43kMeffjpdpiLbg7KyD11NsDFZrpaj+Q2qZLbAKHw4dVxlkAR 8F0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s10bYFfs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h22si364982oie.189.2020.02.20.23.52.32; Thu, 20 Feb 2020 23:52:43 -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=@kernel.org header.s=default header.b=s10bYFfs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729912AbgBUHwa (ORCPT + 99 others); Fri, 21 Feb 2020 02:52:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:50352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729755AbgBUHw3 (ORCPT ); Fri, 21 Feb 2020 02:52:29 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14B432073A; Fri, 21 Feb 2020 07:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271548; bh=yU3/HvfUjHjQ53JRdVWT8WNLGIo0vYw31AjxgZcgicY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s10bYFfsILumYawezrFzGUiIbAPtQS9eWSRhixntcenmWt9bwYSE5NforiwfJmG6l O3ELP0zoy91wEnJsYIodEBsBdwfhpK5lYGTf8104sM6/VdQcHiMsjVZKj+g4HWLx4i 8fpJw4e9Sb//MKIr3E3sGrbPJ3ScQhL5E+8lsz3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam McNally , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.5 209/399] ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isnt one. Date: Fri, 21 Feb 2020 08:38:54 +0100 Message-Id: <20200221072423.264139200@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sam McNally [ Upstream commit d4b74e218a8d0d6cf58e546627ab9d4d4f2645ab ] 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 Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 ad8a2b4bc7092..8a13231dee15d 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.20.1