[generic-2.4] patches/607-netfilter_connmark: fix typo
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 028-gumstix-asoc.patch
1 --- a/sound/soc/pxa/Kconfig
2 +++ b/sound/soc/pxa/Kconfig
3 @@ -16,6 +16,7 @@ config SND_PXA2XX_SOC_AC97
4 tristate
5 select AC97_BUS
6 select SND_SOC_AC97_BUS
7 + select SND_PXA2XX_AC97
8
9 config SND_PXA2XX_SOC_I2S
10 tristate
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).
14
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
20 + help
21 + Say Y if you want to add support for SoC audio on Gumstix
22 +
23 endmenu
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
31
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
37
38 --- /dev/null
39 +++ b/sound/soc/pxa/gumstix.c
40 @@ -0,0 +1,109 @@
41 +/*
42 + * gumstix.c -- SoC audio for Gumstix
43 + *
44 + * Copyright 2005 Wolfson Microelectronics PLC.
45 + * Copyright 2005 Openedhand Ltd.
46 + * Copyright 2007 Gumstix Inc.
47 + *
48 + * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
49 + * Richard Purdie <richard@openedhand.com>
50 + * Craig Hughes <craig@gumstix.com>
51 + *
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.
56 + *
57 + * Revision history
58 + * 26 April 2007 - Initial revision forked from tosa.c
59 + *
60 + *
61 + */
62 +
63 +#include <linux/module.h>
64 +#include <linux/moduleparam.h>
65 +#include <linux/device.h>
66 +
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>
72 +
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>
78 +
79 +#include "pxa2xx-pcm.h"
80 +#include "pxa2xx-ac97.h"
81 +#include "../codecs/ac97.h"
82 +
83 +static struct snd_soc_machine gumstix;
84 +
85 +static int gumstix_ac97_init(struct snd_soc_codec *codec)
86 +{
87 + // For now, do nothing -- should move the ucb1400 patch stuff here
88 + return 0;
89 +}
90 +
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[] = {
94 +{
95 + .name = "ucb1400",
96 + .stream_name = "UCB1400",
97 + .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
98 + .codec_dai = &ac97_dai,
99 + .init = gumstix_ac97_init,
100 +},
101 +};
102 +
103 +static struct snd_soc_machine snd_soc_machine_gumstix = {
104 + .name = "Gumstix",
105 + .dai_link = gumstix_dai,
106 + .num_links = ARRAY_SIZE(gumstix_dai),
107 +};
108 +
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,
113 +};
114 +
115 +static struct platform_device *gumstix_snd_device;
116 +
117 +static int __init gumstix_init(void)
118 +{
119 + int ret;
120 +
121 + if (!machine_is_gumstix())
122 + return -ENODEV;
123 +
124 + gumstix_snd_device = platform_device_alloc("soc-audio", -1);
125 + if (!gumstix_snd_device)
126 + return -ENOMEM;
127 +
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);
131 +
132 + if (ret)
133 + platform_device_put(gumstix_snd_device);
134 +
135 + return ret;
136 +}
137 +
138 +static void __exit gumstix_exit(void)
139 +{
140 + platform_device_unregister(gumstix_snd_device);
141 +}
142 +
143 +module_init(gumstix_init);
144 +module_exit(gumstix_exit);
145 +
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)
155
156 -static struct snd_soc_codec_dai ac97_dai = {
157 +struct snd_soc_codec_dai ac97_dai = {
158 .name = "AC97 HiFi",
159 .playback = {
160 .stream_name = "AC97 Playback",
161 @@ -61,6 +61,8 @@ static struct snd_soc_codec_dai ac97_dai
162 .prepare = ac97_prepare,},
163 };
164
165 +EXPORT_SYMBOL_GPL(ac97_dai);
166 +
167 static unsigned int ac97_read(struct snd_soc_codec *codec,
168 unsigned int reg)
169 {
170 --- a/sound/soc/codecs/ac97.h
171 +++ b/sound/soc/codecs/ac97.h
172 @@ -14,5 +14,6 @@
173 #define __LINUX_SND_SOC_AC97_H
174
175 extern struct snd_soc_codec_device soc_codec_dev_ac97;
176 +extern struct snd_soc_codec_dai ac97_dai;
177
178 #endif
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
182
183 static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
184 {
185 - GCR &= GCR_COLD_RST; /* clear everything but nCRST */
186 - GCR &= ~GCR_COLD_RST; /* then assert nCRST */
187 -
188 - gsr_bits = 0;
189 #ifdef CONFIG_PXA27x
190 /* PXA27x Developers Manual section 13.5.2.2.1 */
191 + GCR |= GCR_ACLINK_OFF;
192 + udelay(5);
193 + GCR &= GCR_COLD_RST; /* Mask all interrupts */
194 + GCR &= ~GCR_COLD_RST; /* cold reset */
195 + udelay(5);
196 pxa_set_cken(1 << 31, 1);
197 udelay(5);
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 */
201 + udelay(5);
202 GCR = GCR_COLD_RST;
203 udelay(50);
204 + wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
205 #else
206 + GCR &= GCR_COLD_RST; /* clear everything but nCRST */
207 + GCR &= ~GCR_COLD_RST; /* then assert nCRST */
208 +
209 + gsr_bits = 0;
210 GCR = GCR_COLD_RST;
211 GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
212 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
This page took 0.05984 seconds and 5 git commands to generate.