Support ZTE zx296702 SPDIF/I2S
Subsystems (3)
v3 cover Support ZTE zx296702 SPDIF/I2S
Changes vs v2:
- remove pcm dma driver and merge the related call into DAI driver
- Add zx HDMI codec with direct HDMI function call
- Other typo and minor fix
Jun Nie (6):
dt: Add documentation for the ZTE SPDIF controller
dt: Add documentation for the ZTE I2S controller
dt: Add doc for the ZTE HDMI audio codec binding
ASoC: zx: Add zx296702 SPDIF support
ASoC: zx: Add ZTE zx296702 I2S DAI driver
ASoC: zx: add zx296702 hdmi codec
.../devicetree/bindings/sound/zte,zx-hdmi.txt | 10 + .../devicetree/bindings/sound/zte,zx-i2s.txt | 44 +++ .../devicetree/bindings/sound/zte,zx-spdif.txt | 28 ++ include/sound/zx_hdmi_audio.h | 7 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 1 + sound/soc/codecs/zx296702_hdmi.c | 121 ++++++ sound/soc/zte/Kconfig | 17 + sound/soc/zte/Makefile | 2 + sound/soc/zte/zx296702-i2s.c | 437 +++++++++++++++++++++ sound/soc/zte/zx296702-spdif.c | 370 +++++++++++++++++ 13 files changed, 1042 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-hdmi.txt create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-i2s.txt create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-spdif.txt create mode 100644 include/sound/zx_hdmi_audio.h create mode 100644 sound/soc/codecs/zx296702_hdmi.c create mode 100644 sound/soc/zte/Kconfig create mode 100644 sound/soc/zte/Makefile create mode 100644 sound/soc/zte/zx296702-i2s.c create mode 100644 sound/soc/zte/zx296702-spdif.c
Signature · 1 line
1.9.1
PATCH v3 1/6 dt: Add documentation for the ZTE SPDIF controller
This patch adds the devicetree documentation for the ZTE zx296702 SPDIF audio controller.
--- .../devicetree/bindings/sound/zte,zx-spdif.txt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-spdif.txt
Documentation/devicetree/bindings/sound/zte,zx-spdif.txt new file +28 -0
@@ -0,0 +1,28 @@ +ZTE ZX296702 SPDIF controller + +Required properties: + - compatible : Must be "zte,zx296702-spdif" + - reg : Must contain SPDIF core's registers location and length + - clocks : Pairs of phandle and specifier referencing the controller's clocks. + - clock-names: "tx" for the clock to the SPDIF interface. + - dmas: Pairs of phandle and specifier for the DMA channel that is used by + the core. The core expects one dma channel for transmit. + - dma-names : Must be "tx" + +For more details on the 'dma', 'dma-names', 'clock' and 'clock-names' properties +please check: + * resource-names.txt + * clock/clock-bindings.txt + * dma/dma.txt + +Example: + spdif0: spdif0@0b004000 { + compatible = "zte,zx296702-spdif"; + reg = <0x0b004000 0x1000>; + clocks = <&lsp0clk ZX296702_SPDIF0_DIV>; + clock-names = "tx"; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&dma 4>; + dma-names = "tx"; + status = "okay"; + };
Signature · 1 line
1.9.1
PATCH v3 2/6 dt: Add documentation for the ZTE I2S controller
In reply to Jun NieThis patch adds the devicetree documentation for the ZTE zx296702 I2S audio controller.
--- .../devicetree/bindings/sound/zte,zx-i2s.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
Documentation/devicetree/bindings/sound/zte,zx-i2s.txt new file +44 -0
@@ -0,0 +1,44 @@ +ZTE ZX296702 I2S controller + +Required properties: + - compatible : Must be "zte,zx296702-i2s" + - reg : Must contain I2S core's registers location and length + - clocks : Pairs of phandle and specifier referencing the controller's clocks. + - clock-names: "tx" for the clock to the I2S interface. + - dmas: Pairs of phandle and specifier for the DMA channel that is used by + the core. The core expects two dma channels for transmit. + - dma-names : Must be "tx" and "rx" + +For more details on the 'dma', 'dma-names', 'clock' and 'clock-names' properties +please check: + * resource-names.txt + * clock/clock-bindings.txt + * dma/dma.txt + +Example: + i2s0: i2s0@0b005000 { + #sound-dai-cells = <0>; + compatible = "zte,zx296702-i2s"; + reg = <0x0b005000 0x1000>; + clocks = <&lsp0clk ZX296702_I2S0_DIV>; + clock-names = "tx"; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&dma 5>, <&dma 6>; + dma-names = "tx", "rx"; + status = "okay"; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "zx296702_snd"; + simple-audio-card,format = "left_j"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + sndcpu: simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + + sndcodec: simple-audio-card,codec { + sound-dai = <&acodec>; + }; + };
Signature · 1 line
1.9.1
PATCH v3 3/6 dt: Add doc for the ZTE HDMI audio codec binding
In reply to Jun NieThis patch adds the devicetree documentation for the ZTE zx296702 HDMI audio codec binding.
--- Documentation/devicetree/bindings/sound/zte,zx-hdmi.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-hdmi.txt
Documentation/devicetree/bindings/sound/zte,zx-hdmi.txt new file +10 -0
@@ -0,0 +1,10 @@ +ZTE HDMI ASoC codec binding + +Required properties: + - compatible : Must be "zte,hdmi-audio" + +Example: + acodec: acodec { + #sound-dai-cells = <0>; + compatible = "zte,hdmi-audio"; + };
Signature · 1 line
1.9.1
PATCH v3 4/6 ASoC: zx: Add zx296702 SPDIF support
In reply to Jun NieAdd driver for zx296702 SPDIF controller
--- sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/zte/Kconfig | 8 + sound/soc/zte/Makefile | 1 + sound/soc/zte/zx296702-spdif.c | 370 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 381 insertions(+) create mode 100644 sound/soc/zte/Kconfig create mode 100644 sound/soc/zte/Makefile create mode 100644 sound/soc/zte/zx296702-spdif.c
sound/soc/Kconfig +1 -0
@@ -57,6 +57,7 @@ source "sound/soc/tegra/Kconfig" source "sound/soc/txx9/Kconfig" source "sound/soc/ux500/Kconfig" source "sound/soc/xtensa/Kconfig" +source "sound/soc/zte/Kconfig" # Supported codecs source "sound/soc/codecs/Kconfig"
sound/soc/Makefile +1 -0
@@ -38,3 +38,4 @@ obj-$(CONFIG_SND_SOC) += tegra/ obj-$(CONFIG_SND_SOC) += txx9/ obj-$(CONFIG_SND_SOC) += ux500/ obj-$(CONFIG_SND_SOC) += xtensa/ +obj-$(CONFIG_SND_SOC) += zte/
sound/soc/zte/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +config ZX296702_SPDIF + tristate "ZX296702 spdif" + depends on SOC_ZX296702 || COMPILE_TEST + depends on COMMON_CLK + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Say Y or M if you want to add support for codecs attached to the + zx296702 spdif interface
sound/soc/zte/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ZX296702_SPDIF) += zx296702-spdif.o
sound/soc/zte/zx296702-spdif.c new file +370 -0
370 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 4/6] ASoC: zx: Add zx296702 SPDIF support
On 05/29/2015 03:31 PM, Jun Nie wrote:
[...]
sound/soc/zte/zx296702-spdif.c line 316
Quoted 7 lines
sound/soc/zte/zx296702-spdif.c new file +7
-0+static int zx_spdif_probe (struct platform_device *pdev) +{ +struct resource *res; +struct zx_spdif_info *zx_spdif; +int ret; + + zx_spdif =kzalloc (sizeof (*zx_spdif),GFP_KERNEL );
extra space and devm_
Quoted 12 lines
sound/soc/zte/zx296702-spdif.c new file +12
-0+if (!zx_spdif) +return -ENOMEM ; + + zx_spdif->dai_clk =devm_clk_get (&pdev->dev,"tx" ); +if (IS_ERR (zx_spdif->dai_clk)) { +dev_err (&pdev->dev,"Fail to get clk\n" ); +return PTR_ERR (zx_spdif->dai_clk); + } + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + zx_spdif->mapbase = res->start; + zx_spdif->reg_base =devm_ioremap_resource (&pdev->dev, res);
sound/soc/zte/zx296702-spdif.c line 338
Quoted 10 lines
sound/soc/zte/zx296702-spdif.c new file +10
-0+if (!zx_spdif->reg_base) { +dev_err (&pdev->dev,"ioremap failed!\n" ); +return -EIO ; + } + +zx_spdif_dev_init (zx_spdif->reg_base); +platform_set_drvdata (pdev, zx_spdif); + + ret =snd_soc_register_component (&pdev->dev, &zx_spdif_component, + &zx_spdif_dai,1 );
devm_
Quoted 10 lines
sound/soc/zte/zx296702-spdif.c new file +10
-0+if (ret) { +dev_err (&pdev->dev,"Register DAI failed: %d\n" , ret); +return ret; + } + + ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); +if (ret) +dev_err (&pdev->dev,"Register platform PCM failed: %d\n" , ret); + +return ret;
PATCH v3 5/6 ASoC: zx: Add ZTE zx296702 I2S DAI driver
In reply to Jun NieAdd ZTE zx296702 I2S interface DAI driver
--- sound/soc/zte/Kconfig | 9 + sound/soc/zte/Makefile | 1 + sound/soc/zte/zx296702-i2s.c | 437 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 447 insertions(+) create mode 100644 sound/soc/zte/zx296702-i2s.c
sound/soc/zte/Kconfig +9 -0
@@ -6,3 +6,12 @@ config ZX296702_SPDIF help Say Y or M if you want to add support for codecs attached to the zx296702 spdif interface + +config ZX296702_I2S + tristate "ZX296702 i2s" + depends on SOC_ZX296702 || COMPILE_TEST + depends on COMMON_CLK + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Say Y or M if you want to add support for codecs attached to the + zx296702 i2s interface
sound/soc/zte/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_ZX296702_SPDIF) += zx296702-spdif.o +obj-$(CONFIG_ZX296702_I2S) += zx296702-i2s.o
sound/soc/zte/zx296702-i2s.c new file +437 -0
437 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v3 5/6] ASoC: zx: Add ZTE zx296702 I2S DAI driver
Quoted 1 line · Jun Nie
Add ZTE zx296702 I2S interface DAI driver
This looks good but the Kconfig and Makefile changes depend on the previous patch.
PATCH v3 6/6 ASoC: zx: add zx296702 hdmi codec
In reply to Jun NieAdd zx296702 hdmi codec to enable SPDIF and I2S output via HDMI. The SPDIF/I2S route is exclusive with current software config and need specify which is valid in defconfig.
--- include/sound/zx_hdmi_audio.h | 7 +++ sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 1 + sound/soc/codecs/zx296702_hdmi.c | 121 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 include/sound/zx_hdmi_audio.h create mode 100644 sound/soc/codecs/zx296702_hdmi.c
include/sound/zx_hdmi_audio.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __ZX_HDMI_AUDIO_H__ +#define __ZX_HDMI_AUDIO_H__ + +int zx_hdmi_audio_cfg (int audio_codec,int audio_way, +u32 sample_rate,u32 sample_len); +void zx_hdmi_audio_en (int on); +#endif /* __ZX_HDMI_AUDIO_H__ */
sound/soc/codecs/Kconfig +3 -0
@@ -844,6 +844,9 @@ config SND_SOC_WM9712 config SND_SOC_WM9713 tristate +config SND_SOC_ZX_HDMI + tristate + # Amp config SND_SOC_LM4857 tristate
sound/soc/codecs/Makefile +1 -0
@@ -357,6 +357,7 @@ obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o +obj-$(CONFIG_SND_SOC_ZX_HDMI) += zx296702_hdmi.o # Amp obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
sound/soc/codecs/zx296702_hdmi.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
Quoted 4 lines · Jun Nie
Add zx296702 hdmi codec to enable SPDIF and I2S output via HDMI. The SPDIF/I2S route is exclusive with current software config and need specify which is valid in defconfig.
That's an issue, the hardware configuration should not depend on kernel configuration setting. This makes it impossible to run the same kernel on platforms with conflicting settings. It should be possible to configure this dynamically at boot time based on platform_data/devicetree, etc.
But is this device real hardware anyway?
Quoted 17 lines
Signed-off-by Jun Nie <[email protected]>--- include/sound/zx_hdmi_audio.h | 7 +++ sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 1 + sound/soc/codecs/zx296702_hdmi.c | 121 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+)create mode 100644
include/sound/zx_hdmi_audio.hcreate mode 100644sound/soc/codecs/zx296702_hdmi.cinclude/sound/zx_hdmi_audio.h new file +0
-0
include/sound/zx_hdmi_audio.h line 6
Quoted 6 lines
include/sound/zx_hdmi_audio.h new file +6
-0@@ -0,0 +1,7 @@ +#ifndef __ZX_HDMI_AUDIO_H__ +#define __ZX_HDMI_AUDIO_H__ + +int zx_hdmi_audio_cfg (int audio_codec,int audio_way, +u32 sample_rate,u32 sample_len); +void zx_hdmi_audio_en (int on);
Where is the implementation for these functions? The fact that they seem to operate on global state indicates that something is wrong wit this API.
Quoted 1 line
include/sound/zx_hdmi_audio.h new file +1
-0+#endif /* __ZX_HDMI_AUDIO_H__ */
Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
Quoted 7 lines · Lars-Peter Clausen
Quoted 4 lines · Jun Nie
Add zx296702 hdmi codec to enable SPDIF and I2S output via HDMI. The SPDIF/I2S route is exclusive with current software config and need specify which is valid in defconfig.
Quoted 6 lines
That's an issue, the hardware configuration should not depend on kernel configuration setting. This makes it impossible to run the same kernel on platforms with conflicting settings. It should be possible to configure this dynamically at boot time based on platform_data/devicetree, etc.
But is this device real hardware anyway?
See previous discussions - the SoC has an internal HDMI encoder connected to a S/PDIF IP which can also be brought out directly as that. The solution suggested in the previous discussions was to represent the HDMI IP as a CODEC and connect the S/PDIF IP up to it with a machine driver, I've not looked at this patch yet though.
Re: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
2015-05-29 23:18 GMT+08:00 Mark Brown <[email protected]>:
Quoted 8 lines · Lars-Peter Clausen
Quoted 6 lines · Jun Nie
Quoted 5 lines
Add zx296702 hdmi codec to enable SPDIF and I2S output via HDMI. The SPDIF/I2S route is exclusive with current software config and need specify which is valid in defconfig.
Quoted 6 lines
Quoted 6 lines
That's an issue, the hardware configuration should not depend on kernel configuration setting. This makes it impossible to run the same kernel on platforms with conflicting settings. It should be possible to configure this dynamically at boot time based on platform_data/devicetree, etc.
But is this device real hardware anyway?
It is a ready hardware with HDMI audio configured either from internal SPDIF or I2S interface. Because DAI and CODEC are totally independent in ASoC design, so CODEC does not know what DAI interface is active. I guess I can add a dts property to indicate that from machine dts config.
Quoted 6 lines
See previous discussions - the SoC has an internal HDMI encoder connected to a S/PDIF IP which can also be brought out directly as that. The solution suggested in the previous discussions was to represent the HDMI IP as a CODEC and connect the S/PDIF IP up to it with a machine driver, I've not looked at this patch yet though.
So I need implement dai link in machine audio card driver, while not use simple card and device tree initialization. In this way, I surely can embed HDMI audio codec in HDMI driver. Is that right?
I had try to initialize audio all from dts, so need a HDMI codec dt node to connect with DAI. However, I cannot find a way to create an independent HDMI CODEC dt node because it is brought up from HDMI driver. If my above understanding is correct, a machine level DAI link shall resolve this issue with dropping simple card and DAI link in dts. Thanks for your comments!
BTW: HDMI driver is far from mature, so you did not see HDMI function implementation in this patch serial.
Jun
Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
Quoted 3 lines · Jun Nie
So I need implement dai link in machine audio card driver, while not use simple card and device tree initialization. In this way, I surely can embed HDMI audio codec in HDMI driver. Is that right?
I'm sorry, I don't entirely follow what you're saying here.
Quoted 6 lines
I had try to initialize audio all from dts, so need a HDMI codec dt node to connect with DAI. However, I cannot find a way to create an independent HDMI CODEC dt node because it is brought up from HDMI driver. If my above understanding is correct, a machine level DAI link shall resolve this issue with dropping simple card and DAI link in dts. Thanks for your comments!
If the HDMI encoder is simple I'd expect it to be possible to use it with simple-card. If it isn't then we can look at why.
Quoted 2 lines
BTW: HDMI driver is far from mature, so you did not see HDMI function implementation in this patch serial.
Sure, no problem.
Re: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
2015-06-03 2:13 GMT+08:00 Mark Brown <[email protected]>:
Quoted 7 lines · Jun Nie
Quoted 4 lines
So I need implement dai link in machine audio card driver, while not use simple card and device tree initialization. In this way, I surely can embed HDMI audio codec in HDMI driver. Is that right?
I'm sorry, I don't entirely follow what you're saying here.
I am guessing you suggest me to implement a ASoC board driver, like sound/soc/omap/omap3pandora.c. I can link HDMI codec with DAI with snd_soc_dai_link structure to avoid specify the connection in dts.
Quoted 10 lines
Quoted 7 lines
I had try to initialize audio all from dts, so need a HDMI codec dt node to connect with DAI. However, I cannot find a way to create an independent HDMI CODEC dt node because it is brought up from HDMI driver. If my above understanding is correct, a machine level DAI link shall resolve this issue with dropping simple card and DAI link in dts. Thanks for your comments!
If the HDMI encoder is simple I'd expect it to be possible to use it with simple-card. If it isn't then we can look at why.
Most of devices is initialized from devicetree if not all on my board. So I need fill CODEC/DAI dt node for imple-card in dts. I experience the difficulty that I cannot create HDMI CODEC dt node. Because HDMI CODEC shall be part of HDMI driver and be brought up with direct call to snd_soc_register_codec in HDMI driver probe function per my understanding. Then I do not have an independent dt node for HDMI CODEC, thus cannot link the CODEC to DAI with dts information. Do you see any chance to connect a DAI to an embedded CODEC of HDMI video device? Thank you!
Quoted 5 lines
Quoted 3 lines
BTW: HDMI driver is far from mature, so you did not see HDMI function implementation in this patch serial.
Sure, no problem.
Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
Quoted 7 lines · Jun Nie
2015-06-03 2:13 GMT+08:00 Mark Brown <[email protected]>:
Quoted 5 lines · Jun Nie
Quoted 4 lines
So I need implement dai link in machine audio card driver, while not use simple card and device tree initialization. In this way, I surely can embed HDMI audio codec in HDMI driver. Is that right?
Quoted 5 lines
Quoted 1 line
I'm sorry, I don't entirely follow what you're saying here.
I am guessing you suggest me to implement a ASoC board driver, like
sound/soc/omap/omap3pandora.c. I can link HDMI codec with DAI withsnd_soc_dai_linkstructure to avoid specify the connection in dts.
You can do that if you like, but it's also fine to show the link between the S/PDIF and HDMI IPs in DT if you like.
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
I had try to initialize audio all from dts, so need a HDMI codec dt node to connect with DAI. However, I cannot find a way to create an independent HDMI CODEC dt node because it is brought up from HDMI driver. If my above understanding is correct, a machine level DAI link shall resolve this issue with dropping simple card and DAI link in dts. Thanks for your comments!
If the HDMI encoder is simple I'd expect it to be possible to use it with simple-card. If it isn't then we can look at why.
Quoted 9 lines
Most of devices is initialized from devicetree if not all on my board. So I need fill CODEC/DAI dt node for imple-card in dts. I experience the difficulty that I cannot create HDMI CODEC dt node. Because HDMI CODEC shall be part of HDMI driver and be brought up with direct call to
snd_soc_register_codecin HDMI driver probe function per my understanding. Then I do not have an independent dt node for HDMI CODEC, thus cannot link the CODEC to DAI with dts information. Do you see any chance to connect a DAI to an embedded CODEC of HDMI video device? Thank you!
Are you saying that the HDMI IP doesn't appear in DT at all? If the HDMI IP appears in DT it should be possible to reference it.
Re: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
2015-06-03 19:01 GMT+08:00 Mark Brown <[email protected]>:
Quoted 37 lines · Jun Nie
Quoted 7 lines
2015-06-03 2:13 GMT+08:00 Mark Brown <[email protected]>:
Quoted 5 lines · Jun Nie
Quoted 4 lines
So I need implement dai link in machine audio card driver, while not use simple card and device tree initialization. In this way, I surely can embed HDMI audio codec in HDMI driver. Is that right?
Quoted 5 lines
Quoted 1 line
I'm sorry, I don't entirely follow what you're saying here.
I am guessing you suggest me to implement a ASoC board driver, like
sound/soc/omap/omap3pandora.c. I can link HDMI codec with DAI withsnd_soc_dai_linkstructure to avoid specify the connection in dts.You can do that if you like, but it's also fine to show the link between the S/PDIF and HDMI IPs in DT if you like.
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
I had try to initialize audio all from dts, so need a HDMI codec dt node to connect with DAI. However, I cannot find a way to create an independent HDMI CODEC dt node because it is brought up from HDMI driver. If my above understanding is correct, a machine level DAI link shall resolve this issue with dropping simple card and DAI link in dts. Thanks for your comments!
If the HDMI encoder is simple I'd expect it to be possible to use it with simple-card. If it isn't then we can look at why.
Quoted 9 lines
Most of devices is initialized from devicetree if not all on my board. So I need fill CODEC/DAI dt node for imple-card in dts. I experience the difficulty that I cannot create HDMI CODEC dt node. Because HDMI CODEC shall be part of HDMI driver and be brought up with direct call to
snd_soc_register_codecin HDMI driver probe function per my understanding. Then I do not have an independent dt node for HDMI CODEC, thus cannot link the CODEC to DAI with dts information. Do you see any chance to connect a DAI to an embedded CODEC of HDMI video device? Thank you!
Quoted 2 lines
Are you saying that the HDMI IP doesn't appear in DT at all? If the HDMI IP appears in DT it should be possible to reference it.
Thanks for confirmation. Seems I have much to learn in DT. Will create a CODEC device in HDMI display driver and feed HDMI device to simple card as below to have a try. Thanks!
Do you think other patches are OK to merge except the two HDMI patches?
hdmi: hdmi@0x12340000 {
compatible = "zte,zx296702-hdmi";
reg = <0x12340000 0x1000>;
};sound {
compatible = "simple-audio-card";
simple-audio-card,name = "zx296702_snd";
simple-audio-card,cpu {
sound-dai = <&spdif0>;
};
simple-audio-card,codec {
sound-dai = <&hdmi>;
};
};Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
Quoted 9 lines · Jun Nie
2015-06-03 19:01 GMT+08:00 Mark Brown <[email protected]>:
Quoted 2 lines
Are you saying that the HDMI IP doesn't appear in DT at all? If the HDMI IP appears in DT it should be possible to reference it.
Thanks for confirmation. Seems I have much to learn in DT. Will create a CODEC device in HDMI display driver and feed HDMI device to simple card as below to have a try. Thanks!
Do you think other patches are OK to merge except the two HDMI patches?
Lars had some comments on the S/PDIF driver. I didn't look at the I2S driver yet, I'll try to do that today.
Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
In reply to Jun Nieinclude/sound/zx_hdmi_audio.h line 6
Quoted 3 lines · Jun Nie
include/sound/zx_hdmi_audio.h new file +3
-0+int zx_hdmi_audio_cfg (int audio_codec,int audio_way, +u32 sample_rate,u32 sample_len); +void zx_hdmi_audio_en (int on);
It's a bit hard to review this properly without knowing what these functions do.
sound/soc/codecs/zx296702_hdmi.c line 31
Quoted 13 lines
sound/soc/codecs/zx296702_hdmi.c new file +13
-0+static int zx_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +#ifdef CONFIG_ZX_HDMI_SND_SPDIF +zx_hdmi_audio_cfg (1 ,0 ,params_rate (params), +#endif +#ifdef CONFIG_ZX_HDMI_SND_I2S +zx_hdmi_audio_cfg (1 ,1 ,params_rate (params), +#endif + params_physical_width(params)); + return 0; +}
The magic numbers aren't great and it does seem a bit odd to call both I2S and S/PDIF versions always - but I guess this will be restructured following our discussion in the other thread anyway.
Re: [PATCH v3 6/6] ASoC: zx: add zx296702 hdmi codec
2015-06-04 1:58 GMT+08:00 Mark Brown <[email protected]>:
Quoted 18 lines · Jun Nie
include/sound/zx_hdmi_audio.h line 6
Quoted 4 lines
include/sound/zx_hdmi_audio.h new file +3
-0+int zx_hdmi_audio_cfg (int audio_codec,int audio_way, +u32 sample_rate,u32 sample_len); +void zx_hdmi_audio_en (int on);It's a bit hard to review this properly without knowing what these functions do.
Quoted 9 lines
sound/soc/codecs/zx296702_hdmi.c new file +9
-0+static int zx_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +#ifdef CONFIG_ZX_HDMI_SND_SPDIF + zx_hdmi_audio_cfg(1, 0, params_rate(params), +#endif +#ifdef CONFIG_ZX_HDMI_SND_I2S + zx_hdmi_audio_cfg(1, 1, params_rate(params),
Quoted 8 lines
sound/soc/codecs/zx296702_hdmi.c line 31
Quoted 4 lines
sound/soc/codecs/zx296702_hdmi.c new file +4
-0+#endif + params_physical_width(params)); +return 0 ; +}The magic numbers aren't great and it does seem a bit odd to call both I2S and S/PDIF versions always - but I guess this will be restructured following our discussion in the other thread anyway.
Yes, HDMI audio will be moved into video driver side and I will add a DT property to indicate active HDMI I2S or SPDIF from machine dts.
Will post patches with taking Lars's comments with dropping HDMI stuff.