aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/azt3328.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/azt3328.c')
-rw-r--r--sound/pci/azt3328.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 006f8c0ffb56..3a9a4a1be26f 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -958,28 +958,35 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip,
958 unsigned long flags; 958 unsigned long flags;
959 const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; 959 const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
960 u16 val = 0xff00; 960 u16 val = 0xff00;
961 u8 freq = 0;
961 962
962 snd_azf3328_dbgcallenter(); 963 snd_azf3328_dbgcallenter();
963 switch (bitrate) { 964 switch (bitrate) {
964 case AZF_FREQ_4000: val |= SOUNDFORMAT_FREQ_SUSPECTED_4000; break; 965#define AZF_FMT_XLATE(in_freq, out_bits) \
965 case AZF_FREQ_4800: val |= SOUNDFORMAT_FREQ_SUSPECTED_4800; break; 966 do { \
966 case AZF_FREQ_5512: 967 case AZF_FREQ_ ## in_freq: \
967 /* the AZF3328 names it "5510" for some strange reason */ 968 freq = SOUNDFORMAT_FREQ_ ## out_bits; \
968 val |= SOUNDFORMAT_FREQ_5510; break; 969 break; \
969 case AZF_FREQ_6620: val |= SOUNDFORMAT_FREQ_6620; break; 970 } while (0);
970 case AZF_FREQ_8000: val |= SOUNDFORMAT_FREQ_8000; break; 971 AZF_FMT_XLATE(4000, SUSPECTED_4000)
971 case AZF_FREQ_9600: val |= SOUNDFORMAT_FREQ_9600; break; 972 AZF_FMT_XLATE(4800, SUSPECTED_4800)
972 case AZF_FREQ_11025: val |= SOUNDFORMAT_FREQ_11025; break; 973 /* the AZF3328 names it "5510" for some strange reason: */
973 case AZF_FREQ_13240: val |= SOUNDFORMAT_FREQ_SUSPECTED_13240; break; 974 AZF_FMT_XLATE(5512, 5510)
974 case AZF_FREQ_16000: val |= SOUNDFORMAT_FREQ_16000; break; 975 AZF_FMT_XLATE(6620, 6620)
975 case AZF_FREQ_22050: val |= SOUNDFORMAT_FREQ_22050; break; 976 AZF_FMT_XLATE(8000, 8000)
976 case AZF_FREQ_32000: val |= SOUNDFORMAT_FREQ_32000; break; 977 AZF_FMT_XLATE(9600, 9600)
978 AZF_FMT_XLATE(11025, 11025)
979 AZF_FMT_XLATE(13240, SUSPECTED_13240)
980 AZF_FMT_XLATE(16000, 16000)
981 AZF_FMT_XLATE(22050, 22050)
982 AZF_FMT_XLATE(32000, 32000)
977 default: 983 default:
978 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); 984 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
979 /* fall-through */ 985 /* fall-through */
980 case AZF_FREQ_44100: val |= SOUNDFORMAT_FREQ_44100; break; 986 AZF_FMT_XLATE(44100, 44100)
981 case AZF_FREQ_48000: val |= SOUNDFORMAT_FREQ_48000; break; 987 AZF_FMT_XLATE(48000, 48000)
982 case AZF_FREQ_66200: val |= SOUNDFORMAT_FREQ_SUSPECTED_66200; break; 988 AZF_FMT_XLATE(66200, SUSPECTED_66200)
989#undef AZF_FMT_XLATE
983 } 990 }
984 /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ 991 /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */
985 /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ 992 /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */
@@ -991,6 +998,8 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip,
991 /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */ 998 /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */
992 /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */ 999 /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */
993 1000
1001 val |= freq;
1002
994 if (channels == 2) 1003 if (channels == 2)
995 val |= SOUNDFORMAT_FLAG_2CHANNELS; 1004 val |= SOUNDFORMAT_FLAG_2CHANNELS;
996 1005