[alsa-devel] Automatically disabling internal speakers when headphones are plugged in

Stephen Warren swarren at nvidia.com
Thu Jan 20 20:17:08 CET 2011

I'm working on jack plug detect for Tegra Harmony, and have a question about
automatically disabling speakers when a headphone jack is plugged in.

For test purposes, I implemented this as follows:

static struct snd_soc_jack_pin harmony_hp_jack_pins[] = {
	    .pin = "Headphone Jack",
	    .mask = SND_JACK_HEADPHONE,
	    .pin = "Int Spk",
	    .mask = SND_JACK_HEADPHONE,
	    .invert = 1,

... following the example of:


However, I wonder if that's the correct approach; should the plug detect
logic only control the headphone output (i.e. only include the first array
entry in jack_pins[] above), and leave it up to user-space whether to
disable the speaker in this case, using a custom Speaker Function control
created by the machine driver, as I see many other drivers expose?

Do the jack reports make it up to user-space so that could be implemented?



More information about the Alsa-devel mailing list