2021-05-05 20:27:49

by Sasha Levin

[permalink] [raw]
Subject: [PATCH AUTOSEL 5.12 090/116] ASoC: rt286: Generalize support for ALC3263 codec

From: David Ward <[email protected]>

[ Upstream commit aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe ]

The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
and Venue 11 Pro 7140. They require the same handling for the combo jack to
work with a headset: GPIO pin 6 must be set.

The HDA driver always sets this pin on the ALC3263, which it distinguishes
by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
(Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
determine if Dell is the system vendor.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
sound/soc/codecs/rt286.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index 8abe232ca4a4..2f18f5114f7e 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -1117,12 +1117,11 @@ static const struct dmi_system_id force_combo_jack_table[] = {
{ }
};

-static const struct dmi_system_id dmi_dell_dino[] = {
+static const struct dmi_system_id dmi_dell[] = {
{
- .ident = "Dell Dino",
+ .ident = "Dell",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
- DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343")
}
},
{ }
@@ -1133,7 +1132,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
{
struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct rt286_priv *rt286;
- int i, ret, val;
+ int i, ret, vendor_id;

rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286),
GFP_KERNEL);
@@ -1149,14 +1148,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
}

ret = regmap_read(rt286->regmap,
- RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
+ RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &vendor_id);
if (ret != 0) {
dev_err(&i2c->dev, "I2C error %d\n", ret);
return ret;
}
- if (val != RT286_VENDOR_ID && val != RT288_VENDOR_ID) {
+ if (vendor_id != RT286_VENDOR_ID && vendor_id != RT288_VENDOR_ID) {
dev_err(&i2c->dev,
- "Device with ID register %#x is not rt286\n", val);
+ "Device with ID register %#x is not rt286\n",
+ vendor_id);
return -ENODEV;
}

@@ -1180,8 +1180,8 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
if (pdata)
rt286->pdata = *pdata;

- if (dmi_check_system(force_combo_jack_table) ||
- dmi_check_system(dmi_dell_dino))
+ if ((vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) ||
+ dmi_check_system(force_combo_jack_table))
rt286->pdata.cbj_en = true;

regmap_write(rt286->regmap, RT286_SET_AUDIO_POWER, AC_PWRST_D3);
@@ -1220,7 +1220,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL3, 0xf777, 0x4737);
regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f);

- if (dmi_check_system(dmi_dell_dino)) {
+ if (vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) {
regmap_update_bits(rt286->regmap,
RT286_SET_GPIO_MASK, 0x40, 0x40);
regmap_update_bits(rt286->regmap,
--
2.30.2


2021-05-07 06:37:28

by David Ward

[permalink] [raw]
Subject: Re: [PATCH AUTOSEL 5.12 090/116] ASoC: rt286: Generalize support for ALC3263 codec

On 5/5/21 12:30 PM, Sasha Levin wrote:
> From: David Ward <[email protected]>
>
> [ Upstream commit aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe ]
>
> The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
> and Venue 11 Pro 7140. They require the same handling for the combo jack to
> work with a headset: GPIO pin 6 must be set.
>
> The HDA driver always sets this pin on the ALC3263, which it distinguishes
> by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
> (Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
> determine if Dell is the system vendor.

For this patch to be useful, commit cd8499d5c03b ("ASoC: rt286: Make
RT286_SET_GPIO_* readable and writable") from the same series is needed
as well, which fixed the regmap config.

(The same comment is true for all stable branches.)

Thank you,

David

>
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
> Signed-off-by: David Ward <[email protected]>
> Reviewed-by: Pierre-Louis Bossart <[email protected]>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Mark Brown <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
> sound/soc/codecs/rt286.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
> index 8abe232ca4a4..2f18f5114f7e 100644
> --- a/sound/soc/codecs/rt286.c
> +++ b/sound/soc/codecs/rt286.c
> @@ -1117,12 +1117,11 @@ static const struct dmi_system_id force_combo_jack_table[] = {
> { }
> };
>
> -static const struct dmi_system_id dmi_dell_dino[] = {
> +static const struct dmi_system_id dmi_dell[] = {
> {
> - .ident = "Dell Dino",
> + .ident = "Dell",
> .matches = {
> DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
> - DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343")
> }
> },
> { }
> @@ -1133,7 +1132,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
> {
> struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev);
> struct rt286_priv *rt286;
> - int i, ret, val;
> + int i, ret, vendor_id;
>
> rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286),
> GFP_KERNEL);
> @@ -1149,14 +1148,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
> }
>
> ret = regmap_read(rt286->regmap,
> - RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
> + RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &vendor_id);
> if (ret != 0) {
> dev_err(&i2c->dev, "I2C error %d\n", ret);
> return ret;
> }
> - if (val != RT286_VENDOR_ID && val != RT288_VENDOR_ID) {
> + if (vendor_id != RT286_VENDOR_ID && vendor_id != RT288_VENDOR_ID) {
> dev_err(&i2c->dev,
> - "Device with ID register %#x is not rt286\n", val);
> + "Device with ID register %#x is not rt286\n",
> + vendor_id);
> return -ENODEV;
> }
>
> @@ -1180,8 +1180,8 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
> if (pdata)
> rt286->pdata = *pdata;
>
> - if (dmi_check_system(force_combo_jack_table) ||
> - dmi_check_system(dmi_dell_dino))
> + if ((vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) ||
> + dmi_check_system(force_combo_jack_table))
> rt286->pdata.cbj_en = true;
>
> regmap_write(rt286->regmap, RT286_SET_AUDIO_POWER, AC_PWRST_D3);
> @@ -1220,7 +1220,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
> regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL3, 0xf777, 0x4737);
> regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f);
>
> - if (dmi_check_system(dmi_dell_dino)) {
> + if (vendor_id == RT288_VENDOR_ID && dmi_check_system(dmi_dell)) {
> regmap_update_bits(rt286->regmap,
> RT286_SET_GPIO_MASK, 0x40, 0x40);
> regmap_update_bits(rt286->regmap,

2021-05-14 18:32:57

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH AUTOSEL 5.12 090/116] ASoC: rt286: Generalize support for ALC3263 codec

On Fri, May 07, 2021 at 12:34:29AM -0400, David Ward wrote:
>On 5/5/21 12:30 PM, Sasha Levin wrote:
>>From: David Ward <[email protected]>
>>
>>[ Upstream commit aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe ]
>>
>>The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
>>and Venue 11 Pro 7140. They require the same handling for the combo jack to
>>work with a headset: GPIO pin 6 must be set.
>>
>>The HDA driver always sets this pin on the ALC3263, which it distinguishes
>>by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
>>(Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
>>determine if Dell is the system vendor.
>
>For this patch to be useful, commit cd8499d5c03b ("ASoC: rt286: Make
>RT286_SET_GPIO_* readable and writable") from the same series is
>needed as well, which fixed the regmap config.
>
>(The same comment is true for all stable branches.)

I'll take it too, thanks!

--
Thanks,
Sasha