Skip to contentSkip to conversation

ASoC: tda998x: Add a codec to the HDMI transmitter

PATCH Superseded Jean-Francois Moine 2 participants 2 messages Sep 10, 2014 – Sep 12, 2014

Subsystems (5)

v5 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ASoC: tda998x: Add a codec to the HDMI transmitter

This patch adds a CODEC function to the NXP TDA998x HDMI transmitter.

The CODEC handles both I2S and S/PDIF inputs.
It maintains the audio format and rate constraints according to the HDMI device parameters (EDID) and does dynamic input switch in the TDA998x I2C driver on start/stop audio streaming.

---
v5:
- use the TDA998x private data instead of a specific area for the CODEC interface
- the CODEC is TDA998x specific (Mark Brown)
v4:
- remove all the TDA998x specific stuff from the CODEC
- move the EDID scan from the CODEC to the TDA998x
- move the CODEC to sound/soc (Mark Brown)
- update the audio_sample_rate from the EDID (Andrew Jackson)
v3: fix bad rate (Andrew Jackson)
v2: check double stream start (Mark Brown)

---
 .../devicetree/bindings/drm/i2c/tda998x.txt        |  18 ++
 drivers/gpu/drm/i2c/Kconfig                        |   1 +
 drivers/gpu/drm/i2c/tda998x_drv.c                  | 234 +++++++++++++++++++--
 include/drm/i2c/tda998x.h                          |  12 ++
 sound/soc/codecs/Kconfig                           |   3 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/tda998x.c                         | 163 ++++++++++++++
 7 files changed, 415 insertions(+), 18 deletions(-)
 create mode 100644 sound/soc/codecs/tda998x.c
Documentation/devicetree/bindings/drm/i2c/tda998x.txt +18 -0
index e9e4bce..e50e7cd 100644
@@ -17,6 +17,20 @@ Optional properties:
   - video-ports: 24 bits value which defines how the video controller
 	output is wired to the TDA998x input - default: <0x230145>
 
+  - audio-ports: must contain one or two values selecting the source
+	in the audio port.
+	The source type is given by the corresponding entry in
+	the audio-port-names property.
+
+  - audio-port-names: must contain entries matching the entries in
+	the audio-ports property.
+	Each value may be "i2s" or "spdif", giving the type of
+	the audio source.
+
+  - #sound-dai-cells: must be set to <1> for use with the simple-card.
+	The TDA998x audio CODEC always defines two DAIs.
+	The DAI 0 is the S/PDIF input and the DAI 1 is the I2S input.
+
 Example:
 
 	tda998x: hdmi-encoder {
@@ -26,4 +40,8 @@ Example:
 		interrupts = <27 2>;		/* falling edge */
 		pinctrl-0 = <&pmx_camera>;
 		pinctrl-names = "default";
+
+		audio-ports = <0x04>, <0x03>;
+		audio-port-names = "spdif", "i2s";
+		#sound-dai-cells = <1>;
 	};
drivers/gpu/drm/i2c/Kconfig +1 -0
index 4d341db..01b4f95 100644
@@ -22,6 +22,7 @@ config DRM_I2C_SIL164
 config DRM_I2C_NXP_TDA998X
 	tristate "NXP Semiconductors TDA998X HDMI encoder"
 	default m if DRM_TILCDC
+	select SND_SOC_TDA998x
 	help
 	  Support for NXP Semiconductors TDA998X HDMI encoders.
 
drivers/gpu/drm/i2c/tda998x_drv.c +216 -18

337 lines not on this page · raw message

include/drm/i2c/tda998x.h +12 -0
index 3e419d9..7db4c64 100644
@@ -1,6 +1,8 @@
 #ifndef __DRM_I2C_TDA998X_H__
 #define __DRM_I2C_TDA998X_H__
 
+#include <sound/pcm_params.h>
+
 struct tda998x_encoder_params {
 	u8 swap_b:3;
 	u8 mirr_b:1;
@@ -27,4 +29,14 @@ struct tda998x_encoder_params {
 	unsigned audio_sample_rate;
 };
 
+/* audio codec interface */
+int tda998x_get_audio(struct device *dev,
+		      int *max_channels,
+		      int *rate_mask,
+		      int *fmt,
+		      struct snd_pcm_hw_constraint_list **rate_constraints);
+void tda998x_audio_switch(struct device *dev,
+			  int port_index,
+			  unsigned sample_rate,
+			  int sample_format);
 #endif
sound/soc/codecs/Kconfig +3 -0
index 8ab1547..5928c4f 100644
@@ -567,6 +567,9 @@ config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
 	depends on I2C
 
+config SND_SOC_TDA998x
+	tristate
+
 config SND_SOC_TLV320AIC23
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index afba944..e7c2bec 100644
@@ -100,6 +100,7 @@ snd-soc-sta350-objs := sta350.o
 snd-soc-sta529-objs := sta529.o
 snd-soc-stac9766-objs := stac9766.o
 snd-soc-tas5086-objs := tas5086.o
+snd-soc-tda998x-objs := tda998x.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
 snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
@@ -272,6 +273,7 @@ obj-$(CONFIG_SND_SOC_STA529)   += snd-soc-sta529.o
 obj-$(CONFIG_SND_SOC_STAC9766)	+= snd-soc-stac9766.o
 obj-$(CONFIG_SND_SOC_TAS2552)	+= snd-soc-tas2552.o
 obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
+obj-$(CONFIG_SND_SOC_TDA998x)	+= snd-soc-tda998x.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C)	+= snd-soc-tlv320aic23-i2c.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI)	+= snd-soc-tlv320aic23-spi.o
sound/soc/codecs/tda998x.c new file +163 -0

163 lines not on this page · raw message

Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 7 lines · Jean-Francois Moine

This patch adds a CODEC function to the NXP TDA998x HDMI transmitter.

The CODEC handles both I2S and S/PDIF inputs.
It maintains the audio format and rate constraints according to the HDMI device parameters (EDID) and does dynamic input switch in the TDA998x I2C driver on start/stop audio streaming.

You should indicate on subsystem spanning patches what tree you think should merge it etc.

If other tda998x ppl are okay with it, you can have my ack for merging via someone else.

Dave.