1 --- a/sound/soc/pxa/Kconfig
2 +++ b/sound/soc/pxa/Kconfig
3 @@ -16,6 +16,7 @@ config SND_PXA2XX_SOC_AC97
6 select SND_SOC_AC97_BUS
7 + select SND_PXA2XX_AC97
9 config SND_PXA2XX_SOC_I2S
11 @@ -56,4 +57,12 @@ config SND_PXA2XX_SOC_TOSA
12 Say Y if you want to add support for SoC audio on Sharp
13 Zaurus SL-C6000x models (Tosa).
15 +config SND_PXA2XX_SOC_GUMSTIX
16 + tristate "SoC AC97 Audio support for Gumstix"
17 + depends on SND_PXA2XX_SOC && ARCH_GUMSTIX
18 + select SND_PXA2XX_SOC_AC97
19 + select SND_SOC_AC97_CODEC
21 + Say Y if you want to add support for SoC audio on Gumstix
24 --- a/sound/soc/pxa/Makefile
25 +++ b/sound/soc/pxa/Makefile
26 @@ -12,9 +12,11 @@ snd-soc-corgi-objs := corgi.o
27 snd-soc-poodle-objs := poodle.o
28 snd-soc-tosa-objs := tosa.o
29 snd-soc-spitz-objs := spitz.o
30 +snd-soc-gumstix-objs := gumstix.o
32 obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o
33 obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o
34 obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o
35 obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o
36 +obj-$(CONFIG_SND_PXA2XX_SOC_GUMSTIX) += snd-soc-gumstix.o
39 +++ b/sound/soc/pxa/gumstix.c
42 + * gumstix.c -- SoC audio for Gumstix
44 + * Copyright 2005 Wolfson Microelectronics PLC.
45 + * Copyright 2005 Openedhand Ltd.
46 + * Copyright 2007 Gumstix Inc.
48 + * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
49 + * Richard Purdie <richard@openedhand.com>
50 + * Craig Hughes <craig@gumstix.com>
52 + * This program is free software; you can redistribute it and/or modify it
53 + * under the terms of the GNU General Public License as published by the
54 + * Free Software Foundation; either version 2 of the License, or (at your
55 + * option) any later version.
58 + * 26 April 2007 - Initial revision forked from tosa.c
63 +#include <linux/module.h>
64 +#include <linux/moduleparam.h>
65 +#include <linux/device.h>
67 +#include <sound/driver.h>
68 +#include <sound/core.h>
69 +#include <sound/pcm.h>
70 +#include <sound/soc.h>
71 +#include <sound/soc-dapm.h>
73 +#include <asm/mach-types.h>
74 +#include <asm/arch/pxa-regs.h>
75 +#include <asm/arch/hardware.h>
76 +#include <asm/arch/audio.h>
77 +#include <asm/arch/gumstix.h>
79 +#include "pxa2xx-pcm.h"
80 +#include "pxa2xx-ac97.h"
81 +#include "../codecs/ac97.h"
83 +static struct snd_soc_machine gumstix;
85 +static int gumstix_ac97_init(struct snd_soc_codec *codec)
87 + // For now, do nothing -- should move the ucb1400 patch stuff here
91 +/* For right now, just add UCB1400 -- once that's working, we can also add
92 + * PCM channels via SPI to bluetooth module, GSM module, or whatnot */
93 +static struct snd_soc_dai_link gumstix_dai[] = {
96 + .stream_name = "UCB1400",
97 + .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
98 + .codec_dai = &ac97_dai,
99 + .init = gumstix_ac97_init,
103 +static struct snd_soc_machine snd_soc_machine_gumstix = {
105 + .dai_link = gumstix_dai,
106 + .num_links = ARRAY_SIZE(gumstix_dai),
109 +static struct snd_soc_device gumstix_snd_devdata = {
110 + .machine = &snd_soc_machine_gumstix,
111 + .platform = &pxa2xx_soc_platform,
112 + .codec_dev = &soc_codec_dev_ac97,
115 +static struct platform_device *gumstix_snd_device;
117 +static int __init gumstix_init(void)
121 + if (!machine_is_gumstix())
124 + gumstix_snd_device = platform_device_alloc("soc-audio", -1);
125 + if (!gumstix_snd_device)
128 + platform_set_drvdata(gumstix_snd_device, &gumstix_snd_devdata);
129 + gumstix_snd_devdata.dev = &gumstix_snd_device->dev;
130 + ret = platform_device_add(gumstix_snd_device);
133 + platform_device_put(gumstix_snd_device);
138 +static void __exit gumstix_exit(void)
140 + platform_device_unregister(gumstix_snd_device);
143 +module_init(gumstix_init);
144 +module_exit(gumstix_exit);
146 +/* Module information */
147 +MODULE_AUTHOR("Craig Hughes <craig@gumstix.com>");
148 +MODULE_DESCRIPTION("ALSA SoC Gumstix");
149 +MODULE_LICENSE("GPL");
150 --- a/sound/soc/codecs/ac97.c
151 +++ b/sound/soc/codecs/ac97.c
152 @@ -43,7 +43,7 @@ static int ac97_prepare(struct snd_pcm_s
153 #define STD_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
154 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
156 -static struct snd_soc_codec_dai ac97_dai = {
157 +struct snd_soc_codec_dai ac97_dai = {
160 .stream_name = "AC97 Playback",
161 @@ -61,6 +61,8 @@ static struct snd_soc_codec_dai ac97_dai
162 .prepare = ac97_prepare,},
165 +EXPORT_SYMBOL_GPL(ac97_dai);
167 static unsigned int ac97_read(struct snd_soc_codec *codec,
170 --- a/sound/soc/codecs/ac97.h
171 +++ b/sound/soc/codecs/ac97.h
173 #define __LINUX_SND_SOC_AC97_H
175 extern struct snd_soc_codec_device soc_codec_dev_ac97;
176 +extern struct snd_soc_codec_dai ac97_dai;
179 --- a/sound/soc/pxa/pxa2xx-ac97.c
180 +++ b/sound/soc/pxa/pxa2xx-ac97.c
181 @@ -154,18 +154,26 @@ static void pxa2xx_ac97_warm_reset(struc
183 static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
185 - GCR &= GCR_COLD_RST; /* clear everything but nCRST */
186 - GCR &= ~GCR_COLD_RST; /* then assert nCRST */
190 /* PXA27x Developers Manual section 13.5.2.2.1 */
191 + GCR |= GCR_ACLINK_OFF;
193 + GCR &= GCR_COLD_RST; /* Mask all interrupts */
194 + GCR &= ~GCR_COLD_RST; /* cold reset */
196 pxa_set_cken(1 << 31, 1);
198 - pxa_set_cken(1 << 31, 0);
199 + GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN; /* unmask the interrupts */
200 + pxa_set_cken(1 << 31, 0); /* clear CKEN31 */
204 + wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
206 + GCR &= GCR_COLD_RST; /* clear everything but nCRST */
207 + GCR &= ~GCR_COLD_RST; /* then assert nCRST */
211 GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
212 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);