Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp43875pxh; Thu, 7 Apr 2022 13:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdhf6dSf8Oc7j+ff4lb2ARCtL4z/haI4hHi/F1PG7AiP+Fxn4ZKcGFmNBTfIkXwxWXdItN X-Received: by 2002:a05:6a00:338e:b0:505:6bbf:1600 with SMTP id cm14-20020a056a00338e00b005056bbf1600mr3566297pfb.80.1649363261000; Thu, 07 Apr 2022 13:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649363260; cv=none; d=google.com; s=arc-20160816; b=vCtluFQlULGfg0IG2W7K9ixocdR+AhgeJOJF5SSHA3iZxMPeTitxfqnJ9gSVKWR60Q 1I+O9slQKAqwDIbAnXD/r7lBhzgVkI1zETWPMTjXF3m3aFkgfL/AhG5VxtIs+d5f1ywg 2t0qRGpN1tIPDvOMV/ulSxem9tRmNFveo0CEguQxJflTYk3hQ8mXV/Nf34KlnYX4PfKX jwkDo6NHrCpiiy2Oltpec/ZnsJVwcSQ8UkxMI+yV3sopFW6cjE0VFP34yvtQt/8KYehn QQWPeNXCU8/PihQhwTkJ2zD8DGKRCx8ZpYSMkQbr/7pyfVRc1K7AolNAnkViMeIc7WrX mupA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MQrsC08dY3hf+sGSxFGlhssoNkjWsdZZlh/a5j30lGE=; b=cRwwStzfaZn2gifOYQP7FOlzwfVviDarv8OumlbXPmcsvvnyp42GWRsAny/F82nqKp 843hLBl6QmWkBoTFZ+L6B41/PPqhKSqX50qMHoeIBHBwFRK7MH1QDgWM7mohcLAFaxhJ djKGl/Zusvr0UBaHOCZeEEtADcrP3eT+bpwU8Y8lZ9r/LMwOulNElMGfYkwp95f3wlYL Mlbs840Gxl/KYxJuKnrM9ocLTjlM0NPj1Hi2avdDEf3AEZGbFFzISDoucMU18BqU6t5q +huYC5asKEkfHjFyb393lnIwaBFZnrJp5sLCRS4xlguysRwjxwjkvS4D3h7JsqU7XkuA DAfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C5ICFnyl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t1-20020a170902e84100b0015605a7d777si744061plg.294.2022.04.07.13.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:27:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C5ICFnyl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C71135C6D3; Thu, 7 Apr 2022 12:42:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346967AbiDGSwF (ORCPT + 99 others); Thu, 7 Apr 2022 14:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243434AbiDGSwE (ORCPT ); Thu, 7 Apr 2022 14:52:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE781066C6 for ; Thu, 7 Apr 2022 11:50:03 -0700 (PDT) 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 7339C61DCD for ; 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 Cc: Mauro Carvalho Chehab , "Hans de Goede" , "Pierre-Louis Bossart" , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Bard Liao , Cezary Rojewski , Jaroslav Kysela , Jie Yang , Liam Girdwood , Mark Brown , Takashi Iwai , linux-kernel@vger.kernel.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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.35.1