aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-19 08:06:18 +1100
committerPaul Kocialkowski <contact@paulk.fr>2013-05-05 18:27:46 +0200
commit3264cb0c2f923278063750d30d4c3fa915110dfb (patch)
treecf585eda8e4d44022408b65ed76006d325ad8673
parent6b165cb5856e4c568147eda2086b41126db749fc (diff)
downloadkernel_goldelico_gta04-3264cb0c2f923278063750d30d4c3fa915110dfb.zip
kernel_goldelico_gta04-3264cb0c2f923278063750d30d4c3fa915110dfb.tar.gz
kernel_goldelico_gta04-3264cb0c2f923278063750d30d4c3fa915110dfb.tar.bz2
Hacking around with sound.
Trying to make sound work on gta04. Still work to do.
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/gtm601.c38
-rw-r--r--sound/soc/codecs/si47xx.c69
-rw-r--r--sound/soc/codecs/si47xx.h1
-rw-r--r--sound/soc/codecs/w2cbw003-bt.c32
-rw-r--r--sound/soc/omap/Makefile3
-rw-r--r--sound/soc/omap/gta04-audio.c33
-rw-r--r--sound/soc/omap/gta04-fm.c14
-rw-r--r--sound/soc/omap/gta04-headset.c4
-rw-r--r--sound/soc/omap/gta04-voice.c4
10 files changed, 71 insertions, 129 deletions
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 11fdb0a..1270961 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -183,5 +183,5 @@ obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o
obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o
obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o
obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o
-obj-$(CONFIG_SND_SOC_SI47XX) += snd-soc-si47xx.o
+#obj-$(CONFIG_SND_SOC_SI47XX) += snd-soc-si47xx.o
obj-$(CONFIG_SND_SOC_W2CBW003) += snd-soc-w2cbw003-bt.o
diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c
index 22c41a4..6c5edbe 100644
--- a/sound/soc/codecs/gtm601.c
+++ b/sound/soc/codecs/gtm601.c
@@ -42,7 +42,8 @@ struct snd_soc_dai_driver gtm601_dai = {
.channels_min = 1, // CHECKME
.channels_max = 1,
.rates = GTM601_RATES,
- .formats = SNDRV_PCM_FMTBIT_S16_LE, /* this is the only format the omap-mcbsp-dai understands */
+ .formats = SNDRV_PCM_FMTBIT_S16_LE, /* this is the only format the
+ * omap-mcbsp-dai understands */
},
.capture = {
.stream_name = "Capture",
@@ -52,50 +53,17 @@ struct snd_soc_dai_driver gtm601_dai = {
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
};
-EXPORT_SYMBOL_GPL(gtm601_dai);
-
-static int gtm601_soc_probe(struct snd_soc_codec *codec)
-{
- int ret = 0;
-
- /* register pcms */
- ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
- if (ret < 0)
- printk(KERN_ERR "gtm601: failed to create pcms\n");
- return ret;
-}
-
-static int gtm601_soc_remove(struct snd_soc_codec *codec)
-{
- if (codec == NULL)
- return 0;
- snd_soc_free_ac97_codec(codec);
- return 0;
-}
-
-struct snd_soc_codec_driver soc_codec_dev_gtm601 = {
- .probe = gtm601_soc_probe,
- .remove = gtm601_soc_remove,
-// .reg_cache_size = ARRAY_SIZE(ad1980_reg),
-// .reg_word_size = sizeof(u16),
-// .reg_cache_step = 2,
-// .write = ac97_write,
-// .read = ac97_read,
-};
-EXPORT_SYMBOL_GPL(soc_codec_dev_gtm601);
+struct snd_soc_codec_driver soc_codec_dev_gtm601;
static __devinit int gtm601_platform_probe(struct platform_device *pdev)
{
-// gtm601_dai.dev = &pdev->dev;
-// return snd_soc_register_dai(&gtm601_dai);
return snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_gtm601, &gtm601_dai, 1);
}
static int __devexit gtm601_platform_remove(struct platform_device *pdev)
{
-// snd_soc_unregister_dai(&gtm601_dai);
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
diff --git a/sound/soc/codecs/si47xx.c b/sound/soc/codecs/si47xx.c
index 1012a3c..23d5bf6 100644
--- a/sound/soc/codecs/si47xx.c
+++ b/sound/soc/codecs/si47xx.c
@@ -32,7 +32,10 @@
#include "si47xx.h"
-struct snd_soc_codec_device soc_codec_dev_si47xx;
+struct si47xx_priv {
+ enum snd_soc_control_type control_type;
+};
+
/*
* We can't read the WM8728 register space so we cache them instead.
@@ -100,8 +103,7 @@ static int si47xx_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_device *socdev = rtd->socdev;
- struct snd_soc_codec *codec = socdev->card->codec;
+ struct snd_soc_codec *codec = rtd->codec;
u16 dac = snd_soc_read(codec, SI47XX_DACCTL);
dac &= ~0x18;
@@ -182,7 +184,7 @@ static int si47xx_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_ON:
case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY:
- if (codec->bias_level == SND_SOC_BIAS_OFF) {
+ if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Power everything up... */
reg = snd_soc_read(codec, SI47XX_DACCTL);
snd_soc_write(codec, SI47XX_DACCTL, reg & ~0x4);
@@ -199,7 +201,7 @@ static int si47xx_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, SI47XX_DACCTL, reg | 0x4);
break;
}
- codec->bias_level = level;
+ codec->dapm.bias_level = level;
return 0;
}
@@ -216,7 +218,7 @@ static struct snd_soc_dai_ops si47xx_dai_ops = {
.set_fmt = si47xx_set_dai_fmt,
};
-struct snd_soc_dai si47xx_dai = {
+struct snd_soc_dai_driver si47xx_dai = {
.name = "Si47xx",
.playback = {
.stream_name = "Playback",
@@ -234,28 +236,26 @@ struct snd_soc_dai si47xx_dai = {
},
.ops = &si47xx_dai_ops,
};
-EXPORT_SYMBOL_GPL(si47xx_dai);
-static int si47xx_suspend(struct platform_device *pdev, pm_message_t state)
+static int si47xx_suspend(struct snd_soc_codec *codec, pm_message_t state)
{
- struct snd_soc_device *socdev = platform_get_drvdata(pdev);
- struct snd_soc_codec *codec = socdev->card->codec;
-
si47xx_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
-static int si47xx_resume(struct platform_device *pdev)
+static int si47xx_resume(struct snd_soc_codec *codec)
{
- struct snd_soc_device *socdev = platform_get_drvdata(pdev);
- struct snd_soc_codec *codec = socdev->card->codec;
-
- si47xx_set_bias_level(codec, codec->suspend_bias_level);
+ si47xx_set_bias_level(codec, codec->dapm.suspend_bias_level);
return 0;
}
+struct snd_soc_codec_driver si47xx_driver = {
+ .set_bias_level = si47xx_set_bias_level,
+ .reg_cache_size = ARRAY_SIZE(si47xx_reg_defaults),
+ .reg_cache_default = si47xx_reg_defaults,
+};
/*
* initialise the Si47xx driver
* register the mixer and dsp interfaces with the kernel
@@ -268,17 +268,10 @@ static int si47xx_init(struct snd_soc_device *socdev,
codec->name = "Si47xx";
codec->owner = THIS_MODULE;
- codec->set_bias_level = si47xx_set_bias_level;
- codec->dai = &si47xx_dai;
- codec->num_dai = 1;
+ codec->driver = si47xx_driver;
codec->bias_level = SND_SOC_BIAS_OFF;
- codec->reg_cache_size = ARRAY_SIZE(si47xx_reg_defaults);
- codec->reg_cache = kmemdup(si47xx_reg_defaults,
- sizeof(si47xx_reg_defaults),
- GFP_KERNEL);
- if (codec->reg_cache == NULL)
- return -ENOMEM;
+ snd_soc_register_codec(dev, si47xx_driver, &si47xx_dai, 1);
ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
if (ret < 0) {
printk(KERN_ERR "si47xx: failed to configure cache I/O: %d\n",
@@ -307,8 +300,6 @@ err:
return ret;
}
-static struct snd_soc_device *si47xx_socdev;
-
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
/*
@@ -318,26 +309,38 @@ static struct snd_soc_device *si47xx_socdev;
* high = 0x1b
*/
-static int si47xx_i2c_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
+static __devinit int si47xx_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
{
+ struct si47xx_priv *si47xx;
struct snd_soc_device *socdev = si47xx_socdev;
struct snd_soc_codec *codec = socdev->card->codec;
int ret;
- i2c_set_clientdata(i2c, codec);
- codec->control_data = i2c;
+ si47xx = kzalloc(sizeof *si47xx, GFP_KERNEL);
+ if (!si47xx)
+ return -ENOMEM;
+
+ si47xx->control_type = SND_SOC_I2C;
+ i2c_set_clientdata(i2c, si47xx);
+
+ ret = snd_soc_register_codec(&i2c->dev,
+ &si47xx_driver, &si47xx_dai, 1);
- ret = si47xx_init(socdev, SND_SOC_I2C);
if (ret < 0)
- pr_err("failed to initialise Si47xx\n");
+ kfree(si47xx);
+/X/ ret = si47xx_init(socdev, SND_SOC_I2C);
+ if (ret < 0)
+ pr_err("failed to initialise Si47xx\n");
return ret;
}
static int si47xx_i2c_remove(struct i2c_client *client)
{
struct snd_soc_codec *codec = i2c_get_clientdata(client);
+ snd_soc_unregister_codec(&client->dev);
+ kfree(i2c_get_clientdata(client));
kfree(codec->reg_cache);
return 0;
}
diff --git a/sound/soc/codecs/si47xx.h b/sound/soc/codecs/si47xx.h
index 33fbe70..5ebe521 100644
--- a/sound/soc/codecs/si47xx.h
+++ b/sound/soc/codecs/si47xx.h
@@ -26,7 +26,6 @@ struct si47xx_setup_data {
unsigned short i2c_address;
};
-extern struct snd_soc_dai si47xx_dai;
extern struct snd_soc_codec_device soc_codec_dev_si47xx;
#endif
diff --git a/sound/soc/codecs/w2cbw003-bt.c b/sound/soc/codecs/w2cbw003-bt.c
index 5582309..0ed327e 100644
--- a/sound/soc/codecs/w2cbw003-bt.c
+++ b/sound/soc/codecs/w2cbw003-bt.c
@@ -57,48 +57,18 @@ struct snd_soc_dai_driver w2cbw003_dai = {
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
};
-EXPORT_SYMBOL_GPL(w2cbw003_dai);
-static int w2cbw003_soc_probe(struct snd_soc_codec *codec)
-{
- int ret = 0;
-
- /* register pcms */
- ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
- if (ret < 0)
- printk(KERN_ERR "w2cbw003: failed to create pcms\n");
-
- return ret;
-}
-
-static int w2cbw003_soc_remove(struct snd_soc_codec *codec)
-{
- if (codec == NULL)
- return 0;
- snd_soc_free_ac97_codec(codec);
- return 0;
-}
-
-struct snd_soc_codec_driver soc_codec_dev_w2cbw003 = {
- .probe = w2cbw003_soc_probe,
- .remove = w2cbw003_soc_remove,
-// .write = ac97_write,
-// .read = ac97_read,
-};
-EXPORT_SYMBOL_GPL(soc_codec_dev_w2cbw003);
+struct snd_soc_codec_driver soc_codec_dev_w2cbw003;
static __devinit int w2cbw003_platform_probe(struct platform_device *pdev)
{
-// w2cbw003_dai.dev = &pdev->dev;
-// return snd_soc_register_dai(&w2cbw003_dai);
return snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_w2cbw003, &w2cbw003_dai, 1);
}
static int __devexit w2cbw003_platform_remove(struct platform_device *pdev)
{
-// snd_soc_unregister_dai(&w2cbw003_dai);
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 56f4e5c..42d6562 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -19,7 +19,8 @@ snd-soc-sdp3430-objs := sdp3430.o
snd-soc-sdp4430-objs := sdp4430.o
snd-soc-omap3pandora-objs := omap3pandora.o
snd-soc-omap3beagle-objs := omap3beagle.o
-snd-soc-gta04-objs := gta04-audio.o gta04-voice.o gta04-headset.o gta04-fm.o
+snd-soc-gta04-objs := gta04-audio.o gta04-voice.o gta04-headset.o
+#gta04-fm.o
snd-soc-zoom2-objs := zoom2.o
snd-soc-igep0020-objs := igep0020.o
diff --git a/sound/soc/omap/gta04-audio.c b/sound/soc/omap/gta04-audio.c
index 3d55038..78fa530 100644
--- a/sound/soc/omap/gta04-audio.c
+++ b/sound/soc/omap/gta04-audio.c
@@ -22,6 +22,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
+#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
@@ -135,13 +136,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
*/
};
-static int omap3gta04_init(struct snd_soc_codec *codec)
+static int omap3gta04_init(struct snd_soc_pcm_runtime *runtime)
{
int ret;
+ struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
ret = snd_soc_dapm_new_controls(dapm, gta04_dapm_widgets,
- ARRAY_SIZE(gta04_dapm_widgets));
+ ARRAY_SIZE(gta04_dapm_widgets));
if (ret < 0)
return ret;
@@ -179,41 +181,36 @@ static struct snd_soc_ops omap3gta04_ops = {
};
/* Digital audio interface glue - connects codec <--> CPU */
-static struct snd_soc_dai_link omap3gta04_dai[] = {
- {
+static struct snd_soc_dai_link omap3gta04_dai = {
.name = "TWL4030",
.stream_name = "TWL4030",
.cpu_dai_name = "omap-mcpdm-dai.0",
+ .platform_name = "omap-pcm-audio",
.codec_dai_name = "twl4030-hifi",
.ops = &omap3gta04_ops,
.init = &omap3gta04_init
- }
};
/* Audio machine driver */
static struct snd_soc_card snd_soc_omap3gta04 = {
.name = "gta04",
-// .platform = &omap_soc_platform,
- .dai_link = &omap3gta04_dai[0],
- .num_links = ARRAY_SIZE(omap3gta04_dai),
+ .owner = THIS_MODULE,
+ .dai_link = &omap3gta04_dai,
+ .num_links = 1,
};
-/* Audio subsystem */
-/*static struct snd_soc_driver omap3gta04_snd_devdata = {
- .card = &snd_soc_omap3gta04,
- .codec_dev = &soc_codec_dev_twl4030,
-};*/
-
static struct platform_device *omap3gta04_snd_device;
static int __init omap3gta04_soc_init(void)
{
int ret;
-/* if (!machine_is_gta04() && !machine_is_omap3_gta04()) {
+#if 0
+ if (!machine_is_gta04() && !machine_is_omap3_gta04()) {
pr_debug("Not GTA04!\n");
return -ENODEV;
- }*/
+ }
+#endif
pr_info("GTA04 OMAP3 SoC snd init\n");
// FIXME: set any GPIOs i.e. enable Audio in/out switch
@@ -226,8 +223,7 @@ static int __init omap3gta04_soc_init(void)
}
platform_set_drvdata(omap3gta04_snd_device, &snd_soc_omap3gta04);
-// omap3gta04_snd_devdata.dev = &omap3gta04_snd_device->dev;
-// *(unsigned int *)omap3gta04_dai[0].cpu_dai->private_data = 1; /* McBSP2 = TPS65950 */
+
ret = platform_device_add(omap3gta04_snd_device);
if (ret)
goto err1;
@@ -244,7 +240,6 @@ err1:
static void __exit omap3gta04_soc_exit(void)
{
platform_device_unregister(omap3gta04_snd_device);
- // switch off power
}
module_init(omap3gta04_soc_init);
diff --git a/sound/soc/omap/gta04-fm.c b/sound/soc/omap/gta04-fm.c
index 9a5d74e..e6e67b1 100644
--- a/sound/soc/omap/gta04-fm.c
+++ b/sound/soc/omap/gta04-fm.c
@@ -16,6 +16,7 @@
*/
#include <linux/platform_device.h>
+#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -32,7 +33,7 @@ static int gta04_fm_hw_params(struct snd_pcm_substream *substream,
/* setup codec dai and cpu dai hardware 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 *cpu_dai = rtd->cpu_dai;
unsigned int fmt;
int ret;
@@ -58,13 +59,14 @@ static int gta04_fm_hw_params(struct snd_pcm_substream *substream,
return 0;
}
-static int gta04_fm_init(struct snd_soc_codec *codec)
+static int gta04_fm_init(struct snd_soc_pcm_runtime *runtime)
{
/* add controls */
/* add routes */
/* setup pins */
+ struct snd_soc_codec *codec = runtime->codec;
- snd_soc_dapm_sync(codec);
+ snd_soc_dapm_sync(&codec->dapm);
return 0;
}
@@ -89,8 +91,8 @@ static struct snd_soc_ops gta04_fm_ops = {
static struct snd_soc_dai_link gta04_fm_dai = {
.name = "Si47xx",
.stream_name = "Si47xx",
- .cpu_dai = &omap_mcbsp_dai[3],
- .codec_dai = &si47xx_dai,
+ .cpu_dai_name = "omap-mcbsp-dai.3",
+ .codec_dai_name = "Si47xx",
.init = gta04_fm_init,
.ops = &gta04_fm_ops,
};
@@ -98,7 +100,7 @@ static struct snd_soc_dai_link gta04_fm_dai = {
/* fm machine driver */
static struct snd_soc_card gta04_fm_card = {
.name = "gta04-fm",
- .platform = &omap_soc_platform,
+// .platform_name = "omap-pcm-audio",
.dai_link = &gta04_fm_dai,
.num_links = 1,
};
diff --git a/sound/soc/omap/gta04-headset.c b/sound/soc/omap/gta04-headset.c
index e200ea7..af7c450 100644
--- a/sound/soc/omap/gta04-headset.c
+++ b/sound/soc/omap/gta04-headset.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
+#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
@@ -58,11 +59,12 @@ static int gta04_headset_hw_params(struct snd_pcm_substream *substream,
return 0;
}
-static int gta04_headset_init(struct snd_soc_codec *codec)
+static int gta04_headset_init(struct snd_soc_pcm_runtime *runtime)
{
/* add controls */
/* add routes */
/* setup pins */
+ struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_sync(dapm);
return 0;
diff --git a/sound/soc/omap/gta04-voice.c b/sound/soc/omap/gta04-voice.c
index 4c475edf..dcc81cf 100644
--- a/sound/soc/omap/gta04-voice.c
+++ b/sound/soc/omap/gta04-voice.c
@@ -16,6 +16,7 @@
*/
#include <linux/platform_device.h>
+#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -83,11 +84,12 @@ static int gta04_voice_hw_params(struct snd_pcm_substream *substream,
return 0;
}
-static int gta04_voice_init(struct snd_soc_codec *codec)
+static int gta04_voice_init(struct snd_soc_pcm_runtime *runtime)
{
/* add controls */
/* add routes */
/* setup pins */
+ struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_sync(dapm);
return 0;