Fix divisor calculation and configuration from previous commit, thanks sn9
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 028-gumstix-asoc.patch
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
6 tristate
7 select AC97_BUS
8 select SND_SOC_AC97_BUS
9 + select SND_PXA2XX_AC97
10
11 config SND_PXA2XX_SOC_I2S
12 tristate
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).
16
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
22 + help
23 + Say Y if you want to add support for SoC audio on Gumstix
24 +
25 endmenu
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
35
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
41
42 Index: linux-2.6.21.7/sound/soc/pxa/gumstix.c
43 ===================================================================
44 --- /dev/null
45 +++ linux-2.6.21.7/sound/soc/pxa/gumstix.c
46 @@ -0,0 +1,109 @@
47 +/*
48 + * gumstix.c -- SoC audio for Gumstix
49 + *
50 + * Copyright 2005 Wolfson Microelectronics PLC.
51 + * Copyright 2005 Openedhand Ltd.
52 + * Copyright 2007 Gumstix Inc.
53 + *
54 + * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
55 + * Richard Purdie <richard@openedhand.com>
56 + * Craig Hughes <craig@gumstix.com>
57 + *
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.
62 + *
63 + * Revision history
64 + * 26 April 2007 - Initial revision forked from tosa.c
65 + *
66 + *
67 + */
68 +
69 +#include <linux/module.h>
70 +#include <linux/moduleparam.h>
71 +#include <linux/device.h>
72 +
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>
78 +
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>
84 +
85 +#include "pxa2xx-pcm.h"
86 +#include "pxa2xx-ac97.h"
87 +#include "../codecs/ac97.h"
88 +
89 +static struct snd_soc_machine gumstix;
90 +
91 +static int gumstix_ac97_init(struct snd_soc_codec *codec)
92 +{
93 + // For now, do nothing -- should move the ucb1400 patch stuff here
94 + return 0;
95 +}
96 +
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[] = {
100 +{
101 + .name = "ucb1400",
102 + .stream_name = "UCB1400",
103 + .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
104 + .codec_dai = &ac97_dai,
105 + .init = gumstix_ac97_init,
106 +},
107 +};
108 +
109 +static struct snd_soc_machine snd_soc_machine_gumstix = {
110 + .name = "Gumstix",
111 + .dai_link = gumstix_dai,
112 + .num_links = ARRAY_SIZE(gumstix_dai),
113 +};
114 +
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,
119 +};
120 +
121 +static struct platform_device *gumstix_snd_device;
122 +
123 +static int __init gumstix_init(void)
124 +{
125 + int ret;
126 +
127 + if (!machine_is_gumstix())
128 + return -ENODEV;
129 +
130 + gumstix_snd_device = platform_device_alloc("soc-audio", -1);
131 + if (!gumstix_snd_device)
132 + return -ENOMEM;
133 +
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);
137 +
138 + if (ret)
139 + platform_device_put(gumstix_snd_device);
140 +
141 + return ret;
142 +}
143 +
144 +static void __exit gumstix_exit(void)
145 +{
146 + platform_device_unregister(gumstix_snd_device);
147 +}
148 +
149 +module_init(gumstix_init);
150 +module_exit(gumstix_exit);
151 +
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)
163
164 -static struct snd_soc_codec_dai ac97_dai = {
165 +struct snd_soc_codec_dai ac97_dai = {
166 .name = "AC97 HiFi",
167 .playback = {
168 .stream_name = "AC97 Playback",
169 @@ -61,6 +61,8 @@ static struct snd_soc_codec_dai ac97_dai
170 .prepare = ac97_prepare,},
171 };
172
173 +EXPORT_SYMBOL_GPL(ac97_dai);
174 +
175 static unsigned int ac97_read(struct snd_soc_codec *codec,
176 unsigned int reg)
177 {
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
182 @@ -14,5 +14,6 @@
183 #define __LINUX_SND_SOC_AC97_H
184
185 extern struct snd_soc_codec_device soc_codec_dev_ac97;
186 +extern struct snd_soc_codec_dai ac97_dai;
187
188 #endif
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
194
195 static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
196 {
197 - GCR &= GCR_COLD_RST; /* clear everything but nCRST */
198 - GCR &= ~GCR_COLD_RST; /* then assert nCRST */
199 -
200 - gsr_bits = 0;
201 #ifdef CONFIG_PXA27x
202 /* PXA27x Developers Manual section 13.5.2.2.1 */
203 + GCR |= GCR_ACLINK_OFF;
204 + udelay(5);
205 + GCR &= GCR_COLD_RST; /* Mask all interrupts */
206 + GCR &= ~GCR_COLD_RST; /* cold reset */
207 + udelay(5);
208 pxa_set_cken(1 << 31, 1);
209 udelay(5);
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 */
213 + udelay(5);
214 GCR = GCR_COLD_RST;
215 udelay(50);
216 + wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
217 #else
218 + GCR &= GCR_COLD_RST; /* clear everything but nCRST */
219 + GCR &= ~GCR_COLD_RST; /* then assert nCRST */
220 +
221 + gsr_bits = 0;
222 GCR = GCR_COLD_RST;
223 GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
224 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
This page took 0.065789 seconds and 5 git commands to generate.