[alsa-devel] [PATCH 00/13] Fix OMAP4+ HDMI audio
This patch set fixes the resource sharing problems between omap-hdmi-dai driver and OMAPDSS HDMI driver. It does it by registering the OMAP HDMI audio related ASoC drivers from OMAPDSS HDMI driver. Platform data structs have been added for omap-hdmi-dai and omap-hdmi-card drivers to pass the information and resources from OMAPDSS HDMI driver.
The idea of this patch set is to fix HDMI audio for the next release after it got broken by OMAPDSS DT changes. It does not mean that I have abandoned the patch set that integrates the omap-hdmi-dai driver into OMAPDSS HDMI driver. The OMAPDSS side of those patches just had some dependencies to the recent ASoC side patches that would have caused problems in the next merge. I'll mail a revised and rebased version of those patches soon.
Best regards, Jyri
Jyri Sarha (13): ARM: omap4.dtsi: Add audio related parametes to hdmi node ARM: omap5.dtsi: Add audio related parameters to hdmi node ARM: OMAP2+: Remove non working OMAP HDMI audio initialization OMAPDSS: hdmi_wp: Add function for getting hdmi_wp physical base address OMAPDSS: hdmi_audio: Add hdmi_audio.c for registering HDMI audio support ASoC: omap-hdmi-dai: Add platform data struct for omap-hdmi-dai driver ASoC: omap-hdmi-card: Add platform data stuct for omap-hdmi-card driver ASoC: omap-hdmi: Changes for registeing the driver from OMAPDSS ASoC: omap-hdmi-card: Changes for registeing the driver from OMAPDSS OMAPDSS: hdmi4: Register HDMI audio ASoC drivers from HDMI driver OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value OMAPDSS: hdmi5: Register HDMI audio ASoC drivers from HDMI driver ASoC: omap: Add Kconfig option for OMAP5 HDMI audio
arch/arm/boot/dts/omap4.dtsi | 2 + arch/arm/boot/dts/omap5.dtsi | 2 + arch/arm/mach-omap2/devices.c | 28 --------- drivers/video/fbdev/omap2/dss/Makefile | 2 +- drivers/video/fbdev/omap2/dss/hdmi.h | 17 ++++- drivers/video/fbdev/omap2/dss/hdmi4.c | 15 +++++ drivers/video/fbdev/omap2/dss/hdmi5.c | 15 +++++ drivers/video/fbdev/omap2/dss/hdmi_audio.c | 92 ++++++++++++++++++++++++++++ drivers/video/fbdev/omap2/dss/hdmi_wp.c | 6 ++ include/sound/omap-hdmi-card-pdata.h | 28 +++++++++ include/sound/omap-hdmi-dai-pdata.h | 31 ++++++++++ sound/soc/omap/Kconfig | 13 +++- sound/soc/omap/omap-hdmi-card.c | 20 ++++-- sound/soc/omap/omap-hdmi.c | 65 +++++--------------- 14 files changed, 253 insertions(+), 83 deletions(-) create mode 100644 drivers/video/fbdev/omap2/dss/hdmi_audio.c create mode 100644 include/sound/omap-hdmi-card-pdata.h create mode 100644 include/sound/omap-hdmi-dai-pdata.h
Adds HDMI audio sDMA properties.
Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/omap4.dtsi | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 649b5cd..335ed54 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -919,6 +919,8 @@ ti,hwmods = "dss_hdmi"; clocks = <&dss_48mhz_clk>, <&dss_sys_clk>; clock-names = "fck", "sys_clk"; + dmas = <&sdma 76>; + dma-names = "audio_tx"; }; }; };
Adds HDMI audio sDMA properties.
Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/omap5.dtsi | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 32c02ce..279a9c7 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -937,6 +937,8 @@ ti,hwmods = "dss_hdmi"; clocks = <&dss_48mhz_clk>, <&dss_sys_clk>; clock-names = "fck", "sys_clk"; + dmas = <&sdma 76>; + dma-names = "audio_tx"; }; }; };
This code is not working currently and it can be removed. There is a conflict in sharing resources with the actual HDMI driver and with the ASoC HDMI audio DAI driver.
Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/mach-omap2/devices.c | 28 ---------------------------- 1 file changed, 28 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index e58609b..4bab682 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -330,33 +330,6 @@ static void omap_init_audio(void) static inline void omap_init_audio(void) {} #endif
-#if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \ - defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE) - -static struct platform_device omap_hdmi_audio = { - .name = "omap-hdmi-audio", - .id = -1, -}; - -static void __init omap_init_hdmi_audio(void) -{ - struct omap_hwmod *oh; - struct platform_device *pdev; - - oh = omap_hwmod_lookup("dss_hdmi"); - if (!oh) - return; - - pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0); - WARN(IS_ERR(pdev), - "Can't build omap_device for omap-hdmi-audio-dai.\n"); - - platform_device_register(&omap_hdmi_audio); -} -#else -static inline void omap_init_hdmi_audio(void) {} -#endif - #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
#include <linux/platform_data/spi-omap2-mcspi.h> @@ -492,7 +465,6 @@ static int __init omap2_init_devices(void) */ omap_init_audio(); omap_init_camera(); - omap_init_hdmi_audio(); omap_init_mbox(); /* If dtb is there, the devices will be created dynamically */ if (!of_have_populated_dt()) {
The hdmi_wp physical base address is needed for hdmi audio dma.
Signed-off-by: Jyri Sarha jsarha@ti.com --- drivers/video/fbdev/omap2/dss/hdmi.h | 2 ++ drivers/video/fbdev/omap2/dss/hdmi_wp.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index fbee078..f644bc8 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -341,6 +341,7 @@ struct hdmi_core_infoframe_avi {
struct hdmi_wp_data { void __iomem *base; + phys_addr_t phys_base; };
struct hdmi_pll_data { @@ -410,6 +411,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp, void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt, struct omap_video_timings *timings, struct hdmi_config *param); int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp); +phys_addr_t hdmi_wp_get_phys_addr(struct hdmi_wp_data *wp);
/* HDMI PLL funcs */ int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp); diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c b/drivers/video/fbdev/omap2/dss/hdmi_wp.c index a16a190..bee6df3 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c @@ -264,6 +264,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp) temp_res.end = temp_res.start + WP_SIZE - 1; res = &temp_res; } + wp->phys_base = res->start;
wp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!wp->base) { @@ -273,3 +274,8 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
return 0; } + +phys_addr_t hdmi_wp_get_phys_addr(struct hdmi_wp_data *wp) +{ + return wp->phys_base; +}
HDMI audio is implemented using ASoC component drivers. The drivers were earlier registered from under mach-omap2 but that code had problems with sharing the HDMI resources. This commit adds functions for registering the ASoC drivers needed for HDMI audio from HDMI driver itself.
Signed-off-by: Jyri Sarha jsarha@ti.com --- drivers/video/fbdev/omap2/dss/Makefile | 2 +- drivers/video/fbdev/omap2/dss/hdmi.h | 12 ++++ drivers/video/fbdev/omap2/dss/hdmi_audio.c | 92 ++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 drivers/video/fbdev/omap2/dss/hdmi_audio.c
diff --git a/drivers/video/fbdev/omap2/dss/Makefile b/drivers/video/fbdev/omap2/dss/Makefile index 390ab74..7ea2d7c 100644 --- a/drivers/video/fbdev/omap2/dss/Makefile +++ b/drivers/video/fbdev/omap2/dss/Makefile @@ -11,7 +11,7 @@ omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \ - hdmi_phy.o + hdmi_phy.o hdmi_audio.o omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index f644bc8..3ddb5f8 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -434,6 +434,18 @@ int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep, struct hdmi_phy_data *phy);
#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || defined(CONFIG_OMAP5_DSS_HDMI_AUDIO) +struct hdmi_audio_data { + struct platform_device *cpudai_pdev; + struct platform_device *codec_pdev; + struct platform_device *card_pdev; +}; + +int hdmi_audio_register(struct platform_device *pdev, + struct hdmi_audio_data *data, + struct omap_dss_device *hdmi, + struct hdmi_wp_data *wp); +void hdmi_audio_unregister(struct hdmi_audio_data *data); + int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts); int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable); int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable); diff --git a/drivers/video/fbdev/omap2/dss/hdmi_audio.c b/drivers/video/fbdev/omap2/dss/hdmi_audio.c new file mode 100644 index 0000000..2a485f7 --- /dev/null +++ b/drivers/video/fbdev/omap2/dss/hdmi_audio.c @@ -0,0 +1,92 @@ +/* + * OMAP4+ HDMI audio + * + * Copyright (C) 2014 Texas Instruments Incorporated + * + * Authors: Jyri Sarha jsarha@ti.com + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/err.h> +#include <linux/string.h> +#include <linux/platform_device.h> +#include <linux/of_dma.h> +#include <linux/dmaengine.h> +#include <sound/omap-hdmi-dai-pdata.h> +#include <sound/omap-hdmi-card-pdata.h> + +#include "hdmi.h" + +static struct asoc_omap_hdmi_dai_pdata dai_pdata; +struct asoc_omap_hdmi_card_pdata card_pdata; + +int hdmi_audio_register(struct platform_device *pdev, + struct hdmi_audio_data *data, + struct omap_dss_device *hdmi, + struct hdmi_wp_data *wp) +{ + struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct dma_chan *dma_ch; + struct resource *res; + + dai_pdata.dssdev = hdmi; + dai_pdata.dma_addr = hdmi_wp_get_phys_addr(wp) + HDMI_WP_AUDIO_DATA; + + dma_ch = of_dma_request_slave_channel(np, "audio_tx"); + if (IS_ERR(dma_ch)) { + dev_info(dev, "Could not get dma request channel from dts.\n"); + /* Revert to hard coding. The DMA req channel is the + same on all supported hw. */ + dai_pdata.dma_req = 76; + } else { + dai_pdata.dma_req = dma_ch->chan_id; + /* We only peeked the chan_id for pdata and let dai + driver take the DMA channel. */ + dma_release_channel(dma_ch); + } + + data->cpudai_pdev = + platform_device_register_data(dev, "omap-hdmi-audio-dai", 0, + &dai_pdata, sizeof(dai_pdata)); + if (IS_ERR(data->cpudai_pdev)) + return PTR_ERR(data->cpudai_pdev); + + data->codec_pdev = + platform_device_register_data(dev, "hdmi-audio-codec", + 0, NULL, 0); + if (IS_ERR(data->codec_pdev)) { + platform_device_unregister(data->cpudai_pdev); + return PTR_ERR(data->codec_pdev); + } + + card_pdata.cpudai_name = dev_name(&data->cpudai_pdev->dev); + card_pdata.codec_name = dev_name(&data->codec_pdev->dev); + data->card_pdev = + platform_device_register_data(dev, "omap-hdmi-audio", 0, + &card_pdata, sizeof(card_pdata)); + if (IS_ERR(data->card_pdev)) { + platform_device_unregister(data->cpudai_pdev); + platform_device_unregister(data->codec_pdev); + return PTR_ERR(data->card_pdev); + } + return 0; +} + +void hdmi_audio_unregister(struct hdmi_audio_data *data) +{ + platform_device_unregister(data->cpudai_pdev); + platform_device_unregister(data->codec_pdev); + platform_device_unregister(data->card_pdev); +}
Provide the means to pass OMAPDSS HDMI resources over to omap-hdmi-dai driver when the OMAPDSS driver registers the DAI driver.
Signed-off-by: Jyri Sarha jsarha@ti.com --- include/sound/omap-hdmi-dai-pdata.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/sound/omap-hdmi-dai-pdata.h
diff --git a/include/sound/omap-hdmi-dai-pdata.h b/include/sound/omap-hdmi-dai-pdata.h new file mode 100644 index 0000000..337c859 --- /dev/null +++ b/include/sound/omap-hdmi-dai-pdata.h @@ -0,0 +1,31 @@ +/* + * omap-hdmi-dai-pdata.h + * + * Platform data for OMAP ALSA SoC DAI driver for HDMI audio on OMAP4+ + * processors. + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ + * Authors: Jyri Sarha jsarha@ti.com + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef __OMAP_HDMI_DAI_PDATA_H__ +#define __OMAP_HDMI_DAI_PDATA_H__ + +struct omap_dss_device; + +struct asoc_omap_hdmi_dai_pdata { + struct omap_dss_device *dssdev; + dma_addr_t dma_addr; + unsigned int dma_req; +}; + +#endif
The names of the needed ASoC component drivers need to be passed to the omap-hdmi-card driver for it to find them.
Signed-off-by: Jyri Sarha jsarha@ti.com --- include/sound/omap-hdmi-card-pdata.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/sound/omap-hdmi-card-pdata.h
diff --git a/include/sound/omap-hdmi-card-pdata.h b/include/sound/omap-hdmi-card-pdata.h new file mode 100644 index 0000000..f70495b --- /dev/null +++ b/include/sound/omap-hdmi-card-pdata.h @@ -0,0 +1,28 @@ +/* + * omap-hdmi-card-pdata.h + * + * Platform data for OMAP ALSA SoC card driver for HDMI audio on OMAP4+ + * processors. + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ + * Authors: Jyri Sarha jsarha@ti.com + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef __OMAP_HDMI_CARD_PDATA_H__ +#define __OMAP_HDMI_CARD_PDATA_H__ + +struct asoc_omap_hdmi_card_pdata { + const char *cpudai_name; + const char *codec_name; +}; + +#endif
The old OMAP HDMI audio registering from arch/arm/mach-omap2/devices.c was broken. The new approach is to register it from OMAPDSS HDMI driver. The commit does the necessary changes for this approach to omap-hdmi-dai driver.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/omap/omap-hdmi.c | 65 ++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 48 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 537a1ec..ed0a37c 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -35,6 +35,7 @@ #include <sound/dmaengine_pcm.h> #include <video/omapdss.h>
+#include <sound/omap-hdmi-dai-pdata.h> #include "omap-hdmi.h" #include "omap-pcm.h"
@@ -65,7 +66,7 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, return err; }
- if (!priv->dssdev->driver->audio_supported(priv->dssdev)) { + if (!priv->dssdev->ops.hdmi->audio_supported(priv->dssdev)) { dev_err(dai->dev, "audio not supported\n"); return -ENODEV; } @@ -80,7 +81,7 @@ static int omap_hdmi_dai_prepare(struct snd_pcm_substream *substream, { struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
- return priv->dssdev->driver->audio_enable(priv->dssdev); + return priv->dssdev->ops.hdmi->audio_enable(priv->dssdev); }
static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, @@ -206,7 +207,7 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, priv->dss_audio.iec = iec; priv->dss_audio.cea = cea;
- err = priv->dssdev->driver->audio_config(priv->dssdev, + err = priv->dssdev->ops.hdmi->audio_config(priv->dssdev, &priv->dss_audio);
return err; @@ -222,12 +223,12 @@ static int omap_hdmi_dai_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - err = priv->dssdev->driver->audio_start(priv->dssdev); + err = priv->dssdev->ops.hdmi->audio_start(priv->dssdev); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - priv->dssdev->driver->audio_stop(priv->dssdev); + priv->dssdev->ops.hdmi->audio_stop(priv->dssdev); break; default: err = -EINVAL; @@ -240,7 +241,7 @@ static void omap_hdmi_dai_shutdown(struct snd_pcm_substream *substream, { struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
- priv->dssdev->driver->audio_disable(priv->dssdev); + priv->dssdev->ops.hdmi->audio_disable(priv->dssdev); }
static const struct snd_soc_dai_ops omap_hdmi_dai_ops = { @@ -267,10 +268,14 @@ static const struct snd_soc_component_driver omap_hdmi_component = {
static int omap_hdmi_probe(struct platform_device *pdev) { - int ret; - struct resource *hdmi_rsrc; + struct asoc_omap_hdmi_dai_pdata *pdata = pdev->dev.platform_data; struct hdmi_priv *hdmi_data; - bool hdmi_dev_found = false; + int ret; + + if (!pdata) { + dev_err(&pdev->dev, "No platform data, bailing out\n"); + return -ENODEV; + }
hdmi_data = devm_kzalloc(&pdev->dev, sizeof(*hdmi_data), GFP_KERNEL); if (hdmi_data == NULL) { @@ -278,48 +283,12 @@ static int omap_hdmi_probe(struct platform_device *pdev) return -ENOMEM; }
- hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!hdmi_rsrc) { - dev_err(&pdev->dev, "Cannot obtain IORESOURCE_MEM HDMI\n"); - return -ENODEV; - } - - hdmi_data->dma_data.addr = hdmi_rsrc->start + OMAP_HDMI_AUDIO_DMA_PORT; - - hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!hdmi_rsrc) { - dev_err(&pdev->dev, "Cannot obtain IORESOURCE_DMA HDMI\n"); - return -ENODEV; - } - - hdmi_data->dma_req = hdmi_rsrc->start; + hdmi_data->dma_data.addr = pdata->dma_addr; + hdmi_data->dma_req = pdata->dma_req; hdmi_data->dma_data.filter_data = &hdmi_data->dma_req; hdmi_data->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- /* - * TODO: We assume that there is only one DSS HDMI device. Future - * OMAP implementations may support more than one HDMI devices and - * we should provided separate audio support for all of them. - */ - /* Find an HDMI device. */ - for_each_dss_dev(hdmi_data->dssdev) { - omap_dss_get_device(hdmi_data->dssdev); - - if (!hdmi_data->dssdev->driver) { - omap_dss_put_device(hdmi_data->dssdev); - continue; - } - - if (hdmi_data->dssdev->type == OMAP_DISPLAY_TYPE_HDMI) { - hdmi_dev_found = true; - break; - } - } - - if (!hdmi_dev_found) { - dev_err(&pdev->dev, "no driver for HDMI display found\n"); - return -ENODEV; - } + hdmi_data->dssdev = pdata->dssdev;
dev_set_drvdata(&pdev->dev, hdmi_data); ret = snd_soc_register_component(&pdev->dev, &omap_hdmi_component,
The old OMAP HDMI audio registering from arch/arm/mach-omap2/devices.c was broken. The new approach is to register the drivers from OMAPDSS HDMI driver. The commit does the necessary changes for this approach.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/omap/omap-hdmi-card.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c index f649fe8..56c0055 100644 --- a/sound/soc/omap/omap-hdmi-card.c +++ b/sound/soc/omap/omap-hdmi-card.c @@ -26,15 +26,13 @@ #include <sound/soc.h> #include <asm/mach-types.h> #include <video/omapdss.h> +#include <sound/omap-hdmi-card-pdata.h>
#define DRV_NAME "omap-hdmi-audio"
static struct snd_soc_dai_link omap_hdmi_dai = { .name = "HDMI", .stream_name = "HDMI", - .cpu_dai_name = "omap-hdmi-audio-dai", - .platform_name = "omap-hdmi-audio-dai", - .codec_name = "hdmi-audio-codec", .codec_dai_name = "hdmi-hifi", };
@@ -47,14 +45,28 @@ static struct snd_soc_card snd_soc_omap_hdmi = {
static int omap_hdmi_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct asoc_omap_hdmi_card_pdata *pdata = dev->platform_data; struct snd_soc_card *card = &snd_soc_omap_hdmi; int ret;
+ if (!pdata) { + dev_err(dev, "No platform data, bailing out\n"); + return -ENODEV; + } + card->dev = &pdev->dev;
+ omap_hdmi_dai.cpu_dai_name = + devm_kstrdup(dev, pdata->cpudai_name, GFP_KERNEL); + omap_hdmi_dai.platform_name = + devm_kstrdup(dev, pdata->cpudai_name, GFP_KERNEL); + omap_hdmi_dai.codec_name = + devm_kstrdup(dev, pdata->codec_name, GFP_KERNEL); + ret = snd_soc_register_card(card); if (ret) { - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + dev_err(dev, "snd_soc_register_card failed (%d)\n", ret); card->dev = NULL; return ret; }
The registering is best done here to share the resources owned by OMAPDSS HDMI driver with ASoC DAI and platform drivers.
Signed-off-by: Jyri Sarha jsarha@ti.com --- drivers/video/fbdev/omap2/dss/hdmi4.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index 626aad2..62ad1d9 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c @@ -52,6 +52,9 @@ static struct { struct clk *sys_clk; struct regulator *vdda_hdmi_dac_reg;
+#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + struct hdmi_audio_data audio; +#endif bool core_enabled;
struct omap_dss_device output; @@ -736,6 +739,15 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_init_output(pdev);
+#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + r = hdmi_audio_register(pdev, &hdmi.audio, &hdmi.output, &hdmi.wp); + if (r) { + DSSERR("Registering HDMI audio failed\n"); + hdmi_uninit_output(pdev); + pm_runtime_disable(&pdev->dev); + return r; + } +#endif dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0; @@ -743,6 +755,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) { +#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + hdmi_audio_unregister(&hdmi.audio); +#endif hdmi_uninit_output(pdev);
pm_runtime_disable(&pdev->dev);
The OMAP5 HDMI audio implementation needs HDMI_AUDIO_LAYOUT_6CH in hdmi_core_audio_layout enum. I found the correct value from ti-linux 3.8 tree.
Signed-off-by: Jyri Sarha jsarha@ti.com --- drivers/video/fbdev/omap2/dss/hdmi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index 3ddb5f8..c9efc92 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -159,7 +159,8 @@ enum hdmi_audio_blk_strt_end_sig {
enum hdmi_core_audio_layout { HDMI_AUDIO_LAYOUT_2CH = 0, - HDMI_AUDIO_LAYOUT_8CH = 1 + HDMI_AUDIO_LAYOUT_8CH = 1, + HDMI_AUDIO_LAYOUT_6CH = 2 };
enum hdmi_core_cts_mode {
The registering is best done here to share the resources owned by OMAPDSS HDMI driver with ASoC DAI and platform drivers.
Signed-off-by: Jyri Sarha jsarha@ti.com --- drivers/video/fbdev/omap2/dss/hdmi5.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index c468b9e..1ba387b 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c @@ -57,6 +57,9 @@ static struct { struct clk *sys_clk; struct regulator *vdda_reg;
+#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO) + struct hdmi_audio_data audio; +#endif bool core_enabled;
struct omap_dss_device output; @@ -761,6 +764,15 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_init_output(pdev);
+#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO) + r = hdmi_audio_register(pdev, &hdmi.audio, &hdmi.output, &hdmi.wp); + if (r) { + DSSERR("Registering HDMI audio failed\n"); + hdmi_uninit_output(pdev); + pm_runtime_disable(&pdev->dev); + return r; + } +#endif dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0; @@ -768,6 +780,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) { +#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO) + hdmi_audio_unregister(&hdmi.audio); +#endif hdmi_uninit_output(pdev);
pm_runtime_disable(&pdev->dev);
Adds SND_OMAP_SOC_OMAP5_HDMI config option for OMAP5 HDMI audio support.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/omap/Kconfig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index d44463a..697e1b8 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -101,7 +101,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040 - PandaBoardES (4460)
config SND_OMAP_SOC_OMAP_HDMI - tristate "SoC Audio support for Texas Instruments OMAP HDMI" + tristate "SoC Audio support for Texas Instruments OMAP4 HDMI" depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS select SND_OMAP_SOC_HDMI select SND_SOC_HDMI_CODEC @@ -110,6 +110,17 @@ config SND_OMAP_SOC_OMAP_HDMI Say Y if you want to add support for SoC HDMI audio on Texas Instruments OMAP4 chips
+ +config SND_OMAP_SOC_OMAP5_HDMI + tristate "SoC Audio support for Texas Instruments OMAP5 HDMI" + depends on SND_OMAP_SOC && OMAP5_DSS_HDMI && OMAP2_DSS + select SND_OMAP_SOC_HDMI + select SND_SOC_HDMI_CODEC + select OMAP5_DSS_HDMI_AUDIO + help + Say Y if you want to add support for SoC HDMI audio on Texas Instruments + OMAP5 chips + config SND_OMAP_SOC_OMAP3_PANDORA tristate "SoC Audio support for OMAP3 Pandora" depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
participants (1)
-
Jyri Sarha