summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards/bytcr_rt5640.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-08-02 16:25:00 +0200
committerMark Brown <broonie@kernel.org>2021-08-02 15:47:46 +0100
commit79c1123bac3b878874a8d7163f2eab6a7448733b (patch)
treefb563c47388ed4438859897557759e17020dbf44 /sound/soc/intel/boards/bytcr_rt5640.c
parent044c76571277bb87dd3318e55c7ae46a0c27ab0f (diff)
downloadlinux-stable-79c1123bac3b878874a8d7163f2eab6a7448733b.tar.gz
linux-stable-79c1123bac3b878874a8d7163f2eab6a7448733b.tar.bz2
linux-stable-79c1123bac3b878874a8d7163f2eab6a7448733b.zip
ASoC: Intel: bytcr_rt5640: Add support for a second headset mic input
Some devices (HP Elitepad 1000 G2) have 2 headset jacks (1 on the dock, 2nd on the tablet itself). The 2nd headset mic input on these is connected to in1 (the internal mics on the HP Elitepad 1000 G2 use DMIC2). Add support for this through a new BYT_RT5640_HSMIC2_ON_IN1 quirk. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210802142501.991985-6-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/bytcr_rt5640.c')
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 54302a86f8df..f67bd6caec36 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -75,6 +75,7 @@ enum {
#define BYT_RT5640_NO_SPEAKERS BIT(24)
#define BYT_RT5640_LINEOUT BIT(25)
#define BYT_RT5640_LINEOUT_AS_HP2 BIT(26)
+#define BYT_RT5640_HSMIC2_ON_IN1 BIT(27)
#define BYTCR_INPUT_DEFAULTS \
(BYT_RT5640_IN3_MAP | \
@@ -127,6 +128,8 @@ static void log_quirks(struct device *dev)
dev_err(dev, "quirk map 0x%x is not supported, microphone input will not work\n", map);
break;
}
+ if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
+ dev_info(dev, "quirk HSMIC2_ON_IN1 enabled\n");
if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
BYT_RT5640_JDSRC(byt_rt5640_quirk));
@@ -1072,6 +1075,14 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
if (ret)
return ret;
+ if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1) {
+ ret = snd_soc_dapm_add_routes(&card->dapm,
+ byt_rt5640_intmic_in1_map,
+ ARRAY_SIZE(byt_rt5640_intmic_in1_map));
+ if (ret)
+ return ret;
+ }
+
if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
ret = snd_soc_dapm_add_routes(&card->dapm,
byt_rt5640_ssp2_aif2_map,
@@ -1347,6 +1358,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3", "none" };
__maybe_unused const char *spk_type;
const struct dmi_system_id *dmi_id;
+ const char *headset2_string = "";
const char *lineout_string = "";
struct byt_rt5640_private *priv;
struct snd_soc_acpi_mach *mach;
@@ -1517,10 +1529,13 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
lineout_string = " cfg-lineout:1";
}
+ if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
+ headset2_string = " cfg-hs2:in1";
+
snprintf(byt_rt5640_components, sizeof(byt_rt5640_components),
- "cfg-spk:%d cfg-mic:%s aif:%d%s", cfg_spk,
+ "cfg-spk:%d cfg-mic:%s aif:%d%s%s", cfg_spk,
map_name[BYT_RT5640_MAP(byt_rt5640_quirk)], aif,
- lineout_string);
+ lineout_string, headset2_string);
byt_rt5640_card.components = byt_rt5640_components;
#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name),