Explorar el Código

ASoC: tlv320dac33: Calculate the interface speed during bursts

When the DAC33 FIFO is in use the dai interface is running in
much higher speed than the sampling frequency.
Calculate the rate based on the internal base frequency and
the bclk divider.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Peter Ujfalusi hace 15 años
padre
commit
76f471274d
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      sound/soc/codecs/tlv320dac33.c

+ 5 - 0
sound/soc/codecs/tlv320dac33.c

@@ -53,6 +53,8 @@
 #define MODE7_LTHR		10
 #define MODE7_LTHR		10
 #define MODE7_UTHR		(DAC33_BUFFER_SIZE_SAMPLES - 10)
 #define MODE7_UTHR		(DAC33_BUFFER_SIZE_SAMPLES - 10)
 
 
+#define BURST_BASEFREQ_HZ	49152000
+
 static struct snd_soc_codec *tlv320dac33_codec;
 static struct snd_soc_codec *tlv320dac33_codec;
 
 
 enum dac33_state {
 enum dac33_state {
@@ -95,6 +97,7 @@ struct tlv320dac33_priv {
 	enum dac33_fifo_modes fifo_mode;/* FIFO mode selection */
 	enum dac33_fifo_modes fifo_mode;/* FIFO mode selection */
 	unsigned int nsample;		/* burst read amount from host */
 	unsigned int nsample;		/* burst read amount from host */
 	u8 burst_bclkdiv;		/* BCLK divider value in burst mode */
 	u8 burst_bclkdiv;		/* BCLK divider value in burst mode */
+	unsigned int burst_rate;	/* Interface speed in Burst modes */
 
 
 	int keep_bclk;			/* Keep the BCLK continuously running
 	int keep_bclk;			/* Keep the BCLK continuously running
 					 * in FIFO modes */
 					 * in FIFO modes */
@@ -1246,6 +1249,8 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client,
 
 
 	dac33->power_gpio = pdata->power_gpio;
 	dac33->power_gpio = pdata->power_gpio;
 	dac33->burst_bclkdiv = pdata->burst_bclkdiv;
 	dac33->burst_bclkdiv = pdata->burst_bclkdiv;
+	/* Pre calculate the burst rate */
+	dac33->burst_rate = BURST_BASEFREQ_HZ / dac33->burst_bclkdiv / 32;
 	dac33->keep_bclk = pdata->keep_bclk;
 	dac33->keep_bclk = pdata->keep_bclk;
 	dac33->irq = client->irq;
 	dac33->irq = client->irq;
 	dac33->nsample = NSAMPLE_MAX;
 	dac33->nsample = NSAMPLE_MAX;