Skip to contentSkip to conversation

ASoC: Codec driver for Texas Instruments tlv320dac33 codec

PATCH In review Peter Ujfalusi 2 participants 2 messages Oct 15, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Codec driver for Texas Instruments tlv320dac33 codec

Driver for Texas Instruments TLV320DAC33 (SLAS546) low power stereo audio DAC.

TLV320DAC33 is a stereo audio codec with integrated 24KB FIFO for low power audio playback.

The digital interface can use I2S, DSP (A or B), Right and Left justified formats.
DAC33 has stereo analog input, which can be bypassed to the analog outputs.

Regarding to the internal 24KB FIFO the driver implements 'FIFO bypass' mode (default) and nSample mode (FIFO is in use).
a) In 'FIFO bypass' mode the internal FIFO is not in use, the codec is working synchronously as a normal codec (it needs constant stream of data on the digital interface).

b) The nSample mode implementation uses one interrupt line from DAC33 to the host:
Alarm threshold is set to 10ms of audio data (limit by the driver implementation).
DAC33 will signal an interrupt, when the FIFO level goes under the Alarm threshold.
The host will write to nSample register a value (number of stereo samples), to tell DAC33 how many samples it should read in a burst from the host. When the DAC33 received the number of samples, it disables the clocks on the I2S bus. When the FIFO use again goes under the Alarm threshold, DAC33 signals the host with an interrupt, and the process is repeated.

---

Hello,

I'll hope that I got it right at this time, one thing that I'm not sure is the hard power handling changes (SND_SOC_BIAS_OFF, and related things).

Changes since try2:
- dac33_write_locked simplified (no duplicated code with dac33_write)
- No unneeded casts
- hard power handling changed
- Interrupt handling is changed a bit (masking all interrupts from dac33 when the state is FLUSH - the needed IRQ will be unmasked when the next stream is starting)
- nSample controls added conditionally
- workqueue is created only, if we have valid IRQ number
- snd_soc_register_codec and snd_soc_register_dai moved as the last thing in dac33_i2c_probe function.

 include/sound/tlv320dac33-plat.h |   20 +
 sound/soc/codecs/Kconfig         |    4 +
 sound/soc/codecs/Makefile        |    2 +
 sound/soc/codecs/tlv320dac33.c   | 1237 ++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tlv320dac33.h   |  267 ++++++++
 5 files changed, 1530 insertions(+), 0 deletions(-)
 create mode 100644 include/sound/tlv320dac33-plat.h
 create mode 100644 sound/soc/codecs/tlv320dac33.c
 create mode 100644 sound/soc/codecs/tlv320dac33.h
include/sound/tlv320dac33-plat.h new file +20 -0
new file mode 100644
index 0000000..5858d06
@@ -0,0 +1,20 @@
+/*
+ * Platform header for Texas Instruments TLV320DAC33 codec driver
+ *
+ * Author:	Peter Ujfalusi <[email protected]>
+ *
+ * Copyright:   (C) 2009 Nokia Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __TLV320DAC33_PLAT_H
+#define __TLV320DAC33_PLAT_H
+
+struct tlv320dac33_platform_data {
+	int power_gpio;
+};
+
+#endif /* __TLV320DAC33_PLAT_H */
sound/soc/codecs/Kconfig +4 -0
index fab01c9..49bab93 100644
@@ -29,6 +29,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_TLV320AIC23 if I2C
 	select SND_SOC_TLV320AIC26 if SPI_MASTER
 	select SND_SOC_TLV320AIC3X if I2C
+	select SND_SOC_TLV320DAC33 if I2C
 	select SND_SOC_TPA6130A2 if I2C
 	select SND_SOC_TWL4030 if TWL4030_CORE
 	select SND_SOC_UDA134X
@@ -142,6 +143,9 @@ config SND_SOC_TLV320AIC26
 config SND_SOC_TLV320AIC3X
 	tristate
 
+config SND_SOC_TLV320DAC33
+	tristate
+
 config SND_SOC_TWL4030
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index 2f14391..8f519ee 100644
@@ -17,6 +17,7 @@ snd-soc-stac9766-objs := stac9766.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic26-objs := tlv320aic26.o
 snd-soc-tlv320aic3x-objs := tlv320aic3x.o
+snd-soc-tlv320dac33-objs := tlv320dac33.o
 snd-soc-twl4030-objs := twl4030.o
 snd-soc-uda134x-objs := uda134x.o
 snd-soc-uda1380-objs := uda1380.o
@@ -70,6 +71,7 @@ obj-$(CONFIG_SND_SOC_STAC9766)	+= snd-soc-stac9766.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
 obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
+obj-$(CONFIG_SND_SOC_TLV320DAC33)	+= snd-soc-tlv320dac33.o
 obj-$(CONFIG_SND_SOC_TWL4030)	+= snd-soc-twl4030.o
 obj-$(CONFIG_SND_SOC_UDA134X)	+= snd-soc-uda134x.o
 obj-$(CONFIG_SND_SOC_UDA1380)	+= snd-soc-uda1380.o
sound/soc/codecs/tlv320dac33.c new file +1237 -0

1,237 lines not on this page · raw message

sound/soc/codecs/tlv320dac33.h new file +267 -0

267 lines not on this page · raw message

--
1.6.5

#1 lore raw
Quoted 2 lines · Peter Ujfalusi

Driver for Texas Instruments TLV320DAC33 (SLAS546) low power stereo audio DAC.

This looks good - applied, thanks!