diff options
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r-- | sound/soc/ux500/Kconfig | 10 | ||||
-rw-r--r-- | sound/soc/ux500/Makefile | 28 | ||||
-rw-r--r-- | sound/soc/ux500/u5500.c | 119 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_ab5500.c | 57 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_ab5500.h | 24 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_dai.c | 2 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_dai.h | 7 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_pcm.c | 4 |
8 files changed, 239 insertions, 12 deletions
diff --git a/sound/soc/ux500/Kconfig b/sound/soc/ux500/Kconfig index 2b1327240fe..a5cdf4358b5 100644 --- a/sound/soc/ux500/Kconfig +++ b/sound/soc/ux500/Kconfig @@ -15,7 +15,15 @@ config SND_SOC_UX500_AB3550 select SND_SOC_AB3550 default n help - Say Y if you want to include AB3550 codec (Petronella MSA). + Say Y if you want to include the AB3550 codec. + +config SND_SOC_UX500_AB5500 + bool "Codec - AB5500" + depends on SND_SOC_UX500 && (UX500_SOC_DB8500 || UX500_SOC_DB5500) && AB5500_CORE + select SND_SOC_AB5500 + default n + help + Say Y if you want to include the AB5500 codec. config SND_SOC_UX500_CG29XX bool "Codec - CG29xx" diff --git a/sound/soc/ux500/Makefile b/sound/soc/ux500/Makefile index e7917509681..84e642bf193 100644 --- a/sound/soc/ux500/Makefile +++ b/sound/soc/ux500/Makefile @@ -7,27 +7,37 @@ CFLAGS_ux500_av8100.o := -DDEBUG endif ifdef CONFIG_SND_SOC_UX500_AB3550 -snd-soc-ux500-av8100-objs := ux500_ab3550.o +snd-soc-ux500-AB3550-objs := ux500_ab3550.o obj-$(CONFIG_SND_SOC_UX500_AB3550) += ux500_ab3550.o endif +ifdef CONFIG_SND_SOC_UX500_AB5500 +snd-soc-ux500-AB5500-objs := ux500_ab5500.o +obj-$(CONFIG_SND_SOC_UX500_AB5500) += ux500_ab5500.o +endif + ifdef CONFIG_SND_SOC_UX500_AV8100 snd-soc-ux500-av8100-objs := ux500_av8100.o obj-$(CONFIG_SND_SOC_UX500_AV8100) += ux500_av8100.o endif ifdef CONFIG_SND_SOC_UX500_CG29XX -snd-soc-ux500-av8100-objs := ux500_cg29xx.o +snd-soc-ux500-cg29xx-objs := ux500_cg29xx.o obj-$(CONFIG_SND_SOC_UX500_CG29XX) += ux500_cg29xx.o endif -#ifdef UX500_SOC_DB8500 -snd-soc-u8500-objs := u8500.o -obj-y += ux500_pcm.o ux500_msp_dai.o snd-soc-u8500.o -#endif +ifdef CONFIG_UX500_SOC_DB8500 +CFLAGS_ux500_msp_dai.o += -DSTE_PLATFORM_U8500 +CFLAGS_ux500_pcm.o += -DSTE_PLATFORM_U8500 +snd-soc-u8500-objs := ux500_pcm.o ux500_msp_dai.o u8500.o +obj-$(CONFIG_UX500_SOC_DB8500) += snd-soc-u8500.o +endif -ifdef UX500_SOC_DB5500 -snd-soc-u8500-objs := u5500.o -obj-$(UX500_SOC_DB5500) += ux500_pcm.o ux500_msp_dai.o snd-soc-u5500.o +ifdef CONFIG_UX500_SOC_DB5500 +CFLAGS_ux500_msp_dai.o += -DSTE_PLATFORM_U5500 +CFLAGS_ux500_pcm.o += -DSTE_PLATFORM_U5500 +snd-soc-u5500-objs := ux500_pcm.o ux500_msp_dai.o u5500.o +obj-$(CONFIG_UX500_SOC_DB5500) += snd-soc-u5500.o endif + diff --git a/sound/soc/ux500/u5500.c b/sound/soc/ux500/u5500.c new file mode 100644 index 00000000000..1993f5dfe0c --- /dev/null +++ b/sound/soc/ux500/u5500.c @@ -0,0 +1,119 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Xie Xiaolei (xie.xiaolei@stericsson.com) + * for ST-Ericsson. + * + * License terms: + * + * 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/io.h> +#include <linux/spi/spi.h> +#include <sound/soc.h> +#include <sound/initval.h> + +#include "ux500_pcm.h" +#include "ux500_msp_dai.h" + +#ifdef CONFIG_SND_SOC_UX500_AB5500 +#include "ux500_ab5500.h" +#endif + +static struct platform_device *u5500_platform_dev; + +/* Create dummy devices for platform drivers */ + +static struct platform_device ux500_pcm = { + .name = "ux500-pcm", + .id = 0, + .dev = { + .platform_data = NULL, + }, +}; + +/* Define the whole U5500 soundcard, linking platform to the codec-drivers */ +struct snd_soc_dai_link u5500_dai_links[] = { +#ifdef CONFIG_SND_SOC_UX500_AB5500 + { + .name = "ab5500_0", + .stream_name = "ab5500_0", + .cpu_dai_name = "i2s.0", + .codec_dai_name = "ab5500-codec-dai.0", + .platform_name = "ux500-pcm.0", + .codec_name = "ab5500-codec.9", + .init = NULL, + .ops = (struct snd_soc_ops[]) { + { + .startup = ux500_ab5500_startup, + .shutdown = ux500_ab5500_shutdown, + .hw_params = ux500_ab5500_hw_params, + } + } + }, + { + .name = "ab5500_1", + .stream_name = "ab5500_1", + .cpu_dai_name = "i2s.1", + .codec_dai_name = "ab5500-codec-dai.1", + .platform_name = "ux500-pcm.0", + .codec_name = "ab5500-codec.9", + .init = NULL, + .ops = (struct snd_soc_ops[]) { + { + .startup = ux500_ab5500_startup, + .shutdown = ux500_ab5500_shutdown, + .hw_params = ux500_ab5500_hw_params, + } + } + }, +#endif +}; + +static struct snd_soc_card u5500_drvdata = { + .name = "U5500-card", + .probe = NULL, + .dai_link = u5500_dai_links, + .num_links = ARRAY_SIZE(u5500_dai_links), +}; + +static int __init u5500_soc_init(void) +{ + int ret; + + pr_debug("%s: Enter.\n", __func__); + + platform_device_register(&ux500_pcm); + + u5500_platform_dev = platform_device_alloc("soc-audio", -1); + if (!u5500_platform_dev) + return -ENOMEM; + + platform_set_drvdata(u5500_platform_dev, &u5500_drvdata); + u5500_drvdata.dev = &u5500_platform_dev->dev; + + ret = platform_device_add(u5500_platform_dev); + if (ret) { + pr_err("%s: Error: Failed to add platform device (%s).\n", + __func__, + u5500_drvdata.name); + platform_device_put(u5500_platform_dev); + } + + return ret; +} + +static void __exit u5500_soc_exit(void) +{ + pr_debug("%s: Enter.\n", __func__); + + platform_device_unregister(u5500_platform_dev); +} + +module_init(u5500_soc_init); +module_exit(u5500_soc_exit); + +MODULE_LICENSE("GPLv2"); diff --git a/sound/soc/ux500/ux500_ab5500.c b/sound/soc/ux500/ux500_ab5500.c new file mode 100644 index 00000000000..89ecc19dfdc --- /dev/null +++ b/sound/soc/ux500/ux500_ab5500.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Ola Lilja <ola.o.lilja@stericsson.com>, + * Roger Nilsson <roger.xr.nilsson@stericsson.com> + * for ST-Ericsson. + * + * License terms: + * + * 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 <sound/soc.h> +#include "../codecs/ab5500.h" + +int ux500_ab5500_startup(struct snd_pcm_substream *substream) +{ + printk(KERN_DEBUG "%s: Enter.\n", __func__); + + return 0; +} + +void ux500_ab5500_shutdown(struct snd_pcm_substream *substream) +{ + printk(KERN_DEBUG "%s: Enter.\n", __func__); +} + +int ux500_ab5500_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + int ret = 0; + + ret = snd_soc_dai_set_fmt(codec_dai, + SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS); + if (ret < 0) { + printk(KERN_DEBUG "%s: snd_soc_dai_set_fmt failed with %d.\n", + __func__, + ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(cpu_dai, + SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS); + if (ret < 0) { + printk(KERN_DEBUG "%s: snd_soc_dai_set_fmt failed with %d.\n", + __func__, + ret); + return ret; + } + + return ret; +} diff --git a/sound/soc/ux500/ux500_ab5500.h b/sound/soc/ux500/ux500_ab5500.h new file mode 100644 index 00000000000..977851bbce6 --- /dev/null +++ b/sound/soc/ux500/ux500_ab5500.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Xie Xiaolei (xie.xiaolei@stericsson.com) + * for ST-Ericsson. + * + * License terms: + * + * 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 UX500_AB5500_H +#define UX500_AB5500_H + +int ux500_ab5500_startup(struct snd_pcm_substream *substream); + +void ux500_ab5500_shutdown(struct snd_pcm_substream *substream); + +int ux500_ab5500_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params); + +#endif diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index b0d327f9ba6..96d4cf9f6f9 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -472,6 +472,8 @@ static void ux500_msp_dai_compile_msp_config(struct snd_pcm_substream *substream msp_config->work_mode = MSP_DMA_MODE; msp_config->frame_freq = rate; + printk(KERN_INFO "%s: input_clock_freq = %u, frame_freq = %u.\n", + __func__, msp_config->input_clock_freq, msp_config->frame_freq); /* To avoid division by zero in I2S-driver (i2s_setup) */ prot_desc->total_clocks_for_one_frame = 1; diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h index 84130f5d624..2b2f3776efc 100644 --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -34,7 +34,12 @@ #define FRAME_PER_8_SLOTS 138 #define FRAME_PER_16_SLOTS 277 -#define UX500_MSP_INTERNAL_CLOCK_FREQ 40000000; +#ifdef STE_PLATFORM_U5500 +#define UX500_MSP_INTERNAL_CLOCK_FREQ 13000000 +#else +#define UX500_MSP_INTERNAL_CLOCK_FREQ 38400000 +#endif + #define UX500_MSP_MIN_CHANNELS 1 #define UX500_MSP_MAX_CHANNELS 8 diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index f8c92b59da2..2655e257ac1 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -105,7 +105,9 @@ void ux500_pcm_dma_eot_handler(void *data) struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *dai = rtd->cpu_dai; - pr_err("%s: MSP %d (%s): Enter.\n", __func__, dai->id, stream_str(substream)); + pr_debug("%s: MSP %d (%s): Enter.\n", + __func__, + dai->id, stream_str(substream)); if (substream) { runtime = substream->runtime; |