ALSA: hda - Add full rates/formats support for Nvidia HDMI
authorTakashi Iwai <tiwai@suse.de>
Fri, 9 Oct 2009 15:44:08 +0000 (17:44 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 9 Oct 2009 15:44:08 +0000 (17:44 +0200)
Allow Nvidia HDMI to support more possible sample rates and formats.
At best, the really supported rates and formats should be determined
together with the negotiation with the HDMI receiver, but it's currently
not implemented yet (Nvidia stuff seems incompatible with HDMI 1.3
standard in this regard).  As a compromise, we enable all bits, assuming
that all recent devices do support such rates/formats.

Tested-by: Alan Alan <alanwww1@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_nvhdmi.c

index c8435c9a97f94bfdf42d401b3b7f0f59ddead619..23ad939831185954e40a93a964a7c39bc12d7de6 100644 (file)
@@ -29,6 +29,9 @@
 #include "hda_codec.h"
 #include "hda_local.h"
 
+/* define below to restrict the supported rates and formats */
+#define LIMITED_RATE_FMT_SUPPORT
+
 struct nvhdmi_spec {
        struct hda_multi_out multiout;
 
@@ -60,6 +63,22 @@ static struct hda_verb nvhdmi_basic_init[] = {
        {} /* terminator */
 };
 
+#ifdef LIMITED_RATE_FMT_SUPPORT
+/* support only the safe format and rate */
+#define SUPPORTED_RATES                SNDRV_PCM_RATE_48000
+#define SUPPORTED_MAXBPS       16
+#define SUPPORTED_FORMATS      SNDRV_PCM_FMTBIT_S16_LE
+#else
+/* support all rates and formats */
+#define SUPPORTED_RATES \
+       (SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
+       SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\
+        SNDRV_PCM_RATE_192000)
+#define SUPPORTED_MAXBPS       24
+#define SUPPORTED_FORMATS \
+       (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
+#endif
+
 /*
  * Controls
  */
@@ -258,9 +277,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = {
        .channels_min = 2,
        .channels_max = 8,
        .nid = Nv_Master_Convert_nid,
-       .rates = SNDRV_PCM_RATE_48000,
-       .maxbps = 16,
-       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+       .rates = SUPPORTED_RATES,
+       .maxbps = SUPPORTED_MAXBPS,
+       .formats = SUPPORTED_FORMATS,
        .ops = {
                .open = nvhdmi_dig_playback_pcm_open,
                .close = nvhdmi_dig_playback_pcm_close_8ch,
@@ -273,9 +292,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = {
        .channels_min = 2,
        .channels_max = 2,
        .nid = Nv_Master_Convert_nid,
-       .rates = SNDRV_PCM_RATE_48000,
-       .maxbps = 16,
-       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+       .rates = SUPPORTED_RATES,
+       .maxbps = SUPPORTED_MAXBPS,
+       .formats = SUPPORTED_FORMATS,
        .ops = {
                .open = nvhdmi_dig_playback_pcm_open,
                .close = nvhdmi_dig_playback_pcm_close_2ch,