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