+static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
+{
- struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card);
- dev_dbg(priv->codec_dev, "speaker power event: %d\n", event);
- if (SND_SOC_DAPM_EVENT_ON(event))
acp3x_es83xx_set_gpios_values(priv, 1, 0);
- else
acp3x_es83xx_set_gpios_values(priv, 0, 1);
Why are these two GPIOs tied together like this?
These GPIOs represent the speaker and the headphone switches. When activating the speaker GPIO you have to deactivate the headphone GPIO and vice versa. The logic is taken from the discussion on the sofproject pull request: https://github.com/thesofproject/linux/pull/4112/commits/810d03e0aecdf0caf58... and https://github.com/thesofproject/linux/pull/4066
These threads didn't exactly lead to a firm conclusion on how the GPIOs should be used, IIRC there are cases where the levels are inverted and all kinds of issues still not clear at all even after reading the tables from ACPI _DSM methods.
I personally gave up, and I would recommend you take these threads as inputs rather than firm directions.