ASoc: TLV320AIC23B Cleanup
Subsystems (3)
PATCH 1/1 ASoc: TLV320AIC23B Cleanup
Use #ifdef DEBUG to print actual sample rates.
sound/soc/codecs/tlv320aic23.c +13 -9
@@ -331,10 +331,11 @@ static int find_rate(int mclk, u32 need_adc, u32 need_dac) adc_h = need_adc + (need_adc >>5 ); dac_l = need_dac - (need_dac >>5 ); dac_h = need_dac + (need_dac >>5 ); -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <ARRAY_SIZE (bosr_usb_divisor_table); i++) {int base = mclk / bosr_usb_divisor_table[i];int mask = sr_valid_mask[i]; -for (j =0 ; j <16 ; j++, mask >>=1 ) { +for (j =0 ; j <ARRAY_SIZE (sr_adc_mult_table); + j++, mask >>=1 ) {int adc;int dac;int score;
@@ -364,21 +365,22 @@ static int find_rate(int mclk, u32 need_adc, u32 need_dac)return (best_j <<2 ) | best_i | (best_div <<TLV320AIC23_CLKIN_SHIFT ); } -static void get_current_sample_rates (struct snd_soc_codec *codec,int mclk, +#ifdef DEBUG +static void get_current_sample_rates (int sample_rate_control,int mclk,u32 *sample_rate_adc,u32 *sample_rate_dac) { -int src =tlv320aic23_read_reg_cache (codec,TLV320AIC23_SRATE ); -int sr = (src >>2 ) &0x0f ; -int val = (mclk / bosr_usb_divisor_table[src &3 ]); +int sr = (sample_rate_control >>2 ) &0x0f ; +int val = (mclk / bosr_usb_divisor_table[sample_rate_control &3 ]);int adc = (val * sr_adc_mult_table[sr]) /SR_MULT ;int dac = (val * sr_dac_mult_table[sr]) /SR_MULT ; -if (src &TLV320AIC23_CLKIN_HALF ) { +if (sample_rate_control &TLV320AIC23_CLKIN_HALF ) { adc >>=1 ; dac >>=1 ; } *sample_rate_adc = adc; *sample_rate_dac = dac; } +#endif static int set_sample_rate_control (struct snd_soc_codec *codec,int mclk,u32 sample_rate_adc,u32 sample_rate_dac)
@@ -391,12 +393,14 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk,return -EINVAL ; }tlv320aic23_write (codec,TLV320AIC23_SRATE , data); -if (1 ) { +#ifdef DEBUG + {int adc, dac; -get_current_sample_rates (codec, mclk, &adc, &dac); +get_current_sample_rates (data, mclk, &adc, &dac);printk (KERN_DEBUG "actual samplerate = %u,%u reg=%x\n" , adc, dac, data); } +#endif return 0 ; }
Signature · 1 line
1.5.4.3
Quoted 3 lines · Troy Kisky
Use #ifdef DEBUG to print actual sample rates.
Signed-off-by Troy Kisky <[email protected]>
Excellent timing - I did a patch doing pretty much the same thing and also fixing some build warnings last night. Could you please check against the for-tiwai branch of:
git://opensource.wolfsonmicro.con/linux-2.6-asoc
and see if I've missed anything?
Quoted 9 lines · Mark Brown
Quoted 3 lines · Troy Kisky
Use #ifdef DEBUG to print actual sample rates.
Signed-off-by Troy Kisky <[email protected]>Excellent timing - I did a patch doing pretty much the same thing and also fixing some build warnings last night. Could you please check against the for-tiwai branch of:
Quoted 8 lines
git://opensource.wolfsonmicro.con/linux-2.6-asocand see if I've missed anything?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sorry for the late response. Your version looks fine.
Thanks
Troy