diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-24 00:55:34 (GMT) |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-24 10:31:26 (GMT) |
commit | 45f3121615b2b354f7d95d30f795bc5fe0043e92 (patch) | |
tree | 25f1e1be27e08c5b955fb5b31150a47032df1251 | |
parent | 39afd66cead742e99c051d6f3b07f89d09eebbbb (diff) | |
download | linux-45f3121615b2b354f7d95d30f795bc5fe0043e92.tar.xz |
ASoC: fsi-ak4642: modify specification method of FSI / ak464x
Current fsi-ak4642 was using id_entry name in order to specify
FSI port and ak464x codec.
But it was no sense, no flexibility.
Platform can specify FSI/ak464x pair by this patch.
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 14 | ||||
-rw-r--r-- | arch/sh/boards/mach-se/7724/setup.c | 14 | ||||
-rw-r--r-- | include/sound/sh_fsi.h | 12 | ||||
-rw-r--r-- | sound/soc/sh/fsi-ak4642.c | 114 |
5 files changed, 63 insertions, 106 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index a3aa0f6..ade98c2 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -762,9 +762,22 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi2_ak4643_info = { + .name = "AK4643", + .card = "FSI2A-AK4643", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0013", + .platform = "sh_fsi2", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4643_device = { - .name = "sh_fsi2_a_ak4643", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi_info, + }, }; + static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .marker_icb = 30, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 9c5e598..a2908d4 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -990,8 +990,20 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi2_ak4643_info = { + .name = "AK4643", + .card = "FSI2A-AK4643", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0013", + .platform = "sh_fsi2", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4643_device = { - .name = "sh_fsi2_a_ak4643", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi2_ak4643_info, + }, }; /* diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index b747c0a..b49723b 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -315,8 +315,20 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi_ak4642_info = { + .name = "AK4642", + .card = "FSIA-AK4642", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0012", + .platform = "sh_fsi.0", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4642_device = { - .name = "sh_fsi_a_ak4642", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi_ak4642_info, + }, }; /* KEYSC in SoC (Needs SW33-2 set to ON) */ diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index 9a155f9..9b1aaca 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -78,4 +78,16 @@ struct sh_fsi_platform_info { int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); }; +/* + * for fsi-ak4642 + */ +struct fsi_ak4642_info { + const char *name; + const char *card; + const char *cpu_dai; + const char *codec; + const char *platform; + int id; +}; + #endif /* __SOUND_FSI_H */ diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index dff64b9..11d2d7f 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -58,27 +58,23 @@ static struct platform_device *fsi_snd_device; static int fsi_ak4642_probe(struct platform_device *pdev) { int ret = -ENOMEM; - const struct platform_device_id *id_entry; - struct fsi_ak4642_data *pdata; + struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; - id_entry = pdev->id_entry; - if (!id_entry) { - dev_err(&pdev->dev, "unknown fsi ak4642\n"); - return -ENODEV; + if (!pinfo) { + dev_err(&pdev->dev, "no info for fsi ak4642\n"); + goto out; } - pdata = (struct fsi_ak4642_data *)id_entry->driver_data; - - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); + fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); 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; - fsi_soc_card.name = pdata->card; + fsi_dai_link.name = pinfo->name; + fsi_dai_link.stream_name = pinfo->name; + fsi_dai_link.cpu_dai_name = pinfo->cpu_dai; + fsi_dai_link.platform_name = pinfo->platform; + fsi_dai_link.codec_name = pinfo->codec; + fsi_soc_card.name = pinfo->card; platform_set_drvdata(fsi_snd_device, &fsi_soc_card); ret = platform_device_add(fsi_snd_device); @@ -96,100 +92,12 @@ static int fsi_ak4642_remove(struct platform_device *pdev) return 0; } -static struct fsi_ak4642_data fsi_a_ak4642 = { - .name = "AK4642", - .card = "FSIA-AK4642", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi.0", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi_b_ak4642 = { - .name = "AK4642", - .card = "FSIB-AK4642", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi.0", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi_a_ak4643 = { - .name = "AK4643", - .card = "FSIA-AK4643", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi.0", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi_b_ak4643 = { - .name = "AK4643", - .card = "FSIB-AK4643", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi.0", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi2_a_ak4642 = { - .name = "AK4642", - .card = "FSI2A-AK4642", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi2", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi2_b_ak4642 = { - .name = "AK4642", - .card = "FSI2B-AK4642", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi2", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi2_a_ak4643 = { - .name = "AK4643", - .card = "FSI2A-AK4643", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi2", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi2_b_ak4643 = { - .name = "AK4643", - .card = "FSI2B-AK4643", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi2", - .id = FSI_PORT_B, -}; - -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) |