Skip to content

Commit

Permalink
ASoC: rt5645: The ALC3270 variant does not have a headset-mic pin
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans de Goede authored and Mark Brown committed Mar 10, 2021
1 parent 452801c commit 3f004d2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions sound/soc/codecs/rt5645.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3f004d2

Please sign in to comment.