alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Automatically disabling internal speakers when headphones are plugged in
@ 2011-01-20 19:17 Stephen Warren
  2011-01-20 20:39 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2011-01-20 19:17 UTC (permalink / raw)
  To: Mark Brown (broonie@opensource.wolfsonmicro.com),
	lrg@slimlogic.co.uk
  Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org

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:

omap/ams-delta.c
samsung/rx1950_uda1380.c
samsung/h1940_uda1380.c

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?

Thanks.

-- 
nvpublic

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Automatically disabling internal speakers when headphones are plugged in
  2011-01-20 19:17 Automatically disabling internal speakers when headphones are plugged in Stephen Warren
@ 2011-01-20 20:39 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-01-20 20:39 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org,
	lrg@slimlogic.co.uk

On Thu, Jan 20, 2011 at 11:17:08AM -0800, Stephen Warren wrote:

> 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?

You really should leave the headphone alone unless there's a reason the
two can't be simultaneously active (eg, being wired in parallel to the
same outputs or power constraints) but it won't break anything from an
ASoC point of view.  It will disable some use cases, though, the main
one being that it won't be possible to play notifications to headphones
and speaker simultaneously.  This is often used for notifications on
portable devices as the user may have inserted headphones during music
playback but removed them for some reason, rendering tones played only
through the headphones inaudible.

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

The jacks appear in userspace as input devices.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-20 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 19:17 Automatically disabling internal speakers when headphones are plugged in Stephen Warren
2011-01-20 20:39 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).