ASoC: tda998x: add a codec to the HDMI transmitter
Subsystems (3)
PATCH v2 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 input and does dynamic input switch in the TDA998x I2C driver on start/stop audio streaming.
---
v2: check double stream start (Mark Brown)
--- .../devicetree/bindings/drm/i2c/tda998x.txt | 13 ++ drivers/gpu/drm/i2c/Makefile | 2 +- drivers/gpu/drm/i2c/tda998x_codec.c | 247 +++++++++++++++++++++ drivers/gpu/drm/i2c/tda998x_drv.c | 74 ++++-- drivers/gpu/drm/i2c/tda998x_drv.h | 32 +++ include/drm/i2c/tda998x.h | 1 + 6 files changed, 348 insertions(+), 21 deletions(-) create mode 100644 drivers/gpu/drm/i2c/tda998x_codec.c create mode 100644 drivers/gpu/drm/i2c/tda998x_drv.h
Documentation/devicetree/bindings/drm/i2c/tda998x.txt +13 -0
@@ -15,6 +15,15 @@ Optional properties: - video-ports: 24 bits value which defines how the video controller output is wired to the TDA998x input - default: <0x230145> + - audio-ports: one or two values corresponding to entries in + the audio-port-names property. + + - audio-port-names: must contain "i2s", "spdif" entries + matching entries in the audio-ports property. + + - #sound-dai-cells: must be set to <1> for use with the simple-card. + The DAI 0 is the I2S input and the DAI 1 is the S/PDIF input. + Example: tda998x: hdmi-encoder {
@@ -24,4 +33,8 @@ Example: interrupts = <27 2>; /* falling edge */ pinctrl-0 = <&pmx_camera>; pinctrl-names = "default"; + + audio-ports = <0x03>, <0x04>; + audio-port-names = "i2s", "spdif"; + #sound-dai-cells = <1>; };
drivers/gpu/drm/i2c/Makefile +1 -1
@@ -6,5 +6,5 @@ obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o sil164-y := sil164_drv.o obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o -tda998x-y := tda998x_drv.o +tda998x-y := tda998x_drv.o tda998x_codec.o obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
drivers/gpu/drm/i2c/tda998x_codec.c new file +247 -0
247 lines not on this page · raw message
drivers/gpu/drm/i2c/tda998x_drv.c +54 -20
149 lines not on this page · raw message
drivers/gpu/drm/i2c/tda998x_drv.h new file +32 -0
@@ -0,0 +1,32 @@ +/* tda998x private data */ + +struct tda998x_priv { +struct i2c_client *cec; +struct i2c_client *hdmi; +uint16_t rev; +uint8_t current_page; +int dpms; +bool is_hdmi_sink; +u8 vip_cntrl_0; +u8 vip_cntrl_1; +u8 vip_cntrl_2; +struct tda998x_encoder_params params; + +wait_queue_head_t wq_edid; +volatile int wq_edid_wait; +struct drm_encoder *encoder; + +u8 audio_ports[2 ]; +int audio_sample_format; +int dai_id;/* DAI ID when streaming active */ + +u8 *eld; + +struct snd_pcm_hw_constraint_list rate_constraints; +}; + +int tda998x_codec_register (struct device *dev); +void tda998x_codec_unregister (struct device *dev); + +void tda998x_audio_start (struct tda998x_priv *priv,int full); +void tda998x_audio_stop (struct tda998x_priv *priv);
include/drm/i2c/tda998x.h +1 -0
@@ -20,6 +20,7 @@ struct tda998x_encoder_params {u8 audio_frame[6 ];enum { +AFMT_NO_AUDIO =0 ,AFMT_SPDIF ,AFMT_I2S } audio_format;
Signature · 11 lines
2.0.1 -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
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 input and does dynamic input switch in the TDA998x I2C driver on start/stop audio streaming.
Signed-off-by Jean-Francois Moine <[email protected]>---
[snip]
Quoted 1 line
+++
b/drivers/gpu/drm/i2c/tda998x_codec.c
[snip]
Quoted 7 lines
drivers/gpu/drm/i2c/tda998x_codec.c new file +7
-0+static int tda_startup (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct tda998x_priv *priv =snd_soc_codec_get_drvdata (dai->codec); +u8 *eld = priv->eld; +struct snd_pcm_runtime *runtime = substream->runtime; +u8 *sad;
drivers/gpu/drm/i2c/tda998x_codec.c line 43
Quoted 10 lines
drivers/gpu/drm/i2c/tda998x_codec.c new file +10
-0+int sad_count; +unsigned eld_ver, mnl, rate_mask; +unsigned max_channels, fmt; +u64 formats; +struct snd_pcm_hw_constraint_list *rate_constraints = + &priv->rate_constraints; +static const u32 hdmi_rates[] = { +32000 ,44100 ,48000 ,88200 ,9600 ,176400 ,192000 + }; +
Shouldn't this be 96000, not 9600? Assuming that the table is ordered in terms of increasing frequencies.
Andrew
Quoted 6 lines · On Tue, 08 Jul 2014 10:17:58 +0100 Andrew Jackson <[email protected]>…
drivers/gpu/drm/i2c/tda998x_codec.c line 43
Quoted 4 lines
drivers/gpu/drm/i2c/tda998x_codec.c new file +4
-0+static const u32 hdmi_rates[] = { +32000 ,44100 ,48000 ,88200 ,9600 ,176400 ,192000 + }; +Shouldn't this be 96000, not 9600? Assuming that the table is ordered in terms of increasing frequencies.
You are right. Thank you.
Signature · 6 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel