Takashi Iwai f8da02
From aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe Mon Sep 17 00:00:00 2001
Takashi Iwai f8da02
From: David Ward <david.ward@gatech.edu>
Takashi Iwai f8da02
Date: Sun, 18 Apr 2021 09:46:58 -0400
Takashi Iwai f8da02
Subject: [PATCH] ASoC: rt286: Generalize support for ALC3263 codec
Takashi Iwai f8da02
Git-commit: aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe
Takashi Iwai f8da02
Patch-mainline: v5.13-rc1
Takashi Iwai f8da02
References: git-fixes
Takashi Iwai f8da02
Takashi Iwai f8da02
The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
Takashi Iwai f8da02
and Venue 11 Pro 7140. They require the same handling for the combo jack to
Takashi Iwai f8da02
work with a headset: GPIO pin 6 must be set.
Takashi Iwai f8da02
Takashi Iwai f8da02
The HDA driver always sets this pin on the ALC3263, which it distinguishes
Takashi Iwai f8da02
by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
Takashi Iwai f8da02
(Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
Takashi Iwai f8da02
determine if Dell is the system vendor.
Takashi Iwai f8da02
Takashi Iwai f8da02
Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
Takashi Iwai f8da02
Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Takashi Iwai f8da02
Signed-off-by: David Ward <david.ward@gatech.edu>
Takashi Iwai f8da02
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Takashi Iwai f8da02
Link: https://lore.kernel.org/r/20210418134658.4333-6-david.ward@gatech.edu
Takashi Iwai f8da02
Signed-off-by: Mark Brown <broonie@kernel.org>
Takashi Iwai f8da02
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai f8da02
Takashi Iwai f8da02
---
Takashi Iwai f8da02
 sound/soc/codecs/rt286.c | 20 ++++++++++----------
Takashi Iwai f8da02
 1 file changed, 10 insertions(+), 10 deletions(-)
Takashi Iwai f8da02
Takashi Iwai f8da02
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
Takashi Iwai f8da02
index 45e4a48ef5bf..802f4851c3df 100644
Takashi Iwai f8da02
--- a/sound/soc/codecs/rt286.c
Takashi Iwai f8da02
+++ b/sound/soc/codecs/rt286.c
Takashi Iwai f8da02
@@ -1125,12 +1125,11 @@ static const struct dmi_system_id force_combo_jack_table[] = {
Takashi Iwai f8da02
 	{ }
Takashi Iwai f8da02
 };
Takashi Iwai f8da02
 
Takashi Iwai f8da02
-static const struct dmi_system_id dmi_dell_dino[] = {
Takashi Iwai f8da02
+static const struct dmi_system_id dmi_dell[] = {
Takashi Iwai f8da02
 	{
Takashi Iwai f8da02
-		.ident = "Dell Dino",
Takashi Iwai f8da02
+		.ident = "Dell",
Takashi Iwai f8da02
 		.matches = {
Takashi Iwai f8da02
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
Takashi Iwai f8da02
-			DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343")
Takashi Iwai f8da02
 		}
Takashi Iwai f8da02
 	},
Takashi Iwai f8da02
 	{ }
Takashi Iwai f8da02
@@ -1141,7 +1140,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
Takashi Iwai f8da02
 {
Takashi Iwai f8da02
 	struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev);
Takashi Iwai f8da02
 	struct rt286_priv *rt286;
Takashi Iwai f8da02
-	int i, ret, val;
Takashi Iwai f8da02
+	int i, ret, vendor_id;
Takashi Iwai f8da02
 
Takashi Iwai f8da02
 	rt286 = devm_kzalloc(&i2c->dev,	sizeof(*rt286),
Takashi Iwai f8da02
 				GFP_KERNEL);
Takashi Iwai f8da02
@@ -1157,14 +1156,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
Takashi Iwai f8da02
 	}
Takashi Iwai f8da02
 
Takashi Iwai f8da02
 	ret = regmap_read(rt286->regmap,
Takashi Iwai f8da02
-		RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val;;
Takashi Iwai f8da02
+		RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &vendor_id);
Takashi Iwai f8da02
 	if (ret != 0) {
Takashi Iwai f8da02
 		dev_err(&i2c->dev, "I2C error %d\n", ret);
Takashi Iwai f8da02
 		return ret;
Takashi Iwai f8da02
 	}
Takashi Iwai f8da02
-	if (val != RT286_VENDOR_ID && val != RT288_VENDOR_ID) {
Takashi Iwai f8da02
+	if (vendor_id != RT286_VENDOR_ID && vendor_id != RT288_VENDOR_ID) {
Takashi Iwai f8da02
 		dev_err(&i2c->dev,
Takashi Iwai f8da02
-			"Device with ID register %#x is not rt286\n", val);
Takashi Iwai f8da02
+			"Device with ID register %#x is not rt286\n",
Takashi Iwai f8da02
+			vendor_id);
Takashi Iwai f8da02
 		return -ENODEV;
Takashi Iwai f8da02
 	}
Takashi Iwai f8da02
 
Takashi Iwai f8da02
@@ -1188,8 +1188,8 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
Takashi Iwai f8da02
 	if (pdata)
Takashi Iwai f8da02
 		rt286->pdata = *pdata;
Takashi Iwai f8da02
 
Takashi Iwai f8da02
-	if (dmi_check_system(force_combo_jack_table) ||
Takashi Iwai f8da02
-		dmi_check_system(dmi_dell_dino))
Takashi Iwai f8da02
+	if ((vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) ||
Takashi Iwai f8da02
+		dmi_check_system(force_combo_jack_table))
Takashi Iwai f8da02
 		rt286->pdata.cbj_en = true;
Takashi Iwai f8da02
 
Takashi Iwai f8da02
 	regmap_write(rt286->regmap, RT286_SET_AUDIO_POWER, AC_PWRST_D3);
Takashi Iwai f8da02
@@ -1228,7 +1228,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
Takashi Iwai f8da02
 	regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL3, 0xf777, 0x4737);
Takashi Iwai f8da02
 	regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f);
Takashi Iwai f8da02
 
Takashi Iwai f8da02
-	if (dmi_check_system(dmi_dell_dino)) {
Takashi Iwai f8da02
+	if (vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) {
Takashi Iwai f8da02
 		regmap_update_bits(rt286->regmap,
Takashi Iwai f8da02
 			RT286_SET_GPIO_MASK, 0x40, 0x40);
Takashi Iwai f8da02
 		regmap_update_bits(rt286->regmap,
Takashi Iwai f8da02
-- 
Takashi Iwai f8da02
2.26.2
Takashi Iwai f8da02