From patchwork Thu Apr 7 18:49:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12805610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D627C433EF for ; Thu, 7 Apr 2022 18:52:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 82C831883; Thu, 7 Apr 2022 20:51:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 82C831883 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649357537; bh=vlqXx0ieppmMKLD+I9u5Kx4ETGPRQ4q+RN6HUTu1DPk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jrc759B7bKgB/wRrUowfnx3mBg/vDOpDzdv4Hgr+dYhnDLunEcigxpQlsp6qPTPq1 Cwzlwl2r+6RPHOWsHEhokfTOCQ6+87B8JSsHLXZoB00C5MUoDQ0SJI0ihLq2CYCUOT 5502gV9BnVe5dN21hEzqTjZI3O1Xxn/QAEBrCRvo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9CB90F8051F; Thu, 7 Apr 2022 20:50:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26D09F80516; Thu, 7 Apr 2022 20:50:11 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 18FF1F8012A for ; Thu, 7 Apr 2022 20:50:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18FF1F8012A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C5ICFnyl" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C5AF561DD2; Thu, 7 Apr 2022 18:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5274C385B1; Thu, 7 Apr 2022 18:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649357402; bh=vlqXx0ieppmMKLD+I9u5Kx4ETGPRQ4q+RN6HUTu1DPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C5ICFnylGtemLREXeUOzU273I0WS0gdBX+8C/1aajTGFUoTgbsqQhOfHslQuzV7m0 HmlCgJoEI/GTlvLXa2xLJinN/FqwU321I/E1fh/UOj10Q6Io1+MHw+ezOvqusHgkUI 05HmVwKVhfwud5DdzEFRiTVKGrfrU6KpfSUK+Qn2iAY4S/6nxQ7UV2Vc95He4F6tY8 hr9MHatTZMVDHp0268ppdQQubE2y4wU9ePRqzTFpUC1NOvnMkx/ziNxUxsBIRMzVfx 0GGbId8w5TpiS8uVvCIOZhtqzjcrrEN2jXYu2ragPH2IV8486Xz8YFvpma3rCLbbWt CrlRjJ5wrAmhw== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1ncXCi-000Rut-9x; Thu, 07 Apr 2022 20:50:00 +0200 From: Mauro Carvalho Chehab To: alsa-devel@alsa-project.org Subject: [PATCH v5 3/4] ASoC: Intel: sof_es8336: add a quirk for headset at mic1 port Date: Thu, 7 Apr 2022 20:49:58 +0200 Message-Id: <5d88fc29b79be7ab77dae391c8e5ee929fd36c27.1649357263.git.mchehab@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Cc: Cezary Rojewski , Bard Liao , Takashi Iwai , Jie Yang , Pierre-Louis Bossart , Liam Girdwood , Hans de Goede , Mark Brown , Mauro Carvalho Chehab , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The headset/internal mic can either be routed as mic1/mic2 or vice-versa. By default, the driver assumes that the headset is mapped as mic2, but not all devices map this way. So, add a quirk to support changing it to mic1, using mic2 for the internal analog mic (if any). Signed-off-by: Mauro Carvalho Chehab --- See [PATCH v5 0/4] at: https://lore.kernel.org/all/cover.1649357263.git.mchehab@kernel.org/ sound/soc/intel/boards/sof_es8336.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c index d15a58666cc6..c71842be9d59 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -31,6 +31,7 @@ #define SOF_ES8336_ENABLE_DMIC BIT(5) #define SOF_ES8336_JD_INVERTED BIT(6) #define SOF_ES8336_HEADPHONE_GPIO BIT(7) +#define SOC_ES8336_HEADSET_MIC1 BIT(8) static unsigned long quirk; @@ -90,6 +91,8 @@ static void log_quirks(struct device *dev) dev_info(dev, "quirk headphone GPIO enabled\n"); if (quirk & SOF_ES8336_JD_INVERTED) dev_info(dev, "quirk JD inverted enabled\n"); + if (quirk & SOC_ES8336_HEADSET_MIC1) + dev_info(dev, "quirk headset at mic1 port enabled\n"); } static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w, @@ -147,11 +150,16 @@ static const struct snd_soc_dapm_route sof_es8316_audio_map[] = { {"Speaker", NULL, "Speaker Power"}, }; -static const struct snd_soc_dapm_route sof_es8316_intmic_in1_map[] = { +static const struct snd_soc_dapm_route sof_es8316_headset_mic2_map[] = { {"MIC1", NULL, "Internal Mic"}, {"MIC2", NULL, "Headset Mic"}, }; +static const struct snd_soc_dapm_route sof_es8316_headset_mic1_map[] = { + {"MIC2", NULL, "Internal Mic"}, + {"MIC1", NULL, "Headset Mic"}, +}; + static const struct snd_soc_dapm_route dmic_map[] = { /* digital mics */ {"DMic", NULL, "SoC DMIC"}, @@ -225,8 +233,13 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime) card->dapm.idle_bias_off = true; - custom_map = sof_es8316_intmic_in1_map; - num_routes = ARRAY_SIZE(sof_es8316_intmic_in1_map); + if (quirk & SOC_ES8336_HEADSET_MIC1) { + custom_map = sof_es8316_headset_mic1_map; + num_routes = ARRAY_SIZE(sof_es8316_headset_mic1_map); + } else { + custom_map = sof_es8316_headset_mic2_map; + num_routes = ARRAY_SIZE(sof_es8316_headset_mic2_map); + } ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes); if (ret)