[alsa-devel] [PATCH] 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.
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(-)
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;
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)
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
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/al...
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/pc...
+ /* clear indep_hp flag if not available */ + if (spec->indep_hp && !indep_hp_possible(codec)) + spec->indep_hp = 0;
participants (2)
-
Raymond Yau
-
Takashi Iwai