[alsa-devel] [PATCH 0/5] ASoC: sh: fsi-codec
Hi Mark, Liam Cc: Paul, Rafael
These patches adds fsi-codec support for SuperH board.
Kuninori Morimoto (5): ASoC: fsi: add fsi-codec card support ASoC: fsi: remove fsi-ak4642 card driver ASoC: fsi: remove fsi-hdmi card driver ASoC: fsi: remove fsi-da7210 card driver ASoC: fsi: add FSI-WM8978 support
Current FSI-xxx cards are using fsi-xxx.c driver. But these were very similar. To reduce useless code, #1 adds common card driver as "fsi-codec", and #2-#4 switch to use it. And #5 adds new card support
Please note that these patches are based on latest linus/master. I guess current mark/for-3.4 will get conflict
Best regards --- Kuninori Morimoto
Current Linux Kernel is using fsi-xxx card driver for SuperH sound card. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds fsi-codec.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/sh_fsi.h | 21 +++++++++ sound/soc/sh/Kconfig | 3 + sound/soc/sh/Makefile | 2 + sound/soc/sh/fsi-codec.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 0 deletions(-) create mode 100644 sound/soc/sh/fsi-codec.c
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index b457e87..e61b251 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -96,4 +96,25 @@ struct fsi_ak4642_info { int id; };
+/* + * for fsi-codec + */ +#define fsi_link_to_info(p) container_of(p, struct fsi_codec_info, snd_link) +#define fsi_card_to_info(p) container_of(p, struct fsi_codec_info, snd_card) +struct fsi_codec_info { + const char *name; + const char *card; + const char *cpu_dai; + const char *codec; + const char *platform; + const char *codec_dai; + unsigned int codec_fmt; + unsigned int cpu_fmt; + unsigned int sysclk; + + /* used in fsi-codec.c */ + struct snd_soc_dai_link snd_link; + struct snd_soc_card snd_card; +}; + #endif /* __SOUND_FSI_H */ diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index d8e06a6..6c406a5 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -46,6 +46,9 @@ config SND_SH7760_AC97 This option enables generic sound support for the first AC97 unit of the SH7760.
+config SND_FSI_CODEC + tristate + config SND_FSI_AK4642 tristate "FSI-AK4642 sound support" depends on SND_SOC_SH4_FSI && I2C diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 94476d4..82ce3e3 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -17,10 +17,12 @@ snd-soc-sh7760-ac97-objs := sh7760-ac97.o snd-soc-fsi-ak4642-objs := fsi-ak4642.o snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-hdmi-objs := fsi-hdmi.o +snd-soc-fsi-codec-objs := fsi-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o +obj-$(CONFIG_SND_FSI_CODEC) += snd-soc-fsi-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-codec.c b/sound/soc/sh/fsi-codec.c new file mode 100644 index 0000000..9781106e --- /dev/null +++ b/sound/soc/sh/fsi-codec.c @@ -0,0 +1,106 @@ +/* + * FSI-Codec sound card support + * + * Copyright (C) 2012 Renesas Solutions Corp. + * Kuninori Morimoto kuninori.morimoto.gx@renesas.com + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include <linux/platform_device.h> +#include <linux/module.h> +#include <sound/sh_fsi.h> + +static int fsi_codec_dai_init(struct snd_soc_pcm_runtime *rtd) +{ + struct fsi_codec_info *pinfo = fsi_link_to_info(rtd->dai_link); + struct snd_soc_dai *codec = rtd->codec_dai; + struct snd_soc_dai *cpu = rtd->cpu_dai; + int ret; + + ret = 0; + if (pinfo->codec_fmt) { + ret = snd_soc_dai_set_fmt(codec, pinfo->codec_fmt); + if (ret < 0) + return ret; + } + + if (pinfo->sysclk) { + ret = snd_soc_dai_set_sysclk(codec, 0, pinfo->sysclk, 0); + if (ret < 0) + return ret; + } + + if (pinfo->cpu_fmt) { + ret = snd_soc_dai_set_fmt(cpu, pinfo->cpu_fmt); + if (ret < 0) + return ret; + } + + return ret; +} + +static int fsi_codec_probe(struct platform_device *pdev) +{ + struct fsi_codec_info *pinfo = pdev->dev.platform_data; + + if (!pinfo) { + dev_err(&pdev->dev, "no info for fsi-codec\n"); + return -EINVAL; + } + + if (!pinfo->name || + !pinfo->card || + !pinfo->cpu_dai || + !pinfo->codec || + !pinfo->platform || + !pinfo->codec_dai) { + dev_err(&pdev->dev, "insufficient fsi_codec_info settings\n"); + return -EINVAL; + } + + /* + * init snd_soc_dai_link + */ + pinfo->snd_link.name = pinfo->name; + pinfo->snd_link.stream_name = pinfo->name; + pinfo->snd_link.cpu_dai_name = pinfo->cpu_dai; + pinfo->snd_link.platform_name = pinfo->platform; + pinfo->snd_link.codec_name = pinfo->codec; + pinfo->snd_link.codec_dai_name = pinfo->codec_dai; + pinfo->snd_link.init = fsi_codec_dai_init; + + /* + * init snd_soc_card + */ + pinfo->snd_card.name = pinfo->card; + pinfo->snd_card.owner = THIS_MODULE; + pinfo->snd_card.dai_link = &pinfo->snd_link; + pinfo->snd_card.num_links = 1; + pinfo->snd_card.dev = &pdev->dev; + + return snd_soc_register_card(&pinfo->snd_card); +} + +static int fsi_codec_remove(struct platform_device *pdev) +{ + struct fsi_codec_info *pinfo = pdev->dev.platform_data; + + return snd_soc_unregister_card(&pinfo->snd_card); +} + +static struct platform_driver fsi_codec = { + .driver = { + .name = "fsi-codec-audio", + }, + .probe = fsi_codec_probe, + .remove = fsi_codec_remove, +}; + +module_platform_driver(fsi_codec); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Generic SuperH FSI-Codec sound card"); +MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
On Sun, Apr 01, 2012 at 06:32:27PM -0700, Kuninori Morimoto wrote:
--- /dev/null +++ b/sound/soc/sh/fsi-codec.c
A more descriptive name (even if it's just fsi-simple-codec or something) would be nice.
- if (pinfo->codec_fmt) {
- if (pinfo->cpu_fmt) {
I'd expect that these should always be the same, it's probably as well to just have one format and then require anyone who wants anything unusual to handle it.
Hi Mark
Thank you for checking patch
--- /dev/null +++ b/sound/soc/sh/fsi-codec.c
A more descriptive name (even if it's just fsi-simple-codec or something) would be nice.
OK.
- if (pinfo->codec_fmt) {
- if (pinfo->cpu_fmt) {
I'd expect that these should always be the same, it's probably as well to just have one format and then require anyone who wants anything unusual to handle it.
I very agree :) Thank you for pointing out it. I fix it in v2
Best regards --- Kuninori Morimoto
Hi Mark
- if (pinfo->codec_fmt) {
- if (pinfo->cpu_fmt) {
I'd expect that these should always be the same, it's probably as well to just have one format and then require anyone who wants anything unusual to handle it.
Now I'm creating v2 patch.
This codec_fmt/cpu_fmt is not only audio formats. It selects clock master / signal inversions... These are depend on platform. And, FSI can use SPDIF format (it doesn't have SND_SOC_DAIFMT_xxx format).
So, it will be...
pinfo->fmt : audio formats pinfo->cpu_daifmt : extra settings for cpu pinfo->codec_daifmt : extra settings for codec
unsigned int cpu_fmt = pinfo->fmt | pinfo->cpu_daifmt; unsigned int codec_fmt = pinfo->fmt | pinfo->codec_fmt;
if (codec_fmt) ...
if (cpu_fmt) ...
This is a little bit complex... but is it OK ?
Best regards --- Kuninori Morimoto
On Mon, Apr 02, 2012 at 07:01:00PM -0700, Kuninori Morimoto wrote:
I'd expect that these should always be the same, it's probably as well to just have one format and then require anyone who wants anything unusual to handle it.
This codec_fmt/cpu_fmt is not only audio formats. It selects clock master / signal inversions... These are depend on platform.
Right, they should be configured by the platform - it's just that if they are configured I'd expect them to be the same for both ends of the link.
And, FSI can use SPDIF format (it doesn't have SND_SOC_DAIFMT_xxx format).
For this case we should just be able to handle having no format specified by the platform I think?
This is a little bit complex... but is it OK ?
I think we should be able to avoid having a CODEC or CPU specific format at all.
This patch uses fsi-codec card driver instead of fsi-ak4642. And removes fsi-ak4642 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- arch/arm/mach-shmobile/board-ap4evb.c | 9 ++- arch/arm/mach-shmobile/board-mackerel.c | 9 ++- arch/sh/boards/mach-se/7724/setup.c | 9 ++- include/sound/sh_fsi.h | 12 ---- sound/soc/sh/Kconfig | 1 + sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-ak4642.c | 108 ------------------------------- 7 files changed, 19 insertions(+), 131 deletions(-) delete mode 100644 sound/soc/sh/fsi-ak4642.c
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index b56dde2..33ced33 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -785,17 +785,20 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct fsi_codec_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, + .codec_dai = "ak4642-hifi", + .codec_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM, + .cpu_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-codec-audio", .dev = { .platform_data = &fsi2_ak4643_info, }, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index f189de6..e6a73ed 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -945,17 +945,20 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct fsi_codec_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, + .codec_dai = "ak4642-hifi", + .codec_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM, + .cpu_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-codec-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 c540b16..5f9cbf0 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -304,17 +304,20 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi_ak4642_info = { +static struct fsi_codec_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, + .codec_dai = "ak4642-hifi", + .codec_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM, + .cpu_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4642_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-codec-audio", .dev = { .platform_data = &fsi_ak4642_info, }, diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index e61b251..a2c49ed 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -85,18 +85,6 @@ struct sh_fsi_platform_info { };
/* - * 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; -}; - -/* * for fsi-codec */ #define fsi_link_to_info(p) container_of(p, struct fsi_codec_info, snd_link) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 6c406a5..c2c045c 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -53,6 +53,7 @@ config SND_FSI_AK4642 tristate "FSI-AK4642 sound support" depends on SND_SOC_SH4_FSI && I2C select SND_SOC_AK4642 + select SND_FSI_CODEC help This option enables generic sound support for the FSI - AK4642 unit diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 82ce3e3..8bd0ac1 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,14 +14,12 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-ak4642-objs := fsi-ak4642.o snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-fsi-codec-objs := fsi-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_FSI_CODEC) += snd-soc-fsi-codec.o diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c deleted file mode 100644 index 97f540a..0000000 --- a/sound/soc/sh/fsi-ak4642.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * FSI-AK464x sound support for ms7724se - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_ak4642_data { - const char *name; - const char *card; - const char *cpu_dai; - const char *codec; - const char *platform; - int id; -}; - -static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .codec_dai_name = "ak4642-hifi", - .init = fsi_ak4642_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_ak4642_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; - - if (!pinfo) { - dev_err(&pdev->dev, "no info for fsi ak4642\n"); - goto out; - } - - fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); - if (!fsi_snd_device) - goto out; - - 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); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_ak4642_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct platform_driver fsi_ak4642 = { - .driver = { - .name = "fsi-ak4642-audio", - }, - .probe = fsi_ak4642_probe, - .remove = fsi_ak4642_remove, -}; - -module_platform_driver(fsi_ak4642); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com");
This patch uses fsi-codec card driver instead of fsi-hdmi. And removes fsi-hdmi driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- arch/arm/mach-shmobile/board-ap4evb.c | 16 ++++- arch/arm/mach-shmobile/board-mackerel.c | 16 ++++- sound/soc/sh/Kconfig | 1 + sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-hdmi.c | 118 ------------------------------- 5 files changed, 31 insertions(+), 122 deletions(-) delete mode 100644 sound/soc/sh/fsi-hdmi.c
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 33ced33..a84e601 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -903,8 +903,22 @@ static struct platform_device lcdc1_device = { }, };
+static struct fsi_codec_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .cpu_fmt = SND_SOC_DAIFMT_CBM_CFM, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "fsi-codec-audio", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static struct gpio_led ap4evb_leds[] = { diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index e6a73ed..ff73e5a 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -502,8 +502,22 @@ static struct platform_device hdmi_lcdc_device = { }, };
+static struct fsi_codec_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .cpu_fmt = SND_SOC_DAIFMT_CBM_CFM, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "fsi-codec-audio", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static void __init hdmi_init_pm_clock(void) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index c2c045c..f9800d3 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -69,6 +69,7 @@ config SND_FSI_DA7210 config SND_FSI_HDMI tristate "FSI-HDMI sound support" depends on SND_SOC_SH4_FSI && FB_SH_MOBILE_HDMI + select SND_FSI_CODEC help This option enables generic sound support for the FSI - HDMI unit diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 8bd0ac1..e1019fb 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -15,12 +15,10 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o ## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o snd-soc-fsi-da7210-objs := fsi-da7210.o -snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-fsi-codec-objs := fsi-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o -obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_FSI_CODEC) += snd-soc-fsi-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c deleted file mode 100644 index 6e41908..0000000 --- a/sound/soc/sh/fsi-hdmi.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * FSI - HDMI sound support - * - * Copyright (C) 2010 Renesas Solutions Corp. - * Kuninori Morimoto kuninori.morimoto.gx@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_hdmi_data { - const char *cpu_dai; - const char *card; - int id; -}; - -static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .name = "HDMI", - .stream_name = "HDMI", - .codec_dai_name = "sh_mobile_hdmi-hifi", - .platform_name = "sh_fsi2", - .codec_name = "sh-mobile-hdmi", - .init = fsi_hdmi_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_hdmi_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - const struct platform_device_id *id_entry; - struct fsi_hdmi_data *pdata; - - id_entry = pdev->id_entry; - if (!id_entry) { - dev_err(&pdev->dev, "unknown fsi hdmi\n"); - return -ENODEV; - } - - pdata = (struct fsi_hdmi_data *)id_entry->driver_data; - - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); - if (!fsi_snd_device) - goto out; - - fsi_dai_link.cpu_dai_name = pdata->cpu_dai; - fsi_soc_card.name = pdata->card; - - platform_set_drvdata(fsi_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_snd_device); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_hdmi_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct fsi_hdmi_data fsi2_a_hdmi = { - .cpu_dai = "fsia-dai", - .card = "FSI2A-HDMI", - .id = FSI_PORT_A, -}; - -static struct fsi_hdmi_data fsi2_b_hdmi = { - .cpu_dai = "fsib-dai", - .card = "FSI2B-HDMI", - .id = FSI_PORT_B, -}; - -static struct platform_device_id fsi_id_table[] = { - /* FSI 2 */ - { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi }, - { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi }, - {}, -}; - -static struct platform_driver fsi_hdmi = { - .driver = { - .name = "fsi-hdmi-audio", - }, - .probe = fsi_hdmi_probe, - .remove = fsi_hdmi_remove, - .id_table = fsi_id_table, -}; - -module_platform_driver(fsi_hdmi); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); -MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
This patch uses fsi-codec card driver instead of fsi-da7210. And removes fsi-da7210 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- arch/sh/boards/mach-ecovec24/setup.c | 20 ++++++++ sound/soc/sh/Kconfig | 1 + sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-da7210.c | 81 ---------------------------------- 4 files changed, 21 insertions(+), 83 deletions(-) delete mode 100644 sound/soc/sh/fsi-da7210.c
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index d12fe9d..109e807 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -809,6 +809,25 @@ static struct platform_device fsi_device = { }, };
+static struct fsi_codec_info fsi_da7210_info = { + .name = "DA7210", + .card = "FSIB-DA7210", + .cpu_dai = "fsib-dai", + .codec = "da7210-codec.0-001a", + .platform = "sh_fsi.0", + .codec_dai = "da7210-hifi", + .codec_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, + .cpu_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, +}; + +static struct platform_device fsi_da7210_device = { + .name = "fsi-codec-audio", + .dev = { + .platform_data = &fsi_da7210_info, + }, +}; + + /* IrDA */ static struct resource irda_resources[] = { [0] = { @@ -945,6 +964,7 @@ static struct platform_device *ecovec_devices[] __initdata = { &camera_devices[1], &camera_devices[2], &fsi_device, + &fsi_da7210_device, &irda_device, &vou_device, #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index f9800d3..a18719e 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -62,6 +62,7 @@ config SND_FSI_DA7210 tristate "FSI-DA7210 sound support" depends on SND_SOC_SH4_FSI && I2C select SND_SOC_DA7210 + select SND_FSI_CODEC help This option enables generic sound support for the FSI - DA7210 unit diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index e1019fb..e8af2a1 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,11 +14,9 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-codec-objs := fsi-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_CODEC) += snd-soc-fsi-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c deleted file mode 100644 index 1dd3354..0000000 --- a/sound/soc/sh/fsi-da7210.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * fsi-da7210.c - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, - SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_da7210_dai = { - .name = "DA7210", - .stream_name = "DA7210", - .cpu_dai_name = "fsib-dai", /* FSI B */ - .codec_dai_name = "da7210-hifi", - .platform_name = "sh_fsi.0", - .codec_name = "da7210-codec.0-001a", - .init = fsi_da7210_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .name = "FSI-DA7210", - .owner = THIS_MODULE, - .dai_link = &fsi_da7210_dai, - .num_links = 1, -}; - -static struct platform_device *fsi_da7210_snd_device; - -static int __init fsi_da7210_sound_init(void) -{ - int ret; - - fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); - if (!fsi_da7210_snd_device) - return -ENOMEM; - - platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_da7210_snd_device); - if (ret) - platform_device_put(fsi_da7210_snd_device); - - return ret; -} - -static void __exit fsi_da7210_sound_exit(void) -{ - platform_device_unregister(fsi_da7210_snd_device); -} - -module_init(fsi_da7210_sound_init); -module_exit(fsi_da7210_sound_exit); - -/* Module information */ -MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com"); -MODULE_LICENSE("GPL");
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/Kconfig | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index a18719e..a45955e 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -75,6 +75,15 @@ config SND_FSI_HDMI This option enables generic sound support for the FSI - HDMI unit
+config SND_FSI_WM8978 + tristate "FSI-WM8978 sound support" + depends on SND_SOC_SH4_FSI + select SND_SOC_WM8978 + select SND_FSI_CODEC + help + This option enables generic sound support for the + FSI - WM8978 unit + config SND_SIU_MIGOR tristate "SIU sound support on Migo-R" depends on SH_MIGOR
On Sun, Apr 01, 2012 at 06:33:29PM -0700, Kuninori Morimoto wrote:
+config SND_FSI_WM8978
- tristate "FSI-WM8978 sound support"
- depends on SND_SOC_SH4_FSI
- select SND_SOC_WM8978
select SND_FSI_CODEC
- help
This option enables generic sound support for the
FSI - WM8978 unit
Rather than having an explicit Kconfig option like this it might be more sensible to have the boards select their CODEC driver. We should only build the CODEC driver if the user enables the subsystem IIRC so this shouldn't be a big cost. You could then just have a single Kconfig for the simple driver.
Hi Mark
Thank you for checking patch
+config SND_FSI_WM8978
- tristate "FSI-WM8978 sound support"
- depends on SND_SOC_SH4_FSI
- select SND_SOC_WM8978
select SND_FSI_CODEC
- help
This option enables generic sound support for the
FSI - WM8978 unit
Rather than having an explicit Kconfig option like this it might be more sensible to have the boards select their CODEC driver. We should only build the CODEC driver if the user enables the subsystem IIRC so this shouldn't be a big cost. You could then just have a single Kconfig for the simple driver.
OK. I understand. I guess this opinion is not only for this "FSI-WM8978" but also for existing cards.
Best regards --- Kuninori Morimoto
Hi Mark
+config SND_FSI_WM8978
- tristate "FSI-WM8978 sound support"
- depends on SND_SOC_SH4_FSI
- select SND_SOC_WM8978
select SND_FSI_CODEC
- help
This option enables generic sound support for the
FSI - WM8978 unit
Rather than having an explicit Kconfig option like this it might be more sensible to have the boards select their CODEC driver. We should only build the CODEC driver if the user enables the subsystem IIRC so this shouldn't be a big cost. You could then just have a single Kconfig for the simple driver.
OK. I understand. I guess this opinion is not only for this "FSI-WM8978" but also for existing cards.
Hmm... If board selects their CODEC driver, the driver will be forcefully included to kernel. And some of these are depend on extra config like I2C. I'm afraid about this kind of "forcefully select".
Of course we can create selectable Kconfig for each boards. but it is just complex..
Best regards --- Kuninori Morimoto
On Mon, Apr 02, 2012 at 07:02:03PM -0700, Kuninori Morimoto wrote:
If board selects their CODEC driver, the driver will be forcefully included to kernel. And some of these are depend on extra config like I2C. I'm afraid about this kind of "forcefully select".
Of course we can create selectable Kconfig for each boards. but it is just complex..
I guess, yes. Though thinking about this further perhaps what we really want to do is provide a way to list all the CODEC drivers which can be supported by this driver and then have the driver select them all together, that way we don't have to keep adding Kconfig options for each individual device.
The driver isn't really particularly FSI specific either... the main thing I want to avoid is having to end up doing lots of this sort of little update on lots of platforms - it feels like we should be able to avoid having to add a Kconfig entry for every single combination of CPU and CODEC unless there's specific code to support that combination somehow (like when the CODEC has fancy clocking arrangements).
On Mon, Apr 02, 2012 at 05:50:56PM -0700, Kuninori Morimoto wrote:
I guess this opinion is not only for this "FSI-WM8978" but also for existing cards.
Yes, it applies to the others too though it's less of an issue there due to backwards compatibility.
Hi Mark, Liam Cc: Paul, Rafael
These are v2 patches of fsi-codec support for SuperH board.
Kuninori Morimoto (4): ASoC: sh: fsi: add fsi-common-codec card support ASoC: sh: fsi: use fsi-common-codec instead of fsi-ak4642 ASoC: sh: fsi: use fsi-common-codec instead of fsi-hdmi ASoC: sh: fsi: use fsi-common-codec instead of fsi-da7210
#2-#3 patches remove fsi-xxx card driver and Kconfig settings from ${LINUX}/sound/soc/sh/Kconfig.
And adds board specific CODEC on each board Kconfig. CODEC/fsi-common-codec will be selected automatically if you select board and FSI.
Best regards --- Kuninori Morimoto
Current Linux Kernel is using fsi-xxx card driver for SuperH sound card. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds fsi-common-codec.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v1 -> v2
- fsi-codec -> fsi-common-codec - add .fmt for CPU/CODEC common audio format
include/sound/sh_fsi.h | 25 +++++++++ sound/soc/sh/Kconfig | 4 ++ sound/soc/sh/Makefile | 2 + sound/soc/sh/fsi-common-codec.c | 107 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 0 deletions(-) create mode 100644 sound/soc/sh/fsi-common-codec.c
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index b457e87..5f125b0 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -96,4 +96,29 @@ struct fsi_ak4642_info { int id; };
+/* + * for fsi-common-codec + */ +#define fsi_link_to_info(p) \ + container_of(p, struct fsi_common_codec_info, snd_link) +#define fsi_card_to_info(p) \ + container_of(p, struct fsi_common_codec_info, snd_card) + +struct fsi_common_codec_info { + const char *name; + const char *card; + const char *cpu_dai; + const char *codec; + const char *platform; + const char *codec_dai; + unsigned int fmt; + unsigned int cpu_daifmt; + unsigned int codec_daifmt; + unsigned int sysclk; + + /* used in fsi-common-codec.c */ + struct snd_soc_dai_link snd_link; + struct snd_soc_card snd_card; +}; + #endif /* __SOUND_FSI_H */ diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index d8e06a6..00d9e09 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -22,6 +22,7 @@ config SND_SOC_SH4_SSI
config SND_SOC_SH4_FSI tristate "SH4 FSI support" + select SND_FSI_COMMON_CODEC help This option enables FSI sound support
@@ -46,6 +47,9 @@ config SND_SH7760_AC97 This option enables generic sound support for the first AC97 unit of the SH7760.
+config SND_FSI_COMMON_CODEC + tristate + config SND_FSI_AK4642 tristate "FSI-AK4642 sound support" depends on SND_SOC_SH4_FSI && I2C diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 94476d4..11e9a56 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -17,10 +17,12 @@ snd-soc-sh7760-ac97-objs := sh7760-ac97.o snd-soc-fsi-ak4642-objs := fsi-ak4642.o snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-hdmi-objs := fsi-hdmi.o +snd-soc-fsi-common-codec-objs := fsi-common-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o +obj-$(CONFIG_SND_FSI_COMMON_CODEC) += snd-soc-fsi-common-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-common-codec.c b/sound/soc/sh/fsi-common-codec.c new file mode 100644 index 0000000..81bbead --- /dev/null +++ b/sound/soc/sh/fsi-common-codec.c @@ -0,0 +1,107 @@ +/* + * FSI common codec sound card support + * + * Copyright (C) 2012 Renesas Solutions Corp. + * Kuninori Morimoto kuninori.morimoto.gx@renesas.com + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include <linux/platform_device.h> +#include <linux/module.h> +#include <sound/sh_fsi.h> + +static int fsi_common_codec_dai_init(struct snd_soc_pcm_runtime *rtd) +{ + struct fsi_common_codec_info *pinfo = fsi_link_to_info(rtd->dai_link); + struct snd_soc_dai *codec = rtd->codec_dai; + struct snd_soc_dai *cpu = rtd->cpu_dai; + unsigned int cpu_daifmt = pinfo->fmt | pinfo->cpu_daifmt; + unsigned int codec_daifmt = pinfo->fmt | pinfo->codec_daifmt; + int ret; + + if (codec_daifmt) { + ret = snd_soc_dai_set_fmt(codec, codec_daifmt); + if (ret < 0) + return ret; + } + + if (pinfo->sysclk) { + ret = snd_soc_dai_set_sysclk(codec, 0, pinfo->sysclk, 0); + if (ret < 0) + return ret; + } + + if (cpu_daifmt) { + ret = snd_soc_dai_set_fmt(cpu, cpu_daifmt); + if (ret < 0) + return ret; + } + + return 0; +} + +static int fsi_common_codec_probe(struct platform_device *pdev) +{ + struct fsi_common_codec_info *pinfo = pdev->dev.platform_data; + + if (!pinfo) { + dev_err(&pdev->dev, "no info for fsi-common-codec\n"); + return -EINVAL; + } + + if (!pinfo->name || + !pinfo->card || + !pinfo->cpu_dai || + !pinfo->codec || + !pinfo->platform || + !pinfo->codec_dai) { + dev_err(&pdev->dev, "insufficient fsi_common_codec_info settings\n"); + return -EINVAL; + } + + /* + * init snd_soc_dai_link + */ + pinfo->snd_link.name = pinfo->name; + pinfo->snd_link.stream_name = pinfo->name; + pinfo->snd_link.cpu_dai_name = pinfo->cpu_dai; + pinfo->snd_link.platform_name = pinfo->platform; + pinfo->snd_link.codec_name = pinfo->codec; + pinfo->snd_link.codec_dai_name = pinfo->codec_dai; + pinfo->snd_link.init = fsi_common_codec_dai_init; + + /* + * init snd_soc_card + */ + pinfo->snd_card.name = pinfo->card; + pinfo->snd_card.owner = THIS_MODULE; + pinfo->snd_card.dai_link = &pinfo->snd_link; + pinfo->snd_card.num_links = 1; + pinfo->snd_card.dev = &pdev->dev; + + return snd_soc_register_card(&pinfo->snd_card); +} + +static int fsi_common_codec_remove(struct platform_device *pdev) +{ + struct fsi_common_codec_info *pinfo = pdev->dev.platform_data; + + return snd_soc_unregister_card(&pinfo->snd_card); +} + +static struct platform_driver fsi_common_codec = { + .driver = { + .name = "fsi-common-codec-audio", + }, + .probe = fsi_common_codec_probe, + .remove = fsi_common_codec_remove, +}; + +module_platform_driver(fsi_common_codec); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("SuperH FSI common codec sound card"); +MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
On Tue, Apr 03, 2012 at 10:06:48PM -0700, Kuninori Morimoto wrote:
Current Linux Kernel is using fsi-xxx card driver for SuperH sound card. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds fsi-common-codec.
So, I've been sitting on this stuff. The reason is not that there's a problem but rather the opposite - I can't see anything here that is FSI specific so really it seems like we should make this available to other platforms by calling it something like "simple-card" and putting it in some generic folder (perhaps even called "generic").
This would mean that even more people could benefit from your work.
Hi Mark
Current Linux Kernel is using fsi-xxx card driver for SuperH sound card. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds fsi-common-codec.
So, I've been sitting on this stuff. The reason is not that there's a problem but rather the opposite - I can't see anything here that is FSI specific so really it seems like we should make this available to other platforms by calling it something like "simple-card" and putting it in some generic folder (perhaps even called "generic").
This would mean that even more people could benefit from your work.
Thank you for checking patch. OK. I can work for it in v3 patch-set.
Best regards --- Kuninori Morimoto
Hi Mark
These are v3 patch set for simple-card/FSI-codec These are based on latest mark/for-3.5 branch
Kuninori Morimoto (5): ASoC: add generic simple-card support ASoC: sh: fsi: use simple-card instead of fsi-ak4642 ASoC: sh: fsi: use simple-card instead of fsi-hdmi ASoC: sh: fsi: use simple-card instead of fsi-da7210 ASoC: sh: fsi: select simple-card on Kconfig
#1 patch adds new generic folder and simple-card driver. #2-#4 switch to use it for SuperH FSI.
BTW, could you please re-check Paul's 2012/03/30 [PATCH] ASoC: fsi: update for dmaengine prep_slave_sg fallout.
current FSI needs this patch.
Best regards --- Kuninori Morimoto
Current ASoC requires card.c file to each platforms in order to specifies its CPU and Codecs pair. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds generic/simple-card.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v2 -> v3
- fsi-common-codec -> simple-card - I added struct asoc_simple_init_info because whether using snd_link.init is depend on platform
include/sound/simple_card.h | 38 +++++++++++++ sound/soc/Kconfig | 3 + sound/soc/Makefile | 1 + sound/soc/generic/Kconfig | 4 ++ sound/soc/generic/Makefile | 3 + sound/soc/generic/simple-card.c | 114 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 163 insertions(+), 0 deletions(-) create mode 100644 include/sound/simple_card.h create mode 100644 sound/soc/generic/Kconfig create mode 100644 sound/soc/generic/Makefile create mode 100644 sound/soc/generic/simple-card.c
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h new file mode 100644 index 0000000..4b62b8d --- /dev/null +++ b/include/sound/simple_card.h @@ -0,0 +1,38 @@ +/* + * ASoC simple sound card support + * + * Copyright (C) 2012 Renesas Solutions Corp. + * Kuninori Morimoto kuninori.morimoto.gx@renesas.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __SIMPLE_CARD_H +#define __SIMPLE_CARD_H + +#include <sound/soc.h> + +struct asoc_simple_dai_init_info { + unsigned int fmt; + unsigned int cpu_daifmt; + unsigned int codec_daifmt; + unsigned int sysclk; +}; + +struct asoc_simple_card_info { + const char *name; + const char *card; + const char *cpu_dai; + const char *codec; + const char *platform; + const char *codec_dai; + struct asoc_simple_dai_init_info *init; /* for snd_link.init */ + + /* used in simple-card.c */ + struct snd_soc_dai_link snd_link; + struct snd_soc_card snd_card; +}; + +#endif /* __SIMPLE_CARD_H */ diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 0f85f6d..a7df779 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -51,5 +51,8 @@ source "sound/soc/txx9/Kconfig" # Supported codecs source "sound/soc/codecs/Kconfig"
+# generic frame-work +source "sound/soc/generic/Kconfig" + endif # SND_SOC
diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 363dfd6..3ca760e 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -24,3 +24,4 @@ obj-$(CONFIG_SND_SOC) += s6000/ obj-$(CONFIG_SND_SOC) += sh/ obj-$(CONFIG_SND_SOC) += tegra/ obj-$(CONFIG_SND_SOC) += txx9/ +obj-$(CONFIG_SND_SOC) += generic/ diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig new file mode 100644 index 0000000..610f612 --- /dev/null +++ b/sound/soc/generic/Kconfig @@ -0,0 +1,4 @@ +config SND_SIMPLE_CARD + tristate "ASoC Simple sound card support" + help + This option enables generic simple sound card support diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile new file mode 100644 index 0000000..9c3b246 --- /dev/null +++ b/sound/soc/generic/Makefile @@ -0,0 +1,3 @@ +snd-soc-simple-card-objs := simple-card.o + +obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c new file mode 100644 index 0000000..b4b4cab --- /dev/null +++ b/sound/soc/generic/simple-card.c @@ -0,0 +1,114 @@ +/* + * ASoC simple sound card support + * + * Copyright (C) 2012 Renesas Solutions Corp. + * Kuninori Morimoto kuninori.morimoto.gx@renesas.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/platform_device.h> +#include <linux/module.h> +#include <sound/simple_card.h> + +#define asoc_simple_get_card_info(p) \ + container_of(p->dai_link, struct asoc_simple_card_info, snd_link) + +static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) +{ + struct asoc_simple_card_info *cinfo = asoc_simple_get_card_info(rtd); + struct asoc_simple_dai_init_info *iinfo = cinfo->init; + struct snd_soc_dai *codec = rtd->codec_dai; + struct snd_soc_dai *cpu = rtd->cpu_dai; + unsigned int cpu_daifmt = iinfo->fmt | iinfo->cpu_daifmt; + unsigned int codec_daifmt = iinfo->fmt | iinfo->codec_daifmt; + int ret; + + if (codec_daifmt) { + ret = snd_soc_dai_set_fmt(codec, codec_daifmt); + if (ret < 0) + return ret; + } + + if (iinfo->sysclk) { + ret = snd_soc_dai_set_sysclk(codec, 0, iinfo->sysclk, 0); + if (ret < 0) + return ret; + } + + if (cpu_daifmt) { + ret = snd_soc_dai_set_fmt(cpu, cpu_daifmt); + if (ret < 0) + return ret; + } + + return 0; +} + +static int asoc_simple_card_probe(struct platform_device *pdev) +{ + struct asoc_simple_card_info *cinfo = pdev->dev.platform_data; + + if (!cinfo) { + dev_err(&pdev->dev, "no info for asoc-simple-card\n"); + return -EINVAL; + } + + if (!cinfo->name || + !cinfo->card || + !cinfo->cpu_dai || + !cinfo->codec || + !cinfo->platform || + !cinfo->codec_dai) { + dev_err(&pdev->dev, "insufficient asoc_simple_card_info settings\n"); + return -EINVAL; + } + + /* + * init snd_soc_dai_link + */ + cinfo->snd_link.name = cinfo->name; + cinfo->snd_link.stream_name = cinfo->name; + cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai; + cinfo->snd_link.platform_name = cinfo->platform; + cinfo->snd_link.codec_name = cinfo->codec; + cinfo->snd_link.codec_dai_name = cinfo->codec_dai; + + /* enable snd_link.init if cinfo has settings */ + if (cinfo->init) + cinfo->snd_link.init = asoc_simple_card_dai_init; + + /* + * init snd_soc_card + */ + cinfo->snd_card.name = cinfo->card; + cinfo->snd_card.owner = THIS_MODULE; + cinfo->snd_card.dai_link = &cinfo->snd_link; + cinfo->snd_card.num_links = 1; + cinfo->snd_card.dev = &pdev->dev; + + return snd_soc_register_card(&cinfo->snd_card); +} + +static int asoc_simple_card_remove(struct platform_device *pdev) +{ + struct asoc_simple_card_info *cinfo = pdev->dev.platform_data; + + return snd_soc_unregister_card(&cinfo->snd_card); +} + +static struct platform_driver asoc_simple_card = { + .driver = { + .name = "asoc-simple-card", + }, + .probe = asoc_simple_card_probe, + .remove = asoc_simple_card_remove, +}; + +module_platform_driver(asoc_simple_card); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("ASoC Simple Sound Card"); +MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
On Sun, Apr 08, 2012 at 09:17:50PM -0700, Kuninori Morimoto wrote:
Current ASoC requires card.c file to each platforms in order to specifies its CPU and Codecs pair. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds generic/simple-card.
I've applied all these - thanks! I tweaked the first patch slightly to move the Makefile entry.
Hi Mark
Current ASoC requires card.c file to each platforms in order to specifies its CPU and Codecs pair. But the differences between these were only value/strings of setting. In order to reduce duplicate driver, this patch adds generic/simple-card.
I've applied all these - thanks! I tweaked the first patch slightly to move the Makefile entry.
Thank you.
But I noticed that this Makefile breaks ALSA device list detection on kernel boot.
------------------------------------------------- obj-$(CONFIG_SND_SOC) += snd-soc-core.o obj-$(CONFIG_SND_SOC) += codecs/ obj-$(CONFIG_SND_SOC) += generic/ obj-$(CONFIG_SND_SOC) += atmel/ ... obj-$(CONFIG_SND_SOC) += sh/ -------------------------------------------------
In our (= SuperH) case, "generic" detected 1st, SuperH is next. So, it get "Driver asoc-simple-card requests probe deferral" when boot.
If "obj-$(CONFIG_SND_SOC) += generic/" is in last line on Makefile, this issue doesn't happen. How to solve this issue ?
this is the kernel boot log (with #define DEBUG)
------------------------------- (snip) Registered platform 'snd-soc-dummy' ak4642-codec 0-0012: codec register 0-0012 ak4642-codec 0-0012: dai register 0-0012 #1 Registered DAI 'ak4642-hifi' Registered codec 'ak4642-codec.0-0012' asoc-simple-card asoc-simple-card.0: binding AK4648 at idx 0 asoc-simple-card asoc-simple-card.0: CPU DAI fsia-dai not registered platform asoc-simple-card.0: Driver asoc-simple-card requests probe deferral <<=== fsi-pcm-audio sh_fsi2: platform register sh_fsi2 Registered platform 'sh_fsi2' fsi-pcm-audio sh_fsi2: dai register sh_fsi2 #2 Registered DAI 'fsia-dai' Registered DAI 'fsib-dai' ALSA device list: No soundcards found. <<==== (snip) /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/drivers/rtc/hctosys.c: unable to ) asoc-simple-card asoc-simple-card.0: probe FSI2A-AK4648 dai link 0 late -2 asoc-simple-card asoc-simple-card.0: probe FSI2A-AK4648 dai link 0 late -1 asoc-simple-card asoc-simple-card.0: probe FSI2A-AK4648 dai link 0 late 0 ak4642-codec 0-0012: read 0 => 0 ak4642-codec 0-0012: write 0 = 40 ak4642-codec 0-0012: read 1 => 0 ak4642-codec 0-0012: read 2 => 1 asoc-simple-card asoc-simple-card.0: probe FSI2A-AK4648 dai link 0 late 1 asoc-simple-card asoc-simple-card.0: probe FSI2A-AK4648 dai link 0 late 2 ak4642-codec 0-0012: read 0 => 40 ak4642-codec 0-0012: read 0 => 40 ak4642-codec 0-0012: read f => b8 ak4642-codec 0-0012: read 1 => 0 ak4642-codec 0-0012: read 1 => 0 ak4642-codec 0-0012: read 1 => 0 ak4642-codec 0-0012: write 1 = b ak4642-codec 0-0012: read 4 => 2 ak4642-codec 0-0012: write 4 = a ak4642-codec 0-0012: read 4 => a ak4642-codec 0-0012: read 4 => a ak4642-codec 0-0012: write 4 = 4a asoc: ak4642-hifi <-> fsia-dai mapping ok <<===
Best regards --- Kuninori Morimoto
On Mon, Apr 16, 2012 at 12:11:28AM -0700, Kuninori Morimoto wrote:
In our (= SuperH) case, "generic" detected 1st, SuperH is next. So, it get "Driver asoc-simple-card requests probe deferral" when boot.
If "obj-$(CONFIG_SND_SOC) += generic/" is in last line on Makefile, this issue doesn't happen. How to solve this issue ?
this is the kernel boot log (with #define DEBUG)
This isn't an issue, it is totally normal behaviour and nothing to be concerned about. As your log shows the card does get registered.
Hi Mark
In our (= SuperH) case, "generic" detected 1st, SuperH is next. So, it get "Driver asoc-simple-card requests probe deferral" when boot.
If "obj-$(CONFIG_SND_SOC) += generic/" is in last line on Makefile, this issue doesn't happen. How to solve this issue ?
this is the kernel boot log (with #define DEBUG)
This isn't an issue, it is totally normal behaviour and nothing to be concerned about. As your log shows the card does get registered.
Thanks. Yes, it could detect the card. I just worried about this message.
ALSA device list: No soundcards found.
Best regards --- Kuninori Morimoto
At Mon, 16 Apr 2012 01:30:19 -0700 (PDT), Kuninori Morimoto wrote:
Hi Mark
In our (= SuperH) case, "generic" detected 1st, SuperH is next. So, it get "Driver asoc-simple-card requests probe deferral" when boot.
If "obj-$(CONFIG_SND_SOC) += generic/" is in last line on Makefile, this issue doesn't happen. How to solve this issue ?
this is the kernel boot log (with #define DEBUG)
This isn't an issue, it is totally normal behaviour and nothing to be concerned about. As your log shows the card does get registered.
Thanks. Yes, it could detect the card. I just worried about this message.
ALSA device list: No soundcards found.
It's the call in sound/last.c. Only devices that have been preoprly regstered at this point of __init calls are shown. So, it's often misleading.
Takashi
On Mon, Apr 16, 2012 at 11:48:35AM +0200, Takashi Iwai wrote:
It's the call in sound/last.c. Only devices that have been preoprly regstered at this point of __init calls are shown. So, it's often misleading.
I keep wondering if we should just remove it due to confusion like this.
At Mon, 16 Apr 2012 11:05:10 +0100, Mark Brown wrote:
On Mon, Apr 16, 2012 at 11:48:35AM +0200, Takashi Iwai wrote:
It's the call in sound/last.c. Only devices that have been preoprly regstered at this point of __init calls are shown. So, it's often misleading.
I keep wondering if we should just remove it due to confusion like this.
I don't mind to get rid of it at all. But maybe it'd be good to have an alternative debug (or info) print, e.g. showing at each card registration.
Takashi
Hi Takashi, Mark
It's the call in sound/last.c. Only devices that have been preoprly regstered at this point of __init calls are shown. So, it's often misleading.
I keep wondering if we should just remove it due to confusion like this.
I don't mind to get rid of it at all. But maybe it'd be good to have an alternative debug (or info) print, e.g. showing at each card registration.
If I used late_initcall_sync() for it, the boot log became below.
------ before -------------------------- -> platform asoc-simple-card.0: Driver asoc-simple-card requests probe deferral -> ALSA device list: -> No soundcards found. TCP: cubic registered NET: Registered protocol family 17 Registering the dns_resolver key type VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 2 /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/drivers/rtc/hctosys.c: unable to ) -> asoc: ak4642-hifi <-> fsia-dai mapping ok smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xdf022000, IRQ: 275 Sending DHCP requests . IP-Config: Got DHCP answer from 192.168.10.77, my address is 192.168.10.119 IP-Config: Complete: device=eth0, addr=192.168.10.119, mask=255.255.255.0, gw=192.168.10.77 host=192.168.10.119, domain=example.org, nis-domain=(none) bootserver=192.168.10.77, rootserver=192.168.10.77, rootpath=/opt/tftpbootm VFS: Mounted root (nfs filesystem) on device 0:10. Freeing init memory: 128K ------ after -------------------------- -> platform asoc-simple-card.0: Driver asoc-simple-card requests probe deferral TCP: cubic registered NET: Registered protocol family 17 Registering the dns_resolver key type VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 2 /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/drivers/rtc/hctosys.c: unable to ) -> asoc: ak4642-hifi <-> fsia-dai mapping ok smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xdf022000, IRQ: 275 Sending DHCP requests . IP-Config: Got DHCP answer from 192.168.10.77, my address is 192.168.10.119 IP-Config: Complete: device=eth0, addr=192.168.10.119, mask=255.255.255.0, gw=192.168.10.77 host=192.168.10.119, domain=example.org, nis-domain=(none) bootserver=192.168.10.77, rootserver=192.168.10.77, rootpath=/opt/tftpbootm -> ALSA device list: -> #0: FSI2A-AK4648 VFS: Mounted root (nfs filesystem) on device 0:10. Freeing init memory: 128K --------------------------------------------
Best regards --- Kuninori Morimoto
At Wed, 18 Apr 2012 19:54:01 -0700 (PDT), Kuninori Morimoto wrote:
Hi Takashi, Mark
It's the call in sound/last.c. Only devices that have been preoprly regstered at this point of __init calls are shown. So, it's often misleading.
I keep wondering if we should just remove it due to confusion like this.
I don't mind to get rid of it at all. But maybe it'd be good to have an alternative debug (or info) print, e.g. showing at each card registration.
If I used late_initcall_sync() for it, the boot log became below.
------ before -------------------------- -> platform asoc-simple-card.0: Driver asoc-simple-card requests probe deferral -> ALSA device list: -> No soundcards found. TCP: cubic registered NET: Registered protocol family 17 Registering the dns_resolver key type VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 2 /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/drivers/rtc/hctosys.c: unable to ) -> asoc: ak4642-hifi <-> fsia-dai mapping ok smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xdf022000, IRQ: 275 Sending DHCP requests . IP-Config: Got DHCP answer from 192.168.10.77, my address is 192.168.10.119 IP-Config: Complete: device=eth0, addr=192.168.10.119, mask=255.255.255.0, gw=192.168.10.77 host=192.168.10.119, domain=example.org, nis-domain=(none) bootserver=192.168.10.77, rootserver=192.168.10.77, rootpath=/opt/tftpbootm VFS: Mounted root (nfs filesystem) on device 0:10. Freeing init memory: 128K ------ after -------------------------- -> platform asoc-simple-card.0: Driver asoc-simple-card requests probe deferral TCP: cubic registered NET: Registered protocol family 17 Registering the dns_resolver key type VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 2 /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/drivers/rtc/hctosys.c: unable to ) -> asoc: ak4642-hifi <-> fsia-dai mapping ok smsc911x smsc911x.0: eth0: SMSC911x/921x identified at 0xdf022000, IRQ: 275 Sending DHCP requests . IP-Config: Got DHCP answer from 192.168.10.77, my address is 192.168.10.119 IP-Config: Complete: device=eth0, addr=192.168.10.119, mask=255.255.255.0, gw=192.168.10.77 host=192.168.10.119, domain=example.org, nis-domain=(none) bootserver=192.168.10.77, rootserver=192.168.10.77, rootpath=/opt/tftpbootm -> ALSA device list: -> #0: FSI2A-AK4648 VFS: Mounted root (nfs filesystem) on device 0:10. Freeing init memory: 128K
This looks like a good workaround. Care to send a patch?
thanks,
Takashi
Current alsa_sound_last_init() was called as __initcall(). So, on current ALSA, only devices that had been properly registered at this point were shown. So, it will show "No soundcards found" if driver requests probe deferment. it's often misleading. This patch delays the timing of alsa_sound_last_init() as workaround.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/last.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/last.c b/sound/last.c index bdd0857..7ffc182 100644 --- a/sound/last.c +++ b/sound/last.c @@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void) return 0; }
-__initcall(alsa_sound_last_init); +late_initcall_sync(alsa_sound_last_init);
On Thu, Apr 19, 2012 at 12:00:27AM -0700, Kuninori Morimoto wrote:
Current alsa_sound_last_init() was called as __initcall(). So, on current ALSA, only devices that had been properly registered at this point were shown. So, it will show "No soundcards found" if driver requests probe deferment. it's often misleading. This patch delays the timing of alsa_sound_last_init() as workaround.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Reviwed-by: Mark Brown broonie@opensource.wolfsonmicro.com
At Thu, 19 Apr 2012 00:00:27 -0700 (PDT), Kuninori Morimoto wrote:
Current alsa_sound_last_init() was called as __initcall(). So, on current ALSA, only devices that had been properly registered at this point were shown. So, it will show "No soundcards found" if driver requests probe deferment. it's often misleading. This patch delays the timing of alsa_sound_last_init() as workaround.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Thanks, applied now.
Takashi
sound/last.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/last.c b/sound/last.c index bdd0857..7ffc182 100644 --- a/sound/last.c +++ b/sound/last.c @@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void) return 0; }
-__initcall(alsa_sound_last_init);
+late_initcall_sync(alsa_sound_last_init);
1.7.5.4
This patch uses simple-card driver instead of fsi-ak4642 on each board. To select AK4642 driver, each boards select it on Kconfig.
This patch removes fsi-ak4642 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v2 -> v3
- based on simple-card
arch/arm/mach-shmobile/Kconfig | 2 + arch/arm/mach-shmobile/board-ap4evb.c | 15 ++++- arch/arm/mach-shmobile/board-mackerel.c | 15 ++++- arch/sh/boards/Kconfig | 1 + arch/sh/boards/mach-se/7724/setup.c | 15 ++++- include/sound/sh_fsi.h | 12 ---- sound/soc/sh/Kconfig | 8 -- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-ak4642.c | 108 ------------------------------- 9 files changed, 39 insertions(+), 139 deletions(-) delete mode 100644 sound/soc/sh/fsi-ak4642.c
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 34560ca..2cda0c2 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -58,6 +58,7 @@ config MACH_AP4EVB depends on ARCH_SH7372 select ARCH_REQUIRE_GPIOLIB select SH_LCD_MIPI_DSI + select SND_SOC_AK4642 if SND_SIMPLE_CARD
choice prompt "AP4EVB LCD panel selection" @@ -82,6 +83,7 @@ config MACH_MACKEREL bool "mackerel board" depends on ARCH_SH7372 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_AK4642 if SND_SIMPLE_CARD
config MACH_KOTA2 bool "KOTA2 board" diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index b56dde2..b397512 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -50,6 +50,7 @@ #include <media/soc_camera.h>
#include <sound/sh_fsi.h> +#include <sound/simple_card.h>
#include <video/sh_mobile_hdmi.h> #include <video/sh_mobile_lcdc.h> @@ -785,17 +786,25 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = { + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, +}; + +static struct asoc_simple_card_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, + .codec_dai = "ak4642-hifi", + .init = &fsi2_ak4643_init_info, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "asoc-simple-card", .dev = { .platform_data = &fsi2_ak4643_info, }, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index f49e28a..4a46138 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -53,6 +53,7 @@ #include <media/soc_camera.h> #include <media/soc_camera_platform.h> #include <sound/sh_fsi.h> +#include <sound/simple_card.h>
#include <mach/common.h> #include <mach/irqs.h> @@ -941,17 +942,25 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = { + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, +}; + +static struct asoc_simple_card_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, + .codec_dai = "ak4642-hifi", + .init = &fsi2_ak4643_init_info, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "asoc-simple-card", .dev = { .platform_data = &fsi2_ak4643_info, }, diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index d893411..0da49f3b 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -54,6 +54,7 @@ config SH_7724_SOLUTION_ENGINE select SOLUTION_ENGINE depends on CPU_SUBTYPE_SH7724 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_AK4642 if SND_SIMPLE_CARD help Select 7724 SolutionEngine if configuring for a Hitachi SH7724 evaluation board. diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index c540b16..5cc5ed4 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -28,6 +28,7 @@ #include <video/sh_mobile_lcdc.h> #include <media/sh_mobile_ceu.h> #include <sound/sh_fsi.h> +#include <sound/simple_card.h> #include <asm/io.h> #include <asm/heartbeat.h> #include <asm/clock.h> @@ -304,17 +305,25 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi_ak4642_info = { +static struct asoc_simple_dai_init_info fsi2_ak4642_init_info = { + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, +}; + +static struct asoc_simple_card_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, + .codec_dai = "ak4642-hifi", + .init = &fsi2_ak4642_init_info, };
static struct platform_device fsi_ak4642_device = { - .name = "fsi-ak4642-audio", + .name = "asoc-simple-card", .dev = { .platform_data = &fsi_ak4642_info, }, diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index b457e87..956e30e 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -84,16 +84,4 @@ struct sh_fsi_platform_info { struct sh_fsi_port_info port_b; };
-/* - * 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/Kconfig b/sound/soc/sh/Kconfig index d8e06a6..c68b90b 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -46,14 +46,6 @@ config SND_SH7760_AC97 This option enables generic sound support for the first AC97 unit of the SH7760.
-config SND_FSI_AK4642 - tristate "FSI-AK4642 sound support" - depends on SND_SOC_SH4_FSI && I2C - select SND_SOC_AK4642 - help - This option enables generic sound support for the - FSI - AK4642 unit - config SND_FSI_DA7210 tristate "FSI-DA7210 sound support" depends on SND_SOC_SH4_FSI && I2C diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 94476d4..01808cd 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,13 +14,11 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-ak4642-objs := fsi-ak4642.o snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c deleted file mode 100644 index 97f540a..0000000 --- a/sound/soc/sh/fsi-ak4642.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * FSI-AK464x sound support for ms7724se - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_ak4642_data { - const char *name; - const char *card; - const char *cpu_dai; - const char *codec; - const char *platform; - int id; -}; - -static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .codec_dai_name = "ak4642-hifi", - .init = fsi_ak4642_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_ak4642_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; - - if (!pinfo) { - dev_err(&pdev->dev, "no info for fsi ak4642\n"); - goto out; - } - - fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); - if (!fsi_snd_device) - goto out; - - 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); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_ak4642_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct platform_driver fsi_ak4642 = { - .driver = { - .name = "fsi-ak4642-audio", - }, - .probe = fsi_ak4642_probe, - .remove = fsi_ak4642_remove, -}; - -module_platform_driver(fsi_ak4642); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com");
This patch uses simple-card driver instead of fsi-hdmi on each board. This patch removes fsi-hdmi driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v2 -> v3
- based on simple-card
arch/arm/mach-shmobile/board-ap4evb.c | 20 +++++- arch/arm/mach-shmobile/board-mackerel.c | 20 +++++- sound/soc/sh/Kconfig | 7 -- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-hdmi.c | 118 ------------------------------- 5 files changed, 38 insertions(+), 129 deletions(-) delete mode 100644 sound/soc/sh/fsi-hdmi.c
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index b397512..8302265 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -909,8 +909,26 @@ static struct platform_device lcdc1_device = { }, };
+static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = { + .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM, +}; + +static struct asoc_simple_card_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .init = &fsi2_hdmi_init_info, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "asoc-simple-card", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static struct gpio_led ap4evb_leds[] = { diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 4a46138..1bf1b2b 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -503,8 +503,26 @@ static struct platform_device hdmi_lcdc_device = { }, };
+static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = { + .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM, +}; + +static struct asoc_simple_card_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .init = &fsi2_hdmi_init_info, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "asoc-simple-card", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static void __init hdmi_init_pm_clock(void) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index c68b90b..9ef49c8 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -54,13 +54,6 @@ config SND_FSI_DA7210 This option enables generic sound support for the FSI - DA7210 unit
-config SND_FSI_HDMI - tristate "FSI-HDMI sound support" - depends on SND_SOC_SH4_FSI && FB_SH_MOBILE_HDMI - help - This option enables generic sound support for the - FSI - HDMI unit - config SND_SIU_MIGOR tristate "SIU sound support on Migo-R" depends on SH_MIGOR diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 01808cd..f37fc3a 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -15,10 +15,8 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o ## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o snd-soc-fsi-da7210-objs := fsi-da7210.o -snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o -obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c deleted file mode 100644 index 6e41908..0000000 --- a/sound/soc/sh/fsi-hdmi.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * FSI - HDMI sound support - * - * Copyright (C) 2010 Renesas Solutions Corp. - * Kuninori Morimoto kuninori.morimoto.gx@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_hdmi_data { - const char *cpu_dai; - const char *card; - int id; -}; - -static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .name = "HDMI", - .stream_name = "HDMI", - .codec_dai_name = "sh_mobile_hdmi-hifi", - .platform_name = "sh_fsi2", - .codec_name = "sh-mobile-hdmi", - .init = fsi_hdmi_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_hdmi_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - const struct platform_device_id *id_entry; - struct fsi_hdmi_data *pdata; - - id_entry = pdev->id_entry; - if (!id_entry) { - dev_err(&pdev->dev, "unknown fsi hdmi\n"); - return -ENODEV; - } - - pdata = (struct fsi_hdmi_data *)id_entry->driver_data; - - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); - if (!fsi_snd_device) - goto out; - - fsi_dai_link.cpu_dai_name = pdata->cpu_dai; - fsi_soc_card.name = pdata->card; - - platform_set_drvdata(fsi_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_snd_device); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_hdmi_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct fsi_hdmi_data fsi2_a_hdmi = { - .cpu_dai = "fsia-dai", - .card = "FSI2A-HDMI", - .id = FSI_PORT_A, -}; - -static struct fsi_hdmi_data fsi2_b_hdmi = { - .cpu_dai = "fsib-dai", - .card = "FSI2B-HDMI", - .id = FSI_PORT_B, -}; - -static struct platform_device_id fsi_id_table[] = { - /* FSI 2 */ - { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi }, - { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi }, - {}, -}; - -static struct platform_driver fsi_hdmi = { - .driver = { - .name = "fsi-hdmi-audio", - }, - .probe = fsi_hdmi_probe, - .remove = fsi_hdmi_remove, - .id_table = fsi_id_table, -}; - -module_platform_driver(fsi_hdmi); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); -MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
This patch uses simple-card driver instead of fsi-da7210 on each board. To select DA7210 driver, each boards select it on Kconfig.
This patch removes fsi-da7210 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v2 -> v3
- based on simple-card
arch/sh/boards/Kconfig | 1 + arch/sh/boards/mach-ecovec24/setup.c | 26 +++++++++++ sound/soc/sh/Kconfig | 8 --- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-da7210.c | 81 ---------------------------------- 5 files changed, 27 insertions(+), 91 deletions(-) delete mode 100644 sound/soc/sh/fsi-da7210.c
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index 0da49f3b..c0241bd 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -224,6 +224,7 @@ config SH_ECOVEC bool "EcoVec" depends on CPU_SUBTYPE_SH7724 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_DA7210 if SND_SIMPLE_CARD help Renesas "R0P7724LC0011/21RL (EcoVec)" support.
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index d12fe9d..299a40a 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -32,6 +32,7 @@ #include <linux/videodev2.h> #include <video/sh_mobile_lcdc.h> #include <sound/sh_fsi.h> +#include <sound/simple_card.h> #include <media/sh_mobile_ceu.h> #include <media/soc_camera.h> #include <media/tw9910.h> @@ -809,6 +810,30 @@ static struct platform_device fsi_device = { }, };
+static struct asoc_simple_dai_init_info fsi_da7210_init_info = { + .fmt = SND_SOC_DAIFMT_I2S, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, +}; + +static struct asoc_simple_card_info fsi_da7210_info = { + .name = "DA7210", + .card = "FSIB-DA7210", + .cpu_dai = "fsib-dai", + .codec = "da7210.0-001a", + .platform = "sh_fsi.0", + .codec_dai = "da7210-hifi", + .init = &fsi_da7210_init_info, +}; + +static struct platform_device fsi_da7210_device = { + .name = "asoc-simple-card", + .dev = { + .platform_data = &fsi_da7210_info, + }, +}; + + /* IrDA */ static struct resource irda_resources[] = { [0] = { @@ -945,6 +970,7 @@ static struct platform_device *ecovec_devices[] __initdata = { &camera_devices[1], &camera_devices[2], &fsi_device, + &fsi_da7210_device, &irda_device, &vou_device, #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 9ef49c8..c9fdf63 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -46,14 +46,6 @@ config SND_SH7760_AC97 This option enables generic sound support for the first AC97 unit of the SH7760.
-config SND_FSI_DA7210 - tristate "FSI-DA7210 sound support" - depends on SND_SOC_SH4_FSI && I2C - select SND_SOC_DA7210 - help - This option enables generic sound support for the - FSI - DA7210 unit - config SND_SIU_MIGOR tristate "SIU sound support on Migo-R" depends on SH_MIGOR diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index f37fc3a..849b387 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,9 +14,7 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c deleted file mode 100644 index 1dd3354..0000000 --- a/sound/soc/sh/fsi-da7210.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * fsi-da7210.c - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, - SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_da7210_dai = { - .name = "DA7210", - .stream_name = "DA7210", - .cpu_dai_name = "fsib-dai", /* FSI B */ - .codec_dai_name = "da7210-hifi", - .platform_name = "sh_fsi.0", - .codec_name = "da7210-codec.0-001a", - .init = fsi_da7210_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .name = "FSI-DA7210", - .owner = THIS_MODULE, - .dai_link = &fsi_da7210_dai, - .num_links = 1, -}; - -static struct platform_device *fsi_da7210_snd_device; - -static int __init fsi_da7210_sound_init(void) -{ - int ret; - - fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); - if (!fsi_da7210_snd_device) - return -ENOMEM; - - platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_da7210_snd_device); - if (ret) - platform_device_put(fsi_da7210_snd_device); - - return ret; -} - -static void __exit fsi_da7210_sound_exit(void) -{ - platform_device_unregister(fsi_da7210_snd_device); -} - -module_init(fsi_da7210_sound_init); -module_exit(fsi_da7210_sound_exit); - -/* Module information */ -MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com"); -MODULE_LICENSE("GPL");
Current SuperH FSI require simple-card driver as sound card. This patch select it on Kconfig when FSI was selected.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v2 -> v3
- based on simple-card
sound/soc/sh/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index c9fdf63..6bcb116 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -22,6 +22,7 @@ config SND_SOC_SH4_SSI
config SND_SOC_SH4_FSI tristate "SH4 FSI support" + select SND_SIMPLE_CARD help This option enables FSI sound support
This patch uses fsi-common-codec card driver instead of fsi-ak4642 on each board. To select AK4642 driver, each boards select it on Kconfig.
This patch removes fsi-ak4642 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v1 -> v2
- select AK4642 on board Kconfig
arch/arm/mach-shmobile/Kconfig | 2 + arch/arm/mach-shmobile/board-ap4evb.c | 10 ++- arch/arm/mach-shmobile/board-mackerel.c | 10 ++- arch/sh/boards/Kconfig | 1 + arch/sh/boards/mach-se/7724/setup.c | 10 ++- include/sound/sh_fsi.h | 12 ---- sound/soc/sh/Kconfig | 8 -- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-ak4642.c | 108 ------------------------------- 9 files changed, 24 insertions(+), 139 deletions(-) delete mode 100644 sound/soc/sh/fsi-ak4642.c
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 34560ca..0a2ce6d 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -58,6 +58,7 @@ config MACH_AP4EVB depends on ARCH_SH7372 select ARCH_REQUIRE_GPIOLIB select SH_LCD_MIPI_DSI + select SND_SOC_AK4642 if SND_FSI_COMMON_CODEC
choice prompt "AP4EVB LCD panel selection" @@ -82,6 +83,7 @@ config MACH_MACKEREL bool "mackerel board" depends on ARCH_SH7372 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_AK4642 if SND_FSI_COMMON_CODEC
config MACH_KOTA2 bool "KOTA2 board" diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index b56dde2..8d86ae9 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -785,17 +785,21 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct fsi_common_codec_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, + .codec_dai = "ak4642-hifi", + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-common-codec-audio", .dev = { .platform_data = &fsi2_ak4643_info, }, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index f49e28a..be08926 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -941,17 +941,21 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi2_ak4643_info = { +static struct fsi_common_codec_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, + .codec_dai = "ak4642-hifi", + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4643_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-common-codec-audio", .dev = { .platform_data = &fsi2_ak4643_info, }, diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index d893411..b340fa4 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -54,6 +54,7 @@ config SH_7724_SOLUTION_ENGINE select SOLUTION_ENGINE depends on CPU_SUBTYPE_SH7724 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_AK4642 if SND_FSI_COMMON_CODEC help Select 7724 SolutionEngine if configuring for a Hitachi SH7724 evaluation board. diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index c540b16..afbaf90 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -304,17 +304,21 @@ static struct platform_device fsi_device = { }, };
-static struct fsi_ak4642_info fsi_ak4642_info = { +static struct fsi_common_codec_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, + .codec_dai = "ak4642-hifi", + .fmt = SND_SOC_DAIFMT_LEFT_J, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, + .sysclk = 11289600, };
static struct platform_device fsi_ak4642_device = { - .name = "fsi-ak4642-audio", + .name = "fsi-common-codec-audio", .dev = { .platform_data = &fsi_ak4642_info, }, diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index 5f125b0..601add0 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -85,18 +85,6 @@ struct sh_fsi_platform_info { };
/* - * 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; -}; - -/* * for fsi-common-codec */ #define fsi_link_to_info(p) \ diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 00d9e09..6aae8cf 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -50,14 +50,6 @@ config SND_SH7760_AC97 config SND_FSI_COMMON_CODEC tristate
-config SND_FSI_AK4642 - tristate "FSI-AK4642 sound support" - depends on SND_SOC_SH4_FSI && I2C - select SND_SOC_AK4642 - help - This option enables generic sound support for the - FSI - AK4642 unit - config SND_FSI_DA7210 tristate "FSI-DA7210 sound support" depends on SND_SOC_SH4_FSI && I2C diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 11e9a56..8248b64 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,14 +14,12 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-ak4642-objs := fsi-ak4642.o snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-fsi-common-codec-objs := fsi-common-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_FSI_COMMON_CODEC) += snd-soc-fsi-common-codec.o diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c deleted file mode 100644 index 97f540a..0000000 --- a/sound/soc/sh/fsi-ak4642.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * FSI-AK464x sound support for ms7724se - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_ak4642_data { - const char *name; - const char *card; - const char *cpu_dai; - const char *codec; - const char *platform; - int id; -}; - -static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .codec_dai_name = "ak4642-hifi", - .init = fsi_ak4642_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_ak4642_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; - - if (!pinfo) { - dev_err(&pdev->dev, "no info for fsi ak4642\n"); - goto out; - } - - fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); - if (!fsi_snd_device) - goto out; - - 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); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_ak4642_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct platform_driver fsi_ak4642 = { - .driver = { - .name = "fsi-ak4642-audio", - }, - .probe = fsi_ak4642_probe, - .remove = fsi_ak4642_remove, -}; - -module_platform_driver(fsi_ak4642); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com");
This patch uses fsi-common-codec card driver instead of fsi-hdmi on each board.
This patch removes fsi-hdmi driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v1 -> v2
- remove FSI-HDMI from Kconfig
arch/arm/mach-shmobile/board-ap4evb.c | 16 ++++- arch/arm/mach-shmobile/board-mackerel.c | 16 ++++- sound/soc/sh/Kconfig | 7 -- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-hdmi.c | 118 ------------------------------- 5 files changed, 30 insertions(+), 129 deletions(-) delete mode 100644 sound/soc/sh/fsi-hdmi.c
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 8d86ae9..0724178 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -904,8 +904,22 @@ static struct platform_device lcdc1_device = { }, };
+static struct fsi_common_codec_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "fsi-common-codec-audio", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static struct gpio_led ap4evb_leds[] = { diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index be08926..cf13d287 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -502,8 +502,22 @@ static struct platform_device hdmi_lcdc_device = { }, };
+static struct fsi_common_codec_info fsi2_hdmi_info = { + .name = "HDMI", + .card = "FSI2B-HDMI", + .cpu_dai = "fsib-dai", + .codec = "sh-mobile-hdmi", + .platform = "sh_fsi2", + .codec_dai = "sh_mobile_hdmi-hifi", + .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM, +}; + static struct platform_device fsi_hdmi_device = { - .name = "sh_fsi2_b_hdmi", + .name = "fsi-common-codec-audio", + .id = 1, + .dev = { + .platform_data = &fsi2_hdmi_info, + }, };
static void __init hdmi_init_pm_clock(void) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 6aae8cf..31aea0b 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -58,13 +58,6 @@ config SND_FSI_DA7210 This option enables generic sound support for the FSI - DA7210 unit
-config SND_FSI_HDMI - tristate "FSI-HDMI sound support" - depends on SND_SOC_SH4_FSI && FB_SH_MOBILE_HDMI - help - This option enables generic sound support for the - FSI - HDMI unit - config SND_SIU_MIGOR tristate "SIU sound support on Migo-R" depends on SH_MIGOR diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 8248b64..7b8819b 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -15,12 +15,10 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o ## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o snd-soc-fsi-da7210-objs := fsi-da7210.o -snd-soc-fsi-hdmi-objs := fsi-hdmi.o snd-soc-fsi-common-codec-objs := fsi-common-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o -obj-$(CONFIG_SND_FSI_HDMI) += snd-soc-fsi-hdmi.o obj-$(CONFIG_SND_FSI_COMMON_CODEC) += snd-soc-fsi-common-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c deleted file mode 100644 index 6e41908..0000000 --- a/sound/soc/sh/fsi-hdmi.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * FSI - HDMI sound support - * - * Copyright (C) 2010 Renesas Solutions Corp. - * Kuninori Morimoto kuninori.morimoto.gx@renesas.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -struct fsi_hdmi_data { - const char *cpu_dai; - const char *card; - int id; -}; - -static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .name = "HDMI", - .stream_name = "HDMI", - .codec_dai_name = "sh_mobile_hdmi-hifi", - .platform_name = "sh_fsi2", - .codec_name = "sh-mobile-hdmi", - .init = fsi_hdmi_dai_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .owner = THIS_MODULE, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct platform_device *fsi_snd_device; - -static int fsi_hdmi_probe(struct platform_device *pdev) -{ - int ret = -ENOMEM; - const struct platform_device_id *id_entry; - struct fsi_hdmi_data *pdata; - - id_entry = pdev->id_entry; - if (!id_entry) { - dev_err(&pdev->dev, "unknown fsi hdmi\n"); - return -ENODEV; - } - - pdata = (struct fsi_hdmi_data *)id_entry->driver_data; - - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); - if (!fsi_snd_device) - goto out; - - fsi_dai_link.cpu_dai_name = pdata->cpu_dai; - fsi_soc_card.name = pdata->card; - - platform_set_drvdata(fsi_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_snd_device); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static int fsi_hdmi_remove(struct platform_device *pdev) -{ - platform_device_unregister(fsi_snd_device); - return 0; -} - -static struct fsi_hdmi_data fsi2_a_hdmi = { - .cpu_dai = "fsia-dai", - .card = "FSI2A-HDMI", - .id = FSI_PORT_A, -}; - -static struct fsi_hdmi_data fsi2_b_hdmi = { - .cpu_dai = "fsib-dai", - .card = "FSI2B-HDMI", - .id = FSI_PORT_B, -}; - -static struct platform_device_id fsi_id_table[] = { - /* FSI 2 */ - { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi }, - { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi }, - {}, -}; - -static struct platform_driver fsi_hdmi = { - .driver = { - .name = "fsi-hdmi-audio", - }, - .probe = fsi_hdmi_probe, - .remove = fsi_hdmi_remove, - .id_table = fsi_id_table, -}; - -module_platform_driver(fsi_hdmi); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); -MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
This patch uses fsi-common-codec card driver instead of fsi-da7210 on each board. To select DA7210 driver, each boards select it on Kconfig.
And removes fsi-da7210 driver which is no longer needed
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- v1 -> v2
- remove FSI-DA7210 from Kconfig - select DA7210 on board config
arch/sh/boards/Kconfig | 1 + arch/sh/boards/mach-ecovec24/setup.c | 21 +++++++++ sound/soc/sh/Kconfig | 8 --- sound/soc/sh/Makefile | 2 - sound/soc/sh/fsi-da7210.c | 81 ---------------------------------- 5 files changed, 22 insertions(+), 91 deletions(-) delete mode 100644 sound/soc/sh/fsi-da7210.c
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index b340fa4..9c83079 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -224,6 +224,7 @@ config SH_ECOVEC bool "EcoVec" depends on CPU_SUBTYPE_SH7724 select ARCH_REQUIRE_GPIOLIB + select SND_SOC_DA7210 if SND_FSI_COMMON_CODEC help Renesas "R0P7724LC0011/21RL (EcoVec)" support.
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index d12fe9d..b3cf4eb 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -809,6 +809,26 @@ static struct platform_device fsi_device = { }, };
+static struct fsi_common_codec_info fsi_da7210_info = { + .name = "DA7210", + .card = "FSIB-DA7210", + .cpu_dai = "fsib-dai", + .codec = "da7210-codec.0-001a", + .platform = "sh_fsi.0", + .codec_dai = "da7210-hifi", + .fmt = SND_SOC_DAIFMT_I2S, + .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, + .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, +}; + +static struct platform_device fsi_da7210_device = { + .name = "fsi-common-codec-audio", + .dev = { + .platform_data = &fsi_da7210_info, + }, +}; + + /* IrDA */ static struct resource irda_resources[] = { [0] = { @@ -945,6 +965,7 @@ static struct platform_device *ecovec_devices[] __initdata = { &camera_devices[1], &camera_devices[2], &fsi_device, + &fsi_da7210_device, &irda_device, &vou_device, #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 31aea0b..3f985a3 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -50,14 +50,6 @@ config SND_SH7760_AC97 config SND_FSI_COMMON_CODEC tristate
-config SND_FSI_DA7210 - tristate "FSI-DA7210 sound support" - depends on SND_SOC_SH4_FSI && I2C - select SND_SOC_DA7210 - help - This option enables generic sound support for the - FSI - DA7210 unit - config SND_SIU_MIGOR tristate "SIU sound support on Migo-R" depends on SH_MIGOR diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 7b8819b..a6d0645 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -14,11 +14,9 @@ obj-$(CONFIG_SND_SOC_SH4_SIU) += snd-soc-siu.o
## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o -snd-soc-fsi-da7210-objs := fsi-da7210.o snd-soc-fsi-common-codec-objs := fsi-common-codec.o snd-soc-migor-objs := migor.o
obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o -obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o obj-$(CONFIG_SND_FSI_COMMON_CODEC) += snd-soc-fsi-common-codec.o obj-$(CONFIG_SND_SIU_MIGOR) += snd-soc-migor.o diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c deleted file mode 100644 index 1dd3354..0000000 --- a/sound/soc/sh/fsi-da7210.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * fsi-da7210.c - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto morimoto.kuninori@renesas.com - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/platform_device.h> -#include <linux/module.h> -#include <sound/sh_fsi.h> - -static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - int ret; - - ret = snd_soc_dai_set_fmt(codec, - SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_CBS_CFS); - - return ret; -} - -static struct snd_soc_dai_link fsi_da7210_dai = { - .name = "DA7210", - .stream_name = "DA7210", - .cpu_dai_name = "fsib-dai", /* FSI B */ - .codec_dai_name = "da7210-hifi", - .platform_name = "sh_fsi.0", - .codec_name = "da7210-codec.0-001a", - .init = fsi_da7210_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .name = "FSI-DA7210", - .owner = THIS_MODULE, - .dai_link = &fsi_da7210_dai, - .num_links = 1, -}; - -static struct platform_device *fsi_da7210_snd_device; - -static int __init fsi_da7210_sound_init(void) -{ - int ret; - - fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); - if (!fsi_da7210_snd_device) - return -ENOMEM; - - platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); - ret = platform_device_add(fsi_da7210_snd_device); - if (ret) - platform_device_put(fsi_da7210_snd_device); - - return ret; -} - -static void __exit fsi_da7210_sound_exit(void) -{ - platform_device_unregister(fsi_da7210_snd_device); -} - -module_init(fsi_da7210_sound_init); -module_exit(fsi_da7210_sound_exit); - -/* Module information */ -MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); -MODULE_AUTHOR("Kuninori Morimoto morimoto.kuninori@renesas.com"); -MODULE_LICENSE("GPL");
Hi,
On Wednesday, April 04, 2012, Kuninori Morimoto wrote:
Hi Mark, Liam Cc: Paul, Rafael
These are v2 patches of fsi-codec support for SuperH board.
Kuninori Morimoto (4): ASoC: sh: fsi: add fsi-common-codec card support ASoC: sh: fsi: use fsi-common-codec instead of fsi-ak4642 ASoC: sh: fsi: use fsi-common-codec instead of fsi-hdmi ASoC: sh: fsi: use fsi-common-codec instead of fsi-da7210
#2-#3 patches remove fsi-xxx card driver and Kconfig settings from ${LINUX}/sound/soc/sh/Kconfig.
And adds board specific CODEC on each board Kconfig. CODEC/fsi-common-codec will be selected automatically if you select board and FSI.
Could you please re-post this series and include linux-sh and Magnus in the CC list?
Rafael
On Wed, Apr 18, 2012 at 12:47:46PM +0200, Rafael J. Wysocki wrote:
On Wednesday, April 04, 2012, Kuninori Morimoto wrote:
And adds board specific CODEC on each board Kconfig. CODEC/fsi-common-codec will be selected automatically if you select board and FSI.
Could you please re-post this series and include linux-sh and Magnus in the CC list?
It's already been applied...
participants (4)
-
Kuninori Morimoto
-
Mark Brown
-
Rafael J. Wysocki
-
Takashi Iwai