diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic23.c')
-rw-r--r-- | sound/soc/codecs/tlv320aic23.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index a95b538b8fe7..c903e4f48dc4 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -331,10 +331,11 @@ static int find_rate(int mclk, u32 need_adc, u32 need_dac) | |||
331 | adc_h = need_adc + (need_adc >> 5); | 331 | adc_h = need_adc + (need_adc >> 5); |
332 | dac_l = need_dac - (need_dac >> 5); | 332 | dac_l = need_dac - (need_dac >> 5); |
333 | dac_h = need_dac + (need_dac >> 5); | 333 | dac_h = need_dac + (need_dac >> 5); |
334 | for (i = 0; i < 4; i++) { | 334 | for (i = 0; i < ARRAY_SIZE(bosr_usb_divisor_table); i++) { |
335 | int base = mclk / bosr_usb_divisor_table[i]; | 335 | int base = mclk / bosr_usb_divisor_table[i]; |
336 | int mask = sr_valid_mask[i]; | 336 | int mask = sr_valid_mask[i]; |
337 | for (j = 0; j < 16; j++, mask >>= 1) { | 337 | for (j = 0; j < ARRAY_SIZE(sr_adc_mult_table); |
338 | j++, mask >>= 1) { | ||
338 | int adc; | 339 | int adc; |
339 | int dac; | 340 | int dac; |
340 | int score; | 341 | int score; |
@@ -364,6 +365,7 @@ static int find_rate(int mclk, u32 need_adc, u32 need_dac) | |||
364 | return (best_j << 2) | best_i | (best_div << TLV320AIC23_CLKIN_SHIFT); | 365 | return (best_j << 2) | best_i | (best_div << TLV320AIC23_CLKIN_SHIFT); |
365 | } | 366 | } |
366 | 367 | ||
368 | #ifdef DEBUG | ||
367 | static void get_current_sample_rates(struct snd_soc_codec *codec, int mclk, | 369 | static void get_current_sample_rates(struct snd_soc_codec *codec, int mclk, |
368 | u32 *sample_rate_adc, u32 *sample_rate_dac) | 370 | u32 *sample_rate_adc, u32 *sample_rate_dac) |
369 | { | 371 | { |
@@ -379,6 +381,7 @@ static void get_current_sample_rates(struct snd_soc_codec *codec, int mclk, | |||
379 | *sample_rate_adc = adc; | 381 | *sample_rate_adc = adc; |
380 | *sample_rate_dac = dac; | 382 | *sample_rate_dac = dac; |
381 | } | 383 | } |
384 | #endif | ||
382 | 385 | ||
383 | static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk, | 386 | static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk, |
384 | u32 sample_rate_adc, u32 sample_rate_dac) | 387 | u32 sample_rate_adc, u32 sample_rate_dac) |
@@ -391,12 +394,14 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk, | |||
391 | return -EINVAL; | 394 | return -EINVAL; |
392 | } | 395 | } |
393 | tlv320aic23_write(codec, TLV320AIC23_SRATE, data); | 396 | tlv320aic23_write(codec, TLV320AIC23_SRATE, data); |
394 | if (1) { | 397 | #ifdef DEBUG |
395 | int adc, dac; | 398 | { |
399 | u32 adc, dac; | ||
396 | get_current_sample_rates(codec, mclk, &adc, &dac); | 400 | get_current_sample_rates(codec, mclk, &adc, &dac); |
397 | printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n", | 401 | printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n", |
398 | adc, dac, data); | 402 | adc, dac, data); |
399 | } | 403 | } |
404 | #endif | ||
400 | return 0; | 405 | return 0; |
401 | } | 406 | } |
402 | 407 | ||