diff mbox

ALSA: hda - Fix a wrong busy check in alt PCM open

Message ID 1436340574-28256-1-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Commit d1f15e06b2af57228d11e33e06a172ff58f5bc1c
Headers show

Commit Message

Takashi Iwai July 8, 2015, 7:29 a.m. UTC
Currently, the alt PCM open callback returns -EBUSY when an
independent HP is turned off, supposing that it conflicts with the
main PCM.  However, obviously, this check is wrong when the
independent HP itself isn't enabled but the alt PCM was explicitly
created via alc_dac_nid by a codec driver.

Reported-and-tested-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Raymond Yau Aug. 2, 2015, 6:03 a.m. UTC | #1
>
> Currently, the alt PCM open callback returns -EBUSY when an
> independent HP is turned off, supposing that it conflicts with the
> main PCM.  However, obviously, this check is wrong when the
> independent HP itself isn't enabled but the alt PCM was explicitly
> created via alc_dac_nid by a codec driver.

The alt_pcm is created only when indep_hp == 1

When indep_hp_enable = 0, HP is reconnected to analog device stream , alt
analog device return ebusy

This look like bug in indep_hp_possible() which should return false when HP
and Line Out/Speaker share same DAC

There are exception even when HP and Line Out are assigned different DACs
(e.g. those 6 channels HDA codecs ad1986a and alc66x does not support
multistreaming)
Takashi Iwai Aug. 2, 2015, 7:12 a.m. UTC | #2
On Sun, 02 Aug 2015 08:03:25 +0200,
Raymond Yau wrote:
> 
> >
> > Currently, the alt PCM open callback returns -EBUSY when an
> > independent HP is turned off, supposing that it conflicts with the
> > main PCM.  However, obviously, this check is wrong when the
> > independent HP itself isn't enabled but the alt PCM was explicitly
> > created via alc_dac_nid by a codec driver.
> 
> The alt_pcm is created only when indep_hp == 1
> 
> When indep_hp_enable = 0, HP is reconnected to analog device stream , alt
> analog device return ebusy
> 
> This look like bug in indep_hp_possible() which should return false when HP
> and Line Out/Speaker share same DAC

The problem happens in a very special case where the codec driver
enables the alt PCM manually in a fixup.  It doesn't exist in the
current code, so this is no real problem, but just a hypothetical
issue.


Takashi
Raymond Yau Aug. 3, 2015, 2:07 a.m. UTC | #3
> >
> > >
> > > Currently, the alt PCM open callback returns -EBUSY when an
> > > independent HP is turned off, supposing that it conflicts with the
> > > main PCM.  However, obviously, this check is wrong when the
> > > independent HP itself isn't enabled but the alt PCM was explicitly
> > > created via alc_dac_nid by a codec driver.
> >
> > The alt_pcm is created only when indep_hp == 1
> >
> > When indep_hp_enable = 0, HP is reconnected to analog device stream , alt
> > analog device return ebusy
> >
> > This look like bug in indep_hp_possible() which should return false when
> HP
> > and Line Out/Speaker share same DAC
>
> The problem happens in a very special case where the codec driver
> enables the alt PCM manually in a fixup.  It doesn't exist in the
> current code, so this is no real problem, but just a hypothetical
> issue.
>
>
http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/alc662-intel-d945gclf2?id=HEAD

This Intel Desktop motherboard is not in the support list of multistreaming

http://www.intel.com/support/motherboards/desktop/sb/CS-034206.htm

However , user can still enable Independent HP by using hint

multi_io = 0
indep_hp = 1

This mean that function indep_hp_possible() should return false for those
hda codecs which does not support multistreaming (e.g. ad1986a and alc66x)


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=55a63d4da3b8850480a1c5b222f77c739e30e346

+ /* clear indep_hp flag if not available */
+ if (spec->indep_hp && !indep_hp_possible(codec))
+ spec->indep_hp = 0;
diff mbox

Patch

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index ac0db1679f09..b077bb644434 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -5175,7 +5175,7 @@  static int alt_playback_pcm_open(struct hda_pcm_stream *hinfo,
 	int err = 0;
 
 	mutex_lock(&spec->pcm_mutex);
-	if (!spec->indep_hp_enabled)
+	if (spec->indep_hp && !spec->indep_hp_enabled)
 		err = -EBUSY;
 	else
 		spec->active_streams |= 1 << STREAM_INDEP_HP;