aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Bruno <remy.bruno@trinnov.com>2008-02-22 11:57:02 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:15 -0400
commit47ba97f8fa01bb5b48e73b4b1271fbf1436a2d4b (patch)
treed77b5f4c4aa99fe6cb3732b0678634ae8c3555f1
parentae0afd81b34ce287ffda7dd4e33b5144de2ad39d (diff)
[ALSA] hdsp - RME 9632 fix at 192kHz
The bits indicating SPDIF frequency in the status register are not the same for the 9632 than for the other cards, because it also supports 192kHz. A specific bitmask has thus been added (used in hdsp_spdif_sample_rate()). The 9632 does not seem to report external sample rates greater than 96kHz. In this case, the best seems to report spdif rate when autosync reference is spdif. This also required to move function hdsp_spdif_sample_rate(). Signed-off-by: Remy Bruno <remy.bruno@trinnov.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/rme9652/hdsp.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 1be84f22d0de..4d6fbb36ab8a 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -318,6 +318,10 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
318#define HDSP_midi1IRQPending (1<<31) 318#define HDSP_midi1IRQPending (1<<31)
319 319
320#define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) 320#define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2)
321#define HDSP_spdifFrequencyMask_9632 (HDSP_spdifFrequency0|\
322 HDSP_spdifFrequency1|\
323 HDSP_spdifFrequency2|\
324 HDSP_spdifFrequency3)
321 325
322#define HDSP_spdifFrequency32KHz (HDSP_spdifFrequency0) 326#define HDSP_spdifFrequency32KHz (HDSP_spdifFrequency0)
323#define HDSP_spdifFrequency44_1KHz (HDSP_spdifFrequency1) 327#define HDSP_spdifFrequency44_1KHz (HDSP_spdifFrequency1)
@@ -328,7 +332,9 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
328#define HDSP_spdifFrequency96KHz (HDSP_spdifFrequency2|HDSP_spdifFrequency1) 332#define HDSP_spdifFrequency96KHz (HDSP_spdifFrequency2|HDSP_spdifFrequency1)
329 333
330/* This is for H9632 cards */ 334/* This is for H9632 cards */
331#define HDSP_spdifFrequency128KHz HDSP_spdifFrequencyMask 335#define HDSP_spdifFrequency128KHz (HDSP_spdifFrequency0|\
336 HDSP_spdifFrequency1|\
337 HDSP_spdifFrequency2)
332#define HDSP_spdifFrequency176_4KHz HDSP_spdifFrequency3 338#define HDSP_spdifFrequency176_4KHz HDSP_spdifFrequency3
333#define HDSP_spdifFrequency192KHz (HDSP_spdifFrequency3|HDSP_spdifFrequency0) 339#define HDSP_spdifFrequency192KHz (HDSP_spdifFrequency3|HDSP_spdifFrequency0)
334 340
@@ -885,28 +891,15 @@ static int snd_hdsp_use_is_exclusive(struct hdsp *hdsp)
885 return ret; 891 return ret;
886} 892}
887 893
888static int hdsp_external_sample_rate (struct hdsp *hdsp)
889{
890 unsigned int status2 = hdsp_read(hdsp, HDSP_status2Register);
891 unsigned int rate_bits = status2 & HDSP_systemFrequencyMask;
892
893 switch (rate_bits) {
894 case HDSP_systemFrequency32: return 32000;
895 case HDSP_systemFrequency44_1: return 44100;
896 case HDSP_systemFrequency48: return 48000;
897 case HDSP_systemFrequency64: return 64000;
898 case HDSP_systemFrequency88_2: return 88200;
899 case HDSP_systemFrequency96: return 96000;
900 default:
901 return 0;
902 }
903}
904
905static int hdsp_spdif_sample_rate(struct hdsp *hdsp) 894static int hdsp_spdif_sample_rate(struct hdsp *hdsp)
906{ 895{
907 unsigned int status = hdsp_read(hdsp, HDSP_statusRegister); 896 unsigned int status = hdsp_read(hdsp, HDSP_statusRegister);
908 unsigned int rate_bits = (status & HDSP_spdifFrequencyMask); 897 unsigned int rate_bits = (status & HDSP_spdifFrequencyMask);
909 898
899 /* For the 9632, the mask is different */
900 if (hdsp->io_type == H9632)
901 rate_bits = (status & HDSP_spdifFrequencyMask_9632);
902
910 if (status & HDSP_SPDIFErrorFlag) 903 if (status & HDSP_SPDIFErrorFlag)
911 return 0; 904 return 0;
912 905
@@ -933,6 +926,31 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp)
933 return 0; 926 return 0;
934} 927}
935 928
929static int hdsp_external_sample_rate(struct hdsp *hdsp)
930{
931 unsigned int status2 = hdsp_read(hdsp, HDSP_status2Register);
932 unsigned int rate_bits = status2 & HDSP_systemFrequencyMask;
933
934 /* For the 9632 card, there seems to be no bit for indicating external
935 * sample rate greater than 96kHz. The card reports the corresponding
936 * single speed. So the best means seems to get spdif rate when
937 * autosync reference is spdif */
938 if (hdsp->io_type == H9632 &&
939 hdsp_autosync_ref(hdsp) == HDSP_AUTOSYNC_FROM_SPDIF)
940 return hdsp_spdif_sample_rate(hdsp);
941
942 switch (rate_bits) {
943 case HDSP_systemFrequency32: return 32000;
944 case HDSP_systemFrequency44_1: return 44100;
945 case HDSP_systemFrequency48: return 48000;
946 case HDSP_systemFrequency64: return 64000;
947 case HDSP_systemFrequency88_2: return 88200;
948 case HDSP_systemFrequency96: return 96000;
949 default:
950 return 0;
951 }
952}
953
936static void hdsp_compute_period_size(struct hdsp *hdsp) 954static void hdsp_compute_period_size(struct hdsp *hdsp)
937{ 955{
938 hdsp->period_bytes = 1 << ((hdsp_decode_latency(hdsp->control_register) + 8)); 956 hdsp->period_bytes = 1 << ((hdsp_decode_latency(hdsp->control_register) + 8));