diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-03 17:03:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-03 17:03:30 -0400 |
commit | 022b466fc353d3dc7a152451144be656248666ce (patch) | |
tree | a1a9c46a86898d2eeffc5dbb8f5fdb7a49666d02 /sound/pci/hda/hda_codec.c | |
parent | aa202455eec51699e44f658530728162cefa1307 (diff) |
ALSA: hda - Avoid invalid formats and rates with shared SPDIF
Check whether formats and rates don't result in zero due to the
restriction of SPDIF sharing. If any of them can be zero, disable
the SPDIF sharing mode instead. Otherwise it will lead to a PCM
configuration error.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 462e2cedaa6a..26d255de6beb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3470,10 +3470,16 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec, | |||
3470 | } | 3470 | } |
3471 | mutex_lock(&codec->spdif_mutex); | 3471 | mutex_lock(&codec->spdif_mutex); |
3472 | if (mout->share_spdif) { | 3472 | if (mout->share_spdif) { |
3473 | runtime->hw.rates &= mout->spdif_rates; | 3473 | if ((runtime->hw.rates & mout->spdif_rates) && |
3474 | runtime->hw.formats &= mout->spdif_formats; | 3474 | (runtime->hw.formats & mout->spdif_formats)) { |
3475 | if (mout->spdif_maxbps < hinfo->maxbps) | 3475 | runtime->hw.rates &= mout->spdif_rates; |
3476 | hinfo->maxbps = mout->spdif_maxbps; | 3476 | runtime->hw.formats &= mout->spdif_formats; |
3477 | if (mout->spdif_maxbps < hinfo->maxbps) | ||
3478 | hinfo->maxbps = mout->spdif_maxbps; | ||
3479 | } else { | ||
3480 | mout->share_spdif = 0; | ||
3481 | /* FIXME: need notify? */ | ||
3482 | } | ||
3477 | } | 3483 | } |
3478 | mutex_unlock(&codec->spdif_mutex); | 3484 | mutex_unlock(&codec->spdif_mutex); |
3479 | } | 3485 | } |