ASoC: Intel: bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using it
authorHans de Goede <hdegoede@redhat.com>
Sun, 4 Mar 2018 14:36:06 +0000 (15:36 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 7 Mar 2018 14:19:00 +0000 (14:19 +0000)
Add a new IN2_HS_IN3 input map and add a quirk for the input mapping and
jack-detect source for the Chuwi Vi8 Plus tablet, which uses this new map.

Note the Chuwi Vi8 Plus lists an extra GPIO in its codecs ACPI resources
which needs to be driven high to enable the external speaker amplifier,
this is not supported yet and will be fixed in a future patch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bytcr_rt5651.c

index 7d5764d23c5190a88f786f327eb57abdb7853101..b798ebb18bf1c836bd6ace1529d094e2056d6037 100644 (file)
@@ -42,6 +42,7 @@ enum {
        BYT_RT5651_IN2_MAP,
        BYT_RT5651_IN1_IN2_MAP,
        BYT_RT5651_IN1_HS_IN3_MAP,
+       BYT_RT5651_IN2_HS_IN3_MAP,
 };
 
 enum {
@@ -93,6 +94,8 @@ static void log_quirks(struct device *dev)
                dev_info(dev, "quirk IN2_MAP enabled");
        if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
                dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
+       if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_HS_IN3_MAP)
+               dev_info(dev, "quirk IN2_HS_IN3_MAP enabled");
        if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
                dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
                         BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -258,6 +261,12 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_hs_in3_map[] = {
        {"IN3P", NULL, "Headset Mic"},
 };
 
+static const struct snd_soc_dapm_route byt_rt5651_intmic_in2_hs_in3_map[] = {
+       {"Internal Mic", NULL, "micbias1"},
+       {"IN2P", NULL, "Internal Mic"},
+       {"IN3P", NULL, "Headset Mic"},
+};
+
 static const struct snd_kcontrol_new byt_rt5651_controls[] = {
        SOC_DAPM_PIN_SWITCH("Headphone"),
        SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -323,6 +332,19 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
                                        BYT_RT5651_OVCD_SF_0P75 |
                                        BYT_RT5651_IN1_IN2_MAP),
        },
+       {
+               /* Chuwi Vi8 Plus (CWI519) */
+               .callback = byt_rt5651_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
+               },
+               .driver_data = (void *)(BYT_RT5651_MCLK_EN |
+                                       BYT_RT5651_JD1_1 |
+                                       BYT_RT5651_OVCD_TH_2000UA |
+                                       BYT_RT5651_OVCD_SF_0P75 |
+                                       BYT_RT5651_IN2_HS_IN3_MAP),
+       },
        {}
 };
 
@@ -386,6 +408,10 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
                custom_map = byt_rt5651_intmic_in1_hs_in3_map;
                num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_hs_in3_map);
                break;
+       case BYT_RT5651_IN2_HS_IN3_MAP:
+               custom_map = byt_rt5651_intmic_in2_hs_in3_map;
+               num_routes = ARRAY_SIZE(byt_rt5651_intmic_in2_hs_in3_map);
+               break;
        default:
                custom_map = byt_rt5651_intmic_dmic_map;
                num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);