Commit 8d9a114e authored by Andreas Mohr's avatar Andreas Mohr Committed by Takashi Iwai

ALSA: azt3328: _setfmt() update

- use a separate variable for the frequency part, don't always "or" it
- use a "clever"(?) macro to shorten the code
Signed-off-by: default avatarAndreas Mohr <andi@lisas.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent adf5931f
...@@ -958,28 +958,35 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, ...@@ -958,28 +958,35 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip,
unsigned long flags; unsigned long flags;
const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
u16 val = 0xff00; u16 val = 0xff00;
u8 freq = 0;
snd_azf3328_dbgcallenter(); snd_azf3328_dbgcallenter();
switch (bitrate) { switch (bitrate) {
case AZF_FREQ_4000: val |= SOUNDFORMAT_FREQ_SUSPECTED_4000; break; #define AZF_FMT_XLATE(in_freq, out_bits) \
case AZF_FREQ_4800: val |= SOUNDFORMAT_FREQ_SUSPECTED_4800; break; do { \
case AZF_FREQ_5512: case AZF_FREQ_ ## in_freq: \
/* the AZF3328 names it "5510" for some strange reason */ freq = SOUNDFORMAT_FREQ_ ## out_bits; \
val |= SOUNDFORMAT_FREQ_5510; break; break; \
case AZF_FREQ_6620: val |= SOUNDFORMAT_FREQ_6620; break; } while (0);
case AZF_FREQ_8000: val |= SOUNDFORMAT_FREQ_8000; break; AZF_FMT_XLATE(4000, SUSPECTED_4000)
case AZF_FREQ_9600: val |= SOUNDFORMAT_FREQ_9600; break; AZF_FMT_XLATE(4800, SUSPECTED_4800)
case AZF_FREQ_11025: val |= SOUNDFORMAT_FREQ_11025; break; /* the AZF3328 names it "5510" for some strange reason: */
case AZF_FREQ_13240: val |= SOUNDFORMAT_FREQ_SUSPECTED_13240; break; AZF_FMT_XLATE(5512, 5510)
case AZF_FREQ_16000: val |= SOUNDFORMAT_FREQ_16000; break; AZF_FMT_XLATE(6620, 6620)
case AZF_FREQ_22050: val |= SOUNDFORMAT_FREQ_22050; break; AZF_FMT_XLATE(8000, 8000)
case AZF_FREQ_32000: val |= SOUNDFORMAT_FREQ_32000; break; AZF_FMT_XLATE(9600, 9600)
AZF_FMT_XLATE(11025, 11025)
AZF_FMT_XLATE(13240, SUSPECTED_13240)
AZF_FMT_XLATE(16000, 16000)
AZF_FMT_XLATE(22050, 22050)
AZF_FMT_XLATE(32000, 32000)
default: default:
snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
/* fall-through */ /* fall-through */
case AZF_FREQ_44100: val |= SOUNDFORMAT_FREQ_44100; break; AZF_FMT_XLATE(44100, 44100)
case AZF_FREQ_48000: val |= SOUNDFORMAT_FREQ_48000; break; AZF_FMT_XLATE(48000, 48000)
case AZF_FREQ_66200: val |= SOUNDFORMAT_FREQ_SUSPECTED_66200; break; AZF_FMT_XLATE(66200, SUSPECTED_66200)
#undef AZF_FMT_XLATE
} }
/* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */
/* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */
...@@ -991,6 +998,8 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, ...@@ -991,6 +998,8 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip,
/* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */ /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */
/* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */ /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */
val |= freq;
if (channels == 2) if (channels == 2)
val |= SOUNDFORMAT_FLAG_2CHANNELS; val |= SOUNDFORMAT_FLAG_2CHANNELS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment