fsi-codec which support some dai_link is used instead of fsi-ak4642 / fsi-da7210, because there is a possibility that SuperH board has some codecs for sound. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> --- sound/soc/sh/Makefile | 6 +- sound/soc/sh/fsi-ak4642.c | 82 --------------------------- sound/soc/sh/fsi-codec.c | 137 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/sh/fsi-da7210.c | 74 ------------------------ 4 files changed, 139 insertions(+), 160 deletions(-) delete mode 100644 sound/soc/sh/fsi-ak4642.c create mode 100644 sound/soc/sh/fsi-codec.c delete mode 100644 sound/soc/sh/fsi-da7210.c diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 8a5a192..3811c9d 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-ak4642-objs := fsi-ak4642.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_AK4642) += snd-soc-fsi-ak4642.o -obj-$(CONFIG_SND_FSI_DA7210) += snd-soc-fsi-da7210.o +obj-$(CONFIG_SND_SOC_SH4_FSI) += snd-soc-fsi-codec.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 2871a20..0000000 --- a/sound/soc/sh/fsi-ak4642.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * FSI-AK464x sound support for ms7724se - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto <morimoto.kuninori@xxxxxxxxxxx> - * - * 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 <sound/sh_fsi.h> -#include <../sound/soc/codecs/ak4642.h> - -static int fsi_ak4642_dai_init(struct snd_soc_codec *codec) -{ - int ret; - - ret = snd_soc_dai_set_fmt(&ak4642_dai, SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_sysclk(&ak4642_dai, 0, 11289600, 0); - - return ret; -} - -static struct snd_soc_dai_link fsi_dai_link = { - .name = "AK4642", - .stream_name = "AK4642", - .cpu_dai = &fsi_soc_dai[0], /* fsi */ - .codec_dai = &ak4642_dai, - .init = fsi_ak4642_dai_init, - .ops = NULL, -}; - -static struct snd_soc_card fsi_soc_card = { - .name = "FSI", - .platform = &fsi_soc_platform, - .dai_link = &fsi_dai_link, - .num_links = 1, -}; - -static struct snd_soc_device fsi_snd_devdata = { - .card = &fsi_soc_card, - .codec_dev = &soc_codec_dev_ak4642, -}; - -static struct platform_device *fsi_snd_device; - -static int __init fsi_ak4642_init(void) -{ - int ret = -ENOMEM; - - fsi_snd_device = platform_device_alloc("soc-audio", -1); - if (!fsi_snd_device) - goto out; - - platform_set_drvdata(fsi_snd_device, - &fsi_snd_devdata); - fsi_snd_devdata.dev = &fsi_snd_device->dev; - ret = platform_device_add(fsi_snd_device); - - if (ret) - platform_device_put(fsi_snd_device); - -out: - return ret; -} - -static void __exit fsi_ak4642_exit(void) -{ - platform_device_unregister(fsi_snd_device); -} - -module_init(fsi_ak4642_init); -module_exit(fsi_ak4642_exit); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); -MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@xxxxxxxxxxx>"); diff --git a/sound/soc/sh/fsi-codec.c b/sound/soc/sh/fsi-codec.c new file mode 100644 index 0000000..33b901f --- /dev/null +++ b/sound/soc/sh/fsi-codec.c @@ -0,0 +1,137 @@ +/* + * FSI - codecs sound support + * + * Copyright (C) 2010 Renesas Solutions Corp. + * Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> + * + * 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 <sound/sh_fsi.h> + +/************************************************************************ + + + FSI - AK4642 + + +************************************************************************/ +#ifdef CONFIG_SND_FSI_AK4642 +#include <../sound/soc/codecs/ak4642.h> + +static int fsi_ak4642_dai_init(struct snd_soc_codec *codec) +{ + int ret; + + ret = snd_soc_dai_set_fmt(&ak4642_dai, SND_SOC_DAIFMT_CBM_CFM); + if (ret < 0) + return ret; + + ret = snd_soc_dai_set_sysclk(&ak4642_dai, 0, 11289600, 0); + + return ret; +} + +#undef CODEC_DEV +#define CODEC_DEV &soc_codec_dev_ak4642 +#endif + +/************************************************************************ + + + FSI - da7210 + + +************************************************************************/ +#ifdef CONFIG_SND_FSI_DA7210 +#include "../codecs/da7210.h" + +static int fsi_da7210_init(struct snd_soc_codec *codec) +{ + return snd_soc_dai_set_fmt(&da7210_dai, + SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM); +} + +#undef CODEC_DEV +#define CODEC_DEV &soc_codec_dev_da7210 +#endif + +/************************************************************************ + + + FSI dai link + + +************************************************************************/ +static struct snd_soc_dai_link fsi_dai_link[] = { +#ifdef CONFIG_SND_FSI_AK4642 + { + .name = "AK4642", + .stream_name = "AK4642", + .cpu_dai = &fsi_soc_dai[0], /* FSI A */ + .codec_dai = &ak4642_dai, + .init = fsi_ak4642_dai_init, + }, +#endif +#ifdef CONFIG_SND_FSI_DA7210 + { + .name = "DA7210", + .stream_name = "DA7210", + .cpu_dai = &fsi_soc_dai[1], /* FSI B */ + .codec_dai = &da7210_dai, + .init = fsi_da7210_init, + }, +#endif +}; + +static struct snd_soc_card fsi_soc_card = { + .name = "FSI", + .platform = &fsi_soc_platform, + .dai_link = fsi_dai_link, + .num_links = ARRAY_SIZE(fsi_dai_link), +}; + +static struct snd_soc_device fsi_snd_devdata = { + .card = &fsi_soc_card, + .codec_dev = CODEC_DEV, +}; + +static struct platform_device *fsi_snd_device; + +static int __init fsi_codec_init(void) +{ + int ret = -ENOMEM; + + fsi_snd_device = platform_device_alloc("soc-audio", -1); + if (!fsi_snd_device) + goto out; + + platform_set_drvdata(fsi_snd_device, + &fsi_snd_devdata); + fsi_snd_devdata.dev = &fsi_snd_device->dev; + ret = platform_device_add(fsi_snd_device); + + if (ret) + platform_device_put(fsi_snd_device); + else + dev_info(fsi_snd_devdata.dev, "FSI common codec\n"); + +out: + return ret; +} + +static void __exit fsi_codec_exit(void) +{ + platform_device_unregister(fsi_snd_device); +} + +module_init(fsi_codec_init); +module_exit(fsi_codec_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Generic FSI - codec sound card"); +MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>"); diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c deleted file mode 100644 index 4d4fd77..0000000 --- a/sound/soc/sh/fsi-da7210.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * fsi-da7210.c - * - * Copyright (C) 2009 Renesas Solutions Corp. - * Kuninori Morimoto <morimoto.kuninori@xxxxxxxxxxx> - * - * 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 <sound/sh_fsi.h> -#include "../codecs/da7210.h" - -static int fsi_da7210_init(struct snd_soc_codec *codec) -{ - return snd_soc_dai_set_fmt(&da7210_dai, - SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBM_CFM); -} - -static struct snd_soc_dai_link fsi_da7210_dai = { - .name = "DA7210", - .stream_name = "DA7210", - .cpu_dai = &fsi_soc_dai[1], /* FSI B */ - .codec_dai = &da7210_dai, - .init = fsi_da7210_init, -}; - -static struct snd_soc_card fsi_soc_card = { - .name = "FSI", - .platform = &fsi_soc_platform, - .dai_link = &fsi_da7210_dai, - .num_links = 1, -}; - -static struct snd_soc_device fsi_da7210_snd_devdata = { - .card = &fsi_soc_card, - .codec_dev = &soc_codec_dev_da7210, -}; - -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", -1); - if (!fsi_da7210_snd_device) - return -ENOMEM; - - platform_set_drvdata(fsi_da7210_snd_device, &fsi_da7210_snd_devdata); - fsi_da7210_snd_devdata.dev = &fsi_da7210_snd_device->dev; - 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@xxxxxxxxxxx>"); -MODULE_LICENSE("GPL"); -- 1.7.0.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel