mirror of https://gitee.com/openkylin/linux.git
ASoC: rt5645: The ALC3270 variant does not have a headset-mic pin
The Asus T100HA and T101HA 2-in-1s use a rt5645 family codec and always report that a headset (rather then headphones) are plugged in even when regular headphones are plugged in. And when a headset is used, then the headset-microphone does not work. According to RealTek the ALC3270 variant used in these devices does not support headsets only headphones. Since the ALC3270 is a budget version of the regular ALC5645 codec, I assume that it is using a package with less pins and the headset-mic pin is simply not connected. Detect if the codec is an ALC3270 based on the ACPI HID and if it is an ALC3270 then always report SND_JACK_MICROPHONE as false, so that userspace will not try to use the not-connected headset-mic. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210306230223.516566-2-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
452801cabc
commit
3f004d2dc1
|
@ -430,6 +430,9 @@ struct rt5645_platform_data {
|
|||
|
||||
/* Value to assign to snd_soc_card.long_name */
|
||||
const char *long_name;
|
||||
|
||||
/* Some (package) variants have the headset-mic pin not-connected */
|
||||
bool no_headset_mic;
|
||||
};
|
||||
|
||||
struct rt5645_priv {
|
||||
|
@ -3180,7 +3183,7 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inse
|
|||
val &= 0x7;
|
||||
dev_dbg(component->dev, "val = %d\n", val);
|
||||
|
||||
if (val == 1 || val == 2) {
|
||||
if ((val == 1 || val == 2) && !rt5645->pdata.no_headset_mic) {
|
||||
rt5645->jack_type = SND_JACK_HEADSET;
|
||||
if (rt5645->en_button_func) {
|
||||
rt5645_enable_push_button_irq(component, true);
|
||||
|
@ -3893,9 +3896,16 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
|
|||
rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk);
|
||||
}
|
||||
|
||||
if (cht_rt5645_gpios && has_acpi_companion(&i2c->dev))
|
||||
if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios))
|
||||
dev_dbg(&i2c->dev, "Failed to add driver gpios\n");
|
||||
if (has_acpi_companion(&i2c->dev)) {
|
||||
if (cht_rt5645_gpios) {
|
||||
if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios))
|
||||
dev_dbg(&i2c->dev, "Failed to add driver gpios\n");
|
||||
}
|
||||
|
||||
/* The ALC3270 package has the headset-mic pin not-connected */
|
||||
if (acpi_dev_hid_uid_match(ACPI_COMPANION(&i2c->dev), "10EC3270", NULL))
|
||||
rt5645->pdata.no_headset_mic = true;
|
||||
}
|
||||
|
||||
rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
|
||||
GPIOD_IN);
|
||||
|
|
Loading…
Reference in New Issue