* [PATCH 2/3] ASoC: Convert corgi to table based DAPM and control init
2011-12-30 3:13 [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver Axel Lin
@ 2011-12-30 3:16 ` Axel Lin
2011-12-30 10:45 ` Mark Brown
2011-12-30 3:18 ` [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card() Axel Lin
2011-12-30 10:44 ` [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver Mark Brown
2 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2011-12-30 3:16 UTC (permalink / raw)
To: linux-kernel
Cc: alsa-devel, Mark Brown, Eric Miao, Haojian Zhuang, Liam Girdwood
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
sound/soc/pxa/corgi.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 5ff6dac..30ebce2 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -227,7 +227,7 @@ SND_SOC_DAPM_HP("Headset Jack", NULL),
};
/* Corgi machine audio map (connections to the codec pins) */
-static const struct snd_soc_dapm_route audio_map[] = {
+static const struct snd_soc_dapm_route corgi_audio_map[] = {
/* headset Jack - in = micin, out = LHPOUT*/
{"Headset Jack", NULL, "LHPOUT"},
@@ -269,24 +269,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
- int err;
snd_soc_dapm_nc_pin(dapm, "LLINEIN");
snd_soc_dapm_nc_pin(dapm, "RLINEIN");
- /* Add corgi specific controls */
- err = snd_soc_add_controls(codec, wm8731_corgi_controls,
- ARRAY_SIZE(wm8731_corgi_controls));
- if (err < 0)
- return err;
-
- /* Add corgi specific widgets */
- snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
- ARRAY_SIZE(wm8731_dapm_widgets));
-
- /* Set up corgi specific audio path audio_map */
- snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
return 0;
}
@@ -310,6 +296,13 @@ static struct snd_soc_card snd_soc_corgi = {
.owner = THIS_MODULE,
.dai_link = &corgi_dai,
.num_links = 1,
+
+ .controls = wm8731_corgi_controls,
+ .num_controls = ARRAY_SIZE(wm8731_corgi_controls),
+ .dapm_widgets = wm8731_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
+ .dapm_routes = corgi_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
};
static struct platform_device *corgi_snd_device;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card()
2011-12-30 3:13 [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver Axel Lin
2011-12-30 3:16 ` [PATCH 2/3] ASoC: Convert corgi to table based DAPM and control init Axel Lin
@ 2011-12-30 3:18 ` Axel Lin
2011-12-31 0:16 ` Haojian Zhuang
2012-01-02 12:48 ` Mark Brown
2011-12-30 10:44 ` [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver Mark Brown
2 siblings, 2 replies; 7+ messages in thread
From: Axel Lin @ 2011-12-30 3:18 UTC (permalink / raw)
To: linux-kernel
Cc: alsa-devel, Mark Brown, Eric Miao, Haojian Zhuang, Liam Girdwood
Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
arch/arm/mach-pxa/corgi.c | 9 +++++++++
sound/soc/pxa/corgi.c | 43 +++++++++++++++++++++++--------------------
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 66600f0..11f1e73 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -436,6 +436,14 @@ static struct platform_device corgiled_device = {
};
/*
+ * Corgi Audio
+ */
+static struct platform_device corgi_audio_device = {
+ .name = "corgi-audio",
+ .id = -1,
+};
+
+/*
* MMC/SD Device
*
* The card detect interrupt isn't debounced so we delay it by 250ms
@@ -641,6 +649,7 @@ static struct platform_device *devices[] __initdata = {
&corgifb_device,
&corgikbd_device,
&corgiled_device,
+ &corgi_audio_device,
&sharpsl_nand_device,
&sharpsl_rom_device,
};
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 30ebce2..bc21944 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -291,7 +291,7 @@ static struct snd_soc_dai_link corgi_dai = {
};
/* corgi audio machine driver */
-static struct snd_soc_card snd_soc_corgi = {
+static struct snd_soc_card corgi = {
.name = "Corgi",
.owner = THIS_MODULE,
.dai_link = &corgi_dai,
@@ -305,38 +305,41 @@ static struct snd_soc_card snd_soc_corgi = {
.num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
};
-static struct platform_device *corgi_snd_device;
-
-static int __init corgi_init(void)
+static int __devinit corgi_probe(struct platform_device *pdev)
{
+ struct snd_soc_card *card = &corgi;
int ret;
- if (!(machine_is_corgi() || machine_is_shepherd() ||
- machine_is_husky()))
- return -ENODEV;
-
- corgi_snd_device = platform_device_alloc("soc-audio", -1);
- if (!corgi_snd_device)
- return -ENOMEM;
-
- platform_set_drvdata(corgi_snd_device, &snd_soc_corgi);
- ret = platform_device_add(corgi_snd_device);
+ card->dev = &pdev->dev;
+ ret = snd_soc_register_card(card);
if (ret)
- platform_device_put(corgi_snd_device);
-
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
+ ret);
return ret;
}
-static void __exit corgi_exit(void)
+static int __devexit corgi_remove(struct platform_device *pdev)
{
- platform_device_unregister(corgi_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+ return 0;
}
-module_init(corgi_init);
-module_exit(corgi_exit);
+static struct platform_driver corgi_driver = {
+ .driver = {
+ .name = "corgi-audio",
+ .owner = THIS_MODULE,
+ },
+ .probe = corgi_probe,
+ .remove = __devexit_p(corgi_remove),
+};
+
+module_platform_driver(corgi_driver);
/* Module information */
MODULE_AUTHOR("Richard Purdie");
MODULE_DESCRIPTION("ALSA SoC Corgi");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:corgi-audio");
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card()
2011-12-30 3:18 ` [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card() Axel Lin
@ 2011-12-31 0:16 ` Haojian Zhuang
2012-01-02 12:48 ` Mark Brown
1 sibling, 0 replies; 7+ messages in thread
From: Haojian Zhuang @ 2011-12-31 0:16 UTC (permalink / raw)
To: Axel Lin
Cc: alsa-devel, Eric Miao, Mark Brown, linux-kernel, Haojian Zhuang,
Liam Girdwood
On Fri, Dec 30, 2011 at 11:18 AM, Axel Lin <axel.lin@gmail.com> wrote:
> Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> arch/arm/mach-pxa/corgi.c | 9 +++++++++
> sound/soc/pxa/corgi.c | 43 +++++++++++++++++++++++--------------------
> 2 files changed, 32 insertions(+), 20 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card()
2011-12-30 3:18 ` [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card() Axel Lin
2011-12-31 0:16 ` Haojian Zhuang
@ 2012-01-02 12:48 ` Mark Brown
1 sibling, 0 replies; 7+ messages in thread
From: Mark Brown @ 2012-01-02 12:48 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Liam Girdwood, Eric Miao, linux-kernel,
Haojian Zhuang
On Fri, Dec 30, 2011 at 11:18:13AM +0800, Axel Lin wrote:
> Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver
2011-12-30 3:13 [PATCH 1/3] ASoC: Use dai_fmt in corgi machine driver Axel Lin
2011-12-30 3:16 ` [PATCH 2/3] ASoC: Convert corgi to table based DAPM and control init Axel Lin
2011-12-30 3:18 ` [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card() Axel Lin
@ 2011-12-30 10:44 ` Mark Brown
2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-12-30 10:44 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Liam Girdwood, Eric Miao, linux-kernel,
Haojian Zhuang
On Fri, Dec 30, 2011 at 11:13:24AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread