ASoC driver updates
cover ASoC driver updates
The following changes since commit 57b41898c2ecd13a9d338b66ef23f66caab5c4e9:
Stephen Rothwell (1):
ALSA: ASoC - restore removed variable declaration
are available in the git repository at:
git://opensource.wolfsonmicro.com/linux-2.6-asoc for-tiwai
Note that this series was generated with git format-patch -M and so won't apply with ordianary diff.
Sedji Gaouaou (2):
ASoC: Merge AT91 and AVR32 support into a single atmel architecture
ASoC: Add audio support for the Atmel AT91SAM9G20ek board(uing wolfson 8731).
Steve Sakoman (3):
ASoC: Add support for TWL4030 audio codec
ASoC: Add support for Gumstix Overo
ASoC: Add support for Beagleboard
sound/soc/Kconfig | 3 +-
sound/soc/Makefile | 2 +-
sound/soc/at32/Kconfig | 34 -
sound/soc/at32/Makefile | 11 -
sound/soc/at32/at32-pcm.h | 79 --
sound/soc/at32/at32-ssc.c | 849 ----------------------
sound/soc/at32/at32-ssc.h | 59 --
sound/soc/at91/Kconfig | 10 -
sound/soc/at91/Makefile | 6 -
sound/soc/at91/at91-pcm.c | 434 -----------
sound/soc/at91/at91-pcm.h | 72 --
sound/soc/at91/at91-ssc.c | 791 --------------------
sound/soc/at91/at91-ssc.h | 27 -
sound/soc/atmel/Kconfig | 43 ++
sound/soc/atmel/Makefile | 15 +
sound/soc/{at32/at32-pcm.c => atmel/atmel-pcm.c} | 376 +++++-----
sound/soc/atmel/atmel-pcm.h | 86 +++
sound/soc/atmel/atmel_ssc_dai.c | 782 ++++++++++++++++++++
sound/soc/atmel/atmel_ssc_dai.h | 121 +++
sound/soc/{at32 => atmel}/playpaq_wm8510.c | 4 +-
sound/soc/atmel/sam9g20_wm8731.c | 329 +++++++++
sound/soc/codecs/Kconfig | 5 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/twl4030.c | 653 +++++++++++++++++
sound/soc/codecs/twl4030.h | 197 +++++
sound/soc/omap/Kconfig | 10 +
sound/soc/omap/Makefile | 3 +
sound/soc/omap/omap3beagle.c | 149 ++++
sound/soc/omap/overo.c | 148 ++++
29 files changed, 2731 insertions(+), 2569 deletions(-)
delete mode 100644 sound/soc/at32/Kconfig
delete mode 100644 sound/soc/at32/Makefile
delete mode 100644 sound/soc/at32/at32-pcm.h
delete mode 100644 sound/soc/at32/at32-ssc.c
delete mode 100644 sound/soc/at32/at32-ssc.h
delete mode 100644 sound/soc/at91/Kconfig
delete mode 100644 sound/soc/at91/Makefile
delete mode 100644 sound/soc/at91/at91-pcm.c
delete mode 100644 sound/soc/at91/at91-pcm.h
delete mode 100644 sound/soc/at91/at91-ssc.c
delete mode 100644 sound/soc/at91/at91-ssc.h
create mode 100644 sound/soc/atmel/Kconfig
create mode 100644 sound/soc/atmel/Makefile
rename sound/soc/{at32/at32-pcm.c => atmel/atmel-pcm.c} (50%)
create mode 100644 sound/soc/atmel/atmel-pcm.h
create mode 100644 sound/soc/atmel/atmel_ssc_dai.c
create mode 100644 sound/soc/atmel/atmel_ssc_dai.h
rename sound/soc/{at32 => atmel}/playpaq_wm8510.c (99%)
create mode 100644 sound/soc/atmel/sam9g20_wm8731.c
create mode 100644 sound/soc/codecs/twl4030.c
create mode 100644 sound/soc/codecs/twl4030.h
create mode 100644 sound/soc/omap/omap3beagle.c
create mode 100644 sound/soc/omap/overo.cPATCH 1/5 ASoC: Add support for TWL4030 audio codec
From: Steve Sakoman <[email protected]>
--- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/twl4030.c | 653 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/twl4030.h | 197 +++++++++++++ 4 files changed, 857 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/twl4030.c create mode 100644 sound/soc/codecs/twl4030.h
sound/soc/codecs/Kconfig +5 -0
@@ -9,6 +9,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_TLV320AIC23 if I2C select SND_SOC_TLV320AIC26 if SPI_MASTER select SND_SOC_TLV320AIC3X if I2C + select SND_SOC_TWL4030 if TWL4030_CORE select SND_SOC_UDA1380 if I2C select SND_SOC_WM8510 if (I2C || SPI_MASTER) select SND_SOC_WM8580 if I2C
@@ -79,6 +80,10 @@ config SND_SOC_TLV320AIC3X tristate depends on I2C +config SND_SOC_TWL4030 + tristate + depends on TWL4030_CORE + config SND_SOC_UDA1380 tristate
sound/soc/codecs/Makefile +2 -0
@@ -7,6 +7,7 @@ snd-soc-ssm2602-objs := ssm2602.o snd-soc-tlv320aic23-objs := tlv320aic23.o snd-soc-tlv320aic26-objs := tlv320aic26.o snd-soc-tlv320aic3x-objs := tlv320aic3x.o +snd-soc-twl4030-objs := twl4030.o snd-soc-uda1380-objs := uda1380.o snd-soc-wm8510-objs := wm8510.o snd-soc-wm8580-objs := wm8580.o
@@ -29,6 +30,7 @@ obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o +obj-$(CONFIG_SND_SOC_TWL4030) += snd-soc-twl4030.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o obj-$(CONFIG_SND_SOC_WM8580) += snd-soc-wm8580.o
sound/soc/codecs/twl4030.c new file +653 -0
653 lines not on this page · raw message
sound/soc/codecs/twl4030.h new file +197 -0
197 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 2/5 ASoC: Add support for Gumstix Overo
From: Steve Sakoman <[email protected]>
--- sound/soc/omap/Kconfig | 10 +++ sound/soc/omap/Makefile | 3 + sound/soc/omap/overo.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 0 deletions(-) create mode 100644 sound/soc/omap/overo.c
sound/soc/omap/Kconfig +10 -0
@@ -21,3 +21,13 @@ config SND_OMAP_SOC_OSK5912 select SND_SOC_TLV320AIC23 help Say Y if you want to add support for SoC audio on osk5912. + +config SND_OMAP_SOC_OVERO + tristate "SoC Audio support for Gumstix Overo" + depends on SND_OMAP_SOC && MACH_OVERO + select SND_OMAP_SOC_MCBSP + select SND_SOC_TWL4030 + help + Say Y if you want to add support for SoC audio on the Gumstix Overo. + +
sound/soc/omap/Makefile +3 -0
@@ -8,6 +8,9 @@ obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o # OMAP Machine Support snd-soc-n810-objs := n810.o snd-soc-osk5912-objs := osk5912.o +snd-soc-overo-objs := overo.o obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o +obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o +
sound/soc/omap/overo.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 3/5 ASoC: Add support for Beagleboard
From: Steve Sakoman <[email protected]>
--- sound/soc/omap/omap3beagle.c | 149 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 149 insertions(+), 0 deletions(-) create mode 100644 sound/soc/omap/omap3beagle.c
sound/soc/omap/omap3beagle.c new file +149 -0
@@ -0,0 +1,149 @@ +/* +* omap3beagle.c -- SoC audio for OMAP3 Beagle +* +* Author: Steve Sakoman <[email protected]> +* +* 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. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#include <linux/clk.h> +#include <linux/platform_device.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> + +#include <asm/mach-types.h> +#include <mach/hardware.h> +#include <mach/gpio.h> +#include <mach/mcbsp.h> + +#include "omap-mcbsp.h" +#include "omap-pcm.h" +#include "../codecs/twl4030.h" + +static int omap3beagle_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->dai->codec_dai; +struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; +int ret; + +/* Set codec DAI configuration */ + ret =snd_soc_dai_set_fmt (codec_dai, +SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF | +SND_SOC_DAIFMT_CBM_CFM ); +if (ret <0 ) { +printk (KERN_ERR "can't set codec DAI configuration\n" ); +return ret; + } + +/* Set cpu DAI configuration */ + ret =snd_soc_dai_set_fmt (cpu_dai, +SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF | +SND_SOC_DAIFMT_CBM_CFM ); +if (ret <0 ) { +printk (KERN_ERR "can't set cpu DAI configuration\n" ); +return ret; + } + +/* Set the codec system clock for DAC and ADC */ + ret =snd_soc_dai_set_sysclk (codec_dai,0 ,26000000 , +SND_SOC_CLOCK_IN ); +if (ret <0 ) { +printk (KERN_ERR "can't set codec system clock\n" ); +return ret; + } + +return 0 ; +} + +static struct snd_soc_ops omap3beagle_ops = { + .hw_params = omap3beagle_hw_params, +}; + +/* Digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link omap3beagle_dai = { + .name ="TWL4030" , + .stream_name ="TWL4030" , + .cpu_dai = &omap_mcbsp_dai[0 ], + .codec_dai = &twl4030_dai, + .ops = &omap3beagle_ops, +}; + +/* Audio machine driver */ +static struct snd_soc_machine snd_soc_machine_omap3beagle = { + .name ="omap3beagle" , + .dai_link = &omap3beagle_dai, + .num_links =1 , +}; + +/* Audio subsystem */ +static struct snd_soc_device omap3beagle_snd_devdata = { + .machine = &snd_soc_machine_omap3beagle, + .platform = &omap_soc_platform, + .codec_dev = &soc_codec_dev_twl4030, +}; + +static struct platform_device *omap3beagle_snd_device; + +static int __init omap3beagle_soc_init (void ) +{ +int ret; + +if (!machine_is_omap3_beagle ()) { +pr_debug ("Not OMAP3 Beagle!\n" ); +return -ENODEV ; + } +pr_info ("OMAP3 Beagle SoC init\n" ); + + omap3beagle_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!omap3beagle_snd_device) { +printk (KERN_ERR "Platform device allocation failed\n" ); +return -ENOMEM ; + } + +platform_set_drvdata (omap3beagle_snd_device, &omap3beagle_snd_devdata); + omap3beagle_snd_devdata.dev = &omap3beagle_snd_device->dev; + *(unsigned int *)omap3beagle_dai.cpu_dai->private_data =1 ;/* McBSP2 */ + + ret =platform_device_add (omap3beagle_snd_device); +if (ret) + goto err1; + +return 0 ; + +err1: +printk (KERN_ERR "Unable to add platform device\n" ); +platform_device_put (omap3beagle_snd_device); + +return ret; +} + +static void __exit omap3beagle_soc_exit(void) +{ +platform_device_unregister (omap3beagle_snd_device); +} + +module_init (omap3beagle_soc_init); +module_exit (omap3beagle_soc_exit); + +MODULE_AUTHOR ("Steve Sakoman <[email protected]>" ); +MODULE_DESCRIPTION ("ALSA SoC OMAP3 Beagle" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
1.5.6.5
PATCH 4/5 ASoC: Merge AT91 and AVR32 support into a single atmel architecture
From: Sedji Gaouaou <[email protected]>
The Ateml AT91 and AVR32 SoC share common IP for audio and can share the same driver code using the atmel-ssc API provided for both architectures. Do this, creating a new unified atmel ASoC architecture to replace the previous at32 and at91 ones.
[This was contributed as a patch series for reviewability but has been squashed down to a single commit to help preserve both the history and bisectability. A small bugfix from Jukka is included.]
---
sound/soc/Kconfig | 3 +-
sound/soc/Makefile | 2 +-
sound/soc/at32/Kconfig | 34 -
sound/soc/at32/Makefile | 11 -
sound/soc/at32/at32-pcm.h | 79 --
sound/soc/at32/at32-ssc.c | 849 ----------------------
sound/soc/at32/at32-ssc.h | 59 --
sound/soc/at91/Kconfig | 10 -
sound/soc/at91/Makefile | 6 -
sound/soc/at91/at91-pcm.c | 434 -----------
sound/soc/at91/at91-pcm.h | 72 --
sound/soc/at91/at91-ssc.c | 791 --------------------
sound/soc/at91/at91-ssc.h | 27 -
sound/soc/atmel/Kconfig | 43 ++
sound/soc/atmel/Makefile | 15 +
sound/soc/{at32/at32-pcm.c => atmel/atmel-pcm.c} | 376 +++++-----
sound/soc/atmel/atmel-pcm.h | 86 +++
sound/soc/atmel/atmel_ssc_dai.c | 782 ++++++++++++++++++++
sound/soc/atmel/atmel_ssc_dai.h | 121 +++
sound/soc/{at32 => atmel}/playpaq_wm8510.c | 4 +-
20 files changed, 1235 insertions(+), 2569 deletions(-)
delete mode 100644 sound/soc/at32/Kconfig
delete mode 100644 sound/soc/at32/Makefile
delete mode 100644 sound/soc/at32/at32-pcm.h
delete mode 100644 sound/soc/at32/at32-ssc.c
delete mode 100644 sound/soc/at32/at32-ssc.h
delete mode 100644 sound/soc/at91/Kconfig
delete mode 100644 sound/soc/at91/Makefile
delete mode 100644 sound/soc/at91/at91-pcm.c
delete mode 100644 sound/soc/at91/at91-pcm.h
delete mode 100644 sound/soc/at91/at91-ssc.c
delete mode 100644 sound/soc/at91/at91-ssc.h
create mode 100644 sound/soc/atmel/Kconfig
create mode 100644 sound/soc/atmel/Makefile
rename sound/soc/{at32/at32-pcm.c => atmel/atmel-pcm.c} (50%)
create mode 100644 sound/soc/atmel/atmel-pcm.h
create mode 100644 sound/soc/atmel/atmel_ssc_dai.c
create mode 100644 sound/soc/atmel/atmel_ssc_dai.h
rename sound/soc/{at32 => atmel}/playpaq_wm8510.c (99%)sound/soc/Kconfig +1 -2
@@ -23,8 +23,7 @@ config SND_SOC_AC97_BUS bool # All the supported Soc's -source "sound/soc/at32/Kconfig" -source "sound/soc/at91/Kconfig" +source "sound/soc/atmel/Kconfig" source "sound/soc/au1x/Kconfig" source "sound/soc/pxa/Kconfig" source "sound/soc/s3c24xx/Kconfig"
sound/soc/Makefile +1 -1
@@ -1,5 +1,5 @@ snd-soc-core-objs := soc-core.o soc-dapm.o obj-$(CONFIG_SND_SOC) += snd-soc-core.o -obj-$(CONFIG_SND_SOC) += codecs/ at32/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ +obj-$(CONFIG_SND_SOC) += codecs/ atmel/ pxa/ s3c24xx/ sh/ fsl/ davinci/ obj-$(CONFIG_SND_SOC) += omap/ au1x/ blackfin/
sound/soc/at32/Kconfig deleted +0 -34
@@ -1,34 +0,0 @@ -config SND_AT32_SOC - tristate "SoC Audio for the Atmel AT32 System-on-a-Chip" - depends on AVR32 && SND_SOC - help - Say Y or M if you want to add support for codecs attached to - the AT32 SSC interface. You will also need to - to select the audio interfaces to support below. - - -config SND_AT32_SOC_SSC - tristate - - - -config SND_AT32_SOC_PLAYPAQ - tristate "SoC Audio support for PlayPaq with WM8510" - depends on SND_AT32_SOC && BOARD_PLAYPAQ - select SND_AT32_SOC_SSC - select SND_SOC_WM8510 - help - Say Y or M here if you want to add support for SoC audio - on the LRS PlayPaq. - - - -config SND_AT32_SOC_PLAYPAQ_SLAVE - bool "Run CODEC on PlayPaq in slave mode" - depends on SND_AT32_SOC_PLAYPAQ - default n - help - Say Y if you want to run with the AT32 SSC generating the BCLK - and FRAME signals on the PlayPaq. Unless you want to play - with the AT32 as the SSC master, you probably want to say N here, - as this will give you better sound quality.
sound/soc/at32/Makefile deleted +0 -11
@@ -1,11 +0,0 @@ -# AT32 Platform Support -snd-soc-at32-objs := at32-pcm.o -snd-soc-at32-ssc-objs := at32-ssc.o - -obj-$(CONFIG_SND_AT32_SOC) += snd-soc-at32.o -obj-$(CONFIG_SND_AT32_SOC_SSC) += snd-soc-at32-ssc.o - -# AT32 Machine Support -snd-soc-playpaq-objs := playpaq_wm8510.o - -obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
sound/soc/at32/at32-pcm.h deleted +0 -79
79 lines not on this page · raw message
sound/soc/at32/at32-ssc.c deleted +0 -849
849 lines not on this page · raw message
sound/soc/at32/at32-ssc.h deleted +0 -59
59 lines not on this page · raw message
sound/soc/at91/Kconfig deleted +0 -10
@@ -1,10 +0,0 @@ -config SND_AT91_SOC - tristate "SoC Audio for the Atmel AT91 System-on-Chip" - depends on ARCH_AT91 - help - Say Y or M if you want to add support for codecs attached to - the AT91 SSC interface. You will also need - to select the audio interfaces to support below. - -config SND_AT91_SOC_SSC - tristate
sound/soc/at91/Makefile deleted +0 -6
@@ -1,6 +0,0 @@ -# AT91 Platform Support -snd-soc-at91-objs := at91-pcm.o -snd-soc-at91-ssc-objs := at91-ssc.o - -obj-$(CONFIG_SND_AT91_SOC) += snd-soc-at91.o -obj-$(CONFIG_SND_AT91_SOC_SSC) += snd-soc-at91-ssc.o
sound/soc/at91/at91-pcm.c deleted +0 -434
434 lines not on this page · raw message
sound/soc/at91/at91-pcm.h deleted +0 -72
72 lines not on this page · raw message
sound/soc/at91/at91-ssc.c deleted +0 -791
791 lines not on this page · raw message
sound/soc/at91/at91-ssc.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* at91-ssc.h - ALSA SSC interface for the Atmel AT91 SoC -* -* Author: Frank Mandarino <[email protected]> -* Endrelia Technologies Inc. -* Created: Jan 9, 2007 -* -* 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 _AT91_SSC_H -#define _AT91_SSC_H - -/* SSC system clock ids */ -#define AT91_SYSCLK_MCK 0/* SSC uses AT91 MCK as system clock */ - -/* SSC divider ids */ -#define AT91SSC_CMR_DIV 0/* MCK divider for BCLK */ -#define AT91SSC_TCMR_PERIOD 1/* BCLK divider for transmit FS */ -#define AT91SSC_RCMR_PERIOD 2/* BCLK divider for receive FS */ - -extern struct snd_soc_dai at91_ssc_dai[]; - -#endif /* _AT91_SSC_H */ -
sound/soc/atmel/Kconfig new file +43 -0
43 lines not on this page · raw message
sound/soc/atmel/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +# AT91 Platform Support +snd-soc-atmel-pcm-objs := atmel-pcm.o +snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o + +obj-$(CONFIG_SND_ATMEL_SOC) += snd-soc-atmel-pcm.o +obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o + +# AT91 Machine Support +snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o + +# AT32 Machine Support +snd-soc-playpaq-objs := playpaq_wm8510.o + +obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o +obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
sound/soc/atmel/atmel-pcm.c renamed from sound/soc/at32/at32-pcm.c +184 -192
555 lines not on this page · raw message
sound/soc/atmel/atmel-pcm.h new file +86 -0
86 lines not on this page · raw message
sound/soc/atmel/atmel_ssc_dai.c new file +782 -0
782 lines not on this page · raw message
sound/soc/atmel/atmel_ssc_dai.h new file +121 -0
121 lines not on this page · raw message
sound/soc/atmel/playpaq_wm8510.c renamed from sound/soc/at32/playpaq_wm8510.c +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.6.5
Part of the diff is not shown here. View the raw message.
PATCH 5/5 ASoC: Add audio support for the Atmel AT91SAM9G20ek board(uing wolfson 8731).
From: Sedji Gaouaou <[email protected]>
Add audio support for the Atmel AT91SAM9G20ek board(uing wolfson 8731). It is based on the former eti_b1_wm8731.c file, using the atmel scc API.
--- sound/soc/atmel/sam9g20_wm8731.c | 329 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 329 insertions(+), 0 deletions(-) create mode 100644 sound/soc/atmel/sam9g20_wm8731.c
sound/soc/atmel/sam9g20_wm8731.c new file +329 -0
@@ -0,0 +1,329 @@ +/* +* sam9g20_wm8731 -- SoC audio for AT91SAM9G20-based +* ATMEL AT91SAM9G20ek board. +* +* Copyright (C) 2005 SAN People +* Copyright (C) 2008 Atmel +* +* Authors: Sedji Gaouaou <[email protected]> +* +* Based on ati_b1_wm8731.c by: +* Frank Mandarino <[email protected]> +* Copyright 2006 Endrelia Technologies Inc. +* Based on corgi.c by: +* Copyright 2005 Wolfson Microelectronics PLC. +* Copyright 2005 Openedhand Ltd. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/version.h> +#include <linux/kernel.h> +#include <linux/clk.h> +#include <linux/timer.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> + +#include <linux/atmel-ssc.h> + +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> + +#include <mach/hardware.h> +#include <mach/gpio.h> + +#include "../codecs/wm8731.h" +#include "atmel-pcm.h" +#include "atmel_ssc_dai.h" + + +static int at91sam9g20ek_startup (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd =snd_pcm_substream_chip (substream); +struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; +int ret; + +/* codec system clock is supplied by PCK0, set to 12MHz */ + ret =snd_soc_dai_set_sysclk (codec_dai,WM8731_SYSCLK , +12000000 ,SND_SOC_CLOCK_IN ); +if (ret <0 ) +return ret; + +return 0 ; +} + +static void at91sam9g20ek_shutdown (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd =snd_pcm_substream_chip (substream); + +dev_dbg (rtd->socdev->dev,"shutdown" ); +} + +static int at91sam9g20ek_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->dai->codec_dai; +struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; +struct atmel_ssc_info *ssc_p = cpu_dai->private_data; +struct ssc_device *ssc = ssc_p->ssc; +int ret; + +unsigned int rate; +int cmr_div, period; + +if (ssc ==NULL ) { +printk (KERN_INFO "at91sam9g20ek_hw_params: ssc is NULL!\n" ); +return -EINVAL ; + } + +/* set codec DAI configuration */ + ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret =snd_soc_dai_set_fmt (cpu_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* +* The SSC clock dividers depend on the sample rate. The CMR.DIV +* field divides the system master clock MCK to drive the SSC TK +* signal which provides the codec BCLK. The TCMR.PERIOD and +* RCMR.PERIOD fields further divide the BCLK signal to drive +* the SSC TF and RF signals which provide the codec DACLRC and +* ADCLRC clocks. +* +* The dividers were determined through trial and error, where a +* CMR.DIV value is chosen such that the resulting BCLK value is +* divisible, or almost divisible, by (2 * sample rate), and then +* the TCMR.PERIOD or RCMR.PERIOD is BCLK / (2 * sample rate) - 1. +*/ + rate =params_rate (params); + +switch (rate) { +case 8000 : + cmr_div =55 ;/* BCLK = 133MHz/(2*55) = 1.209MHz */ + period =74 ;/* LRC = BCLK/(2*(74+1)) ~= 8060,6Hz */ +break ; +case 11025 : + cmr_div =67 ;/* BCLK = 133MHz/(2*60) = 1.108MHz */ + period =45 ;/* LRC = BCLK/(2*(49+1)) = 11083,3Hz */ +break ; +case 16000 : + cmr_div =63 ;/* BCLK = 133MHz/(2*63) = 1.055MHz */ + period =32 ;/* LRC = BCLK/(2*(32+1)) = 15993,2Hz */ +break ; +case 22050 : + cmr_div =52 ;/* BCLK = 133MHz/(2*52) = 1.278MHz */ + period =28 ;/* LRC = BCLK/(2*(28+1)) = 22049Hz */ +break ; +case 32000 : + cmr_div =66 ;/* BCLK = 133MHz/(2*66) = 1.007MHz */ + period =15 ;/* LRC = BCLK/(2*(15+1)) = 31486,742Hz */ +break ; +case 44100 : + cmr_div =29 ;/* BCLK = 133MHz/(2*29) = 2.293MHz */ + period =25 ;/* LRC = BCLK/(2*(25+1)) = 44098Hz */ +break ; +case 48000 : + cmr_div =33 ;/* BCLK = 133MHz/(2*33) = 2.015MHz */ + period =20 ;/* LRC = BCLK/(2*(20+1)) = 47979,79Hz */ +break ; +case 88200 : + cmr_div =29 ;/* BCLK = 133MHz/(2*29) = 2.293MHz */ + period =12 ;/* LRC = BCLK/(2*(12+1)) = 88196Hz */ +break ; +case 96000 : + cmr_div =23 ;/* BCLK = 133MHz/(2*23) = 2.891MHz */ + period =14 ;/* LRC = BCLK/(2*(14+1)) = 96376Hz */ +break ; +default : +printk (KERN_WARNING "unsupported rate %d" +" on at91sam9g20ek board\n" , rate); +return -EINVAL ; + } + +/* set the MCK divider for BCLK */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,ATMEL_SSC_CMR_DIV , cmr_div); +if (ret <0 ) +return ret; + +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +/* set the BCLK divider for DACLRC */ + ret =snd_soc_dai_set_clkdiv (cpu_dai, +ATMEL_SSC_TCMR_PERIOD , period); + }else { +/* set the BCLK divider for ADCLRC */ + ret =snd_soc_dai_set_clkdiv (cpu_dai, +ATMEL_SSC_RCMR_PERIOD , period); + } +if (ret <0 ) +return ret; + +return 0 ; +} + +static struct snd_soc_ops at91sam9g20ek_ops = { + .startup = at91sam9g20ek_startup, + .hw_params = at91sam9g20ek_hw_params, + .shutdown = at91sam9g20ek_shutdown, +}; + + +static const struct snd_soc_dapm_widget at91sam9g20ek_dapm_widgets[] = { +SND_SOC_DAPM_MIC ("Int Mic" ,NULL ), +SND_SOC_DAPM_SPK ("Ext Spk" ,NULL ), +}; + +static const struct snd_soc_dapm_route intercon[] = { + +/* speaker connected to LHPOUT */ + {"Ext Spk" ,NULL ,"LHPOUT" }, + +/* mic is connected to Mic Jack, with WM8731 Mic Bias */ + {"MICIN" ,NULL ,"Mic Bias" }, + {"Mic Bias" ,NULL ,"Int Mic" }, +}; + +/* +* Logic for a wm8731 as connected on a at91sam9g20ek board. +*/ +static int at91sam9g20ek_wm8731_init (struct snd_soc_codec *codec) +{ +printk (KERN_DEBUG +"at91sam9g20ek_wm8731 " +": at91sam9g20ek_wm8731_init() called\n" ); + +/* Add specific widgets */ +snd_soc_dapm_new_controls (codec, at91sam9g20ek_dapm_widgets, +ARRAY_SIZE (at91sam9g20ek_dapm_widgets)); +/* Set up specific audio path interconnects */ +snd_soc_dapm_add_routes (codec, intercon,ARRAY_SIZE (intercon)); + +/* not connected */ +snd_soc_dapm_disable_pin (codec,"RLINEIN" ); +snd_soc_dapm_disable_pin (codec,"LLINEIN" ); + +/* always connected */ +snd_soc_dapm_enable_pin (codec,"Int Mic" ); +snd_soc_dapm_enable_pin (codec,"Ext Spk" ); + +snd_soc_dapm_sync (codec); + +return 0 ; +} + +static struct snd_soc_dai_link at91sam9g20ek_dai = { + .name ="WM8731" , + .stream_name ="WM8731 PCM" , + .cpu_dai = &atmel_ssc_dai[0 ], + .codec_dai = &wm8731_dai, + .init = at91sam9g20ek_wm8731_init, + .ops = &at91sam9g20ek_ops, +}; + +static struct snd_soc_machine snd_soc_machine_at91sam9g20ek = { + .name ="WM8731" , + .dai_link = &at91sam9g20ek_dai, + .num_links =1 , +}; + +static struct wm8731_setup_data at91sam9g20ek_wm8731_setup = { + .i2c_bus =0 , + .i2c_address =0x1b , +}; + +static struct snd_soc_device at91sam9g20ek_snd_devdata = { + .machine = &snd_soc_machine_at91sam9g20ek, + .platform = &atmel_soc_platform, + .codec_dev = &soc_codec_dev_wm8731, + .codec_data = &at91sam9g20ek_wm8731_setup, +}; + +static struct platform_device *at91sam9g20ek_snd_device; + +static int __init at91sam9g20ek_init (void ) +{ +struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data; +struct ssc_device *ssc =NULL ; +int ret; + +/* +* Request SSC device +*/ + ssc =ssc_request (0 ); +if (IS_ERR (ssc)) { + ret =PTR_ERR (ssc); + ssc =NULL ; + goto err_ssc; + } + ssc_p->ssc = ssc; + + at91sam9g20ek_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!at91sam9g20ek_snd_device) { +printk (KERN_DEBUG +"platform device allocation failed\n" ); + ret = -ENOMEM ; + } + +platform_set_drvdata (at91sam9g20ek_snd_device, + &at91sam9g20ek_snd_devdata); + at91sam9g20ek_snd_devdata.dev = &at91sam9g20ek_snd_device->dev; + + ret =platform_device_add (at91sam9g20ek_snd_device); +if (ret) { +printk (KERN_DEBUG +"platform device allocation failed\n" ); +platform_device_put (at91sam9g20ek_snd_device); + } + +return ret; + +err_ssc: +return ret; +} + +static void __exit at91sam9g20ek_exit(void) +{ +struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data; +struct ssc_device *ssc; + +if (ssc_p !=NULL ) { + ssc = ssc_p->ssc; +if (ssc !=NULL ) +ssc_free (ssc); + ssc_p->ssc =NULL ; + } + +platform_device_unregister (at91sam9g20ek_snd_device); + at91sam9g20ek_snd_device =NULL ; +} + +module_init (at91sam9g20ek_init); +module_exit (at91sam9g20ek_exit); + +/* Module information */ +MODULE_AUTHOR ("Sedji Gaouaou <[email protected]>" ); +MODULE_DESCRIPTION ("ALSA SoC AT91SAM9G20EK_WM8731" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
1.5.6.5
At Fri, 31 Oct 2008 13:18:28 +0000,
Quoted 8 lines · Mark Brown
The following changes since commit
57b41898c2ecd13a9d338b66ef23f66caab5c4e9:
Stephen Rothwell (1):
ALSA: ASoC - restore removed variable declarationare available in the git repository at:
git://opensource.wolfsonmicro.com/linux-2.6-asocfor-tiwai
Thanks, pulled now.
Takashi