* questions about asoc jack detection
@ 2011-04-20 6:52 Lu Guanqun
2011-04-20 9:31 ` Mark Brown
0 siblings, 1 reply; 7+ messages in thread
From: Lu Guanqun @ 2011-04-20 6:52 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel
Hi Mark,
I have a question wrt jack detection, suppose now I have internal
speaker enabled and then headphone is inserted. According to the current
jack code in asoc, the Headphone pin wil be enabled, but it does nothing
to Internal Speaker. There is still sound coming out from speaker.
The possible solution is to let the application make the policy to
switch the output source to Headphone, because the jack event can be
observed. If we decide to let the userspace application make the policy,
then why do we bother to enable the jack pin at the first place?
Hope I'm not missing something here. Could you provide some insights?
Thanks!
--
guanqun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 6:52 questions about asoc jack detection Lu Guanqun
@ 2011-04-20 9:31 ` Mark Brown
2011-04-20 14:06 ` Lu Guanqun
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-04-20 9:31 UTC (permalink / raw)
To: Lu Guanqun; +Cc: alsa-devel
On Wed, Apr 20, 2011 at 02:52:12PM +0800, Lu Guanqun wrote:
> I have a question wrt jack detection, suppose now I have internal
> speaker enabled and then headphone is inserted. According to the current
> jack code in asoc, the Headphone pin wil be enabled, but it does nothing
> to Internal Speaker. There is still sound coming out from speaker.
This is a policy question - depending on the use case the application
may wish to still play sound out of the speaker. One obvious example
here is ringtones on phones. If the user has been doing something like
listen to music on headphones but then takes the headphones off they'll
probably not hear anything that plays out of only the headphones so you
should play ringtones out of both outputs in order to ensure that they
are audible.
If you really want to you can add an invert to the hookup for a pin, but
it's not recommended unless there's some physical reason both can't be
enabled simultaneously.
> The possible solution is to let the application make the policy to
> switch the output source to Headphone, because the jack event can be
> observed. If we decide to let the userspace application make the policy,
> then why do we bother to enable the jack pin at the first place?
If we can detect the physical presence of the output transducer it's not
really a policy decision if it's worth enabling the audio path.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 9:31 ` Mark Brown
@ 2011-04-20 14:06 ` Lu Guanqun
2011-04-20 14:53 ` Mark Brown
0 siblings, 1 reply; 7+ messages in thread
From: Lu Guanqun @ 2011-04-20 14:06 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org
On Wed, Apr 20, 2011 at 05:31:02PM +0800, Mark Brown wrote:
> On Wed, Apr 20, 2011 at 02:52:12PM +0800, Lu Guanqun wrote:
>
> > I have a question wrt jack detection, suppose now I have internal
> > speaker enabled and then headphone is inserted. According to the current
> > jack code in asoc, the Headphone pin wil be enabled, but it does nothing
> > to Internal Speaker. There is still sound coming out from speaker.
>
> This is a policy question - depending on the use case the application
> may wish to still play sound out of the speaker. One obvious example
> here is ringtones on phones. If the user has been doing something like
> listen to music on headphones but then takes the headphones off they'll
> probably not hear anything that plays out of only the headphones so you
> should play ringtones out of both outputs in order to ensure that they
> are audible.
Yes, it's related to policy. But I see some inconsistencies in handling
this stuff. In this above example, you suggest we should play out of
both outputs. However in HDA code, the common way when headphone is
inserted is to mute the speaker and enable the headphone. Is there some
differences between the HDA code and the ASoC code? Or this is just due
to legacy code?
>
> If you really want to you can add an invert to the hookup for a pin, but
> it's not recommended unless there's some physical reason both can't be
> enabled simultaneously.
>
> > The possible solution is to let the application make the policy to
> > switch the output source to Headphone, because the jack event can be
> > observed. If we decide to let the userspace application make the policy,
> > then why do we bother to enable the jack pin at the first place?
>
> If we can detect the physical presence of the output transducer it's not
> really a policy decision if it's worth enabling the audio path.
--
guanqun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 14:06 ` Lu Guanqun
@ 2011-04-20 14:53 ` Mark Brown
2011-04-20 15:00 ` Lu Guanqun
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-04-20 14:53 UTC (permalink / raw)
To: Lu Guanqun; +Cc: alsa-devel@alsa-project.org
On Wed, Apr 20, 2011 at 10:06:15PM +0800, Lu Guanqun wrote:
> Yes, it's related to policy. But I see some inconsistencies in handling
> this stuff. In this above example, you suggest we should play out of
> both outputs. However in HDA code, the common way when headphone is
> inserted is to mute the speaker and enable the headphone. Is there some
> differences between the HDA code and the ASoC code? Or this is just due
> to legacy code?
HDA code does this differently. I'd argue that they've taken the wrong
implementation decision and that this should be a userspace issue but
the use cases for PCs are a bit more basic.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 14:53 ` Mark Brown
@ 2011-04-20 15:00 ` Lu Guanqun
2011-04-20 15:14 ` Tobin Davis
0 siblings, 1 reply; 7+ messages in thread
From: Lu Guanqun @ 2011-04-20 15:00 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org
On Wed, Apr 20, 2011 at 10:53:58PM +0800, Mark Brown wrote:
> On Wed, Apr 20, 2011 at 10:06:15PM +0800, Lu Guanqun wrote:
>
> > Yes, it's related to policy. But I see some inconsistencies in handling
> > this stuff. In this above example, you suggest we should play out of
> > both outputs. However in HDA code, the common way when headphone is
> > inserted is to mute the speaker and enable the headphone. Is there some
> > differences between the HDA code and the ASoC code? Or this is just due
> > to legacy code?
>
> HDA code does this differently. I'd argue that they've taken the wrong
> implementation decision and that this should be a userspace issue but
> the use cases for PCs are a bit more basic.
I agree with you that this kind of policy should be put into userspace
instead of hardcoding it in kernel.
Good to hear the points from you. Thanks!
--
guanqun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 15:00 ` Lu Guanqun
@ 2011-04-20 15:14 ` Tobin Davis
2011-04-21 0:29 ` Lu Guanqun
0 siblings, 1 reply; 7+ messages in thread
From: Tobin Davis @ 2011-04-20 15:14 UTC (permalink / raw)
To: Lu Guanqun; +Cc: alsa-devel@alsa-project.org, Mark Brown
On Wed, 2011-04-20 at 23:00 +0800, Lu Guanqun wrote:
> On Wed, Apr 20, 2011 at 10:53:58PM +0800, Mark Brown wrote:
> > On Wed, Apr 20, 2011 at 10:06:15PM +0800, Lu Guanqun wrote:
> >
> > > Yes, it's related to policy. But I see some inconsistencies in handling
> > > this stuff. In this above example, you suggest we should play out of
> > > both outputs. However in HDA code, the common way when headphone is
> > > inserted is to mute the speaker and enable the headphone. Is there some
> > > differences between the HDA code and the ASoC code? Or this is just due
> > > to legacy code?
> >
> > HDA code does this differently. I'd argue that they've taken the wrong
> > implementation decision and that this should be a userspace issue but
> > the use cases for PCs are a bit more basic.
>
> I agree with you that this kind of policy should be put into userspace
> instead of hardcoding it in kernel.
>
> Good to hear the points from you. Thanks!
>
IIRC, the HDA jack detection code is pretty much legacy. It has been
around longer than udev and other prior userspace hw detection systems.
That That doesn't mean it can't change.
--
Tobin Davis
The Angels want to wear my red shoes.
-- E. Costello
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: questions about asoc jack detection
2011-04-20 15:14 ` Tobin Davis
@ 2011-04-21 0:29 ` Lu Guanqun
0 siblings, 0 replies; 7+ messages in thread
From: Lu Guanqun @ 2011-04-21 0:29 UTC (permalink / raw)
To: Tobin Davis; +Cc: alsa-devel@alsa-project.org, Mark Brown
On Wed, Apr 20, 2011 at 11:14:44PM +0800, Tobin Davis wrote:
> On Wed, 2011-04-20 at 23:00 +0800, Lu Guanqun wrote:
> > On Wed, Apr 20, 2011 at 10:53:58PM +0800, Mark Brown wrote:
> > > On Wed, Apr 20, 2011 at 10:06:15PM +0800, Lu Guanqun wrote:
> > >
> > > > Yes, it's related to policy. But I see some inconsistencies in handling
> > > > this stuff. In this above example, you suggest we should play out of
> > > > both outputs. However in HDA code, the common way when headphone is
> > > > inserted is to mute the speaker and enable the headphone. Is there some
> > > > differences between the HDA code and the ASoC code? Or this is just due
> > > > to legacy code?
> > >
> > > HDA code does this differently. I'd argue that they've taken the wrong
> > > implementation decision and that this should be a userspace issue but
> > > the use cases for PCs are a bit more basic.
> >
> > I agree with you that this kind of policy should be put into userspace
> > instead of hardcoding it in kernel.
> >
> > Good to hear the points from you. Thanks!
> >
> IIRC, the HDA jack detection code is pretty much legacy. It has been
> around longer than udev and other prior userspace hw detection systems.
Thanks for your input.
>
> That That doesn't mean it can't change.
Do we afford the changes? I don't think so. Lots of things have to be
changed accordingly and if we fail to fix one stuff out of the whole
chain, the end users will scream and yell at us: "You broke my PC." :)
--
guanqun
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-21 0:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20 6:52 questions about asoc jack detection Lu Guanqun
2011-04-20 9:31 ` Mark Brown
2011-04-20 14:06 ` Lu Guanqun
2011-04-20 14:53 ` Mark Brown
2011-04-20 15:00 ` Lu Guanqun
2011-04-20 15:14 ` Tobin Davis
2011-04-21 0:29 ` Lu Guanqun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.