[alsa-devel] [PATCH 00/11] ASoC: OMAP: HDMI: Use DSS audio interface and prepare for OMAP5
Hello,
The ASoC HDMI codec used to be embedded in the DSS HDMI driver. In order to give the OMAP HDMI code a more logical arrangement and to remove some dependency breaks[1][2], such ASoC HDMI codec was removed[3]. Instead, the DSS HDMI audio functionality[4] is now provided through the new DSS device driver audio interface [5]. Hence, the ASoC HDMI support for OMAP needs to be changed to use this new DSS device driver audio interface. Under this new approach:
* The HDMI audio functionality provided by the OMAP is now regarded as a CPU DAI rather than a codec. Hence, the CPU DAI will perform the operations that were performed previously by the codec (using the DSS dev driver audio interface). * A new ASoC HDMI OMAP codec is introduced as a dummy component. In the future, this component will examine the features supported by the sink and limit the number of channels, sample rates and formats that are exposed to the user.
Also, this set of patches paves the way to the introduction of the HDMI audio functionality for OMAP5. The goal is to use the same set of ASoC drivers for OMAP4 and OMAP5 (DSS will be in charge of selecting the correct set of functions at run time). For this, several patches are submitted for:
* Generalizing the build files to encompass not only OMAP4. * In the HDMI sound card driver, renaming the the functions and structures from omap4_ to omap_.
This set includes the suggestions and improvements that Mark Brown kindly provided some time ago [6][7].
Please note that this set of patches will not build unless the patches from [4], [5] and [8] are present. All these patches have been accepted and should be upstream for K3.5.
This implementation was validated on top of: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v3.4-rc7
and Liam Girdwood's: git://gitorious.org/omap-audio/linux-audio.git lrg/topic/3.5-dev
Thanks,
Ricardo
[1] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67295.html [2] http://www.spinics.net/lists/linux-omap/msg66178.html [3] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67809.html [4] http://www.spinics.net/lists/linux-omap/msg69466.html [5] http://www.spinics.net/lists/linux-omap/msg69451.html [6] http://mailman.alsa-project.org/pipermail/alsa-devel/2012-February/049064.ht... [7] http://mailman.alsa-project.org/pipermail/alsa-devel/2012-February/049065.ht... [8] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg66600.html
Ricardo Neri (11): ASoC: OMAP: HDMI: Introduce codec ASoC: OMAP: HDMI: Update the platform device names ASoC: OMAP: HDMI: Change error values in HDMI CPU DAI ASoC: OMAP: HDMI: Create a structure for private data of the CPU DAI ASoC: OMAP: HDMI: Use the DSS audio interface ASoC: OMAP: HDMI: Expand configuration of hw_params ASoC: OMAP: HDMI: Improve how the display state is verified ASoC: OMAP: HDMI: Expand capabilities of the HDMI DAI ASoC: OMAP: HDMI: Make build config options more generic ASoC: OMAP: HDMI: Make sound card naming more generic ASoC: OMAP: HDMI: Rename sound card driver
sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/omap-hdmi.c | 69 +++++++++++ sound/soc/omap/Kconfig | 8 +- sound/soc/omap/Makefile | 4 +- sound/soc/omap/omap-hdmi-card.c | 87 ++++++++++++++ sound/soc/omap/omap-hdmi.c | 238 +++++++++++++++++++++++++++++++++++--- sound/soc/omap/omap-hdmi.h | 4 +- sound/soc/omap/omap4-hdmi-card.c | 121 ------------------- 9 files changed, 395 insertions(+), 142 deletions(-) create mode 100644 sound/soc/codecs/omap-hdmi.c create mode 100644 sound/soc/omap/omap-hdmi-card.c delete mode 100644 sound/soc/omap/omap4-hdmi-card.c
Introduce codec for HDMI. At the moment, this is a dummy codec. In the future it will parse the EDID to modify the supported parameters, such as the number of channels and the sample rates. At the moment, it blindly supports all the sample rates and audio channels described in the HDMI 1.4a specification.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/codecs/Kconfig | 4 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/omap-hdmi.c | 69 ++++++++++++++++++++++++++++++++++++++++++ sound/soc/omap/Kconfig | 1 + 4 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/omap-hdmi.c
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 59d8efa..7cac665 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -42,6 +42,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9768 if I2C select SND_SOC_MAX9877 if I2C + select SND_SOC_OMAP_HDMI_CODEC if OMAP4_DSS_HDMI select SND_SOC_PCM3008 select SND_SOC_RT5631 if I2C select SND_SOC_SGTL5000 if I2C @@ -226,6 +227,9 @@ config SND_SOC_MAX98095 config SND_SOC_MAX9850 tristate
+config SND_SOC_OMAP_HDMI_CODEC + tristate + config SND_SOC_PCM3008 tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 6662eb0..7e475c9 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -29,6 +29,7 @@ snd-soc-max9768-objs := max9768.o snd-soc-max98088-objs := max98088.o snd-soc-max98095-objs := max98095.o snd-soc-max9850-objs := max9850.o +snd-soc-omap-hdmi-codec-objs := omap-hdmi.o snd-soc-pcm3008-objs := pcm3008.o snd-soc-rt5631-objs := rt5631.o snd-soc-sgtl5000-objs := sgtl5000.o @@ -135,6 +136,7 @@ obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o +obj-$(CONFIG_SND_SOC_OMAP_HDMI_CODEC) += snd-soc-omap-hdmi-codec.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o diff --git a/sound/soc/codecs/omap-hdmi.c b/sound/soc/codecs/omap-hdmi.c new file mode 100644 index 0000000..1bf5c74 --- /dev/null +++ b/sound/soc/codecs/omap-hdmi.c @@ -0,0 +1,69 @@ +/* + * ALSA SoC codec driver for HDMI audio on OMAP processors. + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Ricardo Neri ricardo.neri@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ +#include <linux/module.h> +#include <sound/soc.h> + +#define DRV_NAME "hdmi-audio-codec" + +static struct snd_soc_codec_driver omap_hdmi_codec; + +static struct snd_soc_dai_driver omap_hdmi_codec_dai = { + .name = "omap-hdmi-hifi", + .playback = { + .channels_min = 2, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_32000 | + SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + }, +}; + +static __devinit int omap_hdmi_codec_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, &omap_hdmi_codec, + &omap_hdmi_codec_dai, 1); +} + +static __devexit int omap_hdmi_codec_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + return 0; +} + +static struct platform_driver omap_hdmi_codec_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, + + .probe = omap_hdmi_codec_probe, + .remove = __devexit_p(omap_hdmi_codec_remove), +}; + +module_platform_driver(omap_hdmi_codec_driver); + +MODULE_AUTHOR("Ricardo Neri ricardo.neri@ti.com"); +MODULE_DESCRIPTION("ASoC OMAP HDMI codec driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index deafbfa..9ccfa5e 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -113,6 +113,7 @@ config SND_OMAP_SOC_OMAP4_HDMI tristate "SoC Audio support for Texas Instruments OMAP4 HDMI" depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS && ARCH_OMAP4 select SND_OMAP_SOC_HDMI + select SND_SOC_OMAP_HDMI_CODEC help Say Y if you want to add support for SoC HDMI audio on Texas Instruments OMAP4 chips
On Fri, May 18, 2012 at 01:42:33AM -0500, Ricardo Neri wrote:
Introduce codec for HDMI. At the moment, this is a dummy codec. In the future it will parse the EDID to modify the supported parameters, such as the number of channels and the sample rates. At the moment, it blindly supports all the sample rates and audio channels described in the HDMI 1.4a specification.
Applied this one, though I had to manually fix up the Kconfig and Makefile - you should always submit against the current development tree.
On 05/18/2012 11:32 AM, Mark Brown wrote:
On Fri, May 18, 2012 at 01:42:33AM -0500, Ricardo Neri wrote:
Introduce codec for HDMI. At the moment, this is a dummy codec. In the future it will parse the EDID to modify the supported parameters, such as the number of channels and the sample rates. At the moment, it blindly supports all the sample rates and audio channels described in the HDMI 1.4a specification.
Applied this one, though I had to manually fix up the Kconfig and Makefile - you should always submit against the current development tree.
Thanks Mark! Sorry for the inconvenience, I will use the development tree in the future.
In order to utilize the new OMAP HDMI codec and the updated name of the device of the CPU DAI, update the names at the drivers accordingly.
While there, also update the name of the machine driver to be more generic and encompass more OMAP processors featuring HDMI and not only OMAP4.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap-hdmi.c | 2 +- sound/soc/omap/omap4-hdmi-card.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 38e0def..0925a46 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -35,7 +35,7 @@ #include "omap-pcm.h" #include "omap-hdmi.h"
-#define DRV_NAME "hdmi-audio-dai" +#define DRV_NAME "omap-hdmi-audio-dai"
static struct omap_pcm_dma_data omap_hdmi_dai_dma_params = { .name = "HDMI playback", diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 28d689b..99e96c6 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -27,7 +27,7 @@ #include <asm/mach-types.h> #include <video/omapdss.h>
-#define DRV_NAME "omap4-hdmi-audio" +#define DRV_NAME "omap-hdmi-audio"
static int omap4_hdmi_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -65,10 +65,10 @@ static struct snd_soc_ops omap4_hdmi_dai_ops = { static struct snd_soc_dai_link omap4_hdmi_dai = { .name = "HDMI", .stream_name = "HDMI", - .cpu_dai_name = "hdmi-audio-dai", + .cpu_dai_name = "omap-hdmi-audio-dai", .platform_name = "omap-pcm-audio", - .codec_name = "omapdss_hdmi", - .codec_dai_name = "hdmi-audio-codec", + .codec_name = "hdmi-audio-codec", + .codec_dai_name = "omap-hdmi-hifi", .ops = &omap4_hdmi_dai_ops, };
@@ -106,7 +106,7 @@ static int __devexit omap4_hdmi_remove(struct platform_device *pdev)
static struct platform_driver omap4_hdmi_driver = { .driver = { - .name = "omap4-hdmi-audio", + .name = DRV_NAME, .owner = THIS_MODULE, }, .probe = omap4_hdmi_probe,
When getting the needed resources fails, return -ENODEV. This is more in line with other drivers do and it gives a more descriptive error.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap-hdmi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 0925a46..b889f76 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -106,7 +106,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!hdmi_rsrc) { dev_err(&pdev->dev, "Cannot obtain IORESOURCE_MEM HDMI\n"); - return -EINVAL; + return -ENODEV; }
omap_hdmi_dai_dma_params.port_addr = hdmi_rsrc->start @@ -115,7 +115,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!hdmi_rsrc) { dev_err(&pdev->dev, "Cannot obtain IORESOURCE_DMA HDMI\n"); - return -EINVAL; + return -ENODEV; }
omap_hdmi_dai_dma_params.dma_req = hdmi_rsrc->start;
Hi list, After looking a number of times at the code to start multiple devices at the same time, I wonder if the alsa-lib snd_pcm_info_get_sync() routine works at all.
The documentation says "Because the drivers cannot guarantee the synchronization (sample resolution) on hardware lacking this feature, the #snd_pcm_info_get_sync() function returns synchronization ID, which is equal for hardware synchronized streams".
It seems some drivers set a value when opening the stream using the snd_pcm_set_sync() helper. What exactly is the purpose of this id and what should it be used for in user-space? The value returned seems to be the card#, the same value no matter if streams are synchronized or not.
This is confirmed by a simple experiment, When I tried with a test program on my HDAudio laptop, the ID is consistently zero, no matter if I called snd_pcm_link() to synchronize devices or not. That doesn't seem right. If two devices aren't linked, the information reported my the kernel should be clearly invalid.
What exactly was this intent of this routine, why would a sync_id be needed anyway and has anyone used it successfully?
Thanks, -Pierre
Pierre-Louis Bossart wrote:
After looking a number of times at the code to start multiple devices at the same time, I wonder if the alsa-lib snd_pcm_info_get_sync() routine works at all.
The documentation says "Because the drivers cannot guarantee the synchronization (sample resolution) on hardware lacking this feature, the #snd_pcm_info_get_sync() function returns synchronization ID, which is equal for hardware synchronized streams".
This is somewhat misleading.
It seems some drivers set a value when opening the stream using the snd_pcm_set_sync() helper. What exactly is the purpose of this id
This ID has the same value for two streams if those streams _can_ be started at exactly the same time.
The value returned seems to be the card#, the same value no matter if streams are synchronized or not.
Typically, a card that supports simultaneous starting of multiple streams does so for all its streams (with a register that has one bit for each stream), so the card number is the correct ID to describe this relationship.
Regards, Clemens
Create a struct hdmi_priv to store the relevant data of the CPU DAI driver. As more data is added to the driver, having all the data in the same location eases its handling. At the moment, only the DMA configuration parameters are included in the structure.
Also, the required memory is allocated using devm_kzalloc rather than using a static global variable.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap-hdmi.c | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index b889f76..a6656b2 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -37,9 +37,8 @@
#define DRV_NAME "omap-hdmi-audio-dai"
-static struct omap_pcm_dma_data omap_hdmi_dai_dma_params = { - .name = "HDMI playback", - .sync_mode = OMAP_DMA_SYNC_PACKET, +struct hdmi_priv { + struct omap_pcm_dma_data dma_params; };
static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, @@ -62,23 +61,24 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { + struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); int err = 0;
switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: - omap_hdmi_dai_dma_params.packet_size = 16; + priv->dma_params.packet_size = 16; break; case SNDRV_PCM_FORMAT_S24_LE: - omap_hdmi_dai_dma_params.packet_size = 32; + priv->dma_params.packet_size = 32; break; default: err = -EINVAL; }
- omap_hdmi_dai_dma_params.data_type = OMAP_DMA_DATA_TYPE_S32; + priv->dma_params.data_type = OMAP_DMA_DATA_TYPE_S32;
snd_soc_dai_set_dma_data(dai, substream, - &omap_hdmi_dai_dma_params); + &priv->dma_params);
return err; } @@ -102,6 +102,13 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) { int ret; struct resource *hdmi_rsrc; + struct hdmi_priv *hdmi_data; + + hdmi_data = devm_kzalloc(&pdev->dev, sizeof(*hdmi_data), GFP_KERNEL); + if (hdmi_data == NULL) { + dev_err(&pdev->dev, "Cannot allocate memory for HDMI data\n"); + return -ENOMEM; + }
hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!hdmi_rsrc) { @@ -109,7 +116,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) return -ENODEV; }
- omap_hdmi_dai_dma_params.port_addr = hdmi_rsrc->start + hdmi_data->dma_params.port_addr = hdmi_rsrc->start + OMAP_HDMI_AUDIO_DMA_PORT;
hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -118,8 +125,11 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) return -ENODEV; }
- omap_hdmi_dai_dma_params.dma_req = hdmi_rsrc->start; + hdmi_data->dma_params.dma_req = hdmi_rsrc->start; + hdmi_data->dma_params.name = "HDMI playback"; + hdmi_data->dma_params.sync_mode = OMAP_DMA_SYNC_PACKET;
+ dev_set_drvdata(&pdev->dev, hdmi_data); ret = snd_soc_register_dai(&pdev->dev, &omap_hdmi_dai); return ret; }
Instead of accessing the HDMI IP directly, the CPU DAI driver takes advantage of the audio interface provided by the DSS device driver. The ASoC driver will link the DSS audio functionality with ALSA by calling the appropriate DSS device driver functions at the relevant moments. For this, three new DAI operations are added: trigger, prepare and shutdown operations.
At the moment, it is assumed that only one HDMI display is available in the system, as it is the case in OMAP4. However, in the future, one DAI for each HDMI display should be provided.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/Kconfig | 1 + sound/soc/omap/omap-hdmi.c | 77 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index 9ccfa5e..13afb2c 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -114,6 +114,7 @@ config SND_OMAP_SOC_OMAP4_HDMI depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS && ARCH_OMAP4 select SND_OMAP_SOC_HDMI select SND_SOC_OMAP_HDMI_CODEC + select OMAP4_DSS_HDMI_AUDIO help Say Y if you want to add support for SoC HDMI audio on Texas Instruments OMAP4 chips diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index a6656b2..ff6132a 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -30,6 +30,7 @@ #include <sound/pcm_params.h> #include <sound/initval.h> #include <sound/soc.h> +#include <video/omapdss.h>
#include <plat/dma.h> #include "omap-pcm.h" @@ -39,6 +40,7 @@
struct hdmi_priv { struct omap_pcm_dma_data dma_params; + struct omap_dss_device *dssdev; };
static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, @@ -57,6 +59,14 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, return 0; }
+static int omap_hdmi_dai_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); + + return priv->dssdev->driver->audio_enable(priv->dssdev); +} + static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -83,6 +93,37 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, return err; }
+static int omap_hdmi_dai_trigger(struct snd_pcm_substream *substream, int cmd, + struct snd_soc_dai *dai) +{ + struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); + int err = 0; + + switch (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); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + priv->dssdev->driver->audio_stop(priv->dssdev); + break; + default: + err = -EINVAL; + } + return err; +} + +static void omap_hdmi_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); + + priv->dssdev->driver->audio_disable(priv->dssdev); +} + static const struct snd_soc_dai_ops omap_hdmi_dai_ops = { .startup = omap_hdmi_dai_startup, .hw_params = omap_hdmi_dai_hw_params, @@ -103,6 +144,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) int ret; struct resource *hdmi_rsrc; struct hdmi_priv *hdmi_data; + bool hdmi_dev_found = false;
hdmi_data = devm_kzalloc(&pdev->dev, sizeof(*hdmi_data), GFP_KERNEL); if (hdmi_data == NULL) { @@ -129,14 +171,49 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev) hdmi_data->dma_params.name = "HDMI playback"; hdmi_data->dma_params.sync_mode = OMAP_DMA_SYNC_PACKET;
+ /* + * 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; + } + dev_set_drvdata(&pdev->dev, hdmi_data); ret = snd_soc_register_dai(&pdev->dev, &omap_hdmi_dai); + return ret; }
static int __devexit omap_hdmi_remove(struct platform_device *pdev) { + struct hdmi_priv *hdmi_data = dev_get_drvdata(&pdev->dev); + snd_soc_unregister_dai(&pdev->dev); + + if (hdmi_data == NULL) { + dev_err(&pdev->dev, "cannot obtain HDMi data\n"); + return -ENODEV; + } + + omap_dss_put_device(hdmi_data->dssdev); return 0; }
Expand the configuration of the hw_params to include the IEC-60958 channel status word and the CEA-861 audio infoframe. The configuration of such structures depends on the snd_pcm_hw_params received. A omap_dss_audio is used to pass the configuration parameters to DSS.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap-hdmi.c | 116 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 115 insertions(+), 1 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index ff6132a..fc4815a 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -30,6 +30,8 @@ #include <sound/pcm_params.h> #include <sound/initval.h> #include <sound/soc.h> +#include <sound/asound.h> +#include <sound/asoundef.h> #include <video/omapdss.h>
#include <plat/dma.h> @@ -40,6 +42,9 @@
struct hdmi_priv { struct omap_pcm_dma_data dma_params; + struct omap_dss_audio dss_audio; + struct snd_aes_iec958 iec; + struct snd_cea_861_aud_if cea; struct omap_dss_device *dssdev; };
@@ -72,6 +77,8 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); + struct snd_aes_iec958 *iec = &priv->iec; + struct snd_cea_861_aud_if *cea = &priv->cea; int err = 0;
switch (params_format(params)) { @@ -82,7 +89,8 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, priv->dma_params.packet_size = 32; break; default: - err = -EINVAL; + dev_err(dai->dev, "format not supported!\n"); + return -EINVAL; }
priv->dma_params.data_type = OMAP_DMA_DATA_TYPE_S32; @@ -90,6 +98,109 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, snd_soc_dai_set_dma_data(dai, substream, &priv->dma_params);
+ /* + * fill the IEC-60958 channel status word + */ + + /* specify IEC-60958-3 (commercial use) */ + iec->status[0] &= ~IEC958_AES0_PROFESSIONAL; + + /* specify that the audio is LPCM*/ + iec->status[0] &= ~IEC958_AES0_NONAUDIO; + + iec->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT; + + iec->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE; + + iec->status[0] |= IEC958_AES1_PRO_MODE_NOTID; + + iec->status[1] = IEC958_AES1_CON_GENERAL; + + iec->status[2] |= IEC958_AES2_CON_SOURCE_UNSPEC; + + iec->status[2] |= IEC958_AES2_CON_CHANNEL_UNSPEC; + + switch (params_rate(params)) { + case 32000: + iec->status[3] |= IEC958_AES3_CON_FS_32000; + break; + case 44100: + iec->status[3] |= IEC958_AES3_CON_FS_44100; + break; + case 48000: + iec->status[3] |= IEC958_AES3_CON_FS_48000; + break; + case 88200: + iec->status[3] |= IEC958_AES3_CON_FS_88200; + break; + case 96000: + iec->status[3] |= IEC958_AES3_CON_FS_96000; + break; + case 176400: + iec->status[3] |= IEC958_AES3_CON_FS_176400; + break; + case 192000: + iec->status[3] |= IEC958_AES3_CON_FS_192000; + break; + default: + dev_err(dai->dev, "rate not supported!\n"); + return -EINVAL; + } + + /* specify the clock accuracy */ + iec->status[3] |= IEC958_AES3_CON_CLOCK_1000PPM; + + /* + * specify the word length. The same word length value can mean + * two different lengths. Hence, we need to specify the maximum + * word length as well. + */ + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + iec->status[4] |= IEC958_AES4_CON_WORDLEN_20_16; + iec->status[4] &= ~IEC958_AES4_CON_MAX_WORDLEN_24; + break; + case SNDRV_PCM_FORMAT_S24_LE: + iec->status[4] |= IEC958_AES4_CON_WORDLEN_24_20; + iec->status[4] |= IEC958_AES4_CON_MAX_WORDLEN_24; + break; + default: + dev_err(dai->dev, "format not supported!\n"); + return -EINVAL; + } + + /* + * Fill the CEA-861 audio infoframe (see spec for details) + */ + + cea->db1_ct_cc = (params_channels(params) - 1) + & CEA861_AUDIO_INFOFRAME_DB1CC; + cea->db1_ct_cc |= CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM; + + cea->db2_sf_ss = CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM; + cea->db2_sf_ss |= CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM; + + cea->db3 = 0; /* not used, all zeros */ + + /* + * The OMAP HDMI IP requires to use the 8-channel channel code when + * transmitting more than two channels. + */ + if (params_channels(params) == 2) + cea->db4_ca = 0x0; + else + cea->db4_ca = 0x13; + + cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED; + /* the expression is trivial but makes clear what we are doing */ + cea->db5_dminh_lsv |= (0 & CEA861_AUDIO_INFOFRAME_DB5_LSV); + + priv->dss_audio.iec = iec; + priv->dss_audio.cea = cea; + + err = priv->dssdev->driver->audio_config(priv->dssdev, + &priv->dss_audio); + return err; }
@@ -127,6 +238,9 @@ static void omap_hdmi_dai_shutdown(struct snd_pcm_substream *substream, static const struct snd_soc_dai_ops omap_hdmi_dai_ops = { .startup = omap_hdmi_dai_startup, .hw_params = omap_hdmi_dai_hw_params, + .prepare = omap_hdmi_dai_prepare, + .trigger = omap_hdmi_dai_trigger, + .shutdown = omap_hdmi_dai_shutdown, };
static struct snd_soc_dai_driver omap_hdmi_dai = {
Before starting to play audio, we need to make sure that the display is active and the current video mode supports audio. instead of using the overlay manager in the machine driver, we use the DSS audio interface's audio_supported function. As we already have a pointer to the correct dssdev, we do not have to look for it every time audio is to be played. Also, the CPU DAI startup function is called earlier than the card hw_param function. Hence and we can detect the state of the display earlier.
While there, add a error message if the constraint cannot be applied.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com
squash to improve err --- sound/soc/omap/omap-hdmi.c | 9 ++++++++- sound/soc/omap/omap4-hdmi-card.c | 34 ---------------------------------- 2 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index fc4815a..ec7c7e6 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -51,6 +51,7 @@ struct hdmi_priv { static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); int err; /* * Make sure that the period bytes are multiple of the DMA packet size. @@ -58,9 +59,15 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, */ err = snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128); - if (err < 0) + if (err < 0) { + dev_err(dai->dev, "could not apply constraint\n"); return err; + }
+ if (!priv->dssdev->driver->audio_supported(priv->dssdev)) { + dev_err(dai->dev, "audio not supported\n"); + return -ENODEV; + } return 0; }
diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 99e96c6..6c3255f 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -29,39 +29,6 @@
#define DRV_NAME "omap-hdmi-audio"
-static int omap4_hdmi_dai_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - int i; - struct omap_overlay_manager *mgr = NULL; - struct device *dev = substream->pcm->card->dev; - - /* Find DSS HDMI device */ - for (i = 0; i < omap_dss_get_num_overlay_managers(); i++) { - mgr = omap_dss_get_overlay_manager(i); - if (mgr && mgr->device - && mgr->device->type == OMAP_DISPLAY_TYPE_HDMI) - break; - } - - if (i == omap_dss_get_num_overlay_managers()) { - dev_err(dev, "HDMI display device not found!\n"); - return -ENODEV; - } - - /* Make sure HDMI is power-on to avoid L3 interconnect errors */ - if (mgr->device->state != OMAP_DSS_DISPLAY_ACTIVE) { - dev_err(dev, "HDMI display is not active!\n"); - return -EIO; - } - - return 0; -} - -static struct snd_soc_ops omap4_hdmi_dai_ops = { - .hw_params = omap4_hdmi_dai_hw_params, -}; - static struct snd_soc_dai_link omap4_hdmi_dai = { .name = "HDMI", .stream_name = "HDMI", @@ -69,7 +36,6 @@ static struct snd_soc_dai_link omap4_hdmi_dai = { .platform_name = "omap-pcm-audio", .codec_name = "hdmi-audio-codec", .codec_dai_name = "omap-hdmi-hifi", - .ops = &omap4_hdmi_dai_ops, };
static struct snd_soc_card snd_soc_omap4_hdmi = {
According to the HDMI specification, a source is permitted to transmit L-PCM audio in the following sample rates: 32kHz, 44.1kHz, 48kHz, 88.2kHz, 96kHz, 176.4kHz or 192kHz.
It also supports up to 8 audio channels.
The sink may not necessarily support all these sample rates and channels. However, as this CPU DAI describes the HDMI source, it makes sense to include them. The limitation of capabilities as supported by the sink should be done in the ASoC HDMI codec.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap-hdmi.c | 2 +- sound/soc/omap/omap-hdmi.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index ec7c7e6..a08245d 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -253,7 +253,7 @@ static const struct snd_soc_dai_ops omap_hdmi_dai_ops = { static struct snd_soc_dai_driver omap_hdmi_dai = { .playback = { .channels_min = 2, - .channels_max = 2, + .channels_max = 8, .rates = OMAP_HDMI_RATES, .formats = OMAP_HDMI_FORMATS, }, diff --git a/sound/soc/omap/omap-hdmi.h b/sound/soc/omap/omap-hdmi.h index 34c298d..6ad2bf4 100644 --- a/sound/soc/omap/omap-hdmi.h +++ b/sound/soc/omap/omap-hdmi.h @@ -28,7 +28,9 @@ #define OMAP_HDMI_AUDIO_DMA_PORT 0x8c
#define OMAP_HDMI_RATES (SNDRV_PCM_RATE_32000 | \ - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) + SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \ + SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000)
#define OMAP_HDMI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE)
Make Kconfig and Makefile more generic to encompass not only OMAP4 but other OMAP processors featuring HDMI.
Also, relax the dependency list to depend only on any OMAP processor supporting OMAP2_DSS and OMAP4_DSS_HDMI. As HDMI support for future OMAP versions is added, the dependency list must change accordingly.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/Kconfig | 6 +++--- sound/soc/omap/Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index 13afb2c..57a2fa7 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -109,9 +109,9 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040 - PandaBoard (4430) - PandaBoardES (4460)
-config SND_OMAP_SOC_OMAP4_HDMI - tristate "SoC Audio support for Texas Instruments OMAP4 HDMI" - depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS && ARCH_OMAP4 +config SND_OMAP_SOC_OMAP_HDMI + tristate "SoC Audio support for Texas Instruments OMAP HDMI" + depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS select SND_OMAP_SOC_HDMI select SND_SOC_OMAP_HDMI_CODEC select OMAP4_DSS_HDMI_AUDIO diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile index 1d656bc..b4ef308 100644 --- a/sound/soc/omap/Makefile +++ b/sound/soc/omap/Makefile @@ -41,4 +41,4 @@ obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o obj-$(CONFIG_SND_OMAP_SOC_ZOOM2) += snd-soc-zoom2.o obj-$(CONFIG_SND_OMAP_SOC_IGEP0020) += snd-soc-igep0020.o -obj-$(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) += snd-soc-omap4-hdmi.o +obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap4-hdmi.o
Rename all the relevant structures, variables and functions to not make specific reference to OMAP4. This is to make the driver encompass future OMAP versions that feature HDMI and not only OMAP4. These changes are only in naming. There are not functional changes.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/omap4-hdmi-card.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 6c3255f..eaa2ea0 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -1,7 +1,7 @@ /* - * omap4-hdmi-card.c + * omap-hdmi-card.c * - * OMAP ALSA SoC machine driver for TI OMAP4 HDMI + * OMAP ALSA SoC machine driver for TI OMAP HDMI * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * Author: Ricardo Neri ricardo.neri@ti.com * @@ -29,7 +29,7 @@
#define DRV_NAME "omap-hdmi-audio"
-static struct snd_soc_dai_link omap4_hdmi_dai = { +static struct snd_soc_dai_link omap_hdmi_dai = { .name = "HDMI", .stream_name = "HDMI", .cpu_dai_name = "omap-hdmi-audio-dai", @@ -38,16 +38,16 @@ static struct snd_soc_dai_link omap4_hdmi_dai = { .codec_dai_name = "omap-hdmi-hifi", };
-static struct snd_soc_card snd_soc_omap4_hdmi = { - .name = "OMAP4HDMI", +static struct snd_soc_card snd_soc_omap_hdmi = { + .name = "OMAPHDMI", .owner = THIS_MODULE, - .dai_link = &omap4_hdmi_dai, + .dai_link = &omap_hdmi_dai, .num_links = 1, };
-static __devinit int omap4_hdmi_probe(struct platform_device *pdev) +static __devinit int omap_hdmi_probe(struct platform_device *pdev) { - struct snd_soc_card *card = &snd_soc_omap4_hdmi; + struct snd_soc_card *card = &snd_soc_omap_hdmi; int ret;
card->dev = &pdev->dev; @@ -61,7 +61,7 @@ static __devinit int omap4_hdmi_probe(struct platform_device *pdev) return 0; }
-static int __devexit omap4_hdmi_remove(struct platform_device *pdev) +static int __devexit omap_hdmi_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev);
@@ -70,18 +70,18 @@ static int __devexit omap4_hdmi_remove(struct platform_device *pdev) return 0; }
-static struct platform_driver omap4_hdmi_driver = { +static struct platform_driver omap_hdmi_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, }, - .probe = omap4_hdmi_probe, - .remove = __devexit_p(omap4_hdmi_remove), + .probe = omap_hdmi_probe, + .remove = __devexit_p(omap_hdmi_remove), };
-module_platform_driver(omap4_hdmi_driver); +module_platform_driver(omap_hdmi_driver);
MODULE_AUTHOR("Ricardo Neri ricardo.neri@ti.com"); -MODULE_DESCRIPTION("OMAP4 HDMI machine ASoC driver"); +MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRV_NAME);
Rename sound card driver source file to encompass not only OMAP4 but future OMAP versions that feature HDMI.
Signed-off-by: Ricardo Neri ricardo.neri@ti.com --- sound/soc/omap/Makefile | 4 +- sound/soc/omap/omap-hdmi-card.c | 87 ++++++++++++++++++++++++++++++++++++++ sound/soc/omap/omap4-hdmi-card.c | 87 -------------------------------------- 3 files changed, 89 insertions(+), 89 deletions(-) create mode 100644 sound/soc/omap/omap-hdmi-card.c delete mode 100644 sound/soc/omap/omap4-hdmi-card.c
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile index b4ef308..0e14dd3 100644 --- a/sound/soc/omap/Makefile +++ b/sound/soc/omap/Makefile @@ -25,7 +25,7 @@ snd-soc-omap3pandora-objs := omap3pandora.o snd-soc-omap3beagle-objs := omap3beagle.o snd-soc-zoom2-objs := zoom2.o snd-soc-igep0020-objs := igep0020.o -snd-soc-omap4-hdmi-objs := omap4-hdmi-card.o +snd-soc-omap-hdmi-card-objs := omap-hdmi-card.o
obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o obj-$(CONFIG_SND_OMAP_SOC_RX51) += snd-soc-rx51.o @@ -41,4 +41,4 @@ obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o obj-$(CONFIG_SND_OMAP_SOC_ZOOM2) += snd-soc-zoom2.o obj-$(CONFIG_SND_OMAP_SOC_IGEP0020) += snd-soc-igep0020.o -obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap4-hdmi.o +obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap-hdmi-card.o diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c new file mode 100644 index 0000000..eaa2ea0 --- /dev/null +++ b/sound/soc/omap/omap-hdmi-card.c @@ -0,0 +1,87 @@ +/* + * omap-hdmi-card.c + * + * OMAP ALSA SoC machine driver for TI OMAP HDMI + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Ricardo Neri ricardo.neri@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include <linux/module.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <asm/mach-types.h> +#include <video/omapdss.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-pcm-audio", + .codec_name = "hdmi-audio-codec", + .codec_dai_name = "omap-hdmi-hifi", +}; + +static struct snd_soc_card snd_soc_omap_hdmi = { + .name = "OMAPHDMI", + .owner = THIS_MODULE, + .dai_link = &omap_hdmi_dai, + .num_links = 1, +}; + +static __devinit int omap_hdmi_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &snd_soc_omap_hdmi; + int ret; + + card->dev = &pdev->dev; + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + card->dev = NULL; + return ret; + } + return 0; +} + +static int __devexit omap_hdmi_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + card->dev = NULL; + return 0; +} + +static struct platform_driver omap_hdmi_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, + .probe = omap_hdmi_probe, + .remove = __devexit_p(omap_hdmi_remove), +}; + +module_platform_driver(omap_hdmi_driver); + +MODULE_AUTHOR("Ricardo Neri ricardo.neri@ti.com"); +MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c deleted file mode 100644 index eaa2ea0..0000000 --- a/sound/soc/omap/omap4-hdmi-card.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * omap-hdmi-card.c - * - * OMAP ALSA SoC machine driver for TI OMAP HDMI - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ - * Author: Ricardo Neri ricardo.neri@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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include <linux/module.h> -#include <sound/pcm.h> -#include <sound/soc.h> -#include <asm/mach-types.h> -#include <video/omapdss.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-pcm-audio", - .codec_name = "hdmi-audio-codec", - .codec_dai_name = "omap-hdmi-hifi", -}; - -static struct snd_soc_card snd_soc_omap_hdmi = { - .name = "OMAPHDMI", - .owner = THIS_MODULE, - .dai_link = &omap_hdmi_dai, - .num_links = 1, -}; - -static __devinit int omap_hdmi_probe(struct platform_device *pdev) -{ - struct snd_soc_card *card = &snd_soc_omap_hdmi; - int ret; - - card->dev = &pdev->dev; - - ret = snd_soc_register_card(card); - if (ret) { - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); - card->dev = NULL; - return ret; - } - return 0; -} - -static int __devexit omap_hdmi_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - card->dev = NULL; - return 0; -} - -static struct platform_driver omap_hdmi_driver = { - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, - .probe = omap_hdmi_probe, - .remove = __devexit_p(omap_hdmi_remove), -}; - -module_platform_driver(omap_hdmi_driver); - -MODULE_AUTHOR("Ricardo Neri ricardo.neri@ti.com"); -MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:" DRV_NAME);
On Fri, May 18, 2012 at 01:42:32AM -0500, Ricardo Neri wrote:
Hello,
The ASoC HDMI codec used to be embedded in the DSS HDMI driver. In order to give the OMAP HDMI code a more logical arrangement and to remove
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
participants (4)
-
Clemens Ladisch
-
Mark Brown
-
Pierre-Louis Bossart
-
Ricardo Neri