* [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection
@ 2010-11-30 2:32 Kuninori Morimoto
2010-11-30 5:56 ` Paul Mundt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2010-11-30 2:32 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA, Paul Mundt, Liam Girdwood
Current FSI-Ak4642 device had niche settings which were
FSI2-A-AK4643 and FSI-A-AK4642.
This patch add platform_device_id which can control
FSI/FSI2, PortA/PortB, AK4642/AK4643 from platform data.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/mach-shmobile/board-ap4evb.c | 5 +
arch/sh/boards/mach-se/7724/setup.c | 5 +
sound/soc/sh/fsi-ak4642.c | 133 ++++++++++++++++++++++++++++++---
3 files changed, 131 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index d326054..82c3204 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -640,6 +640,10 @@ static struct platform_device fsi_device = {
},
};
+static struct platform_device fsi_ak4643_device = {
+ .name = "sh_fsi2_a_ak4643",
+};
+
static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
.clock_source = LCDC_CLK_EXTERNAL,
.ch[0] = {
@@ -838,6 +842,7 @@ static struct platform_device *ap4evb_devices[] __initdata = {
&sdhi1_device,
&usb1_host_device,
&fsi_device,
+ &fsi_ak4643_device,
&sh_mmcif_device,
&lcdc1_device,
&lcdc_device,
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index c31d228..dff89d0 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -343,6 +343,10 @@ static struct platform_device fsi_device = {
},
};
+static struct platform_device fsi_ak4642_device = {
+ .name = "sh_fsi_a_ak4642",
+};
+
/* KEYSC in SoC (Needs SW33-2 set to ON) */
static struct sh_keysc_info keysc_info = {
.mode = SH_KEYSC_MODE_1,
@@ -615,6 +619,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
&sh7724_usb0_host_device,
&sh7724_usb1_gadget_device,
&fsi_device,
+ &fsi_ak4642_device,
&sdhi0_cn7_device,
&sdhi1_cn8_device,
&irda_device,
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index d96602d..4ef279c 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -12,6 +12,13 @@
#include <linux/platform_device.h>
#include <sound/sh_fsi.h>
+struct fsi_ak4642_data {
+ const char *name;
+ const char *cpu_dai;
+ const char *codec;
+ const char *platform;
+};
+
static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *dai = rtd->codec_dai;
@@ -27,17 +34,12 @@ static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
}
static struct snd_soc_dai_link fsi_dai_link = {
- .name = "AK4642",
- .stream_name = "AK4642",
- .cpu_dai_name = "fsia-dai", /* fsi A */
+ /* .name */
+ /* .stream_name */
+ /* .cpu_dai_name */
.codec_dai_name = "ak4642-hifi",
-#ifdef CONFIG_MACH_AP4EVB
- .platform_name = "sh_fsi2",
- .codec_name = "ak4642-codec.0-0013",
-#else
- .platform_name = "sh_fsi.0",
- .codec_name = "ak4642-codec.0-0012",
-#endif
+ /* .platform_name */
+ /* .codec_name */
.init = fsi_ak4642_dai_init,
.ops = NULL,
};
@@ -50,14 +52,30 @@ static struct snd_soc_card fsi_soc_card = {
static struct platform_device *fsi_snd_device;
-static int __init fsi_ak4642_init(void)
+static int fsi_ak4642_probe(struct platform_device *pdev)
{
int ret = -ENOMEM;
+ const struct platform_device_id *id_entry;
+ struct fsi_ak4642_data *pdata;
+
+ id_entry = pdev->id_entry;
+ if (!id_entry) {
+ dev_err(&pdev->dev, "unknown fsi ak4642\n");
+ return -ENODEV;
+ }
+
+ pdata = (struct fsi_ak4642_data *)id_entry->driver_data;
fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
if (!fsi_snd_device)
goto out;
+ fsi_dai_link.name = pdata->name;
+ fsi_dai_link.stream_name = pdata->name;
+ fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
+ fsi_dai_link.platform_name = pdata->platform;
+ fsi_dai_link.codec_name = pdata->codec;
+
platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
ret = platform_device_add(fsi_snd_device);
@@ -68,9 +86,100 @@ out:
return ret;
}
-static void __exit fsi_ak4642_exit(void)
+static int fsi_ak4642_remove(struct platform_device *pdev)
{
platform_device_unregister(fsi_snd_device);
+ return 0;
+}
+
+static struct fsi_ak4642_data fsi_a_ak4642 = {
+ .name = "AK4642",
+ .cpu_dai = "fsia-dai",
+ .codec = "ak4642-codec.0-0012",
+ .platform = "sh_fsi.0",
+};
+
+static struct fsi_ak4642_data fsi_b_ak4642 = {
+ .name = "AK4642",
+ .cpu_dai = "fsib-dai",
+ .codec = "ak4642-codec.0-0012",
+ .platform = "sh_fsi.0",
+};
+
+static struct fsi_ak4642_data fsi_a_ak4643 = {
+ .name = "AK4643",
+ .cpu_dai = "fsia-dai",
+ .codec = "ak4642-codec.0-0013",
+ .platform = "sh_fsi.0",
+};
+
+static struct fsi_ak4642_data fsi_b_ak4643 = {
+ .name = "AK4643",
+ .cpu_dai = "fsib-dai",
+ .codec = "ak4642-codec.0-0013",
+ .platform = "sh_fsi.0",
+};
+
+static struct fsi_ak4642_data fsi2_a_ak4642 = {
+ .name = "AK4642",
+ .cpu_dai = "fsia-dai",
+ .codec = "ak4642-codec.0-0012",
+ .platform = "sh_fsi2",
+};
+
+static struct fsi_ak4642_data fsi2_b_ak4642 = {
+ .name = "AK4642",
+ .cpu_dai = "fsib-dai",
+ .codec = "ak4642-codec.0-0012",
+ .platform = "sh_fsi2",
+};
+
+static struct fsi_ak4642_data fsi2_a_ak4643 = {
+ .name = "AK4643",
+ .cpu_dai = "fsia-dai",
+ .codec = "ak4642-codec.0-0013",
+ .platform = "sh_fsi2",
+};
+
+static struct fsi_ak4642_data fsi2_b_ak4643 = {
+ .name = "AK4643",
+ .cpu_dai = "fsib-dai",
+ .codec = "ak4642-codec.0-0013",
+ .platform = "sh_fsi2",
+};
+
+static struct platform_device_id fsi_id_table[] = {
+ /* FSI */
+ { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 },
+ { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 },
+ { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 },
+ { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 },
+
+ /* FSI 2 */
+ { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 },
+ { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 },
+ { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 },
+ { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 },
+ {},
+};
+
+static struct platform_driver fsi_ak4642 = {
+ .driver = {
+ .name = "fsi-ak4642-audio",
+ },
+ .probe = fsi_ak4642_probe,
+ .remove = fsi_ak4642_remove,
+ .id_table = fsi_id_table,
+};
+
+static int __init fsi_ak4642_init(void)
+{
+ return platform_driver_register(&fsi_ak4642);
+}
+
+static void __exit fsi_ak4642_exit(void)
+{
+ platform_driver_unregister(&fsi_ak4642);
}
module_init(fsi_ak4642_init);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection
2010-11-30 2:32 [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection Kuninori Morimoto
@ 2010-11-30 5:56 ` Paul Mundt
2010-11-30 11:31 ` Liam Girdwood
2010-11-30 11:35 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2010-11-30 5:56 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown, Liam Girdwood
On Tue, Nov 30, 2010 at 11:32:04AM +0900, Kuninori Morimoto wrote:
> Current FSI-Ak4642 device had niche settings which were
> FSI2-A-AK4643 and FSI-A-AK4642.
> This patch add platform_device_id which can control
> FSI/FSI2, PortA/PortB, AK4642/AK4643 from platform data.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> arch/arm/mach-shmobile/board-ap4evb.c | 5 +
> arch/sh/boards/mach-se/7724/setup.c | 5 +
> sound/soc/sh/fsi-ak4642.c | 133 ++++++++++++++++++++++++++++++---
> 3 files changed, 131 insertions(+), 12 deletions(-)
>
Acked-by: Paul Mundt <lethal@linux-sh.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection
2010-11-30 2:32 [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection Kuninori Morimoto
2010-11-30 5:56 ` Paul Mundt
@ 2010-11-30 11:31 ` Liam Girdwood
2010-11-30 11:35 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-11-30 11:31 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown, Paul Mundt
On Tue, 2010-11-30 at 11:32 +0900, Kuninori Morimoto wrote:
> Current FSI-Ak4642 device had niche settings which were
> FSI2-A-AK4643 and FSI-A-AK4642.
> This patch add platform_device_id which can control
> FSI/FSI2, PortA/PortB, AK4642/AK4643 from platform data.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
but
> static struct snd_soc_dai_link fsi_dai_link = {
> - .name = "AK4642",
> - .stream_name = "AK4642",
> - .cpu_dai_name = "fsia-dai", /* fsi A */
> + /* .name */
> + /* .stream_name */
> + /* .cpu_dai_name */
it looks like you forgot to delete these comments.
> .codec_dai_name = "ak4642-hifi",
> -#ifdef CONFIG_MACH_AP4EVB
> - .platform_name = "sh_fsi2",
> - .codec_name = "ak4642-codec.0-0013",
> -#else
> - .platform_name = "sh_fsi.0",
> - .codec_name = "ak4642-codec.0-0012",
> -#endif
> + /* .platform_name */
> + /* .codec_name */
ditto.
> .init = fsi_ak4642_dai_init,
> .ops = NULL,
no need to set ops to NULL here.
> };
> @@ -50,14 +52,30 @@ static struct snd_soc_card fsi_soc_card = {
>
Could you send an incremental update that fixes these issues.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection
2010-11-30 2:32 [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection Kuninori Morimoto
2010-11-30 5:56 ` Paul Mundt
2010-11-30 11:31 ` Liam Girdwood
@ 2010-11-30 11:35 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-11-30 11:35 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Paul Mundt, Liam Girdwood
On Tue, Nov 30, 2010 at 11:32:04AM +0900, Kuninori Morimoto wrote:
> Current FSI-Ak4642 device had niche settings which were
> FSI2-A-AK4643 and FSI-A-AK4642.
> This patch add platform_device_id which can control
> FSI/FSI2, PortA/PortB, AK4642/AK4643 from platform data.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-30 11:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30 2:32 [PATCH] ASoC: sh: fsi-ak4642: Add FSI port and ak464x selection Kuninori Morimoto
2010-11-30 5:56 ` Paul Mundt
2010-11-30 11:31 ` Liam Girdwood
2010-11-30 11:35 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.