summaryrefslogtreecommitdiff
path: root/sound/soc/ux500/ux500_av8100.c
diff options
context:
space:
mode:
authorOla Lilja <ola.o.lilja@stericsson.com>2010-11-25 18:02:05 +0100
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 15:14:42 +0200
commitfe1e8e8b6b8637eda7fb33dc9b98a4d3ec9d7f37 (patch)
tree6891167a081639c7f2d429fa5dae54edc478bb49 /sound/soc/ux500/ux500_av8100.c
parent0185e37f689cecb899655c4c39bc4797993e0bf7 (diff)
Ux500 ASoC: Multi-component support.
The Ux500 driver is now rewritten to for multi-component support. This includes the Ux500 platform driver, the AV8100 codec-driver, the CG29xx codec-driver and the AB3550 codec-driver. There is now one common machine-driver for all codecs, and all three codecs can be activated indepentantly. Change-Id: I4c942b040306a1d6033ee4d80f9368917cb9b4d3 Signed-off-by: Ola Lilja <ola.o.lilja@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9767 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/10280
Diffstat (limited to 'sound/soc/ux500/ux500_av8100.c')
-rw-r--r--sound/soc/ux500/ux500_av8100.c127
1 files changed, 16 insertions, 111 deletions
diff --git a/sound/soc/ux500/ux500_av8100.c b/sound/soc/ux500/ux500_av8100.c
index 5317670c3b4..25e6a0deb0c 100644
--- a/sound/soc/ux500/ux500_av8100.c
+++ b/sound/soc/ux500/ux500_av8100.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) ST-Ericsson SA 2010
*
- * Author: Ola Lilja (ola.o.lilja@stericsson.com)
+ * Author: Ola Lilja <ola.o.lilja@stericsson.com>
* for ST-Ericsson.
*
* License terms:
@@ -11,42 +11,31 @@
* by the Free Software Foundation.
*/
-#include <linux/io.h>
#include <sound/soc.h>
-
-#include "ux500_pcm.h"
-#include "ux500_msp_dai.h"
-
-#include <linux/spi/spi.h>
-#include <sound/initval.h>
-
#include "../codecs/av8100_audio.h"
-
-static struct platform_device *ux500_av8100_platform_device;
+#include "ux500_av8100.h"
static int ux500_av8100_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
+ struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
-
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ int channels = params_channels(params);
unsigned int tx_mask, fmt;
enum hdmi_channel_allocation hdmi_ca;
enum hdmi_audio_channel_count hdmi_cc;
struct hdmi_audio_settings as;
+ int ret;
- int channels = params_channels(params);
- int ret = 0;
-
- pr_debug("%s: Enter (TDM-mode, channels = %d, name = %s, number = %d).\n",
- __func__,
- channels,
- substream->name,
- substream->number);
-
+ pr_debug("%s: Enter.\n", __func__);
pr_debug("%s: substream->pcm->name = %s.\n", __func__, substream->pcm->name);
pr_debug("%s: substream->pcm->id = %s.\n", __func__, substream->pcm->id);
+ pr_debug("%s: substream->name = %s.\n", __func__, substream->name);
+ pr_debug("%s: substream->number = %d.\n", __func__, substream->number);
+ pr_debug("%s: channels = %d.\n", __func__, channels);
+ pr_debug("%s: DAI-index (Codec): %d\n", __func__, codec_dai->id);
+ pr_debug("%s: DAI-index (Platform): %d\n", __func__, cpu_dai->id);
switch (channels) {
case 1:
@@ -100,7 +89,7 @@ static int ux500_av8100_hw_params(struct snd_pcm_substream *substream,
as.channel_allocation = hdmi_ca;
as.level_shift_value = AV8100_CODEC_LSV_0DB;
as.downmix_inhibit = false;
- ret = av8100_codec_change_hdmi_audio_settings(substream, &as);
+ ret = av8100_codec_change_hdmi_audio_settings(codec_dai, &as);
if (ret < 0) {
pr_err("%s: Unable to change HDMI audio-settings for codec-DAI "
"(av8100_codec_change_hdmi_audio_settings returned %d)!\n",
@@ -155,93 +144,9 @@ static int ux500_av8100_hw_params(struct snd_pcm_substream *substream,
return ret;
}
-
-
-struct snd_soc_dai_link ux500_av8100_dai_links[] = {
+struct snd_soc_ops ux500_av8100_ops[] = {
{
- .name = "hdmi",
- .stream_name = "hdmi",
- .cpu_dai = &ux500_msp_dai[2],
- .codec_dai = &av8100_codec_dai[0],
- .init = NULL,
- .ops = (struct snd_soc_ops[]) {
- {
- .hw_params = ux500_av8100_hw_params,
- }
+ .hw_params = ux500_av8100_hw_params,
}
- },
};
-static struct snd_soc_card ux500_av8100 = {
- .name = "hdmi",
- .probe = NULL,
- .dai_link = ux500_av8100_dai_links,
- .num_links = ARRAY_SIZE(ux500_av8100_dai_links),
- .platform = &ux500_soc_platform,
-};
-
-struct snd_soc_device ux500_av8100_drvdata = {
- .card = &ux500_av8100,
- .codec_dev = &soc_codec_dev_av8100,
-};
-
-static int __init ux500_av8100_soc_init(void)
-{
- int ret = 0;
-
- pr_debug("%s: Enter.\n", __func__);
-
- pr_info("%s: Card name: %s\n",
- __func__,
- ux500_av8100_drvdata.card->name);
-
- pr_debug("%s: DAI-link 0, name: %s\n",
- __func__,
- ux500_av8100_drvdata.card->dai_link[0].name);
- pr_debug("%s: DAI-link 0, stream_name: %s\n",
- __func__,
- ux500_av8100_drvdata.card->dai_link[0].stream_name);
-
- pr_debug("%s: Allocate platform device (%s).\n",
- __func__,
- ux500_av8100_drvdata.card->name);
- ux500_av8100_platform_device = platform_device_alloc("soc-audio", -1);
- if (!ux500_av8100_platform_device)
- return -ENOMEM;
-
- pr_debug("%s: Set platform drvdata (%s).\n",
- __func__,
- ux500_av8100_drvdata.card->name);
- platform_set_drvdata(
- ux500_av8100_platform_device,
- &ux500_av8100_drvdata);
- ux500_av8100_drvdata.dev = &ux500_av8100_platform_device->dev;
-
- pr_debug("%s: Add platform device (%s).\n",
- __func__,
- ux500_av8100_drvdata.card->name);
- ret = platform_device_add(ux500_av8100_platform_device);
- if (ret) {
- pr_err("%s: Error: Failed to add platform device (%s).\n",
- __func__,
- ux500_av8100_drvdata.card->name);
- platform_device_put(ux500_av8100_platform_device);
- }
-
- return ret;
-}
-
-static void __exit ux500_av8100_soc_exit(void)
-{
- pr_debug("%s: Enter.\n", __func__);
-
- pr_debug("%s: Unregister platform device (%s).\n",
- __func__,
- ux500_av8100_drvdata.card->name);
- platform_device_unregister(ux500_av8100_platform_device);
-}
-
-module_init(ux500_av8100_soc_init);
-module_exit(ux500_av8100_soc_exit);
-
-MODULE_LICENSE("GPL v2");