ALSA: hda - Avoid invalid formats and rates with shared SPDIF

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Saturday, July 4, 2009 - 1:59 pm

Gitweb:     http://git.kernel.org/linus/022b466fc353d3dc7a152451144be656248666ce
Commit:     022b466fc353d3dc7a152451144be656248666ce
Parent:     aa202455eec51699e44f658530728162cefa1307
Author:     Takashi Iwai <tiwai@suse.de>
AuthorDate: Fri Jul 3 23:03:30 2009 +0200
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Fri Jul 3 23:03:30 2009 +0200

    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>
---
 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 462e2ce..26d255d 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,
 		}
 		mutex_lock(&codec->spdif_mutex);
 		if (mout->share_spdif) {
-			runtime->hw.rates &= mout->spdif_rates;
-			runtime->hw.formats &= mout->spdif_formats;
-			if (mout->spdif_maxbps < hinfo->maxbps)
-				hinfo->maxbps = mout->spdif_maxbps;
+			if ((runtime->hw.rates & mout->spdif_rates) &&
+			    (runtime->hw.formats & mout->spdif_formats)) {
+				runtime->hw.rates &= mout->spdif_rates;
+				runtime->hw.formats &= mout->spdif_formats;
+				if (mout->spdif_maxbps < hinfo->maxbps)
+					hinfo->maxbps = mout->spdif_maxbps;
+			} else {
+				mout->share_spdif = 0;
+				/* FIXME: need notify? */
+			}
 		}
 		mutex_unlock(&codec->spdif_mutex);
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ALSA: hda - Avoid invalid formats and rates with shared SPDIF, Linux Kernel Mailing List..., (Sat Jul 4, 1:59 pm)