* [PATCH 1/1] [ALSA] ASoc: TLV320AIC23B Cleanup
@ 2008-11-18 0:30 Troy Kisky
2008-11-18 11:09 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Troy Kisky @ 2008-11-18 0:30 UTC (permalink / raw)
To: alsa-devel; +Cc: broonie, Troy Kisky
Use #ifdef DEBUG to print actual sample rates.
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index a95b538..8a9ef21 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)
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;
}
--
1.5.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] [ALSA] ASoc: TLV320AIC23B Cleanup
2008-11-18 0:30 [PATCH 1/1] [ALSA] ASoc: TLV320AIC23B Cleanup Troy Kisky
@ 2008-11-18 11:09 ` Mark Brown
2008-11-21 4:48 ` Troy Kisky
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2008-11-18 11:09 UTC (permalink / raw)
To: Troy Kisky; +Cc: alsa-devel
On Mon, Nov 17, 2008 at 05:30:44PM -0700, Troy Kisky wrote:
> Use #ifdef DEBUG to print actual sample rates.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] [ALSA] ASoc: TLV320AIC23B Cleanup
2008-11-18 11:09 ` Mark Brown
@ 2008-11-21 4:48 ` Troy Kisky
0 siblings, 0 replies; 3+ messages in thread
From: Troy Kisky @ 2008-11-21 4:48 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel
Mark Brown wrote:
> On Mon, Nov 17, 2008 at 05:30:44PM -0700, Troy Kisky wrote:
>> Use #ifdef DEBUG to print actual sample rates.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>
> 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?
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Sorry for the late response. Your version looks fine.
Thanks
Troy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-21 4:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 0:30 [PATCH 1/1] [ALSA] ASoc: TLV320AIC23B Cleanup Troy Kisky
2008-11-18 11:09 ` Mark Brown
2008-11-21 4:48 ` Troy Kisky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.