]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/soc/samsung/goni_wm8994.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / sound / soc / samsung / goni_wm8994.c
similarity index 84%
rename from sound/soc/s3c24xx/goni_wm8994.c
rename to sound/soc/samsung/goni_wm8994.c
index 694f702cc8e2c7c350d26893bb33811e9c8b95ac..34dd9ef1b9c0f1130bb4f4e7716bf7cc68c08a51 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <sound/soc.h>
-#include <sound/soc-dapm.h>
 #include <sound/jack.h>
 #include <asm/mach-types.h>
 #include <mach/gpio.h>
 #include <linux/mfd/wm8994/core.h>
 #include <linux/mfd/wm8994/registers.h>
 #include "../codecs/wm8994.h"
-#include "s3c-dma.h"
-#include "s3c64xx-i2s.h"
+#include "dma.h"
+#include "i2s.h"
+
+#define MACHINE_NAME   0
+#define CPU_VOICE_DAI  1
+
+static const char *aquila_str[] = {
+       [MACHINE_NAME] = "aquila",
+       [CPU_VOICE_DAI] = "aquila-voice-dai",
+};
 
 static struct snd_soc_card goni;
 static struct platform_device *goni_snd_device;
@@ -97,28 +104,34 @@ static const struct snd_soc_dapm_route goni_dapm_routes[] = {
 static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_codec *codec = rtd->codec;
+       struct snd_soc_dapm_context *dapm = &codec->dapm;
        int ret;
 
        /* add goni specific widgets */
-       snd_soc_dapm_new_controls(codec, goni_dapm_widgets,
+       snd_soc_dapm_new_controls(dapm, goni_dapm_widgets,
                        ARRAY_SIZE(goni_dapm_widgets));
 
        /* set up goni specific audio routes */
-       snd_soc_dapm_add_routes(codec, goni_dapm_routes,
+       snd_soc_dapm_add_routes(dapm, goni_dapm_routes,
                        ARRAY_SIZE(goni_dapm_routes));
 
        /* set endpoints to not connected */
-       snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN");
-       snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP");
-       snd_soc_dapm_nc_pin(codec, "LINEOUT1N");
-       snd_soc_dapm_nc_pin(codec, "LINEOUT1P");
-       snd_soc_dapm_nc_pin(codec, "LINEOUT2N");
-       snd_soc_dapm_nc_pin(codec, "LINEOUT2P");
+       snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN");
+       snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP");
+       snd_soc_dapm_nc_pin(dapm, "LINEOUT1N");
+       snd_soc_dapm_nc_pin(dapm, "LINEOUT1P");
+       snd_soc_dapm_nc_pin(dapm, "LINEOUT2N");
+       snd_soc_dapm_nc_pin(dapm, "LINEOUT2P");
 
-       snd_soc_dapm_sync(codec);
+       if (machine_is_aquila()) {
+               snd_soc_dapm_nc_pin(dapm, "SPKOUTRN");
+               snd_soc_dapm_nc_pin(dapm, "SPKOUTRP");
+       }
+
+       snd_soc_dapm_sync(dapm);
 
        /* Headset jack detection */
-       ret = snd_soc_jack_new(&goni, "Headset Jack",
+       ret = snd_soc_jack_new(codec, "Headset Jack",
                        SND_JACK_HEADSET | SND_JACK_MECHANICAL | SND_JACK_AVOUT,
                        &jack);
        if (ret)
@@ -150,12 +163,6 @@ static int goni_hifi_hw_params(struct snd_pcm_substream *substream,
        if (ret < 0)
                return ret;
 
-       /* set the cpu system clock */
-       ret = snd_soc_dai_set_sysclk(cpu_dai, S3C64XX_CLKSRC_PCLK,
-                       0, SND_SOC_CLOCK_IN);
-       if (ret < 0)
-               return ret;
-
        /* set codec DAI configuration */
        ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
                        SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
@@ -236,9 +243,9 @@ static struct snd_soc_dai_link goni_dai[] = {
 {
        .name = "WM8994",
        .stream_name = "WM8994 HiFi",
-       .cpu_dai_name = "s3c64xx-i2s-v4",
+       .cpu_dai_name = "samsung-i2s.0",
        .codec_dai_name = "wm8994-hifi",
-       .platform_name = "s3c24xx-pcm-audio",
+       .platform_name = "samsung-audio",
        .codec_name = "wm8994-codec.0-0x1a",
        .init = goni_wm8994_init,
        .ops = &goni_hifi_ops,
@@ -247,7 +254,7 @@ static struct snd_soc_dai_link goni_dai[] = {
        .stream_name = "Voice",
        .cpu_dai_name = "goni-voice-dai",
        .codec_dai_name = "wm8994-voice",
-       .platform_name = "s3c24xx-pcm-audio",
+       .platform_name = "samsung-audio",
        .codec_name = "wm8994-codec.0-0x1a",
        .ops = &goni_voice_ops,
 },
@@ -263,7 +270,11 @@ static int __init goni_init(void)
 {
        int ret;
 
-       if (!machine_is_goni())
+       if (machine_is_aquila()) {
+               voice_dai.name = aquila_str[CPU_VOICE_DAI];
+               goni_dai[1].cpu_dai_name = aquila_str[CPU_VOICE_DAI];
+               goni.name = aquila_str[MACHINE_NAME];
+       } else if (!machine_is_goni())
                return -ENODEV;
 
        goni_snd_device = platform_device_alloc("soc-audio", -1);
@@ -272,20 +283,25 @@ static int __init goni_init(void)
 
        /* register voice DAI here */
        ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai);
-       if (ret)
+       if (ret) {
+               platform_device_put(goni_snd_device);
                return ret;
+       }
 
        platform_set_drvdata(goni_snd_device, &goni);
        ret = platform_device_add(goni_snd_device);
 
-       if (ret)
+       if (ret) {
+               snd_soc_unregister_dai(&goni_snd_device->dev);
                platform_device_put(goni_snd_device);
+       }
 
        return ret;
 }
 
 static void __exit goni_exit(void)
 {
+       snd_soc_unregister_dai(&goni_snd_device->dev);
        platform_device_unregister(goni_snd_device);
 }