Skip to contentSkip to conversation

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

PATCH In review Takashi Iwai 2 participants 4 messages Jul 8, 2015 – Aug 3, 2015 Sound

lore
Share & tools
lore
#0 lore raw

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

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.

---
 sound/pci/hda/hda_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_generic.c +1 -1
index ac0db1679f09..b077bb644434 100644
@@ -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;
Signature · 1 line
2.4.5
#1 lore raw
Quoted 6 lines

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)

#2 lore raw
Quoted 8 lines · Raymond Yau
Quoted 7 lines

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.

Quoted 7 lines

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

#3 lore raw
Quoted 13 lines
Quoted 13 lines
Quoted 7 lines

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

Quoted 10 lines
Quoted 1 line

This look like bug in indep_hp_possible() which should return false when

HP

Quoted 1 line

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;