Skip to contentSkip to conversation

ASoC: tlv320dac33: FIFO mode updates

PATCH Superseded Peter Ujfalusi 2 participants 6 messages Jul 27, 2010 – Jul 28, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ASoC: tlv320dac33: FIFO mode updates

Hello,

The main feature of this series is the automatic FIFO configuration of the FIFO, when one of the FIFO mode is selected.
The first patch simplifies the handling of the Mode1 in manual mode, and also removes the hardwired latency definition from the code, so it can be adjusted based on the underlying platform.

The second patch adds option to select the automatic FIFO configuration. When this mode is selected the driver will configure the FIFO to match the stream's period size with the burst length (in terms of samples bursted out from the host).
In Mode1 this is trivial, since I can configure the nSample to match with the period size. However the Mode7 is a bit more complicated. The formula (UTHR_FROM_PERIOD_SIZE) calculates the UTHR configuration for the given number of samples.

The patches are generated against:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git:topic/asoc

---
Peter Ujfalusi (2):
ASoC: tlv320dac33: Revisit the FIFO Mode1 handling
ASoC: tlv320dac33: Add support for automatic FIFO configuration

 include/sound/tlv320dac33-plat.h |    2 +
 sound/soc/codecs/tlv320dac33.c   |  125 ++++++++++++++++++++++++--------------
 2 files changed, 82 insertions(+), 45 deletions(-)

--
1.7.2

#1 lore raw

PATCH 1/2 ASoC: tlv320dac33: Revisit the FIFO Mode1 handling

Replace the hardwired latency definition with platform data parameter, and simplify the nSample parameter calculation.

---
 include/sound/tlv320dac33-plat.h |    1 +
 sound/soc/codecs/tlv320dac33.c   |   71 ++++++++++++++++++--------------------
 2 files changed, 35 insertions(+), 37 deletions(-)
include/sound/tlv320dac33-plat.h +1 -0
index 3f428d5..30ff25b 100644
@@ -15,6 +15,7 @@
 
 struct tlv320dac33_platform_data {
 	int power_gpio;
+	int mode1_i2c_latency; /* latency caused by the i2c writes in us */
 	int keep_bclk;	/* Keep the BCLK running in FIFO modes */
 	u8 burst_bclkdiv;
 };
sound/soc/codecs/tlv320dac33.c +34 -37

115 lines not on this page · raw message

Signature · 1 line
1.7.2
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] ASoC: tlv320dac33: Revisit the FIFO Mode1 handling

Quoted 4 lines · Peter Ujfalusi

Replace the hardwired latency definition with platform data parameter, and simplify the nSample parameter calculation.

I did notice that the default changes from 20ms:

sound/soc/codecs/tlv320dac33.c

Quoted 4 lines
sound/soc/codecs/tlv320dac33.c +2 -1
-#define LATENCY_TIME_MS		20
 
+	if (!dac33->mode1_i2c_latency)
+		dac33->mode1_i2c_latency = 10000; /* 10ms */

to 10ms with the new code but that shouldn't be a problem.

#3 lore raw

Re: [PATCH 1/2] ASoC: tlv320dac33: Revisit the FIFO Mode1 handling

Quoted 7 lines · On Tuesday 27 July 2010 19:32:44 ext Mark Brown wrote:

I did notice that the default changes from 20ms:

sound/soc/codecs/tlv320dac33.c

Quoted 4 lines
sound/soc/codecs/tlv320dac33.c +2 -1
-#define LATENCY_TIME_MS		20
 
+	if (!dac33->mode1_i2c_latency)
+		dac33->mode1_i2c_latency = 10000; /* 10ms */

to 10ms with the new code but that shouldn't be a problem.

Correct.
The LATENCY_TIME_MS was used for two things:
alarm threshold = LATENCY_TIME_MS / 2
nSample lower limit = LATENCY_TIME_MS

The new default (10ms) comes from the old alarm threshold time.

There is no real need to limit the nSample for higher value, it is safe to use the same time constraint for alarm threshold and nSample lower limit. The important thing is actually the alarm threshold value here: we need to have enough time to handle the interrupt, schedule the work, and write to nSample registers (via i2c) within certain amount of time.
Probably naming the mode1_i2c_latency differently, like mode1_latency would be better.

Probably it would be better if I resend the series with this change?

Thanks,
Péter

#4 lore raw

PATCH 2/2 ASoC: tlv320dac33: Add support for automatic FIFO configuration

In reply to Peter Ujfalusi

Platform parameter to enable automatic FIFO configuration when the codec is in Mode1 or Mode7 FIFO mode.
When this mode is selected, the controls for changing nSample (in Mode1), and UTHR (in Mode7) are not added. The driver configures the FIFO configuration based on the stream's period size in a way, that every burst will read period size of data from the host.
In Mode7 we need to use a formula, which gives close enough aproximation for the burst length from the host point of view.

---
 include/sound/tlv320dac33-plat.h |    1 +
 sound/soc/codecs/tlv320dac33.c   |   90 +++++++++++++++++++++++++++-----------
 2 files changed, 65 insertions(+), 26 deletions(-)
include/sound/tlv320dac33-plat.h +1 -0
index 30ff25b..5cd887b 100644
@@ -16,6 +16,7 @@
 struct tlv320dac33_platform_data {
 	int power_gpio;
 	int mode1_i2c_latency; /* latency caused by the i2c writes in us */
+	int auto_fifo_config; /* FIFO config based on the period size */
 	int keep_bclk;	/* Keep the BCLK running in FIFO modes */
 	u8 burst_bclkdiv;
 };
sound/soc/codecs/tlv320dac33.c +64 -26

135 lines not on this page · raw message

Signature · 1 line
1.7.2
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] ASoC: tlv320dac33: Add support for automatic FIFO configuration

Quoted 11 lines · Peter Ujfalusi

Platform parameter to enable automatic FIFO configuration when the codec is in Mode1 or Mode7 FIFO mode.
When this mode is selected, the controls for changing nSample (in Mode1), and UTHR (in Mode7) are not added. The driver configures the FIFO configuration based on the stream's period size in a way, that every burst will read period size of data from the host.
In Mode7 we need to use a formula, which gives close enough aproximation for the burst length from the host point of view.

Quoted 1 line