ASoC: tda998x: add a codec to the HDMI transmitter
Subsystems (5)
v4 cover ASoC: tda998x: add a codec to the HDMI transmitter
The NXP TDA998x HDMI transmitter may transmit audio to the HDMI link from 2 different sources, I2S and S/PDIF.
This patch set adds a generic HDMI CODEC module which is used by the TDA998x driver to update the audio constraints from the display characteristics (EDID) and by the audio subsystem to connect the chosen audio source to the HDMI link.
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)
Jean-Francois Moine (2):
ASoC:codecs: Add a generic HDMI audio CODEC
drm/i2c:tda998x: Use the HDMI2 audio CODEC
Documentation/devicetree/bindings/sound/hdmi2.txt | 32 ++++ drivers/gpu/drm/i2c/Kconfig | 1 + drivers/gpu/drm/i2c/tda998x_drv.c | 142 ++++++++++++++- include/sound/hdmi2.h | 24 +++ sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/hdmi2.c | 204 ++++++++++++++++++++++ 7 files changed, 400 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/hdmi2.txt create mode 100644 include/sound/hdmi2.h create mode 100644 sound/soc/codecs/hdmi2.c
Signature · 1 line
2.1.0
PATCH v4 1/2 ASoC:codecs: Add a generic HDMI audio CODEC
This patch adds a generic audio CODEC function to HDMI transmitters.
The CODEC is implemented as a library in a kernel module.
It handles both I2S and S/PDIF input, maintaining the audio format and rates constraints according to the HDMI device parameters (EDID).
Audio source input switch is offered to the HDMI driver on start/stop of audio streaming.
--- Documentation/devicetree/bindings/sound/hdmi2.txt | 32 ++++ include/sound/hdmi2.h | 24 +++ sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/hdmi2.c | 204 ++++++++++++++++++++++ 5 files changed, 265 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/hdmi2.txt create mode 100644 include/sound/hdmi2.h create mode 100644 sound/soc/codecs/hdmi2.c
Documentation/devicetree/bindings/sound/hdmi2.txt new file +32 -0
@@ -0,0 +1,32 @@ +Device-Tree bindings for the generic HDMI2 CODEC + +The HDMI2 CODEC describes how the audio controller is connected to the +HDMI transmitter. +These definitions are included in the HDMI transmiter description. + +Required properties: + + - audio-ports: must contain one or two HDMI transmitter dependant + values identifying the audio sources. + 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 associated audio port. + + - #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: + + hdmi: hdmi-encoder { + compatible = "nxp,tda998x"; + reg = <0x70>; + ... + + audio-ports = <0x03>, <0x04>; + audio-port-names = "i2s", "spdif"; + #sound-dai-cells = <1>; + };
include/sound/hdmi2.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef SND_HDMI2_H +#define SND_HDMI2_H +/* hdmi2 codec data */ +struct hdmi2_codec { +u8 ports[2 ]; +u16 source;/* audio DAI = index to ports[] */ +#define HDMI2_I2S 0 +#define HDMI2_SPDIF 1 + +unsigned sample_rate;/* current streaming values */ +int sample_format; + +u64 formats;/* HDMI (EDID) values */ +unsigned max_channels; +struct snd_pcm_hw_constraint_list rate_constraints; + +void (*start)(struct hdmi2_codec *audio,int full); +void (*stop)(struct hdmi2_codec *audio); +}; + +/* hdmi device -> hdmi2 codec */ +int hdmi2_codec_register (struct device *dev); +void hdmi2_codec_unregister (struct device *dev); +#endif
sound/soc/codecs/Kconfig +3 -0
@@ -424,6 +424,9 @@ config SND_SOC_ES8328_SPI tristate select SND_SOC_ES8328 +config SND_SOC_HDMI2 + tristate + config SND_SOC_ISABELLE tristate
sound/soc/codecs/Makefile +2 -0
@@ -53,6 +53,7 @@ snd-soc-dmic-objs := dmic.o snd-soc-es8328-objs := es8328.o snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-spi-objs := es8328-spi.o +snd-soc-hdmi2-objs := hdmi2.o snd-soc-isabelle-objs := isabelle.o snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o
@@ -228,6 +229,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o +obj-$(CONFIG_SND_SOC_HDMI2) += snd-soc-hdmi2.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
sound/soc/codecs/hdmi2.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
2.1.0
Mark Brown
maintainerRe: [PATCH v4 1/2] ASoC:codecs: Add a generic HDMI audio CODEC
Quoted 6 lines · Jean-Francois Moine
Documentation/devicetree/bindings/sound/hdmi2.txt | 32 ++++ include/sound/hdmi2.h | 24 +++ sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/hdmi2.c | 204 ++++++++++++++++++++++ 5 files changed, 265 insertions(+)
This is clearly not a good name and it's not clear what the difference between this and the existing HDMI stub CODEC is intended to be.
Documentation/devicetree/bindings/sound/hdmi2.txt line 17
Quoted 11 lines
Documentation/devicetree/bindings/sound/hdmi2.txt new file +11
-0+Required properties: + + - audio-ports: must contain one or two HDMI transmitter dependant + values identifying the audio sources. + 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 associated audio port.
It seems hard to see this binding as really generic - I'd expect to see other devices which are just able to have fixed audio ports for example.
sound/soc/codecs/hdmi2.c line 131
Quoted 11 lines
sound/soc/codecs/hdmi2.c new file +11
-0+static int hdmi2_probe (struct snd_soc_codec *codec) +{ +struct i2c_client *i2c_client =to_i2c_client (codec->dev); +struct hdmi2_codec *audio =i2c_get_clientdata (i2c_client); +struct device_node *np = codec->dev->of_node; +int i, j, ret; +const char *p; + +if (!audio) +return -ENODEV ; +snd_soc_codec_set_drvdata (codec, audio);
The code also seems pretty device specific. I think it's probably better to leave the binding device specific for now and concentrate on sharing inside the kernel, making any generic binding additions be about how the devices interface rather than what's going on inside a specific device.
PATCH v4 2/2 drm/i2c:tda998x: Use the HDMI2 audio CODEC
In reply to Jean-Francois MoineThis patch adds an audio CODEC function to the NXP TDA998x transmitter.
--- drivers/gpu/drm/i2c/Kconfig | 1 + drivers/gpu/drm/i2c/tda998x_drv.c | 142 +++++++++++++++++++++++++++++++++++--- 2 files changed, 135 insertions(+), 8 deletions(-)
drivers/gpu/drm/i2c/Kconfig +1 -0
@@ -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_HDMI2 help Support for NXP Semiconductors TDA998X HDMI encoders.
drivers/gpu/drm/i2c/tda998x_drv.c +134 -8
244 lines not on this page · raw message
Signature · 1 line
2.1.0