1 diff -Nuar linux-2.4.18/arch/arm/mach-sa1100/m62332.c linux-2.4.18p/arch/arm/mach-sa1100/m62332.c
2 --- linux-2.4.18/arch/arm/mach-sa1100/m62332.c 2003-05-13 11:18:14.000000000 +0200
3 +++ linux-2.4.18p/arch/arm/mach-sa1100/m62332.c 2004-10-12 22:36:36.000000000 +0200
8 +EXPORT_SYMBOL(m62332_senddata);
10 diff -Nuar linux-2.4.18/arch/arm/mach-sa1100/Makefile linux-2.4.18p/arch/arm/mach-sa1100/Makefile
11 --- linux-2.4.18/arch/arm/mach-sa1100/Makefile 2003-05-13 11:18:14.000000000 +0200
12 +++ linux-2.4.18p/arch/arm/mach-sa1100/Makefile 2004-10-12 22:36:19.000000000 +0200
14 export-objs := assabet.o consus.o badge4.o dma-sa1100.o dma-sa1111.o \
15 flexanet.o freebird.o generic.o h3600.o \
16 huw_webpanel.o irq.o pcipool.o sa1111.o sa1111-pcibuf.o \
17 - system3.o yopy.o usb_ctl.o usb_recv.o usb_send.o
18 + system3.o yopy.o usb_ctl.o usb_recv.o usb_send.o m62332.o
20 # These aren't present yet, and prevents a plain -ac kernel building.
23 obj-$(CONFIG_SA1100_LART) += cpu-sa1100.o
26 -obj-$(CONFIG_SA1100_COLLIE) += collie.o m62332.o collie_battery.o collie_led.o collie_buzzer.o
27 +obj-$(CONFIG_SA1100_COLLIE) += collie.o m62332.o collie_battery.o collie_led.o
29 # Next, the SA1111 stuff.
30 obj-$(CONFIG_SA1111) += sa1111.o dma-sa1111.o
31 diff -Nuar linux-2.4.18/drivers/char/Makefile linux-2.4.18p/drivers/char/Makefile
32 --- linux-2.4.18/drivers/char/Makefile 2003-05-13 11:18:18.000000000 +0200
33 +++ linux-2.4.18p/drivers/char/Makefile 2004-10-12 17:26:44.000000000 +0200
35 obj-y += joystick/js.o
38 -obj-$(CONFIG_SA1100_COLLIE) += sharp_led.o sharp_kbdctl.o sharp_buzzer.o
39 +obj-$(CONFIG_SA1100_COLLIE) += sharp_led.o sharp_kbdctl.o
40 obj-$(CONFIG_DISCOVERY_LED) += sharp_led.o discovery_led.o
41 obj-$(CONFIG_ARCH_PXA_POODLE) += sharp_led.o sharp_kbdctl.o sharpsl_led.o sharp_buzzer.o
42 obj-$(CONFIG_ARCH_PXA_CORGI) += sharp_led.o sharpsl_led.o sharp_kbdctl.o corgi_rc.o sharp_buzzer.o
43 diff -Nuar linux-2.4.18/drivers/sound/colliebuzzer.h linux-2.4.18p/drivers/sound/colliebuzzer.h
44 --- linux-2.4.18/drivers/sound/colliebuzzer.h 1970-01-01 01:00:00.000000000 +0100
45 +++ linux-2.4.18p/drivers/sound/colliebuzzer.h 2004-10-13 15:24:51.028208808 +0200
47 +unsigned short tap_data[] = {
48 + 0x0000 , 0xff00 , 0xff00 , 0x0000 ,
49 + 0xff00 , 0x0000 , 0x0000 , 0x0100 ,
50 + 0x0000 , 0x0100 , 0x0000 , 0x0100 ,
51 + 0x0100 , 0x0000 , 0x0100 , 0x0100 ,
52 + 0x0100 , 0x0100 , 0x0100 , 0x0100 ,
53 + 0x0100 , 0x0100 , 0x0100 , 0x0100 ,
54 + 0x0100 , 0x0000 , 0x0100 , 0x0000 ,
55 + 0x0100 , 0xff00 , 0x0100 , 0x0000 ,
56 + 0x0100 , 0x0000 , 0x0000 , 0x0100 ,
57 + 0x0000 , 0x0100 , 0x0000 , 0x0100 ,
58 + 0x0000 , 0x0000 , 0x0000 , 0x0000 ,
59 + 0x0000 , 0x0100 , 0x0000 , 0x0100 ,
60 + 0x0000 , 0x0100 , 0x0700 , 0x1c00 ,
61 + 0xc800 , 0xd900 , 0x2b00 , 0x2700 ,
62 + 0xbf00 , 0xe000 , 0x0d00 , 0x1000 ,
63 + 0xf500 , 0xd700 , 0x0100 , 0x0a00 ,
64 + 0xfb00 , 0xfa00 , 0x2200 , 0x0100 ,
65 + 0xeb00 , 0x0300 , 0x0600 , 0x1600 ,
66 + 0xe500 , 0xf500 , 0x0d00 , 0x0a00 ,
67 + 0x0100 , 0xfb00 , 0x0000 , 0x0100 ,
68 + 0xf200 , 0x0400 , 0x0600 , 0x0000 ,
69 + 0xf100 , 0x0300 , 0x1200 , 0xfe00 ,
70 + 0xe900 , 0x0400 , 0x0100 , 0x0d00 ,
71 + 0xf500 , 0x0100 , 0x0100 , 0xfe00 ,
72 + 0x0100 , 0xfb00 , 0x0400 , 0xff00 ,
73 + 0xf700 , 0x0400 , 0x0000 , 0xfe00 ,
74 + 0x0200 , 0x0000 , 0x0100 , 0xfd00 ,
75 + 0x0000 , 0xff00 , 0x0200 , 0x0000 ,
76 + 0xff00 , 0x0000 , 0x0200 , 0xfc00 ,
77 + 0xfe00 , 0xff00 , 0x0100 , 0x0200 ,
78 + 0x0000 , 0xff00 , 0xfc00 , 0x0100 ,
79 + 0x0100 , 0x0100 , 0xff00 , 0x0000 ,
80 + 0x0300 , 0xfe00 , 0xfe00 , 0x0200 ,
81 + 0xff00 , 0x0000 , 0x0000 , 0xfe00 ,
82 + 0x0000 , 0xff00 , 0x0000 , 0x0000 ,
83 + 0x0000 , 0xff00 , 0x0000 , 0x0000 ,
84 + 0xff00 , 0xfe00 , 0xfd00 , 0x0100 ,
85 + 0x0000 , 0xfe00 , 0xff00 , 0xff00 ,
86 + 0x0000 , 0xff00 , 0x0100 , 0xfe00 ,
87 + 0xff00 , 0xff00 , 0x0000 , 0x0000 ,
88 + 0xfe00 , 0xff00 , 0x0100 , 0x0100 ,
89 + 0xff00 , 0x0100 , 0x0100 , 0xfe00 ,
90 + 0x0000 , 0x0000 , 0x0000 , 0x0100 ,
91 + 0x0000 , 0x0000 , 0xff00 , 0x0000 ,
92 + 0x0100 , 0x0000 , 0x0200 };
95 +unsigned short click_data[] = {
96 + 0x0100 , 0x0100 , 0x0100 , 0x0000 ,
97 + 0x0100 , 0xff00 , 0x0100 , 0x0000 ,
98 + 0xff00 , 0xff00 , 0xff00 , 0x0000 ,
99 + 0xff00 , 0xff00 , 0xff00 , 0xff00 ,
100 + 0xff00 , 0xff00 , 0x0000 , 0xff00 ,
101 + 0xff00 , 0xff00 , 0x0000 , 0xff00 ,
102 + 0xff00 , 0xff00 , 0xff00 , 0x0100 ,
103 + 0x0000 , 0xff00 , 0xfe00 , 0x0100 ,
104 + 0xff00 , 0x0100 , 0xff00 , 0x0100 ,
105 + 0x0100 , 0x0300 , 0xff00 , 0xff00 ,
106 + 0xff00 , 0x0100 , 0x0100 , 0x0000 ,
107 + 0xfe00 , 0xfe00 , 0xfe00 , 0xfc00 ,
108 + 0xfe00 , 0x0100 , 0xfd00 , 0xff00 ,
109 + 0xff00 , 0xfc00 , 0xfe00 , 0xfd00 ,
110 + 0x0100 , 0xfe00 , 0x0100 , 0xf800 ,
111 + 0xfe00 , 0xfe00 , 0xfc00 , 0xe600 ,
112 + 0xdb00 , 0x2500 , 0xdb00 , 0xee00 ,
113 + 0xdb00 , 0x0600 , 0xeb00 , 0x1f00 ,
114 + 0x1e00 , 0xeb00 , 0xfe00 , 0x0000 ,
115 + 0xff00 , 0x1900 , 0xef00 , 0xf700 ,
116 + 0x2100 , 0xe400 , 0x0100 , 0x0600 ,
117 + 0xff00 , 0x0300 , 0xf900 , 0x0f00 ,
118 + 0xf600 , 0x0100 , 0xfe00 , 0xf900 ,
119 + 0x0500 , 0xf500 , 0x0600 , 0xfb00 ,
120 + 0x0800 , 0x0100 , 0x0300 , 0x0100 ,
121 + 0xf700 , 0xfa00 , 0xfd00 , 0xfc00 ,
122 + 0x0800 , 0xfb00 , 0x0500 , 0xfe00 ,
123 + 0xfc00 , 0xfc00 , 0xfe00 , 0x0400 ,
124 + 0xff00 , 0xff00 , 0x0500 , 0x0100 ,
125 + 0xfc00 , 0xff00 , 0xfe00 , 0xfb00 ,
126 + 0x0200 , 0x0200 , 0xff00 , 0xfe00 ,
127 + 0xfe00 , 0x0600 , 0xfb00 , 0xff00 ,
128 + 0xfc00 , 0x0600 , 0xfb00 , 0xff00 ,
129 + 0xff00 , 0x0100 , 0xff00 , 0x0200 ,
130 + 0xff00 , 0xfb00 , 0xff00 , 0x0200 ,
131 + 0xff00 , 0x0200 , 0x0100 , 0xfe00 ,
132 + 0xfe00 , 0x0100 , 0xfd00 , 0x0200 ,
133 + 0xfc00 , 0x0800 , 0xfe00 , 0xfe00 ,
134 + 0x0400 , 0xfc00 , 0xff00 , 0xfc00 ,
135 + 0x0500 , 0x0200 , 0x0800 , 0x0200 ,
136 + 0x0100 , 0xfe00 , 0x0100 , 0xff00 ,
137 + 0x0700 , 0xfb00 , 0xfc00 , 0x0100 ,
138 + 0xfe00 , 0xfc00 , 0x0b00 , 0xfb00 ,
139 + 0xfb00 , 0x0700 , 0xfb00 , 0xfb00 ,
140 + 0x0100 , 0xff00 , 0xfb00 , 0xfd00 ,
141 + 0x0000 , 0xfe00 , 0xfe00 , 0xff00 ,
142 + 0xfc00 , 0x0400 , 0x0000 , 0xfe00 ,
143 + 0xff00 , 0x0200 , 0xff00 , 0x0000 ,
144 + 0x0500 , 0x0100 , 0x0100 , 0x0100 ,
145 + 0x0100 , 0x0000 , 0x0300 , 0xfe00 ,
146 + 0xff00 , 0x0100 , 0x0100 , 0xfe00 ,
147 + 0x0000 , 0xff00 , 0x0100 , 0xff00 ,
148 + 0x0200 , 0xff00 , 0xff00 , 0xff00 ,
149 + 0xff00 , 0xfe00 , 0x0000 , 0xff00 ,
150 + 0xfe00 , 0xff00 , 0xfd00 , 0x0000 ,
151 + 0xff00 , 0xfe00 , 0xff00 , 0xfc00 ,
152 + 0x0100 , 0xfd00 , 0xff00 , 0xff00 ,
153 + 0x0200 , 0xff00 , 0x0100 , 0xff00 ,
154 + 0xfc00 , 0x0300 , 0xff00 , 0x0200 ,
155 + 0xff00 , 0x0100 , 0xff00 , 0x0100 ,
156 + 0xff00 , 0xff00 , 0x0100 , 0xfe00 ,
157 + 0x0300 , 0xfc00 , 0x0100 , 0xff00 ,
158 + 0x0100 , 0x0100 , 0x0100 , 0xfc00 ,
159 + 0xff00 , 0x0100 , 0x0100 , 0xfe00 ,
160 + 0x0100 , 0xff00 , 0x0100 , 0xfc00 ,
161 + 0x0100 , 0x0200 , 0xff00 , 0x0100 ,
162 + 0xff00 , 0xff00 , 0x0200 , 0xfd00 ,
163 + 0xfe00 , 0x0100 , 0xff00 , 0x0100 ,
164 + 0xfe00 , 0x0100 , 0x0300 , 0xfe00 ,
165 + 0x0300 , 0xfe00 , 0xff00 , 0x0100 ,
166 + 0xff00 , 0x0200 , 0xfd00 , 0x0000 ,
167 + 0xff00 , 0x0200 , 0xff00 , 0x0200 ,
168 + 0xff00 , 0x0100 , 0x0000 , 0xff00 ,
169 + 0x0200 , 0x0100 , 0x0000 , 0xff00 ,
170 + 0x0100 , 0xfe00 , 0x0200 , 0xfe00 ,
171 + 0xfe00 , 0x0100 , 0xfe00 , 0x0100 ,
172 + 0xfd00 , 0xff00 , 0xff00 , 0xfe00 ,
173 + 0xff00 , 0xfc00 , 0x0100 , 0xfe00 ,
174 + 0x0100 , 0xff00 , 0xfe00 , 0xff00 ,
175 + 0xff00 , 0xfe00 , 0x0100 , 0xfe00 ,
176 + 0x0100 , 0xff00 , 0x0100 , 0xfe00 ,
177 + 0xff00 , 0x0200 , 0xfe00 , 0x0000 ,
178 + 0x0100 , 0x0200 , 0xff00 , 0x0200 ,
179 + 0xff00 , 0x0000 , 0x0100 , 0x0100 ,
180 + 0xff00 , 0x0200 , 0xfe00 , 0xff00 ,
181 + 0xff00 , 0xff00 , 0x0100 , 0x0000 ,
182 + 0xff00 , 0x0100 , 0xff00 , 0x0000 ,
183 + 0x0100 , 0xff00 , 0xfe00 , 0xff00 ,
184 + 0xff00 , 0x0100 , 0xff00 , 0x0100 ,
185 + 0xfe00 , 0xff00 , 0xff00 , 0xff00 ,
186 + 0xfe00 , 0xff00 , 0xff00 , 0x0100 ,
187 + 0xff00 , 0x0200 , 0xff00 , 0x0100 ,
191 +unsigned short alarm_data[] = {
192 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
193 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
194 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
195 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
196 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
197 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
198 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
199 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
200 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
201 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
202 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
203 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
204 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
205 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
206 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
207 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
208 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
209 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
210 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
211 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
212 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
213 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
214 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
215 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
216 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
217 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
218 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
219 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
220 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
221 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
222 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
223 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
224 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
225 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
226 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
227 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
228 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
229 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
230 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
231 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
232 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
233 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
234 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
235 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
236 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
237 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
238 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
239 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
240 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
241 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
242 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
243 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
244 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
245 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
246 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
247 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
248 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
249 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
250 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
251 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
252 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
253 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
254 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
255 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
256 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
257 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
258 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
259 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
260 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
261 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
262 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
263 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
264 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
265 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
266 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
267 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
268 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
269 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
270 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
271 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
272 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
273 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
274 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
275 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
276 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
277 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
278 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
279 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
280 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
281 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
282 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
283 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
284 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
285 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
286 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
287 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
288 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
289 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
290 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
291 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
292 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
293 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
294 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
295 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
296 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
297 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
298 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
299 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
300 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
301 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
302 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
303 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
304 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
305 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
306 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
307 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
308 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
309 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
310 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
311 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
312 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
313 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
314 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
315 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
316 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
317 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
318 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
319 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
320 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
321 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
322 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
323 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
324 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
325 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
326 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
327 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
328 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
329 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
330 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
331 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
332 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
333 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
334 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
335 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
336 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
337 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
338 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
339 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
340 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
341 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
342 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
343 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
344 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
345 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
346 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
347 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
348 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
349 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
350 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
351 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
352 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
353 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
354 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
355 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
356 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
357 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
358 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
359 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
360 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
361 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
362 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
363 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
364 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
365 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
366 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
367 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
368 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
369 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
370 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
371 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
372 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
373 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
374 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
375 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
376 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
377 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
378 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
379 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
380 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
381 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
382 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
383 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
384 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
385 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
386 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
387 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
388 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
389 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
390 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
391 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
392 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
393 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
394 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
395 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
396 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
397 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
398 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
399 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
400 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
401 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
402 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
403 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
404 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
405 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
406 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
407 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
408 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
409 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
410 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
411 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
412 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
413 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
414 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
415 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
416 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
417 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
418 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
419 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
420 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
421 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
422 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
423 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
424 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
425 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
426 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
427 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
428 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
429 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
430 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
431 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
432 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
433 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
434 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
435 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
436 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
437 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
438 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
439 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
440 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
441 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
442 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
443 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
444 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
445 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
446 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
447 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
448 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
449 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
450 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
451 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
452 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
453 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
454 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
455 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
456 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
457 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
458 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
459 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
460 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
461 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
462 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
463 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
464 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
465 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
466 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
467 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
468 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
469 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
470 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
471 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
472 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
473 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
474 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
475 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
476 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
477 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
478 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
479 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
480 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
481 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
482 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
483 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
484 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
485 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
486 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
487 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
488 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
489 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
490 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
491 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
492 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
493 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
494 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
495 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
496 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
497 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
498 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
499 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
500 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
501 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
502 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
503 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
504 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
505 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
506 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
507 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
508 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
509 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
510 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
511 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
512 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
513 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
514 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
515 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
516 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
517 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
518 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
519 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
520 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
521 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
522 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
523 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
524 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
525 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
526 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
527 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
528 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
529 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
530 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
531 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
532 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
533 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
534 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
535 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
536 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
537 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
538 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
539 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
540 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
541 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
542 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
543 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
544 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
545 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
546 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
547 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
548 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
549 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
550 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
551 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
552 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
553 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
554 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
555 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
556 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
557 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
558 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
559 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
560 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
561 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
562 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
563 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
564 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
565 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
566 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
567 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
568 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
569 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
570 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
571 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
572 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
573 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
574 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
575 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
576 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
577 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
578 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
579 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
580 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
581 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
582 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
583 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
584 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
585 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
586 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
587 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
588 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
589 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
590 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
591 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
592 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
593 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
594 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
595 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
596 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
597 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
598 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
599 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
600 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
601 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
602 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
603 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
604 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
605 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
606 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
607 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
608 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
609 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
610 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
611 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
612 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
613 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
614 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
615 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
616 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
617 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
618 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
619 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
620 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
621 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 0
622 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
623 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
624 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
625 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
626 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
627 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
628 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
629 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
630 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
631 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 1
632 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 0
633 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 1
634 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 2
635 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 3
636 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 4
637 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 5
638 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 6
639 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 7
640 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 8
641 + 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x7fff , 0x7fff , 0x8000 , 0x8000 , // 9 2
642 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
643 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
644 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
645 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
646 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
647 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
648 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
649 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
650 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
651 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 3
652 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
653 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
654 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
655 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
656 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
657 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
658 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
659 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
660 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
661 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 4
662 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 0
663 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 1
664 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 2
665 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 3
666 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 4
667 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 5
668 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 6
669 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 7
670 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 8
671 + 0x7fff , 0x7fff , 0x7fff , 0x7fff , 0x8000 , 0x8000 , 0x8000 , 0x8000 , // 9 5
679 +#define SHARP_BUZ_TOUCHSOUND 1
680 +#define SHARP_BUZ_KEYSOUND 2
681 +#define SHARP_BUZ_ALARM 11
682 +#define SHARP_BUZZER_MAKESOUND 0x5680
684 +static int collie_ct_s16_buzzer(const u_char *userPtr, size_t userCount,
685 + u_char frame[], ssize_t *frameUsed,
688 + ssize_t count, used;
689 + signed short *fp = (unsigned short *) &frame[*frameUsed];
690 + signed short *up = (unsigned short *) userPtr;
692 + DPRINTK("Collie_ct_s16 begin\n");
694 + used = count = (userCount < frameLeft) ? userCount/2 : frameLeft/4;
696 + DPRINTK("Collie_ct_s16 begin count %d \n",count);
698 + while (count > 0) {
704 + *frameUsed+=used*4;
705 + DPRINTK("Collie_ct_s16 exit\n");
710 +static ssize_t sq_write_buzzer(int soundid)
713 + audio_stream_t *s = &output_stream;
715 + ssize_t uUsed, bUsed, bLeft, uLeft, ret = 0;
718 + if ((collie_tc_status!=NA) && (collie_tc_status!=PLAY))
721 + collie_tc_status=PLAY;
723 + if (!s->buffers && sq_allocate_buffers(s)) {
729 + /* Auto Power off cancel */
730 +// autoPowerCancel = 0;
732 + DPRINTK("sq_write_buzzer: id:%d\n", soundid);
735 + case SHARP_BUZ_TOUCHSOUND:
739 + case SHARP_BUZ_KEYSOUND:
743 + case SHARP_BUZ_ALARM:
750 + DPRINTK("sq_write_buzzer: uLeft=%d\n", uLeft);
752 + collie_tc_mute_off();
753 + while (uLeft > 0) {
754 + audio_buf_t *b = s->buf;
756 + ret = -ERESTARTSYS;
757 + if (down_interruptible(&b->sem)) {
761 + dest = b->start + b->size;
763 + bLeft = s->fragsize - b->size;
764 + uUsed = collie_ct_s16_buzzer(src, uLeft, dest, &bUsed, bLeft);
765 + cpu_cache_clean_invalidate_range((unsigned long)dest,
766 + (unsigned long)(dest+(audio_fragsize)), 0);
768 + DPRINTK("back to sq_write_buzzer %p\n",dest);
778 + if (b->size < s->fragsize) {
783 + /* Send current buffer to dma */
784 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL,
785 + (void *) b, b->dma_addr, b->size);
787 + Collie_volume_set(4);
789 + b->size = 0; /* indicate that the buffer has been sent */
793 + DPRINTK("sq_write_buzzer: return\n");
803 diff -Nuar linux-2.4.18/drivers/sound/collie_ssp.c linux-2.4.18p/drivers/sound/collie_ssp.c
804 --- linux-2.4.18/drivers/sound/collie_ssp.c 2003-05-13 11:18:37.000000000 +0200
805 +++ linux-2.4.18p/drivers/sound/collie_ssp.c 2004-10-13 15:05:36.000000000 +0200
807 * I/F : Synchronous serial port (SSP) TI mode
809 * Copyright (C) 2001 SHARP
810 + * p.nis/dolOps messed around with it too!
812 * This program is free software; you can redistribute it and/or modify
813 * it under the terms of the GNU General Public License as published by
816 * tune hardware control method
817 * 12-Nov-2001 Lineo Japan, Inc.
818 - * 14-Feb-2003 Sharp Corporation 8bit , GETOSPACE
820 + * 26-Dec-2002 getospace added, some unneeded things removed
822 + * 28-Dec-2002 cut out old stuff, reorder stuff
824 + * 04-Jan-2003 put in getospace from lineo's collie-tc35143.c
825 + * also added collie_record_on off, and exported these symbols
827 + * 06-Jan-2003 if mixer ioctl SOUND_MIXER_READ_DEVMASK returns 0 as mask,
828 + * than the headphone(/mic) is not connected
832 #include <linux/module.h>
833 #include <linux/sched.h>
835 #include <linux/fcntl.h>
836 #include <linux/errno.h>
837 #include <linux/mm.h>
838 -#include <linux/malloc.h>
839 +#include <linux/slab.h>
840 #include <linux/sound.h>
841 #include <linux/init.h>
842 #include <linux/delay.h>
844 #include <asm/uaccess.h>
847 -#include <asm/ucb1200.h>
849 #include <linux/soundcard.h>
850 #include <asm/proc/cache.h>
852 -#include <asm/arch/gpio.h>
853 +#include <asm/arch/hardware.h>
854 #include <asm/arch/m62332.h>
855 #include <asm/arch/tc35143.h>
860 #define DPRINTK( x... ) printk( ##x )
862 #define DPRINTK( x... )
865 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0) || \
866 - defined(CONFIG_COLLIE_TR1) || defined(CONFIG_COLLIE_DEV)
867 -#define COLLIE_TRY_ONE
869 -#undef COLLIE_TRY_ONE
871 +#define COLLIE_TRY_ONE
873 #ifdef COLLIE_TRY_ONE
874 #ifndef GPIO_REMOCON_ADC_SW
875 #define GPIO_REMOCON_ADC_SW GPIO_GPIO(18)
878 +static int collie_rc_irq;
879 static DECLARE_WAIT_QUEUE_HEAD(audio_on);
882 static inline void collie_rc_set_int_mode(void)
884 GPSR = GPIO_REMOCON_ADC_SW;
890 int collie_dmasound_irq = -1;
891 -#define COLLIE_SOUND_DMA_CHANNEL (collie_dmasound_irq)
893 +#define COLLIE_SOUND_DMA_CHANNEL (collie_dmasound_irq)
894 #define SND_NDEVS 256 /* Number of supported devices */
895 #define SND_DEV_CTL 0 /* Control port /dev/mixer */
896 -#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
897 - synthesizer and MIDI output) */
898 +#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM synthesizer and MIDI output) */
899 #define SND_DEV_MIDIN 2 /* Raw midi access */
900 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
901 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
902 @@ -121,142 +123,25 @@
905 /*** Some declarations ***********************************************/
907 -#define DMASND_FALCON 2
908 -#define DMASND_AMIGA 3
909 -#define DMASND_AWACS 4
910 -#define DMASND_IRIS 5
911 -#define DMASND_COLLIE 6
913 -#define COLLIE_WAIT_AMP_ON 1 /* 10ms */
915 #define COLLIE_WAIT_LCM_ACC_XEN 50 /* 500ms */
917 -static int catchRadius = 0;
920 static int collie_amp_init = 0;
921 static int collie_dac_init = 0;
922 -static int collie_op_shdn_on = 0;
923 static int collie_resume = 0;
924 static int collie_hard_mute = 1;
925 static int collie_soft_mute = 1;
926 static int collie_volume = 0;
927 +int collie_recording=0;
928 +static int playing=0;
929 +static int headphone;
931 -int collie_buzzer_volume = 0;
934 -static DECLARE_WAIT_QUEUE_HEAD(open_queue);
935 +#define AUDIO_NBFRAGS_DEFAULT 64
936 +#define AUDIO_FRAGSIZE_DEFAULT 4096
938 -#define SIGNAL_RECEIVED (signal_pending(current))
939 -#define ONE_SECOND HZ /* in jiffies (100ths of a second) */
940 -#define SLEEP(queue, time_limit) \
941 - interruptible_sleep_on_timeout((wait_queue_head_t*)&queue, (time_limit));
942 -#define WAKE_UP(queue) (wake_up_interruptible((wait_queue_head_t*)&queue))
945 -#define AUDIO_NBFRAGS_DEFAULT 8
946 -#define AUDIO_FRAGSIZE_DEFAULT 8192
953 -#define TRACE_SENDDATA 0
957 -#define TRACE_OP_SHDN 1
958 -#define TRACE_WRITE 1
959 -#define TRACE_MUTE 1
960 -#define TRACE_CLOCK 1
961 -#define TRACE_PAIF 1
963 -#define TRACE_VOLUME 1
965 -#define TRACE_INTERRUPT 0
967 -char *pLevel[16] = {
989 - return (level < 16 ) ? pLevel[level] : pLevel[15];
992 -#define P_ID (current->tgid)
993 -#define ENTER(f,fn) {if(f)printk("%d:%s+[%d]%s\n",jiffies,indent(cLevel),P_ID,(fn));cLevel++;}
994 -#define LEAVE(f,fn) {cLevel--;if(f>1)printk("%d:%s-[%d]%s\n",jiffies,indent(cLevel),P_ID,(fn));}
998 -#endif /* end TRACE */
1001 - * DAC power management
1003 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0) || \
1004 - defined(CONFIG_COLLIE_TR1) || defined(CONFIG_COLLIE_DEV)
1005 -#define DAC_OFF_WITH_DEVICE_OFF 1
1006 -#undef HARD_MUTE_CTRL_DISABLE
1008 -#undef DAC_OFF_WITH_DEVICE_OFF
1009 #undef HARD_MUTE_CTRL_DISABLE
1013 -#define TRY_DELAY_OFF
1014 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
1015 -static DECLARE_WAIT_QUEUE_HEAD(delay_off);
1016 -struct semaphore df_sem;
1020 -static unsigned int DelayedFlag = 0;
1021 -#define DELAY_DAC_OFF 0x1
1022 -#define DELAY_HARD_MUTE_ON 0x2
1024 -static inline void ResetDelayAll(void)
1029 -static inline int isDelayedExist(void)
1031 - return DelayedFlag;
1034 -static inline void SetDelay(unsigned int flag)
1036 - DelayedFlag |= flag;
1039 -static inline void ResetDelay(unsigned int flag)
1041 - DelayedFlag &= ~flag;
1044 -static inline unsigned int isDelayed(unsigned int flag)
1046 - return DelayedFlag & flag;
1053 dma_addr_t dma_addr; /* physical buffer address */
1054 struct semaphore sem; /* down before touching the buffer */
1055 int master; /* master owner for buffer allocation */
1056 + u_int idx; /* buffer index, so that we know which buffer was sent last*/
1060 @@ -291,16 +177,6 @@
1062 static volatile int audio_wr_refcount; /* nbr of concurrent open() for playback */
1064 -static ssize_t (*ct_func)(const u_char *, size_t, u_char *, ssize_t *, ssize_t) = NULL;
1067 -MODULE_PARM(catchRadius, "i");
1069 -MODULE_PARM(numBufs, "i");
1070 -MODULE_PARM(bufSize, "i");
1072 -#define min(x, y) ((x) < (y) ? (x) : (y))
1074 #define IOCTL_IN(arg, ret) \
1075 do { int error = get_user(ret, (int *)(arg)); \
1076 if (error) return error; \
1077 @@ -310,11 +186,7 @@
1081 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
1082 -#define COLLIE_GPIO_OPSHDN GPIO_GPIO (17) /* AMP contorol */
1083 -#else /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
1084 #define COLLIE_GPIO_MIC GPIO_GPIO (17) /* MIC contorol */
1085 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
1089 @@ -352,122 +224,11 @@
1090 ( LCM_ACC_XSEL1 | LCM_ACC_CLKSEL101 ) ,
1093 +/*** "Translations" ************************************************************/
1095 -/* 16 bit mu-law */
1097 -static short ulaw2dma16[] = {
1098 - -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
1099 - -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
1100 - -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
1101 - -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
1102 - -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
1103 - -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
1104 - -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
1105 - -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
1106 - -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
1107 - -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
1108 - -876, -844, -812, -780, -748, -716, -684, -652,
1109 - -620, -588, -556, -524, -492, -460, -428, -396,
1110 - -372, -356, -340, -324, -308, -292, -276, -260,
1111 - -244, -228, -212, -196, -180, -164, -148, -132,
1112 - -120, -112, -104, -96, -88, -80, -72, -64,
1113 - -56, -48, -40, -32, -24, -16, -8, 0,
1114 - 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
1115 - 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
1116 - 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
1117 - 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
1118 - 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
1119 - 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
1120 - 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
1121 - 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
1122 - 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
1123 - 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
1124 - 876, 844, 812, 780, 748, 716, 684, 652,
1125 - 620, 588, 556, 524, 492, 460, 428, 396,
1126 - 372, 356, 340, 324, 308, 292, 276, 260,
1127 - 244, 228, 212, 196, 180, 164, 148, 132,
1128 - 120, 112, 104, 96, 88, 80, 72, 64,
1129 - 56, 48, 40, 32, 24, 16, 8, 0,
1134 -static short alaw2dma16[] = {
1135 - -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
1136 - -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
1137 - -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
1138 - -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392,
1139 - -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944,
1140 - -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136,
1141 - -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472,
1142 - -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568,
1143 - -344, -328, -376, -360, -280, -264, -312, -296,
1144 - -472, -456, -504, -488, -408, -392, -440, -424,
1145 - -88, -72, -120, -104, -24, -8, -56, -40,
1146 - -216, -200, -248, -232, -152, -136, -184, -168,
1147 - -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184,
1148 - -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696,
1149 - -688, -656, -752, -720, -560, -528, -624, -592,
1150 - -944, -912, -1008, -976, -816, -784, -880, -848,
1151 - 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736,
1152 - 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784,
1153 - 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368,
1154 - 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392,
1155 - 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944,
1156 - 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136,
1157 - 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472,
1158 - 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568,
1159 - 344, 328, 376, 360, 280, 264, 312, 296,
1160 - 472, 456, 504, 488, 408, 392, 440, 424,
1161 - 88, 72, 120, 104, 24, 8, 56, 40,
1162 - 216, 200, 248, 232, 152, 136, 184, 168,
1163 - 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184,
1164 - 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696,
1165 - 688, 656, 752, 720, 560, 528, 624, 592,
1166 - 944, 912, 1008, 976, 816, 784, 880, 848,
1171 -/*** Translations ************************************************************/
1173 -static ssize_t collie_ct_law(const u_char *userPtr, size_t userCount,
1174 - u_char frame[], ssize_t *frameUsed,
1175 - ssize_t frameLeft);
1176 -static ssize_t collie_ct_s8(const u_char *userPtr, size_t userCount,
1177 - u_char frame[], ssize_t *frameUsed,
1178 - ssize_t frameLeft);
1179 -static ssize_t collie_ct_u8(const u_char *userPtr, size_t userCount,
1180 - u_char frame[], ssize_t *frameUsed,
1181 - ssize_t frameLeft);
1182 static ssize_t collie_ct_s16(const u_char *userPtr, size_t userCount,
1183 u_char frame[], ssize_t *frameUsed,
1185 -static ssize_t collie_ct_u16(const u_char *userPtr, size_t userCount,
1186 - u_char frame[], ssize_t *frameUsed,
1187 - ssize_t frameLeft);
1189 -/*** Machine definitions *****************************************************/
1194 - void *(*dma_alloc)(unsigned int, int);
1195 - void (*dma_free)(void *, unsigned int);
1196 - int (*irqinit)(void);
1198 - void (*irqcleanup)(void);
1199 -#endif /* MODULE */
1200 - void (*init)(void);
1201 - void (*silence)(void);
1202 - int (*setFormat)(int);
1203 - int (*setVolume)(int);
1204 - int (*setBass)(int);
1205 - int (*setTreble)(int);
1206 - int (*setGain)(int);
1207 - void (*play)(void);
1211 /*** Low level stuff *********************************************************/
1213 @@ -477,71 +238,28 @@
1214 int stereo; /* 0 = mono, 1 = stereo */
1215 int size; /* 8/16 bit*/
1216 int speed; /* speed */
1221 - ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1222 - ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1223 - ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1224 - ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1225 - ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1226 - ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1227 - ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1228 - ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
1231 -struct sound_settings {
1232 - MACHINE mach; /* machine dependent things */
1233 - SETTINGS hard; /* hardware settings */
1234 - SETTINGS soft; /* software settings */
1235 - SETTINGS dsp; /* /dev/dsp default settings */
1236 - TRANS *trans; /* supported translations */
1237 - int volume_left; /* volume (range is machine dependent) */
1239 - int bass; /* tone (range is machine dependent) */
1242 - int minDev; /* minor device number currently open */
1245 -static struct sound_settings sound;
1246 +static SETTINGS sound;
1249 -extern int autoPowerCancel;
1250 +//extern int autoPowerCancel;
1252 -int collie_main_volume;
1253 -extern int collie_under_recording; /* collie_buzzer.c */
1254 -#define COLLE_RECORDING (collie_under_recording)
1256 static void Collie_Set_Volume(int volume);
1257 static int Collie_Get_Volume(void);
1258 -static void Collie_disable_sound(void);
1261 -static void Collie_clock_stop(void);
1262 -static void Collie_FS8KLPF_stop(void);
1265 static int CollieIrqInit(void);
1266 static int CollieGetSamp(void);
1267 -static void Collie_OP_SHDN_on(void);
1268 -static void Collie_OP_SHDN_off(void);
1269 -static void Collie_FS8KLPF_start(void);
1271 -static void CollieIrqCleanUp(void);
1272 -#endif /* MODULE */
1273 -static void CollieSilence(void);
1274 static void Collie_DAC_sendword(int);
1275 -static void CollieInit(void);
1276 static int CollieSetFormat(int format);
1277 static void Collie_sq_interrupt(void*, int);
1278 static int sq_allocate_buffers(audio_stream_t*);
1279 static void sq_release_buffers(audio_stream_t*);
1280 +static inline void Collie_volume_init(void);
1281 +static void Collie_volume_set(int);
1283 /*** Mid level stuff *********************************************************/
1284 -static void sound_silence(void);
1285 -static void sound_init(void);
1286 -static int sound_set_format(int format);
1287 static int sound_set_speed(int speed);
1288 static int sound_set_stereo(int stereo);
1290 @@ -572,468 +290,122 @@
1291 static long long sound_lseek(struct file *file, long long offset, int orig);
1292 static inline int ioctl_return(int *addr, int value)
1294 - ENTER(TRACE_ON,"ioctl_return");
1296 - LEAVE(TRACE_ON,"ioctl_return");
1300 - LEAVE(TRACE_ON,"ioctl_return");
1301 return put_user(value, addr)? -EFAULT: 0;
1305 -/*** Config & Setup **********************************************************/
1308 -void dmasound_init(void);
1309 -void dmasound_setup(char *str, int *ints);
1312 -/*** Translations ************************************************************/
1315 -/* ++TeSche: radically changed for new expanding purposes...
1317 - * These two routines now deal with copying/expanding/translating the samples
1318 - * from user space into our buffer at the right frequency. They take care about
1319 - * how much data there's actually to read, how much buffer space there is and
1320 - * to convert samples into the right frequency/encoding. They will only work on
1321 - * complete samples so it may happen they leave some bytes in the input stream
1322 - * if the user didn't write a multiple of the current sample size. They both
1323 - * return the number of bytes they've used from both streams so you may detect
1324 - * such a situation. Luckily all programs should be able to cope with that.
1326 - * I think I've optimized anything as far as one can do in plain C, all
1327 - * variables should fit in registers and the loops are really short. There's
1328 - * one loop for every possible situation. Writing a more generalized and thus
1329 - * parameterized loop would only produce slower code. Feel free to optimize
1330 - * this in assembler if you like. :)
1332 - * I think these routines belong here because they're not yet really hardware
1333 - * independent, especially the fact that the Falcon can play 16bit samples
1334 - * only in stereo is hardcoded in both of them!
1336 - * ++geert: split in even more functions (one per format)
1339 -static ssize_t collie_ct_law(const u_char *userPtr, size_t userCount,
1340 - u_char frame[], ssize_t *frameUsed,
1341 - ssize_t frameLeft)
1343 - short *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma16: alaw2dma16;
1344 - ssize_t count, used;
1345 - short *p = (short *) &frame[*frameUsed];
1346 - int val, stereo = sound.soft.stereo;
1348 - ENTER(TRACE_ON,"collie_ct_law");
1352 - used = count = min(userCount, frameLeft);
1353 - if (!COLLE_RECORDING) {
1354 - while (count > 0) {
1356 - if (get_user(data, userPtr++)) {
1357 - LEAVE(TRACE_ON,"collie_ct_law");
1360 - val = table[data];
1361 - *p++ = val; /* Left Ch. */
1363 - if (get_user(data, userPtr++)) {
1364 - LEAVE(TRACE_ON,"collie_ct_law");
1367 - val = table[data];
1369 - *p++ = val; /* Right Ch. */
1373 - while (count > 0) {
1376 - if (get_user(data, userPtr++)) {
1377 - LEAVE(TRACE_ON,"collie_ct_law");
1380 - val = table[data];
1381 - ave = val; /* Left Ch. */
1383 - if (get_user(data, userPtr++)) {
1384 - LEAVE(TRACE_ON,"collie_ct_law");
1387 - val = table[data];
1389 - ave += val; /* Right Ch. */
1391 - *p++ = 0; /* Left Ch. */
1392 - *p++ = ave; /* Right Ch. */
1396 - *frameUsed += used * 4;
1397 - LEAVE(TRACE_ON,"collie_ct_law");
1398 - return stereo? used * 2: used;
1402 -static ssize_t collie_ct_s8(const u_char *userPtr, size_t userCount,
1403 - u_char frame[], ssize_t *frameUsed,
1404 - ssize_t frameLeft)
1406 - ssize_t count, used;
1407 - short *p = (short *) &frame[*frameUsed];
1408 - int stereo = sound.soft.stereo;
1411 - ENTER(TRACE_ON,"collie_ct_s8");
1415 - used = count = min(userCount, frameLeft);
1416 - if (!COLLE_RECORDING) {
1417 - while (count > 0) {
1420 - if (get_user(data, userPtr++)) {
1421 - LEAVE(TRACE_ON,"collie_ct_s8");
1424 - val = ( data - 0x80 ) << 8;
1425 - *p++ = val; /* Left Ch. */
1427 - if ( get_user(data, userPtr++)) {
1428 - LEAVE(TRACE_ON,"collie_ct_s8");
1431 - val = ( data - 0x80 ) << 8;
1433 - *p++ = val; /* Right Ch. */
1437 - while (count > 0) {
1441 - if (get_user(data, userPtr++)) {
1442 - LEAVE(TRACE_ON,"collie_ct_s8");
1445 - val = ( data - 0x80 ) << 8;
1446 - ave = val; /* Left Ch. */
1448 - if ( get_user(data, userPtr++)) {
1449 - LEAVE(TRACE_ON,"collie_ct_s8");
1452 - val = ( data - 0x80 ) << 8;
1454 - ave += val; /* Right Ch. */
1456 - *p++ = 0; /* Left Ch. */
1457 - *p++ = ave; /* Right Ch. */
1461 - *frameUsed += used * 4;
1462 - LEAVE(TRACE_ON,"collie_ct_s8");
1463 - return stereo? used * 2: used;
1467 -static ssize_t collie_ct_u8(const u_char *userPtr, size_t userCount,
1468 - u_char frame[], ssize_t *frameUsed,
1469 - ssize_t frameLeft)
1470 +static void wait_ms(int ten_ms)
1472 - ssize_t count, used;
1473 - short *p = (short *) &frame[*frameUsed];
1474 - int stereo = sound.soft.stereo;
1477 - ENTER(TRACE_ON,"collie_ct_u8");
1481 - used = count = min(userCount, frameLeft);
1482 - if (!COLLE_RECORDING) {
1483 - while (count > 0) {
1486 - if (get_user(data, userPtr++)) {
1487 - LEAVE(TRACE_ON,"collie_ct_u8");
1491 - *p++ = (val ^ 0x80) << 8; /* Left Ch. */
1493 - if ( get_user(data, userPtr++)) {
1494 - LEAVE(TRACE_ON,"collie_ct_u8");
1499 - *p++ = (val ^ 0x80) << 8; /* Right Ch. */
1503 - while (count > 0) {
1507 - if (get_user(data, userPtr++)) {
1508 - LEAVE(TRACE_ON,"collie_ct_u8");
1512 - ave = (val ^ 0x80) << 8; /* Left Ch. */
1514 - if ( get_user(data, userPtr++)) {
1515 - LEAVE(TRACE_ON,"collie_ct_u8");
1520 - ave += (val ^ 0x80) << 8; /* Right Ch. */
1522 - *p++ = 0; /* Left Ch. */
1523 - *p++ = ave; /* Right Ch. */
1527 - *frameUsed += used * 4;
1528 - LEAVE(TRACE_ON,"collie_ct_u8");
1529 - return stereo? used * 2: used;
1530 + schedule_timeout(ten_ms);
1533 +/*** Translation ************************************************************/
1535 static ssize_t collie_ct_s16(const u_char *userPtr, size_t userCount,
1536 u_char frame[], ssize_t *frameUsed,
1539 ssize_t count, used;
1540 - int stereo = sound.soft.stereo;
1541 short *fp = (short *) &frame[*frameUsed];
1542 + short *up = (short *) userPtr;
1544 - ENTER(TRACE_ON,"collie_ct_s16");
1546 - userCount >>= (stereo? 2: 1);
1547 - used = count = min(userCount, frameLeft);
1549 - short *up = (short *) userPtr;
1550 - while (count > 0) {
1552 - if (get_user(data, up++)) {
1553 - LEAVE(TRACE_ON,"collie_ct_s16");
1556 - *fp++ = (!COLLE_RECORDING) ? data : 0; /* Left Ch. */
1560 + used = count = (userCount < frameLeft) ? userCount : frameLeft;
1562 + while (count > 0) {
1565 + if (get_user(data, up++)) {
1569 - short *up = (short *) userPtr;
1570 - while (count > 0) {
1573 - if (get_user(data, up++)) {
1574 - LEAVE(TRACE_ON,"collie_ct_s16");
1577 - if (get_user(temp, up++)) {
1578 - LEAVE(TRACE_ON,"collie_ct_s16");
1581 - if (!COLLE_RECORDING) {
1582 - *fp++ = data; /* Left Ch. */
1583 - *fp++ = temp; /* Right Ch. */
1586 - data += (temp >> 1);
1587 - *fp++ = 0; /* Left Ch. */
1588 - *fp++ = data; /* Right Ch. */
1591 + if (!collie_recording) *fp++ = data;
1594 + if (get_user(data, up++)) {
1601 *frameUsed += used * 4;
1602 - LEAVE(TRACE_ON,"collie_ct_s16");
1603 - return stereo? used * 4: used * 2;
1607 -static ssize_t collie_ct_u16(const u_char *userPtr, size_t userCount,
1608 - u_char frame[], ssize_t *frameUsed,
1609 - ssize_t frameLeft)
1611 - ssize_t count, used;
1612 - int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
1613 - int stereo = sound.soft.stereo;
1614 - short *fp = (short *) &frame[*frameUsed];
1615 - short *up = (short *) userPtr;
1616 +/*** HARDWARE dependent stuff *********************************************************/
1618 - ENTER(TRACE_ON,"collie_ct_u16");
1620 - userCount >>= (stereo? 2: 1);
1621 - used = count = min(userCount, frameLeft);
1622 - if (!COLLE_RECORDING) {
1623 - while (count > 0) {
1626 - if (get_user(data, up++)) {
1627 - LEAVE(TRACE_ON,"collie_ct_u16");
1631 - *fp++ = data; /* Left Ch. */
1633 - if (get_user(temp, up++)) {
1634 - LEAVE(TRACE_ON,"collie_ct_u16");
1641 - *fp++ = data; /* Right Ch. */
1644 +static inline void Collie_DAC_sendbit(int bit_data)
1646 + if (bit_data & 1) {
1647 + LCM_GPO |= (LCM_GPIO_DAC_SDATA);
1649 - while (count > 0) {
1653 - if (get_user(data, up++)) {
1654 - LEAVE(TRACE_ON,"collie_ct_u16");
1658 - ave = data; /* Left Ch. */
1660 - if (get_user(temp, up++)) {
1661 - LEAVE(TRACE_ON,"collie_ct_u16");
1670 - *fp++ = 0; /* Left Ch. */
1671 - *fp++ = ave; /* Right Ch. */
1674 + LCM_GPO &= ~(LCM_GPIO_DAC_SDATA);
1676 - *frameUsed += used * 4;
1677 - LEAVE(TRACE_ON,"collie_ct_u16");
1678 - return stereo? used * 4: used * 2;
1681 -static TRANS transCollie = {
1682 - collie_ct_law, collie_ct_law, collie_ct_s8, collie_ct_u8,
1683 - collie_ct_s16, collie_ct_u16, collie_ct_s16, collie_ct_u16
1686 + LCM_GPO |= (LCM_GPIO_DAC_SCK);
1688 -/*** Low level stuff *********************************************************/
1690 + LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
1692 + LCM_GPO &= ~(LCM_GPIO_DAC_SDATA);
1696 -static void Collie_Set_Volume(int volume)
1697 +static void Collie_DAC_sendword(int data)
1699 - ENTER(TRACE_ON,"Collie_Set_Volume");
1701 - sound.volume_left = volume & 0xff;
1702 - if ( sound.volume_left > 100 ) sound.volume_left = 100;
1704 - collie_main_volume = sound.volume_left;
1706 - sound.volume_right = ( volume & 0xff00 >> 8);
1707 - if ( sound.volume_right > 100 ) sound.volume_right = 100;
1708 - LEAVE(TRACE_ON,"Collie_Set_Volume");
1711 - collie_buzzer_volume = sound.volume_right;
1712 +#if defined(CONFIG_COLLIE_PCM1741)
1714 + LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
1716 + LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
1720 + for (i = 0; i < 16; i++)
1721 + Collie_DAC_sendbit(data >> (15 - i));
1723 + LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
1726 -static int Collie_Get_Volume(void)
1728 - ENTER(TRACE_ON,"Collie_Get_Volume");
1729 - LEAVE(TRACE_ON,"Collie_Get_Volume");
1730 - return ( sound.volume_right << 8 | sound.volume_left );
1732 +#elif defined(CONFIG_COLLIE_PCM1717)
1734 + LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
1736 + LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
1738 + LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
1741 -static void wait_ms(int ten_ms)
1743 - ENTER(TRACE_ON,"wait_ms");
1744 - LEAVE(TRACE_ON,"wait_ms");
1745 - schedule_timeout(ten_ms);
1747 + for (i = 0; i < 16; i++)
1748 + Collie_DAC_sendbit(data >> (15 - i));
1750 -static inline void Collie_AMP_off(void)
1752 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
1753 - ENTER(TRACE_AMP,"Collie_AMP_off");
1754 -#if 0 /* OBSOLETED: power controled by only OP_SHDN */
1755 - /* Set up TC35143 GPIO I/O Direction (GPIO4 output mode) */
1756 - ucb1200_set_io_direction(TC35143_GPIO_AMP_ON,
1757 - TC35143_IODIR_OUTPUT);
1759 - ucb1200_set_io(TC35143_GPIO_AMP_ON,
1760 - TC35143_IODAT_LOW);
1761 - collie_amp_init = 0;
1763 - LEAVE(TRACE_AMP,"Collie_AMP_off");
1764 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
1767 -static inline void Collie_AMP_on(void)
1769 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
1770 - ENTER(TRACE_AMP,"Collie_AMP_on");
1771 -// if (!collie_amp_init) {
1772 - /* Set up TC35143 GPIO I/O Direction (GPIO4 output mode) */
1773 - ucb1200_set_io_direction(TC35143_GPIO_AMP_ON,
1774 - TC35143_IODIR_OUTPUT);
1776 - ucb1200_set_io(TC35143_GPIO_AMP_ON, TC35143_IODAT_HIGH);
1777 - SCP_REG_GPWR |= SCP_AMP_ON;
1778 - wait_ms(COLLIE_WAIT_AMP_ON);
1779 - collie_amp_init = 1;
1781 - LEAVE(TRACE_AMP,"Collie_AMP_on");
1782 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
1783 + LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
1785 + LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
1787 + LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
1792 -static inline void Collie_AMP_init(void)
1794 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
1795 - ENTER(TRACE_AMP,"Collie_AMP_init");
1797 - LEAVE(TRACE_AMP,"Collie_AMP_init");
1798 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
1801 static inline void Collie_DAC_off(void)
1803 - ENTER(TRACE_DAC,"Collie_DAC_off");
1804 - if (!COLLE_RECORDING) {
1806 - LCM_GPD &= ~(LCM_GPIO_DAC_ON); /* set up output */
1807 - LCM_GPO &= ~(LCM_GPIO_DAC_ON);
1809 - /* LoCoMo GPIO disable */
1810 - LCM_GPE &= ~(LCM_GPIO_DAC_ON);
1811 - collie_dac_init = 0;
1813 - LEAVE(TRACE_DAC,"Collie_DAC_off");
1815 + LCM_GPD &= ~(LCM_GPIO_DAC_ON); /* set up output */
1816 + LCM_GPO &= ~(LCM_GPIO_DAC_ON);
1817 + /* LoCoMo GPIO disable */
1818 + LCM_GPE &= ~(LCM_GPIO_DAC_ON);
1819 + collie_dac_init = 0;
1822 static inline void Collie_DAC_on(void)
1824 - ENTER(TRACE_DAC,"Collie_DAC_on");
1825 -// if (!collie_dac_init) {
1826 if (!(LCM_GPO & LCM_GPIO_DAC_ON)) {
1827 /* LoCoMo GPIO enable */
1828 LCM_GPE &= ~LCM_GPIO_DAC_ON;
1829 @@ -1049,24 +421,10 @@
1834 - LEAVE(TRACE_DAC,"Collie_DAC_on");
1837 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP */
1838 -static inline void Collie_DAC_delay_off(void)
1840 - ENTER(TRACE_DAC,"Collie_DAC_deleay_off");
1842 - SetDelay(DELAY_DAC_OFF);
1844 - LEAVE(TRACE_DAC,"Collie_DAC_delay_off");
1848 static inline void Collie_DAC_init(void)
1850 - ENTER(TRACE_DAC,"Collie_DAC_init");
1851 /* LoCoMo GPIO enable */
1853 ~(LCM_GPIO_DAC_SDATA | LCM_GPIO_DAC_SCK | LCM_GPIO_DAC_SLOAD);
1854 @@ -1075,7 +433,6 @@
1855 ~(LCM_GPIO_DAC_SDATA | LCM_GPIO_DAC_SCK | LCM_GPIO_DAC_SLOAD);
1857 #if defined(CONFIG_COLLIE_PCM1741)
1859 Collie_DAC_sendword(DAC_REG16_SetupData); /* register16 */
1860 Collie_DAC_sendword(DAC_REG17_SetupData); /* register17 */
1861 Collie_DAC_sendword(DAC_REG18_SetupData); /* register18 */
1862 @@ -1083,78 +440,53 @@
1863 Collie_DAC_sendword(DAC_REG20_SetupData); /* register20 */
1864 //// Collie_DAC_sendword(DAC_REG21_SetupData); /* register21 */
1865 Collie_DAC_sendword(DAC_REG22_SetupData); /* register22 */
1867 #elif defined(CONFIG_COLLIE_PCM1717)
1869 Collie_DAC_sendword(DAC_MODE0_SetupData); /* MODE0 */
1870 Collie_DAC_sendword(DAC_MODE1_SetupData); /* MODE1 */
1871 Collie_DAC_sendword(DAC_MODE2_SetupData); /* MODE2 */
1872 Collie_DAC_sendword(DAC_MODE3_SetupData); /* MODE3 */
1876 /* LoCoMo GPIO disable */
1878 ~(LCM_GPIO_DAC_SDATA | LCM_GPIO_DAC_SCK | LCM_GPIO_DAC_SLOAD);
1879 - LEAVE(TRACE_DAC,"Collie_DAC_init");
1882 static inline void Collie_soft_DAC_on(void)
1884 #if defined(CONFIG_COLLIE_PCM1741)
1885 - ENTER(TRACE_DAC, "Collie_soft_DAC_on");
1886 Collie_DAC_sendword(DAC_REG19_DACOn); /* register19 */
1887 - LEAVE(TRACE_DAC, "Collie_soft_DAC_on");
1888 #endif /* CONFIG_COLLIE_PCM1741 */
1891 static inline void Collie_soft_DAC_off(void)
1893 #if defined(CONFIG_COLLIE_PCM1741)
1894 - ENTER(TRACE_DAC, "Collie_soft_DAC_off");
1895 Collie_DAC_sendword(DAC_REG19_DACOff); /* register19 */
1896 - LEAVE(TRACE_DAC, "Collie_soft_DAC_off");
1897 -#endif /* CONFIG_COLLIE_PCM1741 */
1900 -static inline void Collie_soft_mute_init(void)
1902 -#if defined(CONFIG_COLLIE_PCM1741)
1903 - ENTER(TRACE_MUTE, "Collie_soft_mute_init");
1904 - Collie_DAC_sendword(DAC_REG18_MuteOn); /* register18 */
1905 - collie_soft_mute = 1;
1906 - LEAVE(TRACE_MUTE, "Collie_soft_mute_init");
1907 #endif /* CONFIG_COLLIE_PCM1741 */
1910 static inline void Collie_soft_mute_on(void)
1912 #if defined(CONFIG_COLLIE_PCM1741)
1913 - ENTER(TRACE_MUTE, "Collie_soft_mute_on");
1914 if (!collie_soft_mute) {
1915 Collie_DAC_sendword(DAC_REG18_MuteOn); /* register18 */
1916 collie_soft_mute = 1;
1918 - LEAVE(TRACE_MUTE, "Collie_soft_mute_on");
1919 #endif /* CONFIG_COLLIE_PCM1741 */
1922 static inline void Collie_soft_mute_off(void)
1924 #if defined(CONFIG_COLLIE_PCM1741)
1925 - ENTER(TRACE_MUTE, "Collie_soft_mute_off");
1926 if (collie_soft_mute) {
1927 Collie_DAC_sendword(DAC_REG18_MuteOff); /* register18 */
1928 collie_soft_mute = 0;
1930 - LEAVE(TRACE_MUTE, "Collie_soft_mute_off");
1931 #endif /* CONFIG_COLLIE_PCM1741 */
1934 static inline void Collie_hard_mute_init(void)
1936 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
1937 - ENTER(TRACE_MUTE, "Collie_hard_mute_init");
1938 SCP_REG_GPCR |= (SCP_GPCR_PA14 | SCP_GPCR_PA15);
1939 #ifdef HARD_MUTE_CTRL_DISABLE
1940 SCP_REG_GPWR |= (SCP_GPCR_PA14 | SCP_GPCR_PA15);
1941 @@ -1162,84 +494,107 @@
1942 SCP_REG_GPWR &= ~(SCP_GPCR_PA14 | SCP_GPCR_PA15);
1943 #endif /* HARD_MUTE_CTRL_DISABLE */
1944 collie_hard_mute = 1;
1945 -#if !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
1948 int time = jiffies + 5;
1949 while (jiffies <= time)
1953 - LEAVE(TRACE_MUTE, "Collie_hard_mute_init");
1954 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
1957 static inline void Collie_hard_mute_on(void)
1959 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
1960 #ifndef HARD_MUTE_CTRL_DISABLE
1961 - ENTER(TRACE_MUTE, "Collie_hard_mute_on");
1962 if (!collie_hard_mute) {
1963 SCP_REG_GPWR &= ~(SCP_GPCR_PA14 | SCP_GPCR_PA15);
1964 collie_hard_mute = 1;
1965 -#if !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
1967 int time = jiffies + 5;
1968 while (jiffies <= time)
1973 - LEAVE(TRACE_MUTE, "Collie_hard_mute_on");
1974 #endif /* HARD_MUTE_CTRL_DISABLE */
1975 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
1978 static inline void Collie_hard_mute_off(void)
1980 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
1981 #ifndef HARD_MUTE_CTRL_DISABLE
1982 - ENTER(TRACE_MUTE, "Collie_hard_mute_off");
1983 if (collie_hard_mute) {
1984 - if (!COLLE_RECORDING)
1985 SCP_REG_GPWR |= (SCP_GPCR_PA14 | SCP_GPCR_PA15);
1987 - SCP_REG_GPWR |= (SCP_GPCR_PA15);
1988 collie_hard_mute = 0;
1989 -#if !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
1992 for (i=0; i<=1000; i++) {
1998 - LEAVE(TRACE_MUTE, "Collie_hard_mute_off");
1999 #endif /* HARD_MUTE_CTRL_DISABLE */
2000 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
2003 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
2004 -static inline void Collie_hard_mute_delay_on(void)
2006 - ENTER(TRACE_MUTE, "Collie_hard_mute_delay_on");
2008 - SetDelay(DELAY_HARD_MUTE_ON);
2010 - LEAVE(TRACE_MUTE, "Collie_hard_mute_delay_on");
2014 -static inline void Collie_audio_clock_init(void)
2015 +static inline void Collie_hard_mute_left_on(void)
2017 +#ifndef HARD_MUTE_CTRL_DISABLE
2018 +// if (!collie_hard_mute) {
2019 + SCP_REG_GPWR &= ~(SCP_GPCR_PA14);
2021 + int time = jiffies + 5;
2022 + while (jiffies <= time)
2026 +#endif /* HARD_MUTE_CTRL_DISABLE */
2029 +static inline void Collie_hard_mute_left_off(void)
2031 +#ifndef HARD_MUTE_CTRL_DISABLE
2032 +// if (collie_hard_mute) {
2033 + SCP_REG_GPWR |= (SCP_GPCR_PA14);
2036 + for (i=0; i<=1000; i++) {
2041 +#endif /* HARD_MUTE_CTRL_DISABLE */
2045 +static int CollieGetSamp(void)
2047 + switch (sound.speed) {
2049 + return clock_set_data[7];
2051 + return clock_set_data[0];
2053 + return clock_set_data[1];
2055 + return clock_set_data[2];
2057 + return clock_set_data[3];
2059 + return clock_set_data[4];
2061 + return clock_set_data[5];
2063 + return clock_set_data[6];
2065 + printk("Collie sound: Illegal sound rate %d\n", sound.speed);
2066 + return clock_set_data[7];
2070 +static inline void Collie_audio_clock_init(void)
2072 - ENTER(TRACE_CLOCK, "Collie_audio_clock_init");
2074 - LEAVE(TRACE_CLOCK, "Collie_audio_clock_init");
2077 static inline void Collie_audio_clock_on(void)
2079 - ENTER(TRACE_CLOCK, "Collie_audio_clock_on");
2080 /* LoCoMo Audio clock on */
2081 LCM_ACC = CollieGetSamp();
2083 @@ -1248,263 +603,58 @@
2084 LCM_ACC |= LCM_ACC_XEN;
2086 LCM_ACC |= (LCM_ACC_MCLKEN | LCM_ACC_64FSEN);
2087 - LEAVE(TRACE_CLOCK, "Collie_audio_clock_on");
2090 static inline void Collie_audio_clock_off(void)
2092 - ENTER(TRACE_CLOCK, "Collie_audio_clock_off");
2093 /* LoCoMo Audio clock off */
2094 LCM_ACC &= ~(LCM_ACC_XEN | LCM_ACC_MCLKEN | LCM_ACC_64FSEN);
2096 LCM_ACC &= ~(LCM_ACC_XON);
2097 - LEAVE(TRACE_CLOCK, "Collie_audio_clock_off");
2100 -static inline void Collie_paif_init(void)
2102 - ENTER(TRACE_PAIF, "Collie_paif_init");
2103 - // LCM_PAIF = (LCM_PAIF_SCINV | LCM_PAIF_LRCRST);
2104 - LCM_PAIF = (LCM_PAIF_LRCRST);
2105 - LEAVE(TRACE_PAIF, "Collie_paif_init");
2108 static inline void Collie_paif_on(void)
2110 - ENTER(TRACE_PAIF, "Collie_paif_on");
2111 LCM_PAIF = (LCM_PAIF_SCINV | LCM_PAIF_LRCRST);
2112 LCM_PAIF &= ~(LCM_PAIF_LRCRST);
2113 LCM_PAIF |= (LCM_PAIF_SCEN | LCM_PAIF_LRCEN);
2114 - LEAVE(TRACE_PAIF, "Collie_paif_on");
2117 static inline void Collie_paif_off(void)
2119 - ENTER(TRACE_PAIF, "Collie_paif_off");
2120 - // LCM_PAIF = (LCM_PAIF_SCINV | LCM_PAIF_LRCRST);
2121 LCM_PAIF = (LCM_PAIF_LRCRST);
2122 - LEAVE(TRACE_PAIF, "Collie_paif_off");
2125 static inline void Collie_MIC_init(void)
2127 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
2128 - ENTER(TRACE_MIC, "Collie_MIC_init");
2129 /* MIC to GPIO 17 */
2130 /* alternate functions for the GPIOs */
2131 - GAFR &= ~( COLLIE_GPIO_MIC );
2133 + GAFR &= ~( COLLIE_GPIO_MIC );
2134 /* Set the direction: 17 output */
2135 GPDR |= ( COLLIE_GPIO_MIC );
2137 -#if defined(CONFIG_COLLIE_TR1)
2138 - /* Set pin level (Low) */
2139 - GPCR = ( COLLIE_GPIO_MIC );
2141 /* Set pin level (High) */
2142 GPSR = ( COLLIE_GPIO_MIC );
2144 - LEAVE(TRACE_MIC, "Collie_MIC_init");
2145 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
2148 static inline void Collie_MIC_on(void)
2150 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
2151 - ENTER(TRACE_MIC, "Collie_MIC_on");
2152 -#if defined(CONFIG_COLLIE_TR1)
2153 - GPSR = ( COLLIE_GPIO_MIC );
2155 GPCR = ( COLLIE_GPIO_MIC );
2157 - LEAVE(TRACE_MIC, "Collie_MIC_on");
2158 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
2161 static inline void Collie_MIC_off(void)
2163 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0)
2164 - ENTER(TRACE_MIC, "Collie_MIC_off");
2165 - if (!COLLE_RECORDING) {
2166 -#if defined(CONFIG_COLLIE_TR1)
2167 - GPCR = ( COLLIE_GPIO_MIC );
2169 - GPSR = ( COLLIE_GPIO_MIC );
2172 - LEAVE(TRACE_MIC, "Collie_MIC_off");
2173 -#endif /* !CONFIG_COLLIE_TS && !CONFIG_COLLIE_TR0 */
2176 -static inline void Collie_volume_init(void)
2178 - ENTER(TRACE_VOLUME, "Collie_volume_init");
2179 - m62332_senddata(0, M62332_EVR_CH);
2180 - collie_volume = 0;
2181 - LEAVE(TRACE_VOLUME, "Collie_volume_init");
2184 -static inline void Collie_volume_on(void)
2186 - ENTER(TRACE_VOLUME, "Collie_volume_on");
2187 - if (collie_volume != sound.volume_left) {
2188 - //Collie_hard_mute_on();
2189 - m62332_senddata(0xff * sound.volume_left / 100, M62332_EVR_CH);
2190 - //Collie_hard_mute_off();
2191 - collie_volume = sound.volume_left;
2193 - LEAVE(TRACE_VOLUME, "Collie_volume_on");
2196 -static inline void Collie_volume_off(void)
2198 - ENTER(TRACE_VOLUME, "Collie_volume_off");
2199 - if (collie_volume) {
2200 - //Collie_hard_mute_on();
2201 - m62332_senddata(0, M62332_EVR_CH);
2202 - //Collie_hard_mute_off();
2203 - collie_volume = 0;
2205 - LEAVE(TRACE_VOLUME, "Collie_volume_off");
2208 -#define VOL_THRES 40
2209 -static void Collie_volume_half_adjust(void)
2211 - int volume = collie_volume;
2212 - ENTER(TRACE_VOLUME, "Collie_volume_half_adjust");
2213 - if (collie_volume > sound.volume_left) {
2215 - if (collie_volume > VOL_THRES) {
2216 - if (sound.volume_left > VOL_THRES) {
2217 - volume = (collie_volume + sound.volume_left)/2;
2218 - if (volume == collie_volume) {
2219 - volume = sound.volume_left;
2222 - volume = (collie_volume + VOL_THRES)/2;
2223 - if (volume == collie_volume) {
2224 - volume = VOL_THRES;
2228 - /* we can pull down without noise */
2229 - volume = sound.volume_left;
2231 - } else if (collie_volume < sound.volume_left) {
2233 - if (sound.volume_left > VOL_THRES) {
2234 - if (collie_volume < VOL_THRES) {
2235 - /* we can pull up to VOL_THRES without noise */
2236 - volume = VOL_THRES;;
2238 - volume = (collie_volume + sound.volume_left)/2;
2239 - if (volume == collie_volume) {
2240 - volume = sound.volume_left;
2244 - /* we can pull up without noise */
2245 - volume = sound.volume_left;
2248 - if (collie_volume != volume) {
2249 - m62332_senddata(0xff * volume / 100, M62332_EVR_CH);
2250 - collie_volume = volume;
2252 - LEAVE(TRACE_VOLUME, "Collie_volume_half_adjust");
2255 -static void Collie_volume_half_off(void)
2259 - ENTER(TRACE_VOLUME, "Collie_volume_half_off");
2260 - while (0 < collie_volume) {
2261 - if (collie_volume <= VOL_THRES) {
2264 - if (collie_volume > delta) {
2265 - volume = collie_volume - delta;
2269 - if (volume && volume < VOL_THRES) {
2270 - volume = VOL_THRES;
2274 - m62332_senddata(0xff * volume / 100, M62332_EVR_CH);
2275 - collie_volume = volume;
2278 - LEAVE(TRACE_VOLUME, "Collie_volume_half_off");
2281 -static void Collie_OP_SHDN_on(void)
2283 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
2284 - ENTER(TRACE_OP_SHDN,"Collie_OP_SHDN_on");
2285 - if (!collie_op_shdn_on) {
2287 - Collie_volume_off();
2289 - /* OP_SHDN to GPIO 17 */
2290 - /* alternate functions for the GPIOs */
2291 - GAFR &= ~( COLLIE_GPIO_OPSHDN );
2293 - /* Set the direction: 17 output */
2294 - GPDR |= ( COLLIE_GPIO_OPSHDN );
2296 - /* Set pin level (high) */
2297 - GPSR |= ( COLLIE_GPIO_OPSHDN );
2300 - Collie_volume_on();
2302 - collie_op_shdn_on = 1;
2304 - LEAVE(TRACE_OP_SHDN,"Collie_OP_SHDN_on");
2305 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
2308 -static void Collie_OP_SHDN_off(void)
2310 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
2311 - ENTER(TRACE_OP_SHDN,"Collie_OP_SHDN_off");
2312 - /* OP_SHDN to GPIO 17 */
2313 - /* alternate functions for the GPIOs */
2314 - GAFR &= ~( COLLIE_GPIO_OPSHDN );
2316 - /* Set the direction: 17 output */
2317 - GPDR |= ( COLLIE_GPIO_OPSHDN );
2319 - /* Clear pin level (low) */
2320 - GPCR |= ( COLLIE_GPIO_OPSHDN );
2322 - collie_op_shdn_on = 0;
2323 - LEAVE(TRACE_OP_SHDN,"Collie_OP_SHDN_off");
2324 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
2325 + GPSR = ( COLLIE_GPIO_MIC );
2328 static inline void Collie_ssp_init(void)
2330 - ENTER(TRACE_SSP, "Collie_ssp_init");
2331 /* alternate functions for the GPIOs */
2332 /* SSP port to GPIO 10,12,13, 19 */
2333 GAFR |= ( GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK );
2334 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
2335 - /* SSP port to GPIO 11 */
2336 - GAFR |= GPIO_SSP_RXD;
2337 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
2339 /* Set the direction: 10, 12, 13 output; 19 input */
2340 GPDR |= ( GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM );
2341 GPDR &= ~( GPIO_SSP_CLK );
2342 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
2343 - /* Set the direction: 11 input */
2344 - GPDR &= ~( GPIO_SSP_RXD );
2345 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
2347 /* enable SSP pin swap */
2349 @@ -1516,400 +666,162 @@
2350 /* the SSP setting */
2351 Ser4SSCR0 = (SSCR0_DataSize(16) | SSCR0_TI | SSCR0_SerClkDiv(2));
2352 Ser4SSCR1 = (SSCR1_SClkIactL | SSCR1_SClk1P | SSCR1_ExtClk);
2354 - LEAVE(TRACE_SSP, "Collie_ssp_init");
2357 static inline void Collie_ssp_on(void)
2359 - ENTER(TRACE_SSP, "Collie_ssp_on");
2360 /* turn on the SSP */
2361 Ser4SSCR0 |= ( SSCR0_SSE );
2362 - LEAVE(TRACE_SSP, "Collie_ssp_on");
2365 static inline void Collie_ssp_off(void)
2367 - ENTER(TRACE_SSP, "Collie_ssp_off");
2368 /* turn off the SSP */
2369 Ser4SSCR0 &= ~( SSCR0_SSE );
2370 - LEAVE(TRACE_SSP, "Collie_ssp_off");
2373 -static inline void Collie_sound_hard_init(void)
2375 - ENTER(TRACE_ON, "Collie_sound_hard_init");
2376 - Collie_hard_mute_init();
2377 - Collie_audio_clock_init();
2378 - Collie_paif_init();
2379 - Collie_volume_init();
2380 - Collie_ssp_init();
2381 - Collie_MIC_init();
2383 - Collie_FS8KLPF_start();
2384 - LEAVE(TRACE_ON, "Collie_sound_hard_init");
2387 -static inline void Collie_sound_hard_term(void)
2389 - ENTER(TRACE_ON, "Collie_sound_hard_term");
2390 -#ifdef DAC_OFF_WITH_DEVICE_OFF
2394 - LEAVE(TRACE_ON, "Collie_sound_hard_term");
2397 -static void Collie_FS8KLPF_start(void)
2399 -#if defined(CONFIG_COLLIE_TS) || defined(CONFIG_COLLIE_TR0)
2400 - ENTER(TRACE_ON,"Collie_FS8KLPF_start");
2401 - /* Set up TC35143 GPIO I/O Direction (GPIO5 output mode) */
2402 - ucb1200_set_io_direction(TC35143_GPIO_FS8KLPF,
2403 - TC35143_IODIR_OUTPUT);
2404 - /* Set up TC35143 GPIO 5 (set LOW) */
2405 - ucb1200_set_io(TC35143_GPIO_FS8KLPF, TC35143_IODAT_LOW);
2406 - LEAVE(TRACE_ON,"Collie_FS8KLPF_start");
2407 -#endif /* CONFIG_COLLIE_TS || CONFIG_COLLIE_TR0 */
2412 -static void Collie_FS8KLPF_stop(void)
2414 - /* Set up TC35143 GPIO I/O Direction (GPIO5 output mode) */
2415 - ucb1200_set_io_direction(TC35143_GPIO_FS8KLPF,
2416 - TC35143_IODIR_OUTPUT);
2417 - /* Set up TC35143 GPIO 5 (set LOW) */
2418 - ucb1200_set_io(TC35143_GPIO_FS8KLPF, TC35143_IODAT_HIGH);
2421 -static void Collie_clock_stop(void)
2423 - /* LoCoMo PCM audio interface */
2424 - Collie_paif_off();
2426 - /* LoCoMo audio clock off */
2427 - Collie_audio_clock_off();
2432 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
2433 -static unsigned long in_timehandle = 0;
2434 -static struct timer_list timer;
2436 -static void collieDoDelayedSilence(void)
2438 - ENTER(TRACE_ON,"collieDoDelayedSilence");
2440 - if(isDelayed(DELAY_HARD_MUTE_ON)) {
2441 - Collie_hard_mute_on();
2443 - if(isDelayed(DELAY_DAC_OFF)) {
2448 - LEAVE(TRACE_ON,"colliDoDelayedSilence");
2451 -static void collieDelayedSilence(void)
2453 - ENTER(TRACE_ON,"collieDelayedSilence");
2455 - sleep_on(&delay_off);
2456 - collieDoDelayedSilence();
2458 - LEAVE(TRACE_ON,"collieDelayedSilence");
2461 -static void collieStartDelayedSilence(unsigned long data)
2463 - ENTER(TRACE_ON,"collieStartDelayedSilence");
2464 - in_timehandle = 0;
2465 - wake_up(&delay_off);
2466 - LEAVE(TRACE_ON,"collieStartDelayedSilence");
2469 -static void collieTriggerDelayedSilence(void)
2471 - ENTER(TRACE_ON,"collieTriggerDelayedSilence");
2472 - in_timehandle = 1;
2473 - init_timer(&timer);
2474 - timer.function = collieStartDelayedSilence;
2475 - timer.expires = jiffies + 5*100;
2476 - add_timer(&timer);
2477 - LEAVE(TRACE_ON,"collieTriggerDelayedSilence");
2480 -static void collieCancelDelayedSilence(void)
2482 - ENTER(TRACE_ON,"collieCancelDelayedSilence");
2486 - if (in_timehandle) {
2487 - del_timer(&timer);
2488 - in_timehandle = 0;
2490 - LEAVE(TRACE_ON,"collieCancelDelayedSilence");
2494 -static void Collie_disable_sound(void)
2496 - ENTER(TRACE_ON,"Collie_disable_sound");
2497 - sa1100_dma_stop(COLLIE_SOUND_DMA_CHANNEL);
2498 - sa1100_dma_flush_all(COLLIE_SOUND_DMA_CHANNEL);
2499 -#ifndef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.18 */
2500 - Collie_volume_half_off();
2501 - Collie_hard_mute_on();
2502 - Collie_soft_mute_on();
2506 - /* Collie_clock_stop(); */
2508 - LEAVE(TRACE_ON,"Collie_disable_sound");
2511 -static void CollieSilence(void)
2513 - ENTER(TRACE_ON,"CollieSilence");
2514 - /* Disable sound & DMA */
2515 - Collie_disable_sound();
2517 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.18 */
2518 - Collie_volume_half_off();
2519 - Collie_hard_mute_delay_on();
2520 - Collie_soft_mute_on();
2524 - /* Collie_clock_stop(); */
2527 -#if 0 /* H.Hayami SHARP 2001.12.18 */
2528 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0) && \
2529 - !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
2530 - Collie_volume_off();
2533 - Collie_OP_SHDN_off();
2534 - Collie_soft_DAC_off();
2535 - Collie_paif_off();
2536 - Collie_audio_clock_off();
2538 - //Collie_MIC_on();
2540 -#ifndef DAC_OFF_WITH_DEVICE_OFF
2542 -#ifdef TRY_DELAY_OFF /* H.Hayami 2001.12.15 */
2543 - Collie_DAC_delay_off();
2547 -#endif /* end DAC_OFF_WITH_DEVICE_OFF */
2552 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.18 */
2553 - collieTriggerDelayedSilence();
2555 - LEAVE(TRACE_ON,"CollieSilence");
2558 -static int CollieGetSamp(void)
2560 - ENTER(TRACE_ON,"CollieGetSamp");
2561 - switch (sound.soft.speed) {
2563 - LEAVE(TRACE_ON,"CollieGetSamp");
2564 - return clock_set_data[7];
2566 - LEAVE(TRACE_ON,"CollieGetSamp");
2567 - return clock_set_data[0];
2569 - LEAVE(TRACE_ON,"CollieGetSamp");
2570 - return clock_set_data[1];
2572 - LEAVE(TRACE_ON,"CollieGetSamp");
2573 - return clock_set_data[2];
2575 - LEAVE(TRACE_ON,"CollieGetSamp");
2576 - return clock_set_data[3];
2578 - LEAVE(TRACE_ON,"CollieGetSamp");
2579 - return clock_set_data[4];
2581 - LEAVE(TRACE_ON,"CollieGetSamp");
2582 - return clock_set_data[5];
2584 - LEAVE(TRACE_ON,"CollieGetSamp");
2585 - return clock_set_data[6];
2587 - printk("Collie sound: Illegal sound rate %d\n", sound.soft.speed);
2588 - LEAVE(TRACE_ON,"CollieGetSamp");
2589 - return clock_set_data[7];
2593 -static inline void Collie_DAC_sendbit(int bit_data)
2595 - ENTER(TRACE_SENDDATA,"Collie_DAC_sendbit");
2596 - if (bit_data & 1) {
2597 - LCM_GPO |= (LCM_GPIO_DAC_SDATA);
2599 - LCM_GPO &= ~(LCM_GPIO_DAC_SDATA);
2603 - LCM_GPO |= (LCM_GPIO_DAC_SCK);
2606 - LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
2608 - LCM_GPO &= ~(LCM_GPIO_DAC_SDATA);
2610 - LEAVE(TRACE_SENDDATA,"Collie_DAC_sendbit");
2613 -static void Collie_DAC_sendword(int data)
2617 - ENTER(TRACE_SENDDATA,"Collie_DAC_sendword");
2618 -#if defined(CONFIG_COLLIE_PCM1741)
2620 - LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
2622 - LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
2625 - for (i = 0; i < 16; i++)
2626 - Collie_DAC_sendbit(data >> (15 - i));
2628 - LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
2631 -#elif defined(CONFIG_COLLIE_PCM1717)
2633 - LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
2635 - LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
2637 - LCM_GPO &= ~(LCM_GPIO_DAC_SCK);
2640 - for (i = 0; i < 16; i++)
2641 - Collie_DAC_sendbit(data >> (15 - i));
2643 - LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
2645 - LCM_GPO |= (LCM_GPIO_DAC_SLOAD);
2647 - LCM_GPO &= ~(LCM_GPIO_DAC_SLOAD);
2651 - LEAVE(TRACE_SENDDATA,"Collie_DAC_sendword");
2655 -Collie_audio_power_on(void)
2657 +static inline void Collie_sound_hard_init(void)
2660 + Collie_hard_mute_init();
2661 + Collie_audio_clock_init();
2662 + Collie_paif_off();
2663 + Collie_volume_init();
2664 + Collie_ssp_init();
2665 + Collie_MIC_init();
2666 + Collie_soft_mute_on();
2670 - ENTER(TRACE_ON,"Collie_audio_power_on");
2671 +void Collie_recording_on(void)
2673 + collie_recording=1;
2677 + Collie_hard_mute_left_on();
2681 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
2682 - collieCancelDelayedSilence();
2684 +void Collie_recording_off(void)
2686 + collie_recording=0;
2691 + Collie_hard_mute_left_off();
2694 +static void Collie_audio_power_on(void)
2697 collie_amp_init = 0;
2700 - Collie_OP_SHDN_off();
2711 - /* LoCoMo Audio clock */
2712 - Collie_audio_clock_off();
2713 + if (!collie_recording)
2716 + Collie_audio_clock_off(); /* LoCoMo Audio clock */
2717 Collie_audio_clock_on();
2719 - /* LoCoMo PCM audio interface */
2722 + Collie_paif_on(); /* LoCoMo PCM audio interface */
2728 Collie_soft_DAC_on();
2729 - Collie_soft_mute_init();
2730 + Collie_soft_mute_off();
2731 + Collie_hard_mute_off();
2732 + if (collie_recording)
2733 + Collie_hard_mute_left_on();
2734 + Collie_volume_set(sound.volume);
2737 - sound.hard = sound.soft;
2738 +static void Collie_audio_power_off(void){ /* Disable sound only */
2739 + Collie_volume_set(0);
2740 + Collie_hard_mute_on();
2741 + Collie_soft_mute_on();
2743 + Collie_soft_DAC_off();
2744 + Collie_paif_off();
2745 + Collie_audio_clock_off();
2746 + if (!collie_recording)
2751 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0) && \
2752 - !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
2754 - Collie_volume_half_adjust();
2757 - for (i=0; i<10*1000; i++) {
2760 +static inline void Collie_volume_init(void)
2762 + m62332_senddata(0, M62332_EVR_CH);
2763 + collie_volume = 0;
2766 +#define VOL_THRES 10
2768 +static void Collie_volume_set(int dest)
2771 + while (dest != collie_volume) {
2772 + chn = dest-collie_volume;
2773 + if (chn>VOL_THRES)
2775 + else if (chn<-VOL_THRES)
2778 + collie_volume += chn;
2779 + m62332_senddata(0xff * collie_volume / 100, M62332_EVR_CH);
2786 - Collie_soft_mute_off();
2787 - Collie_hard_mute_off();
2788 +static int sound_set_speed(int speed)
2791 + return(sound.speed);
2794 + if (speed<8000) sound.speed=8000;
2795 + else if (speed<=11025) sound.speed=11025;
2796 + else if (speed<=16000) sound.speed=16000;
2797 + else if (speed<=22050) sound.speed=22050;
2798 + else if (speed<=24000) sound.speed=24000;
2799 + else if (speed<=32000) sound.speed=32000;
2800 + else if (speed<=44100) sound.speed=44100;
2801 + else sound.speed=48000;
2803 + /* LoCoMo Audio clock */
2804 + Collie_audio_clock_off();
2805 + Collie_audio_clock_on();
2806 + return(sound.speed);
2809 - LEAVE(TRACE_ON,"Collie_audio_power_on");
2810 +/*** Mid level stuff *********************************************************/
2812 +static void Collie_Set_Volume(int volume)
2814 + sound.volume = volume & 0xff;
2815 + sound.volume += ( volume & 0xff00 >> 8);
2816 + sound.volume >>=1;
2817 + if (sound.volume>100) sound.volume=100;
2820 -static void CollieInit(void)
2821 +static int Collie_Get_Volume(void)
2823 - ENTER(TRACE_ON,"CollieInit");
2824 - sound.hard = sound.soft;
2825 - LEAVE(TRACE_ON,"CollieInit");
2826 + return ( sound.volume << 8 | sound.volume );
2830 static void Collie_sq_interrupt(void* id, int size)
2832 audio_buf_t *b = (audio_buf_t *) id;
2833 - ENTER(TRACE_INTERRUPT,"Collie_sq_interrupt");
2835 -printk("Collie_sq_interrupt: Start\n");
2839 * Current buffer is sent: wake up any process waiting for it.
2841 - ENTER(TRACE_SEM,"up sem");
2843 - LEAVE(TRACE_SEM,"up sem");
2845 -printk("Collie_sq_interrupt: up End\n");
2847 /* And any process polling on write. */
2848 - ENTER(TRACE_SEM,"up wait");
2849 - wake_up(&b->sem.wait);
2850 - LEAVE(TRACE_SEM,"up wait");
2852 -printk("Collie_sq_interrupt: wake_up End\n");
2854 + wake_up_interruptible(&b->sem.wait);
2855 + /* And indicate which was the last buffer sent */
2857 DPRINTK("Collie_sq_interrupt \n");
2858 - LEAVE(TRACE_INTERRUPT,"Collie_sq_interrupt");
2862 @@ -1917,191 +829,52 @@
2866 - ENTER(TRACE_ON,"CollieIrqInit");
2867 err = sa1100_request_dma(&collie_dmasound_irq, "dmasound",
2870 - LEAVE(TRACE_ON,"CollieIrqInit");
2873 - /* printk("collie_dmasound_irq=%d\n", collie_dmasound_irq); */
2874 + printk("collie_dmasound_irq=%d\n", collie_dmasound_irq);
2876 sa1100_dma_set_callback(collie_dmasound_irq,
2877 (dma_callback_t)Collie_sq_interrupt);
2880 - /* Disable sound & DMA */
2881 - Collie_disable_sound();
2883 - LEAVE(TRACE_ON,"CollieIrqInit");
2884 + sa1100_dma_stop(COLLIE_SOUND_DMA_CHANNEL);
2885 + sa1100_dma_flush_all(COLLIE_SOUND_DMA_CHANNEL);
2886 + Collie_audio_power_off();
2892 -static void CollieIrqCleanUp(void)
2894 - ENTER(TRACE_ON,"CollieIrqCleanUp");
2895 - /* Disable sound & DMA */
2896 - Collie_disable_sound();
2898 - /* release the interrupt */
2899 - free_irq(IRQ_DMA, Collie_sq_interrupt);
2900 - LEAVE(TRACE_ON,"CollieIrqCleanUp");
2902 -#endif /* MODULE */
2905 static int CollieSetFormat(int format)
2909 - ENTER(TRACE_ON,"CollieSetFormat");
2910 - /* Falcon sound DMA supports 8bit and 16bit modes */
2914 - LEAVE(TRACE_ON,"CollieSetFormat");
2915 - return(sound.soft.format);
2918 - ct_func = sound.trans->ct_ulaw;
2922 - ct_func = sound.trans->ct_alaw;
2926 - ct_func = sound.trans->ct_s8;
2930 - ct_func = sound.trans->ct_u8;
2934 - ct_func = sound.trans->ct_s16be;
2938 - ct_func = sound.trans->ct_u16be;
2942 - ct_func = sound.trans->ct_s16le;
2945 + return(sound.format);
2946 + default: /* This is the only one supported by the hardware it seems */
2948 - ct_func = sound.trans->ct_u16le;
2950 - default: /* :-) */
2955 - sound.soft.format = format;
2956 - sound.soft.size = size;
2957 - if (sound.minDev == SND_DEV_DSP) {
2958 - sound.dsp.format = format;
2959 - sound.dsp.size = sound.soft.size;
2960 + format = AFMT_S16_LE;
2962 + sound.format = format;
2963 + sound.size = size;
2965 - LEAVE(TRACE_ON,"CollieSetFormat");
2969 -/*** Machine definitions *****************************************************/
2971 -static MACHINE machCollie = {
2972 - DMASND_COLLIE, // int type
2973 - NULL, // void *dma_alloc(uint, int)
2974 - NULL, // void dma_free(void *, uint)
2975 - CollieIrqInit, // void irqinit(void)
2977 - CollieIrqCleanUp, // void irqcleanup(void)
2978 -#endif /* MODULE */
2979 - CollieInit, // void init(void)
2980 - CollieSilence, // void silence(void)
2981 - CollieSetFormat, // int setFormat(int)
2982 - NULL, // int setVolume(int)
2983 - NULL, // int setBass(int)
2984 - NULL, // int setTreble(int)
2985 - NULL, // int setGain(int)
2986 - NULL // void play(void)
2990 -/*** Mid level stuff *********************************************************/
2993 -static void sound_silence(void)
2995 - ENTER(TRACE_ON,"sound_silence");
2996 - /* update hardware settings one more */
2997 - //(*sound.mach.init)();
2998 - (*sound.mach.silence)();
2999 - LEAVE(TRACE_ON,"sound_silence");
3004 -static void sound_init(void)
3006 - ENTER(TRACE_ON,"sound_init");
3007 - (*sound.mach.init)();
3008 - LEAVE(TRACE_ON,"sound_init");
3012 -static int sound_set_format(int format)
3014 - ENTER(TRACE_ON,"sound_set_format");
3015 - LEAVE(TRACE_ON,"sound_set_format");
3016 - return(*sound.mach.setFormat)(format);
3020 -static int sound_set_speed(int speed)
3022 - ENTER(TRACE_ON,"sound_set_speed");
3024 - LEAVE(TRACE_ON,"sound_set_speed");
3025 - return(sound.soft.speed);
3028 - sound.soft.speed = speed;
3029 - (*sound.mach.init)();
3030 - if (sound.minDev == SND_DEV_DSP)
3031 - sound.dsp.speed = sound.soft.speed;
3033 - /* LoCoMo Audio clock */
3034 - Collie_audio_clock_off();
3035 - Collie_audio_clock_on();
3037 - LEAVE(TRACE_ON,"sound_set_speed");
3038 - return(sound.soft.speed);
3042 static int sound_set_stereo(int stereo)
3044 - ENTER(TRACE_ON,"sound_set_stereo");
3045 +/* Only stereo is supported by hardware */
3047 - LEAVE(TRACE_ON,"sound_set_stereo");
3048 - return(sound.soft.stereo);
3049 + return(sound.stereo);
3054 - stereo = !!stereo; /* should be 0 or 1 now */
3056 - sound.soft.stereo = stereo;
3057 - if (sound.minDev == SND_DEV_DSP)
3058 - sound.dsp.stereo = stereo;
3059 - //(*sound.mach.init)();
3061 - LEAVE(TRACE_ON,"sound_set_stereo");
3064 +/* Higher level stuff ************************************************/
3067 * /dev/mixer abstraction
3068 @@ -2109,20 +882,15 @@
3070 static int mixer_open(struct inode *inode, struct file *file)
3072 - ENTER(TRACE_ON,"mixer_open");
3075 - LEAVE(TRACE_ON,"mixer_open");
3080 static int mixer_release(struct inode *inode, struct file *file)
3082 - ENTER(TRACE_ON,"mixer_release");
3085 - LEAVE(TRACE_ON,"mixer_release");
3089 @@ -2132,58 +900,37 @@
3093 - ENTER(TRACE_ON,"mixer_ioctl");
3094 - switch (sound.mach.type) {
3095 - case DMASND_COLLIE:
3098 - case SOUND_MIXER_READ_DEVMASK:
3099 - LEAVE(TRACE_ON,"mixer_ioctl");
3100 - return IOCTL_OUT(arg, SOUND_MASK_VOLUME );
3101 - case SOUND_MIXER_READ_RECMASK:
3102 - LEAVE(TRACE_ON,"mixer_ioctl");
3103 - return IOCTL_OUT(arg, 0);
3104 - case SOUND_MIXER_READ_STEREODEVS:
3105 - LEAVE(TRACE_ON,"mixer_ioctl");
3106 - return IOCTL_OUT(arg, SOUND_MASK_VOLUME);
3107 - case SOUND_MIXER_READ_CAPS:
3108 - LEAVE(TRACE_ON,"mixer_ioctl");
3109 - return IOCTL_OUT(arg, 0);
3111 - case SOUND_MIXER_WRITE_VOLUME:
3112 - IOCTL_IN(arg, data);
3113 - Collie_Set_Volume(data);
3114 - case SOUND_MIXER_READ_VOLUME:
3115 - LEAVE(TRACE_ON,"mixer_ioctl");
3116 - return IOCTL_OUT(arg, Collie_Get_Volume());
3118 - case SOUND_MIXER_READ_TREBLE:
3119 - LEAVE(TRACE_ON,"mixer_ioctl");
3120 - return IOCTL_OUT(arg, 0);
3121 - case SOUND_MIXER_WRITE_TREBLE:
3122 - LEAVE(TRACE_ON,"mixer_ioctl");
3123 - return IOCTL_OUT(arg, 0);
3125 - case SOUND_MIXER_WRITE_MIC:
3126 - LEAVE(TRACE_ON,"mixer_ioctl");
3127 - return IOCTL_OUT(arg, 0);
3128 - case SOUND_MIXER_READ_MIC:
3129 - LEAVE(TRACE_ON,"mixer_ioctl");
3130 - return IOCTL_OUT(arg, 0);
3132 - case SOUND_MIXER_READ_SPEAKER:
3133 - LEAVE(TRACE_ON,"mixer_ioctl");
3134 - return IOCTL_OUT(arg, 0);
3135 - case SOUND_MIXER_WRITE_SPEAKER:
3136 - LEAVE(TRACE_ON,"mixer_ioctl");
3137 - return IOCTL_OUT(arg, 0);
3142 - LEAVE(TRACE_ON,"mixer_ioctl");
3144 + case SOUND_MIXER_READ_DEVMASK:
3145 + return IOCTL_OUT(arg, headphone ? SOUND_MASK_VOLUME : 0 );
3146 + case SOUND_MIXER_READ_RECMASK:
3147 + return IOCTL_OUT(arg, 0);
3148 + case SOUND_MIXER_READ_STEREODEVS:
3149 + return IOCTL_OUT(arg, headphone ? SOUND_MASK_VOLUME : 0 );
3150 + case SOUND_MIXER_READ_CAPS:
3151 + return IOCTL_OUT(arg, 0);
3153 + case SOUND_MIXER_WRITE_VOLUME:
3154 + IOCTL_IN(arg, data);
3155 + Collie_Set_Volume(data);
3156 + case SOUND_MIXER_READ_VOLUME:
3157 + return IOCTL_OUT(arg, Collie_Get_Volume());
3158 + case SOUND_MIXER_READ_TREBLE:
3159 + return IOCTL_OUT(arg, 0);
3160 + case SOUND_MIXER_WRITE_TREBLE:
3161 + return IOCTL_OUT(arg, 0);
3163 + case SOUND_MIXER_WRITE_MIC:
3164 + return IOCTL_OUT(arg, 0);
3165 + case SOUND_MIXER_READ_MIC:
3166 + return IOCTL_OUT(arg, 0);
3168 + case SOUND_MIXER_READ_SPEAKER:
3169 + return IOCTL_OUT(arg, 0);
3170 + case SOUND_MIXER_WRITE_SPEAKER:
3171 + return IOCTL_OUT(arg, 0);
3178 @@ -2198,32 +945,13 @@
3180 static void __init mixer_init(void)
3185 - ENTER(TRACE_ON,"mixer_init");
3186 mixer_unit = register_sound_mixer(&mixer_fops, -1);
3187 if (mixer_unit < 0) {
3188 - LEAVE(TRACE_ON,"mixer_init");
3195 - switch (sound.mach.type) {
3196 - case DMASND_COLLIE:
3197 - // sound.volume_left = 0x3c;
3198 - // sound.volume_right = 0x3c;
3199 - sound.volume_left = 80;
3200 - sound.volume_right = 80;
3201 - collie_main_volume = sound.volume_left;
3205 - // printk("mixer_init : ret \n");
3207 - LEAVE(TRACE_ON,"mixer_init");
3208 + sound.volume = 80;
3209 + Collie_volume_set(sound.volume);
3212 /* This function allocates the buffer structure array and buffer data space
3213 @@ -2237,11 +965,9 @@
3215 dma_addr_t dmaphys = 0;
3217 - ENTER(TRACE_ON,"sq_allocate_buffers");
3218 DPRINTK("sq_allocate_buffers\n");
3221 - LEAVE(TRACE_ON,"sq_allocate_buffers");
3225 @@ -2279,10 +1005,8 @@
3228 b->dma_addr = dmaphys;
3230 sema_init(&b->sem, 1);
3231 - DPRINTK("buf %d: start %p dma %p\n", frag, b->start,
3234 dmabuf += s->fragsize;
3235 dmaphys += s->fragsize;
3236 dmasize -= s->fragsize;
3237 @@ -2291,13 +1015,12 @@
3239 s->buf = &s->buffers[0];
3241 - LEAVE(TRACE_ON,"sq_allocate_buffers");
3246 printk("sound driver : unable to allocate audio memory\n ");
3247 sq_release_buffers(s);
3248 - LEAVE(TRACE_ON,"sq_allocate_buffers");
3252 @@ -2307,7 +1030,6 @@
3254 static void sq_release_buffers(audio_stream_t * s)
3256 - ENTER(TRACE_ON,"sq_release_buffers");
3257 DPRINTK("sq_release_buffers\n");
3259 /* ensure DMA won't run anymore */
3260 @@ -2328,7 +1050,6 @@
3264 - LEAVE(TRACE_ON,"sq_release_buffers");
3267 static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
3268 @@ -2339,27 +1060,20 @@
3270 ssize_t uUsed, bUsed, bLeft, ret = 0;
3272 - ENTER(TRACE_WRITE,"sq_write");
3273 DPRINTK("sq_write: uLeft=%d\n", uLeft);
3276 - Collie_OP_SHDN_on();
3278 switch (file->f_flags & O_ACCMODE) {
3283 - LEAVE(TRACE_WRITE,"sq_write1");
3287 if (!s->buffers && sq_allocate_buffers(s)) {
3288 - LEAVE(TRACE_WRITE,"sq_write2");
3293 if (collie_resume == 1) {
3296 @@ -2367,10 +1081,9 @@
3302 /* Auto Power off cancel */
3303 - autoPowerCancel = 0;
3304 +// autoPowerCancel = 0;
3308 @@ -2379,41 +1092,30 @@
3309 /* Wait for a buffer to become free */
3310 if (file->f_flags & O_NONBLOCK) {
3312 - ENTER(TRACE_SEM,"down_try sem");
3313 if (down_trylock(&b->sem)) {
3314 - LEAVE(TRACE_SEM,"down_try1 sem");
3317 - LEAVE(TRACE_SEM,"down_try2 sem");
3320 - ENTER(TRACE_SEM,"down_int sem");
3321 - //printk("### 0x%08x:%d\n", &b->sem.count, atomic_read(&b->sem.count));
3322 if (down_interruptible(&b->sem)) {
3323 - LEAVE(TRACE_SEM,"down_int1 sem");
3326 - LEAVE(TRACE_SEM,"down_int2 sem");
3329 dest = b->start + b->size;
3331 bLeft = s->fragsize - b->size;
3334 - uUsed = ct_func(src, uLeft, dest, &bUsed, bLeft);
3335 + if (collie_ct_s16) {
3336 + uUsed = collie_ct_s16(src, uLeft, dest, &bUsed, bLeft);
3337 cpu_cache_clean_invalidate_range((unsigned long)dest,
3338 (unsigned long)(dest+(audio_fragsize)), 0);
3340 - LEAVE(TRACE_WRITE,"sq_write3");
3345 - ENTER(TRACE_SEM,"up sem");
3347 - LEAVE(TRACE_SEM,"up sem");
3348 - LEAVE(TRACE_WRITE,"sq_write4");
3352 @@ -2421,9 +1123,7 @@
3355 if (b->size < s->fragsize) {
3356 - ENTER(TRACE_SEM,"up sem");
3358 - LEAVE(TRACE_SEM,"up sem");
3362 @@ -2431,7 +1131,7 @@
3363 sa1100_dma_queue_buffer(COLLIE_SOUND_DMA_CHANNEL,
3364 (void *) b, b->dma_addr, b->size);
3366 - Collie_volume_half_adjust();
3367 + Collie_volume_set(sound.volume);
3369 b->size = 0; /* indicate that the buffer has been sent */
3371 @@ -2440,7 +1140,6 @@
3372 if ((src - buffer0))
3373 ret = src - buffer0;
3374 DPRINTK("sq_write: return=%d\n", ret);
3375 - LEAVE(TRACE_WRITE,"sq_write0");
3379 @@ -2450,7 +1149,6 @@
3380 unsigned int mask = 0;
3383 - ENTER(TRACE_ON,"sq_poll");
3384 DPRINTK("sq_poll(): mode=%s%s\n",
3385 (file->f_mode & FMODE_READ) ? "r" : "",
3386 (file->f_mode & FMODE_WRITE) ? "w" : "");
3387 @@ -2458,12 +1156,9 @@
3388 if (file->f_mode & FMODE_WRITE) {
3389 if (!output_stream.buffers
3390 && sq_allocate_buffers(&output_stream)) {
3391 - LEAVE(TRACE_ON,"sq_poll");
3394 - ENTER(TRACE_SEM,"poll_wait wait");
3395 poll_wait(file, &output_stream.buf->sem.wait, wait);
3396 - LEAVE(TRACE_SEM,"poll_wait wait");
3399 if (file->f_mode & FMODE_WRITE) {
3400 @@ -2477,65 +1172,33 @@
3401 (mask & POLLIN) ? "r" : "",
3402 (mask & POLLOUT) ? "w" : "");
3404 - LEAVE(TRACE_ON,"sq_poll");
3408 static int sq_open(struct inode *inode, struct file *file)
3410 - ENTER(TRACE_ON,"sq_open");
3411 DPRINTK("sq_open\n");
3413 if (((file->f_flags & O_ACCMODE) == O_WRONLY)
3414 || ((file->f_flags & O_ACCMODE) == O_RDWR)) {
3416 - MOD_INC_USE_COUNT;
3417 - while(audio_wr_refcount) {
3418 - SLEEP(open_queue, ONE_SECOND);
3419 - if (SIGNAL_RECEIVED) {
3420 - MOD_DEC_USE_COUNT;
3421 - LEAVE(TRACE_ON,"sq_open");
3426 if (audio_wr_refcount) {
3427 DPRINTK(" sq_open EBUSY\n");
3428 - LEAVE(TRACE_ON,"sq_open");
3433 audio_wr_refcount++;
3435 DPRINTK(" sq_open EINVAL\n");
3436 - LEAVE(TRACE_ON,"sq_open");
3440 - if (audio_wr_refcount == 1) {
3441 - DPRINTK("cold\n");
3443 - audio_fragsize = AUDIO_FRAGSIZE_DEFAULT;
3444 - audio_nbfrags = AUDIO_NBFRAGS_DEFAULT;
3445 - sq_release_buffers(&output_stream);
3446 - sound.minDev = MINOR(inode->i_rdev) & 0x0f;
3447 - sound.soft = sound.dsp;
3448 - sound.hard = sound.dsp;
3450 - if ((MINOR(inode->i_rdev) & 0x0f) == SND_DEV_AUDIO) {
3451 - sound_set_speed(8000);
3452 - sound_set_stereo(0);
3453 - sound_set_format(AFMT_MU_LAW);
3455 - Collie_audio_power_on();
3459 - MOD_INC_USE_COUNT;
3461 - LEAVE(TRACE_ON,"sq_open");
3463 + audio_fragsize = AUDIO_FRAGSIZE_DEFAULT;
3464 + audio_nbfrags = AUDIO_NBFRAGS_DEFAULT;
3465 + sq_release_buffers(&output_stream);
3466 + output_stream.buf_idx=0;
3467 + Collie_audio_power_on();
3471 static int sq_fsync(struct file *filp, struct dentry *dentry)
3472 @@ -2543,11 +1206,9 @@
3473 audio_stream_t *s = &output_stream;
3474 audio_buf_t *b = s->buf;
3476 - ENTER(TRACE_ON,"sq_fsync");
3477 DPRINTK("sq_fsync\n");
3480 - LEAVE(TRACE_ON,"sq_fsync");
3484 @@ -2557,12 +1218,10 @@
3487 /* Auto Power off cancel */
3488 - autoPowerCancel = 0;
3489 +// autoPowerCancel = 0;
3492 - ENTER(TRACE_SEM,"down sem");
3494 - LEAVE(TRACE_SEM,"down sem");
3495 sa1100_dma_queue_buffer(COLLIE_SOUND_DMA_CHANNEL,
3496 (void *) b, b->dma_addr, b->size);
3498 @@ -2576,23 +1235,15 @@
3499 * - the buffer was already free thus nothing else to sync.
3501 b = s->buffers + ((s->nbfrags + s->buf_idx - 1) % s->nbfrags);
3502 - ENTER(TRACE_SEM,"down-int sem");
3503 if (down_interruptible(&b->sem)) {
3504 - LEAVE(TRACE_SEM,"down-int sem");
3505 - LEAVE(TRACE_ON,"sq_fsync");
3508 - LEAVE(TRACE_SEM,"down-int sem");
3509 - ENTER(TRACE_SEM,"up sem");
3511 - LEAVE(TRACE_SEM,"up sem");
3512 - LEAVE(TRACE_ON,"sq_fsync");
3516 static int sq_release(struct inode *inode, struct file *file)
3518 - ENTER(TRACE_ON,"sq_release");
3519 DPRINTK("sq_release\n");
3521 switch (file->f_flags & O_ACCMODE) {
3522 @@ -2606,24 +1257,12 @@
3525 if (!audio_wr_refcount) {
3526 - sound.soft = sound.dsp;
3527 - sound.hard = sound.dsp;
3529 - Collie_OP_SHDN_off();
3530 + sa1100_dma_stop(COLLIE_SOUND_DMA_CHANNEL);
3531 + sa1100_dma_flush_all(COLLIE_SOUND_DMA_CHANNEL);
3532 + Collie_audio_power_off();
3536 - switch (file->f_flags & O_ACCMODE) {
3539 - if (!audio_wr_refcount) {
3540 - WAKE_UP(open_queue);
3546 - LEAVE(TRACE_ON,"sq_release");
3550 @@ -2634,8 +1273,8 @@
3554 +// audio_buf_info abinfo;
3556 - ENTER(TRACE_ON,"sq_ioctl");
3558 case SNDCTL_DSP_RESET:
3559 switch (file->f_flags & O_ACCMODE) {
3560 @@ -2643,11 +1282,9 @@
3562 sq_release_buffers(&output_stream);
3564 - LEAVE(TRACE_ON,"sq_ioctl");
3566 case SNDCTL_DSP_POST:
3567 case SNDCTL_DSP_SYNC:
3568 - LEAVE(TRACE_ON,"sq_ioctl");
3569 return sq_fsync(file, file->f_dentry);
3571 /* ++TeSche: before changing any of these it's
3572 @@ -2656,59 +1293,34 @@
3573 case SNDCTL_DSP_SPEED:
3574 sq_fsync(file, file->f_dentry);
3575 IOCTL_IN(arg, data);
3576 - LEAVE(TRACE_ON,"sq_ioctl");
3577 return IOCTL_OUT(arg, sound_set_speed(data));
3578 case SNDCTL_DSP_STEREO:
3579 sq_fsync(file, file->f_dentry);
3580 IOCTL_IN(arg, data);
3581 - LEAVE(TRACE_ON,"sq_ioctl");
3582 return IOCTL_OUT(arg, sound_set_stereo(data));
3583 - case SOUND_PCM_WRITE_CHANNELS:
3584 + case SNDCTL_DSP_CHANNELS:
3585 sq_fsync(file, file->f_dentry);
3586 IOCTL_IN(arg, data);
3587 - LEAVE(TRACE_ON,"sq_ioctl");
3588 return IOCTL_OUT(arg, sound_set_stereo(data-1)+1);
3589 case SNDCTL_DSP_SETFMT:
3590 sq_fsync(file, file->f_dentry);
3591 IOCTL_IN(arg, data);
3592 - LEAVE(TRACE_ON,"sq_ioctl");
3593 - return IOCTL_OUT(arg, sound_set_format(data));
3594 + return IOCTL_OUT(arg, CollieSetFormat(data));
3595 case SNDCTL_DSP_GETFMTS:
3597 - if (sound.trans) {
3598 - if (sound.trans->ct_ulaw)
3599 - fmt |= AFMT_MU_LAW;
3600 - if (sound.trans->ct_alaw)
3601 - fmt |= AFMT_A_LAW;
3602 - if (sound.trans->ct_s8)
3604 - if (sound.trans->ct_u8)
3606 - if (sound.trans->ct_s16be)
3607 - fmt |= AFMT_S16_BE;
3608 - if (sound.trans->ct_u16be)
3609 - fmt |= AFMT_U16_BE;
3610 - if (sound.trans->ct_s16le)
3611 - fmt |= AFMT_S16_LE;
3612 - if (sound.trans->ct_u16le)
3613 - fmt |= AFMT_U16_LE;
3615 - LEAVE(TRACE_ON,"sq_ioctl");
3616 + fmt = AFMT_S16_LE;
3617 return IOCTL_OUT(arg, fmt);
3618 case SNDCTL_DSP_GETBLKSIZE:
3619 - LEAVE(TRACE_ON,"sq_ioctl");
3620 return IOCTL_OUT(arg, audio_fragsize);
3621 case SNDCTL_DSP_SUBDIVIDE:
3623 case SNDCTL_DSP_SETFRAGMENT:
3624 if (output_stream.buffers) {
3625 - LEAVE(TRACE_ON,"sq_ioctl");
3628 get_user(val, (long *) arg);
3629 audio_fragsize = 1 << (val & 0xFFFF);
3630 - if (audio_fragsize < 16)
3631 - audio_fragsize = 16;
3632 + if (audio_fragsize < 256)
3633 + audio_fragsize = 256;
3634 if (audio_fragsize > 16384)
3635 audio_fragsize = 16384;
3636 audio_nbfrags = (val >> 16) & 0x7FFF;
3637 @@ -2717,46 +1329,54 @@
3638 if (audio_nbfrags * audio_fragsize > 128 * 1024)
3639 audio_nbfrags = 128 * 1024 / audio_fragsize;
3640 if (sq_allocate_buffers(&output_stream)) {
3641 - LEAVE(TRACE_ON,"sq_ioctl");
3644 - LEAVE(TRACE_ON,"sq_ioctl");
3648 +/* case SNDCTL_DSP_GETOSPACE:
3649 + abinfo.fragsize = audio_fragsize;
3650 + abinfo.fragstotal = audio_nbfrags;
3651 + abinfo.fragments = lastsent-output_stream.buf_idx;
3652 + if (abinfo.fragments<0)
3653 + abinfo.fragments += abinfo.fragstotal;
3654 + abinfo.bytes = abinfo.fragments*abinfo.fragsize;
3655 + return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
3657 case SNDCTL_DSP_GETOSPACE:
3659 - audio_buf_info inf = { 0, };
3660 + audio_stream_t *s = &output_stream;
3661 + audio_buf_info *inf = (audio_buf_info *) arg;
3662 + int err = verify_area(VERIFY_WRITE, inf, sizeof(*inf));
3664 + int frags = 0, bytes = 0;
3666 - if (!(file->f_mode & FMODE_WRITE))
3668 - if (!output_stream.buffers && sq_allocate_buffers(&output_stream))
3670 - for (i = 0; i < output_stream.nbfrags; i++) {
3671 - if (atomic_read(&output_stream.buffers[i].sem.count) > 0) {
3672 - if (output_stream.buffers[i].size == 0)
3674 - inf.bytes += output_stream.fragsize - output_stream.buffers[i].size;
3678 + if (output_stream.buffers) {
3679 + for (i = 0; i < s->nbfrags; i++) {
3680 + if (atomic_read(&s->buffers[i].sem.count) > 0) {
3681 + if (s->buffers[i].size == 0) frags++;
3682 + bytes += s->fragsize - s->buffers[i].size;
3685 + put_user(s->nbfrags, &inf->fragstotal);
3686 + put_user(s->fragsize, &inf->fragsize);
3688 + frags=audio_nbfrags;
3689 + bytes=frags*audio_fragsize;
3690 + put_user(frags, &inf->fragstotal);
3691 + put_user(audio_fragsize, &inf->fragsize);
3693 - inf.fragstotal = output_stream.nbfrags;
3694 - inf.fragsize = output_stream.fragsize;
3695 - return copy_to_user((void *)arg, &inf, sizeof(inf));
3696 + put_user(frags, &inf->fragments);
3697 + return put_user(bytes, &inf->bytes);
3703 - LEAVE(TRACE_ON,"sq_ioctl");
3704 return mixer_ioctl(inode, file, cmd, arg);
3706 - LEAVE(TRACE_ON,"sq_ioctl");
3712 static struct file_operations sq_fops =
3714 llseek: sound_lseek,
3715 @@ -2770,40 +1390,18 @@
3717 static void __init sq_init(void)
3722 - ENTER(TRACE_ON,"sq_init");
3723 sq_unit = register_sound_dsp(&sq_fops, -1);
3725 - LEAVE(TRACE_ON,"sq_init");
3729 - /* whatever you like as startup mode for /dev/dsp,
3730 - * (/dev/audio hasn't got a startup mode). note that
3731 - * once changed a new open() will *not* restore these!
3733 - sound.dsp.format = AFMT_S16_LE;
3735 - sound.dsp.stereo = 0;
3736 - sound.dsp.size = 16;
3738 - /* set minimum rate possible without expanding */
3739 - switch (sound.mach.type) {
3740 - case DMASND_COLLIE:
3741 - sound.dsp.speed = 8000;
3745 - /* before the first open to /dev/dsp this wouldn't be set */
3746 - sound.soft = sound.dsp;
3747 - sound.hard = sound.dsp;
3748 - sound.trans = &transCollie;
3750 - CollieSetFormat(sound.dsp.format);
3752 - LEAVE(TRACE_ON,"sq_init");
3753 + sound.format = AFMT_S16_LE;
3755 + sound.speed = 44100;
3757 + CollieSetFormat(AFMT_S16_LE);
3758 + Collie_audio_power_off();
3759 + output_stream.buf=output_stream.buffers=NULL;
3763 @@ -2816,9 +1414,7 @@
3764 char *buffer = state.buf;
3767 - ENTER(TRACE_ON,"state_open");
3769 - LEAVE(TRACE_ON,"state_open");
3773 @@ -2828,8 +1424,8 @@
3775 len += sprintf(buffer+len, " COLLIE DMA sound driver:\n");
3777 - len += sprintf(buffer+len, "\tsound.format = 0x%x", sound.soft.format);
3778 - switch (sound.soft.format) {
3779 + len += sprintf(buffer+len, "\tsound.format = 0x%x", sound.format);
3780 + switch (sound.format) {
3782 len += sprintf(buffer+len, " (mu-law)");
3784 @@ -2857,22 +1453,19 @@
3786 len += sprintf(buffer+len, "\n");
3787 len += sprintf(buffer+len, "\tsound.speed = %dHz (phys. %dHz)\n",
3788 - sound.soft.speed, sound.hard.speed);
3789 + sound.speed, sound.speed);
3790 len += sprintf(buffer+len, "\tsound.stereo = 0x%x (%s)\n",
3791 - sound.soft.stereo,
3792 - sound.soft.stereo ? "stereo" : "mono");
3794 + sound.stereo ? "stereo" : "mono");
3796 - LEAVE(TRACE_ON,"state_open");
3801 static int state_release(struct inode *inode, struct file *file)
3803 - ENTER(TRACE_ON,"state_release");
3806 - LEAVE(TRACE_ON,"state_release");
3810 @@ -2881,19 +1474,15 @@
3813 int n = state.len - state.ptr;
3814 - ENTER(TRACE_ON,"state_read");
3818 - LEAVE(TRACE_ON,"state_read");
3821 if (copy_to_user(buf, &state.buf[state.ptr], n)) {
3822 - LEAVE(TRACE_ON,"state_read");
3826 - LEAVE(TRACE_ON,"state_read");
3830 @@ -2909,20 +1498,11 @@
3832 static void __init state_init(void)
3837 - ENTER(TRACE_ON,"state_unit");
3838 state_unit = register_sound_special(&state_fops, SND_DEV_STATUS);
3839 if (state_unit < 0) {
3840 - LEAVE(TRACE_ON,"state_unit");
3845 - // printk("state_init : ret \n");
3846 - LEAVE(TRACE_ON,"state_unit");
3851 @@ -2930,8 +1510,6 @@
3853 static long long sound_lseek(struct file *file, long long offset, int orig)
3855 - ENTER(TRACE_ON,"sound_lseek");
3856 - LEAVE(TRACE_ON,"sound_lseek");
3860 @@ -2941,96 +1519,41 @@
3861 static int collie_sound_pm_callback(struct pm_dev *pm_dev,
3862 pm_request_t req, void *data)
3864 - ENTER(TRACE_PM,"collie_sound_pm_callback");
3867 #ifdef COLLIE_TRY_ONE
3868 disable_irq(IRQ_GPIO_nREMOCON_INT);
3870 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
3871 - collieDoDelayedSilence();
3872 - collieCancelDelayedSilence();
3874 - if (audio_wr_refcount == 1) {
3875 - Collie_volume_off();
3876 - Collie_hard_mute_on();
3877 - Collie_soft_mute_on();
3878 - sa1100_dma_sleep((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3880 -#if 0 /* H.Hayami SHARP 2001.12.18 */
3881 -#if !defined(CONFIG_COLLIE_TS) && !defined(CONFIG_COLLIE_TR0) && \
3882 - !defined(CONFIG_COLLIE_TR1) && !defined(CONFIG_COLLIE_DEV)
3883 - Collie_volume_off();
3886 - Collie_OP_SHDN_off();
3887 - Collie_soft_DAC_off();
3888 - Collie_paif_off();
3889 - Collie_audio_clock_off();
3890 - //Collie_MIC_on();
3894 - sa1100_dma_sleep((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3896 - Collie_sound_hard_term();
3897 + sa1100_dma_sleep((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3898 + Collie_audio_power_off();
3901 -/***** DEBUG *****g
3902 -printk("collie_sound_pm_callback: audio_wr_refcount=%d\n", audio_wr_refcount);
3905 #ifdef COLLIE_TRY_ONE
3906 enable_irq(IRQ_GPIO_nREMOCON_INT);
3909 - Collie_sound_hard_init();
3911 - if (audio_wr_refcount == 1) {
3912 - collie_resume = 1;
3914 - Collie_audio_power_on();
3916 - sa1100_dma_wakeup((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3917 -#if 0 /* H.Hayami SHARP 2001.12.18 */
3918 - Collie_soft_mute_off();
3919 - Collie_hard_mute_off();
3922 + Collie_sound_hard_init(); /* this needs to be done! */
3923 + collie_resume = 1;
3924 + Collie_audio_power_off();
3925 + if (audio_wr_refcount) Collie_audio_power_on();
3926 + if (collie_recording) Collie_recording_on();
3927 + sa1100_dma_wakeup((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3928 #ifdef COLLIE_TRY_ONE
3929 - if ( !( GPLR & GPIO_nREMOCON_INT ) )
3930 + if ( !( GPLR & GPIO_nREMOCON_INT ) )
3933 - sa1100_dma_wakeup((dmach_t)COLLIE_SOUND_DMA_CHANNEL);
3940 - LEAVE(TRACE_PM,"collie_sound_pm_callback");
3946 #ifdef COLLIE_TRY_ONE
3948 -static void collie_audio_on(void)
3951 - sleep_on(&audio_on);
3955 - // printk("call audio on \n");
3960 void Collie_rc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3962 - // printk("int !\n");
3963 - wake_up(&audio_on);
3964 + headphone=!headphone;
3965 + printk("%s headphone \n",headphone ? "connected" : "disconnected");
3969 @@ -3038,113 +1561,85 @@
3971 int __init Collie_sound_init(void)
3973 - int has_sound = 0;
3976 - ENTER(TRACE_ON,"Collie_sound_init");
3978 - sound.mach = machCollie;
3981 - LEAVE(TRACE_ON,"Collie_sound_init");
3985 -#ifdef TRY_DELAY_OFF /* H.Hayami SHARP 2001.12.19 */
3986 - sema_init(&df_sem, 1);
3987 - kernel_thread(collieDelayedSilence, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
3990 Collie_sound_hard_init();
3992 - if (!sound.mach.irqinit()) {
3993 + if (!CollieIrqInit()) {
3994 printk("Sound driver: Interrupt initialization failed\n");
3995 - LEAVE(TRACE_ON,"Collie_sound_init");
3999 - /* Set up sound queue, /dev/audio and /dev/dsp. */
4001 /* Set default settings. */
4004 /* Set up /dev/sndstat. */
4007 /* Set up /dev/mixer. */
4014 printk("Collie Sound Driver Installed\n");
4017 collie_sound_pm_dev = pm_register(PM_SYS_DEV, 0,
4018 collie_sound_pm_callback);
4022 #ifdef COLLIE_TRY_ONE
4024 collie_rc_set_int_mode();
4026 /* GPIO15(int):IN, GPIO18(sw):OUT */
4027 GPDR = ((GPDR)&~GPIO_nREMOCON_INT)|GPIO_REMOCON_ADC_SW;
4029 /* GPIO15,18:not Alternate */
4030 GAFR &= ~(GPIO_nREMOCON_INT|GPIO_REMOCON_ADC_SW);
4032 + /* Initialize headphone state */
4033 + headphone=!(GPLR & GPIO_nREMOCON_INT);
4034 /* GPIO15:Falling Edge */
4035 - set_GPIO_IRQ_edge(GPIO_nREMOCON_INT, GPIO_FALLING_EDGE);
4037 + set_GPIO_IRQ_edge(GPIO_nREMOCON_INT, GPIO_BOTH_EDGES);
4038 /* Register interrupt handler */
4039 if ( request_irq(IRQ_GPIO_nREMOCON_INT, Collie_rc_interrupt,
4040 - SA_INTERRUPT, "INSERT-HEADPHONE", Collie_rc_interrupt)) {
4041 - printk("%s: request_irq(%d) failed.\n",
4042 - __FUNCTION__, IRQ_GPIO_nREMOCON_INT);
4044 + SA_INTERRUPT, "headphone", 0)) {
4045 + printk("headphone: request_irq failed.\n");
4047 - /* Make threads */
4048 - kernel_thread(collie_audio_on, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
4050 + printk("Requested irq collie_rc succesfully (headphone) \n");
4051 + printk("Headphone is now %s\n",headphone ? "connected" : "disconnected");
4055 - LEAVE(TRACE_ON,"Collie_sound_init");
4056 + Collie_audio_power_on(); // decreasing rec. noise?
4057 + Collie_audio_power_off();
4061 -module_init(Collie_sound_init);
4066 -int init_module(void)
4067 +static int collie_ssp_init_module(void)
4069 - ENTER(TRACE_ON,"init_module");
4070 Collie_sound_init();
4071 - LEAVE(TRACE_ON,"init_module");
4075 -void cleanup_module(void)
4076 +static void collie_ssp_cleanup_module(void)
4078 - ENTER(TRACE_ON,"cleanup_module");
4080 + pm_unregister(collie_sound_pm_dev);
4082 if (irq_installed) {
4084 - sound.mach.irqcleanup();
4085 + sa1100_dma_stop(COLLIE_SOUND_DMA_CHANNEL);
4086 + sa1100_dma_flush_all(COLLIE_SOUND_DMA_CHANNEL);
4087 + Collie_audio_power_off();
4088 + sa1100_free_dma(COLLIE_SOUND_DMA_CHANNEL);
4091 - sq_release_buffers();
4093 - if (mixer_unit >= 0)
4094 - unregister_sound_mixer(mixer_unit);
4095 - if (state_unit >= 0)
4096 - unregister_sound_special(state_unit);
4098 - unregister_sound_dsp(sq_unit);
4099 - LEAVE(TRACE_ON,"cleanup_module");
4102 +#ifdef COLLIE_TRY_ONE
4103 + free_irq(IRQ_GPIO_nREMOCON_INT,0);
4105 + unregister_sound_mixer(mixer_unit);
4106 + unregister_sound_special(state_unit);
4107 + unregister_sound_dsp(sq_unit);
4108 + printk("collie_ssp has to go now, see you later!\n");
4111 +module_init(collie_ssp_init_module);
4112 +module_exit(collie_ssp_cleanup_module);
4113 +MODULE_DESCRIPTION("Collie 16bit sound driver");
4114 +MODULE_AUTHOR("SHARP");
4115 +MODULE_LICENSE("GPL");
4116 +EXPORT_SYMBOL(Collie_recording_off);
4117 +EXPORT_SYMBOL(Collie_recording_on);
4118 +EXPORT_SYMBOL(collie_recording);
4121 diff -Nuar linux-2.4.18/drivers/sound/collie_tc35143af.c linux-2.4.18p/drivers/sound/collie_tc35143af.c
4122 --- linux-2.4.18/drivers/sound/collie_tc35143af.c 1970-01-01 01:00:00.000000000 +0100
4123 +++ linux-2.4.18p/drivers/sound/collie_tc35143af.c 2004-10-13 15:26:20.336631864 +0200
4128 + buzzer compatibility is not fool proof - if an app starts sending buzzer ioctls
4129 + and then write or read, nothing good will happen / but this api is obsolote anyway
4131 + mixer_ioctls missing: write/read_mic/igain (there are sane defaults for those)
4133 + fixed samplerate at 22050hz (mono,s16_le), although it can be changed
4134 + between 8000-22050hz hardwarewise
4139 + buffers are only allocated once, and freed when module is unloaded
4140 + mute left channel when duplex playing & recording
4142 + depend on collie_ssp, and call needed functions when needed
4143 + (recording noise should be gone too as a consequence)
4144 + lineo's getospace incorporated (getispace left alone)
4145 + "optimized" default fragsize and number, so there is now no clicking all the time
4146 + commented out scndctl_dsp_setfragment so that no application can set bad settings (eg.xmms)
4147 + if you start reading from this device, than it won't let you write later unless you close it first
4149 + speaker is muted if nothing is playing, so noise is gone
4153 +#include <linux/module.h>
4154 +#include <linux/sched.h>
4155 +#include <linux/timer.h>
4156 +#include <linux/poll.h>
4157 +#include <linux/major.h>
4158 +#include <linux/config.h>
4159 +#include <linux/fcntl.h>
4160 +#include <linux/errno.h>
4161 +#include <linux/mm.h>
4162 +#include <linux/slab.h>
4163 +#include <linux/sound.h>
4164 +#include <linux/init.h>
4165 +#include <linux/delay.h>
4167 +#include <linux/pm.h>
4169 +#include <asm/system.h>
4170 +#include <asm/irq.h>
4171 +#include <asm/pgtable.h>
4172 +#include <asm/uaccess.h>
4173 +#include <asm/io.h>
4174 +#include <asm/dma.h>
4176 +#include <asm/ucb1200.h>
4177 +#include <linux/soundcard.h>
4178 +#include <asm/proc/cache.h>
4180 +#include <asm/arch/hardware.h>
4181 +#include <asm/arch/tc35143.h>
4185 +#define DPRINTK( x... ) printk( ##x )
4187 +#define DPRINTK( x... )
4190 +extern int collie_recording;
4191 +extern void Collie_recording_on(void);
4192 +extern void Collie_recording_off(void);
4194 +int collie_tc35143f_irq = -1;
4195 +int collie_tc35143f_input_irq = -1;
4197 +#define COLLIE_BUZZER_DMA_CHANNEL (collie_tc35143f_irq)
4198 +#define COLLIE_BUZZER_DMA_CHANNEL_INPUT (collie_tc35143f_input_irq)
4199 +#define COLLIE_GPIO_MIC GPIO_GPIO (17)
4201 +#define SND_NDEVS 256 /* Number of supported devices */
4202 +#define SND_DEV_CTL 0 /* Control port /dev/mixer */
4203 +#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM synthesizer and MIDI output) */
4204 +#define SND_DEV_MIDIN 2 /* Raw midi access */
4205 +#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
4206 +#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
4207 +#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
4208 +#define SND_DEV_STATUS 6 /* /dev/sndstat */
4209 +/* #7 not in use now. Was in 2.4. Free for use after v3.0. */
4210 +#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
4211 +#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
4212 +#define SND_DEV_PSS SND_DEV_SNDPROC
4215 +static int sq_unit = -1;
4216 +static int mixer_unit = -1;
4217 +static int state_unit = -1;
4218 +static int irq_installed = 0;
4219 +#endif /* MODULE */
4222 +static struct pm_dev* collie_sound_pm_dev;
4225 +/*** Some declarations ***********************************************/
4226 +static int collie_buzzer_volume = 100;
4227 +static int audio_igain = 0;
4228 +static int audio_iamp = 0x05;
4229 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4230 +static struct ucb1x00 * ucbstruct;
4232 +static int TC35143f_control_reg_a;
4233 +static int TC35143f_control_reg_b;
4234 +static int TC35143f_mode;
4236 +#define AUDIO_NBFRAGS_DEFAULT 32
4237 +#define AUDIO_FRAGSIZE_DEFAULT 2048
4240 + int size; /* buffer size */
4241 + char *start; /* points to actual buffer */
4242 + dma_addr_t dma_addr; /* physical buffer address */
4243 + struct semaphore sem; /* down before touching the buffer */
4244 + int master; /* master owner for buffer allocation */
4245 + u_int idx; /* buffer index, so that we know which buffer was sent last*/
4249 + audio_buf_t *buffers; /* pointer to audio buffer structures */
4250 + audio_buf_t *buf; /* current buffer used by read/write */
4251 + u_int buf_idx; /* index for the pointer above... */
4252 + u_int fragsize; /* fragment i.e. buffer size */
4253 + u_int nbfrags; /* nbr of fragments i.e. buffers */
4256 +static audio_stream_t output_stream, input_stream;
4258 +#define NEXT_BUF(_s_,_b_) { \
4259 + (_s_)->_b_##_idx++; \
4260 + (_s_)->_b_##_idx %= (_s_)->nbfrags; \
4261 + (_s_)->_b_ = (_s_)->buffers + (_s_)->_b_##_idx; }
4263 +/* Current specs for incoming audio data */
4264 +static u_int audio_fragsize=AUDIO_FRAGSIZE_DEFAULT;
4265 +static u_int audio_nbfrags=AUDIO_NBFRAGS_DEFAULT;
4267 +static volatile int audio_refcount; /* nbr of concurrent open() for playback */
4268 +typedef enum { REC,PLAY,NA,BUZZ } collie_tc_status_t;
4269 +static collie_tc_status_t collie_tc_status;
4270 +int collie_tc_muted;
4272 +#define IOCTL_IN(arg, ret) \
4273 + do { int error = get_user(ret, (int *)(arg)); \
4274 + if (error) return error; \
4276 +#define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret)
4278 +/*** "Translations" ************************************************************/
4280 +static ssize_t collie_ct_s16(const u_char *userPtr, size_t userCount,
4281 + u_char frame[], ssize_t *frameUsed,
4282 + ssize_t frameLeft);
4283 +static signed short ct_out=0;
4284 +/*** Low level stuff *********************************************************/
4288 + int format; /* AFMT_* */
4289 + int stereo; /* 0 = mono, 1 = stereo */
4290 + int size; /* 8/16 bit*/
4291 + int speed; /* speed */
4295 +static SETTINGS sound;
4298 +//extern int autoPowerCancel;
4301 +static void Collie_Set_Volume(int volume);
4302 +static int Collie_Get_Volume(void);
4303 +static int CollieIrqInit(void);
4304 +static int CollieSetFormat(int format);
4305 +static void Collie_sq_interrupt(void*, int);
4306 +static int sq_allocate_buffers(audio_stream_t*);
4307 +static void sq_release_buffers(audio_stream_t*);
4309 +/*** Mid level stuff *********************************************************/
4310 +static int sound_set_speed(int speed);
4313 + * /dev/mixer abstraction
4316 +struct sound_mixer {
4320 +static struct sound_mixer mixer;
4326 +/*** Common stuff ********************************************************/
4328 +static long long sound_lseek(struct file *file, long long offset, int orig);
4329 +static inline int ioctl_return(int *addr, int value)
4334 + return put_user(value, addr)? -EFAULT: 0;
4337 +static void wait_ms(int ten_ms)
4339 + schedule_timeout(ten_ms);
4342 +/*** Translation ************************************************************/
4344 +static ssize_t collie_ct_s16(const u_char *userPtr, size_t userCount,
4345 + u_char frame[], ssize_t *frameUsed,
4346 + ssize_t frameLeft)
4348 + ssize_t count, used;
4349 + signed short *fp = (unsigned short *) &frame[*frameUsed];
4350 + signed short *up = (unsigned short *) userPtr;
4354 + used = count = (userCount < frameLeft) ? userCount : frameLeft;
4356 + while (count > 0) {
4357 + signed short data;
4358 + if (get_user(data, up++)) {
4360 + } /* lowpass filtering, not that it matters much - something is resonating inside the Zaurus at high frequencies ? */
4361 + *fp++ = ct_out = (short)( ( (long)data + (long)ct_out ) >> 1LL );
4365 + *frameUsed += used * 2;
4369 +/*** HARDWARE dependent stuff *********************************************************/
4370 +#define VOL_THRES 10
4371 +#define CODEC_ASD_NUMERATOR 13
4372 +/*~ (9216000 / ( 32 * 22050 )) */
4374 +static int Collie_Sampling_value(void)
4376 + int asd = CODEC_ASD_NUMERATOR;
4377 + DPRINTK("Collie_Sampling_value %x\n",asd);
4381 +static void Collie_sound_hard_init(void)
4385 + DPRINTK("CollieInit\n");
4386 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4387 + ucb1x00_enable(ucbstruct);
4388 + ucb1x00_io_set_dir(ucbstruct,0, TC35143_GPIO_BUZZER_BIAS);
4389 + ucb1x00_disable(ucbstruct);
4391 + ucb1200_set_io_direction(TC35143_GPIO_BUZZER_BIAS, TC35143_IODIR_OUTPUT);
4394 + DPRINTK("TC35143F Init");
4397 + asd = Collie_Sampling_value();
4398 + Ser4MCCR0 &= ~MCCR0_MCE;
4399 + Ser4MCCR0 &= ~0xff;
4400 + Ser4MCCR0 |= (MCCR0_ARE | MCCR0_ATE |MCCR0_ADM | MCCR0_ECS | asd);
4401 + Ser4MCCR0 |= MCCR0_MCE;
4402 + Ser4MCSR = 0xffffffff;
4404 + DPRINTK("Init MCP %x\n",Ser4MCCR0);
4407 +static void Collie_audio_power_on(void)
4409 + if ( collie_buzzer_volume > 100 ) collie_buzzer_volume = 100;
4410 + if ( collie_buzzer_volume < 0 ) collie_buzzer_volume = 0;
4411 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4412 + ucb1x00_enable(ucbstruct);
4414 + TC35143f_control_reg_a = ( TC35143_VDIV_22KHZ );
4415 + TC35143f_control_reg_b = ( TC35143_VADMUTE | TC35143_VHSMUTE | ( 7 - collie_buzzer_volume / 13));
4416 + TC35143f_mode = ( TC35143_VOFFCAN | TC35143_VCOF_22_OR_16KHZ );
4417 + TC35143f_control_reg_a &= ~(TC35143_VINSEL_MASK | TC35143_VGAIN_MASK | TC35143_VAMP_MASK);
4418 + TC35143f_control_reg_a |= (TC35143_VINSEL_VBIN2 | ((audio_igain & 0x3)<<11) | ((audio_iamp & 0x0f)<<7));
4419 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4420 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_B , TC35143f_control_reg_b);
4421 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_A , TC35143f_control_reg_a);
4422 + ucb1x00_reg_write(ucbstruct,TC35143_MODE_REG , TC35143f_mode );
4423 + ucb1x00_io_write(ucbstruct, TC35143_GPIO_BUZZER_BIAS,0);
4424 + ucb1x00_disable(ucbstruct);
4426 + ucb1200_write_reg(TC35143_CONTROL_REG_B , TC35143f_control_reg_b );
4427 + ucb1200_write_reg(TC35143_MODE_REG , TC35143f_mode );
4428 + ucb1200_write_reg(TC35143_CONTROL_REG_A , TC35143f_control_reg_a );
4429 + ucb1200_set_io(TC35143_GPIO_BUZZER_BIAS, TC35143_IODAT_HIGH);
4431 + collie_tc_muted=1;
4434 +static void Collie_audio_power_off(void){ /* Disable sound only */
4435 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4436 + ucb1x00_enable(ucbstruct);
4437 + ucb1x00_io_write(ucbstruct,0, TC35143_GPIO_BUZZER_BIAS);
4439 + ucb1200_set_io(TC35143_GPIO_BUZZER_BIAS, TC35143_IODAT_LOW);
4442 + TC35143f_control_reg_a = ( TC35143_VDIV_22KHZ );
4443 + TC35143f_control_reg_b = ( TC35143_ALL_MUTE );
4445 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4446 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_B , TC35143f_control_reg_b);
4447 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_A , TC35143f_control_reg_a);
4448 + ucb1x00_disable(ucbstruct);
4450 + ucb1200_write_reg(TC35143_CONTROL_REG_B , TC35143f_control_reg_b );
4451 + ucb1200_write_reg(TC35143_CONTROL_REG_A , TC35143f_control_reg_a );
4455 +static void collie_tc_mute_on(void){
4456 + unsigned int reg_b;
4457 + unsigned int reg_a;
4459 + if (!collie_tc_muted) {
4460 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4461 + ucb1x00_enable(ucbstruct);
4462 + reg_b = ucb1x00_reg_read(ucbstruct,TC35143_CONTROL_REG_B);
4463 + reg_a = ucb1x00_reg_read(ucbstruct,TC35143_CONTROL_REG_A);
4465 + reg_b = ucb1200_read_reg(TC35143_CONTROL_REG_B);
4466 + reg_a = ucb1200_read_reg(TC35143_CONTROL_REG_A);
4468 + reg_b &= ~TC35143_VOUT1_EN;
4469 + reg_a &= ~TC35143_VOUT2_EN;
4470 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4471 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_A, reg_a);
4472 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_B, reg_b);
4473 + ucb1x00_disable(ucbstruct);
4475 + ucb1200_write_reg(TC35143_CONTROL_REG_A, reg_a);
4476 + ucb1200_write_reg(TC35143_CONTROL_REG_B, reg_b);
4478 + collie_tc_muted=1;
4482 +static void collie_tc_mute_off(void){
4483 + unsigned int reg_b;
4484 + unsigned int reg_a;
4486 + if (collie_tc_muted) {
4487 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4488 + ucb1x00_enable(ucbstruct);
4489 + reg_b = ucb1x00_reg_read(ucbstruct,TC35143_CONTROL_REG_B);
4490 + reg_a = ucb1x00_reg_read(ucbstruct,TC35143_CONTROL_REG_A);
4492 + reg_b = ucb1200_read_reg(TC35143_CONTROL_REG_B);
4493 + reg_a = ucb1200_read_reg(TC35143_CONTROL_REG_A);
4495 + reg_b |= TC35143_VOUT1_EN ;
4497 + reg_b |= ( 7 - collie_buzzer_volume / 13);
4498 + reg_a |= TC35143_VOUT2_EN;
4499 + reg_a &= ~(TC35143_VGAIN_MASK | TC35143_VAMP_MASK);
4500 + reg_a |= (((audio_igain & 0x3)<<11) | ((audio_iamp & 0x0f)<<7));
4501 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4502 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_A, reg_a);
4503 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_B, reg_b);
4504 + ucb1x00_disable(ucbstruct);
4506 + ucb1200_write_reg(TC35143_CONTROL_REG_A, reg_a);
4507 + ucb1200_write_reg(TC35143_CONTROL_REG_B, reg_b);
4509 + collie_tc_muted=0;
4514 +static void Collie_volume_set(int dest)
4516 + if (collie_buzzer_volume==dest) return;
4517 + collie_buzzer_volume=dest;
4518 + collie_tc_mute_on();
4519 + collie_tc_mute_off();
4523 +/*********** GENERAL stuff, same as collie_ssp *******************************/
4526 +static void Collie_Set_Volume(int volume)
4528 + sound.volume = volume & 0xff;
4529 + sound.volume += ( volume & 0xff00 >> 8);
4530 + sound.volume >>=1;
4531 + if (sound.volume>100) sound.volume=100;
4534 +static int Collie_Get_Volume(void)
4536 + return ( sound.volume << 8 | sound.volume );
4539 +static void Collie_sq_interrupt(void* id, int size)
4541 + audio_buf_t *b = (audio_buf_t *) id;
4542 + audio_buf_t *b2 = output_stream.buffers + ((b->idx + 1) % output_stream.nbfrags);
4544 + /* If this is the last buffer for know, let's mute the speaker */
4545 + if (!down_trylock(&b2->sem)) {
4546 + collie_tc_mute_on();
4551 + * Current buffer is sent: wake up any process waiting for it.
4554 + /* And any process polling on write. */
4555 + wake_up_interruptible(&b->sem.wait);
4557 + DPRINTK("Collie_sq_interrupt \n");
4560 +static void Collie_sq_input_interrupt(void* id, int size)
4562 + audio_buf_t *b = (audio_buf_t *) id;
4564 + * Current buffer is sent: wake up any process waiting for it.
4568 + /* And any process polling on write. */
4569 + wake_up_interruptible(&b->sem.wait);
4570 + /* And indicate which was the last buffer sent */
4572 + DPRINTK("Collie_sq_input_interrupt \n");
4576 +static int __init CollieIrqInit(void)
4580 + err = sa1100_request_dma(&COLLIE_BUZZER_DMA_CHANNEL, "buzzer output",
4586 + printk("collie_tc35143f_irq=%d\n", collie_tc35143f_irq);
4588 + err = sa1100_request_dma(&COLLIE_BUZZER_DMA_CHANNEL_INPUT, "buzzer input",
4594 + printk("collie_tc35143f_input_irq=%d\n", collie_tc35143f_input_irq);
4597 + sa1100_dma_set_callback(COLLIE_BUZZER_DMA_CHANNEL,
4598 + (dma_callback_t)Collie_sq_interrupt);
4600 + sa1100_dma_set_callback(COLLIE_BUZZER_DMA_CHANNEL_INPUT,
4601 + (dma_callback_t)Collie_sq_input_interrupt);
4604 + sa1100_dma_stop(COLLIE_BUZZER_DMA_CHANNEL);
4605 + Collie_audio_power_off();
4606 + sa1100_dma_stop(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
4607 + sa1100_dma_flush_all(COLLIE_BUZZER_DMA_CHANNEL);
4611 +static int CollieSetFormat(int format)
4617 + return(sound.format);
4618 + default: /* This is the only one supported by the hardware it seems */
4620 + format = AFMT_S16_LE;
4622 + sound.format = format;
4623 + sound.size = size;
4629 +static int sound_set_speed(int speed)
4632 + return(sound.speed);
4634 + sound.speed=22050;
4635 + return(sound.speed);
4638 +/* Higher level stuff ************************************************/
4641 + * /dev/mixer abstraction
4644 +static int mixer_open(struct inode *inode, struct file *file)
4646 + MOD_INC_USE_COUNT;
4651 +static int mixer_release(struct inode *inode, struct file *file)
4654 + MOD_DEC_USE_COUNT;
4659 +static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
4664 + DPRINTK("Got mixer ioctl \n");
4667 + case SOUND_MIXER_INFO:
4670 + case SOUND_OLD_MIXER_INFO:
4674 + case SOUND_MIXER_READ_DEVMASK:
4676 + return IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_MIC | SOUND_MASK_IGAIN );
4677 + case SOUND_MIXER_READ_RECMASK:
4679 + return IOCTL_OUT(arg, SOUND_MASK_MIC);
4680 + case SOUND_MIXER_READ_STEREODEVS:
4682 + return IOCTL_OUT(arg, 0);
4683 + case SOUND_MIXER_READ_CAPS:
4685 + return IOCTL_OUT(arg, 0);
4687 + case SOUND_MIXER_WRITE_VOLUME:
4688 + IOCTL_IN(arg, data);
4689 + Collie_Set_Volume(data);
4690 + DPRINTK("mix_io returning\n");
4691 + return IOCTL_OUT(arg, data);
4692 + case SOUND_MIXER_READ_VOLUME:
4694 + return IOCTL_OUT(arg, Collie_Get_Volume());
4695 + case SOUND_MIXER_READ_TREBLE:
4697 + return IOCTL_OUT(arg, 0);
4698 + case SOUND_MIXER_WRITE_TREBLE:
4700 + return IOCTL_OUT(arg, 0);
4702 + case SOUND_MIXER_READ_BASS:
4704 + return IOCTL_OUT(arg, 0);
4705 + case SOUND_MIXER_WRITE_BASS:
4707 + return IOCTL_OUT(arg, 0);
4710 + case SOUND_MIXER_WRITE_MIC:
4711 + case SOUND_MIXER_WRITE_IGAIN:
4713 + return IOCTL_OUT(arg, 100);
4714 + case SOUND_MIXER_READ_MIC:
4715 + case SOUND_MIXER_READ_IGAIN:
4717 + return IOCTL_OUT(arg, 0);
4719 + case SOUND_MIXER_READ_SPEAKER:
4721 + return IOCTL_OUT(arg, 0);
4722 + case SOUND_MIXER_WRITE_SPEAKER:
4724 + return IOCTL_OUT(arg, 0);
4726 + DPRINTK("12 %d\n",cmd);
4729 + DPRINTK("EINVAL %d??\n",cmd);
4734 +static struct file_operations mixer_fops =
4736 + llseek: sound_lseek,
4737 + ioctl: mixer_ioctl,
4739 + release: mixer_release,
4743 +static void __init mixer_init(void)
4745 + mixer_unit = register_sound_mixer(&mixer_fops, -1);
4746 + if (mixer_unit < 0) {
4750 + sound.volume = 100;
4751 + Collie_volume_set(sound.volume);
4754 +/* This function initializes the buffer
4757 +static void sq_clean_buffers(audio_stream_t * s)
4761 + sa1100_dma_flush_all(COLLIE_BUZZER_DMA_CHANNEL);
4762 + sa1100_dma_flush_all(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
4764 + s->nbfrags = audio_nbfrags;
4765 + s->fragsize = audio_fragsize;
4770 + for (frag = 0; frag < s->nbfrags; frag++) {
4771 + audio_buf_t *b = &s->buffers[frag];
4773 + sema_init(&b->sem, 1);
4776 + s->buf = &s->buffers[0];
4780 + printk("sound driver : where did the buffer go ??\n ");
4783 +/* This function allocates the buffer structure array and buffer data space
4784 + * according to the current number of fragments and fragment size.
4787 +static int sq_allocate_buffers(audio_stream_t * s)
4792 + dma_addr_t dmaphys = 0;
4794 + DPRINTK("sq_allocate_buffers\n");
4800 + s->nbfrags = audio_nbfrags;
4801 + s->fragsize = audio_fragsize;
4803 + s->buffers = (audio_buf_t *)
4804 + kmalloc(sizeof(audio_buf_t) * s->nbfrags, GFP_KERNEL);
4807 + memset(s->buffers, 0, sizeof(audio_buf_t) * s->nbfrags);
4809 + for (frag = 0; frag < s->nbfrags; frag++) {
4810 + audio_buf_t *b = &s->buffers[frag];
4813 + * Let's allocate non-cached memory for DMA buffers.
4814 + * We try to allocate all memory at once.
4815 + * If this fails (a common reason is memory fragmentation),
4816 + * then we allocate more smaller buffers.
4819 + dmasize = (s->nbfrags - frag) * s->fragsize;
4821 + dmabuf = consistent_alloc(GFP_KERNEL|GFP_DMA,
4825 + dmasize -= s->fragsize;
4826 + } while (!dmabuf && dmasize);
4829 + b->master = dmasize;
4832 + b->start = dmabuf;
4833 + b->dma_addr = dmaphys;
4835 + sema_init(&b->sem, 1);
4836 + dmabuf += s->fragsize;
4837 + dmaphys += s->fragsize;
4838 + dmasize -= s->fragsize;
4842 + s->buf = &s->buffers[0];
4847 + printk("sound driver : unable to allocate audio memory\n ");
4848 + sq_release_buffers(s);
4853 + * This function frees all buffers
4856 +static void sq_release_buffers(audio_stream_t * s)
4858 + DPRINTK("sq_release_buffers\n");
4860 + /* ensure DMA won't run anymore */
4861 + sa1100_dma_flush_all(COLLIE_BUZZER_DMA_CHANNEL);
4862 + sa1100_dma_flush_all(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
4866 + for (frag = 0; frag < s->nbfrags; frag++) {
4867 + if (!s->buffers[frag].master)
4869 + consistent_free(s->buffers[frag].start,
4870 + s->buffers[frag].master,
4871 + s->buffers[frag].dma_addr);
4873 + kfree(s->buffers);
4874 + s->buffers = NULL;
4881 +static int audio_recording(audio_stream_t * s)
4884 + unsigned int reg_b;
4886 + if (!collie_recording) {
4888 + * Set TC35143 Audio in enable
4890 +//// DPRINTK("audio_recording : audio in enable\n");
4891 +//// reg_b = ucb1200_read_reg(TC35143_CONTROL_REG_B);
4892 +//// reg_b &= ~(TC35143_VADMUTE);
4893 +//// reg_b |= (TC35143_VIN_EN | TC35143_VCLP_CLR);
4894 +//// ucb1200_write_reg(TC35143_CONTROL_REG_B, reg_b);
4897 + * We must ensure there is an output stream at any time while
4898 + * recording since this is how the TC35143 gets its clock.
4899 + * So if there is no playback data to send, the output DMA will
4900 + * spin with all zeroes.
4903 + Collie_recording_on();
4904 + collie_tc_mute_off(); /* This is needed for good volume */
4905 + DPRINTK("audio_recording : sa1100_dma_set_spin\n");
4906 + sa1100_dma_set_spin(COLLIE_BUZZER_DMA_CHANNEL,
4907 + (dma_addr_t) FLUSH_BASE_PHYS, 2048);
4910 + * Since we just allocated all buffers, we must send them to
4911 + * the DMA code before receiving data.
4913 + DPRINTK("audio_recording : for loop\n");
4914 + for (i = 0; i < s->nbfrags; i++) {
4915 + audio_buf_t *b = s->buf;
4917 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL_INPUT, (void *) b,
4918 + b->dma_addr, s->fragsize);
4921 + DPRINTK("audio_recording : End for loop\n");
4924 + * Set TC35143 Audio in enable
4926 + DPRINTK("audio_recording : audio in enable\n");
4927 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4928 + ucb1x00_enable(ucbstruct);
4929 + ucb1x00_io_write(ucbstruct, 0, TC35143_GPIO_BUZZER_BIAS);
4930 + reg_b = ucb1x00_reg_read(ucbstruct,TC35143_CONTROL_REG_B);
4932 + ucb1200_set_io(TC35143_GPIO_BUZZER_BIAS, TC35143_IODAT_LOW);
4933 + reg_b = ucb1200_read_reg(TC35143_CONTROL_REG_B);
4935 + reg_b &= ~(TC35143_VADMUTE);
4936 + reg_b |= (TC35143_VIN_EN | TC35143_VCLP_CLR);
4937 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
4938 + ucb1x00_reg_write(ucbstruct,TC35143_CONTROL_REG_B, reg_b);
4939 + ucb1x00_disable(ucbstruct);
4941 + ucb1200_write_reg(TC35143_CONTROL_REG_B, reg_b);
4948 +static int sq_read(struct file *file, char *buffer,
4949 + size_t count, loff_t * ppos)
4951 + char *buffer0 = buffer;
4952 + audio_stream_t *s = &input_stream;
4953 + int chunksize, ret = 0;
4955 + DPRINTK("audio_read: count=%d\n", count);
4958 + ret = audio_recording(s);
4960 + if ((collie_tc_status!=NA) && (collie_tc_status!=REC))
4962 + collie_tc_status=REC;
4967 + /* be sure to have a full sample byte count */
4970 +// DPRINTK("audio_read : Start while loop\n");
4971 + while (count > 0) {
4972 + audio_buf_t *b = s->buf;
4974 + /* Wait for a buffer to become full */
4975 + if (file->f_flags & O_NONBLOCK) {
4976 +// DPRINTK("audio_read : down_trylock\n");
4978 + if (down_trylock(&b->sem))
4981 +// DPRINTK("audio_read : down_interruptible\n");
4982 + ret = -ERESTARTSYS;
4983 + if (down_interruptible(&b->sem))
4987 + /* Grab data from the current buffer */
4988 + chunksize = b->size;
4989 + if (chunksize > count)
4990 + chunksize = count;
4991 + DPRINTK("read %d from %d\n", chunksize, s->buf_idx);
4993 + if (copy_to_user(buffer, b->start + s->fragsize - b->size, chunksize)) {
4995 + DPRINTK("not copied to buffer \n");
4998 + DPRINTK("copied to buffer \n");
5000 + b->size -= chunksize;
5001 + buffer += chunksize;
5002 + count -= chunksize;
5004 + if (b->size > 0) {
5009 + /* Make current buffer available for DMA again */
5010 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL_INPUT, (void *) b,
5011 + b->dma_addr, s->fragsize);
5014 +// DPRINTK("audio_read : End while loop\n");
5016 + if ((buffer - buffer0))
5017 + ret = buffer - buffer0;
5018 +// DPRINTK("audio_read: return=%d\n", ret);
5022 +static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
5025 + const char *buffer0 = src;
5026 + audio_stream_t *s = &output_stream;
5028 + ssize_t uUsed, bUsed, bLeft, ret = 0;
5030 + DPRINTK("sq_write: uLeft=%d\n", uLeft);
5032 + if ((collie_tc_status!=NA) && (collie_tc_status!=PLAY))
5035 + collie_tc_status=PLAY;
5037 + if (!s->buffers && sq_allocate_buffers(s)) {
5043 + /* Auto Power off cancel */
5044 +// autoPowerCancel = 0;
5047 + collie_tc_mute_off();
5048 + while (uLeft > 0) {
5049 + audio_buf_t *b = s->buf;
5051 + /* Wait for a buffer to become free */
5052 + if (file->f_flags & O_NONBLOCK) {
5054 + if (down_trylock(&b->sem)) {
5058 + ret = -ERESTARTSYS;
5059 + if (down_interruptible(&b->sem)) {
5064 + dest = b->start + b->size;
5066 + bLeft = s->fragsize - b->size;
5068 + if (collie_ct_s16) {
5069 + uUsed = collie_ct_s16(src, uLeft, dest, &bUsed, bLeft);
5070 + cpu_cache_clean_invalidate_range((unsigned long)dest,
5071 + (unsigned long)(dest+(audio_fragsize)), 0);
5084 + if (b->size < s->fragsize) {
5089 + /* Send current buffer to dma */
5090 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL,
5091 + (void *) b, b->dma_addr, b->size);
5093 + Collie_volume_set(sound.volume);
5095 + b->size = 0; /* indicate that the buffer has been sent */
5099 + if ((src - buffer0))
5100 + ret = src - buffer0;
5101 + DPRINTK("sq_write: return=%d\n", ret);
5105 +static unsigned int sq_poll(struct file *file,
5106 + struct poll_table_struct *wait)
5108 + unsigned int mask = 0;
5111 + DPRINTK("sq_poll(): mode=%s%s\n",
5112 + (file->f_mode & FMODE_READ) ? "r" : "",
5113 + (file->f_mode & FMODE_WRITE) ? "w" : "");
5115 + if ((file->f_mode & FMODE_READ) && (file->f_mode & FMODE_WRITE) && (collie_tc_status==NA))
5118 + if ((file->f_mode & FMODE_WRITE) && (collie_tc_status!=REC)) {
5119 + if (!output_stream.buffers
5120 + && sq_allocate_buffers(&output_stream)) {
5123 + poll_wait(file, &output_stream.buf->sem.wait, wait);
5126 + if ((file->f_mode & FMODE_WRITE) && (collie_tc_status!=REC)) {
5127 + for (i = 0; i < output_stream.nbfrags; i++) {
5128 + if (atomic_read(&output_stream.buffers[i].sem.count) > 0)
5129 + mask |= POLLOUT | POLLWRNORM;
5133 + if ((file->f_mode & FMODE_READ) && (collie_tc_status!=PLAY)) {
5134 + ret = audio_recording(&input_stream);
5138 + poll_wait(file, &input_stream.buf->sem.wait, wait);
5141 + if ((file->f_mode & FMODE_READ) && (collie_tc_status!=PLAY)) {
5142 + for (i = 0; i < input_stream.nbfrags; i++) {
5143 + if (atomic_read(&input_stream.buffers[i].sem.count) > 0)
5144 + mask |= POLLIN | POLLRDNORM;
5148 + DPRINTK("sq_poll() returned mask of %s%s\n",
5149 + (mask & POLLIN) ? "r" : "",
5150 + (mask & POLLOUT) ? "w" : "");
5155 +static int sq_open(struct inode *inode, struct file *file)
5157 + DPRINTK("sq_open\n");
5159 + if (audio_refcount) {
5160 + DPRINTK(" sq_open EBUSY\n");
5164 + switch (file->f_flags & O_ACCMODE) {
5166 + collie_tc_status=PLAY;
5167 + sa1100_dma_stop(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5170 + collie_tc_status=REC;
5173 + collie_tc_status=NA;
5176 + DPRINTK(" sq_open EINVAL\n");
5180 + MOD_INC_USE_COUNT;
5183 + audio_fragsize = AUDIO_FRAGSIZE_DEFAULT;
5184 + audio_nbfrags = AUDIO_NBFRAGS_DEFAULT;
5185 + sq_clean_buffers(&input_stream);
5186 + sq_clean_buffers(&output_stream);
5187 + Collie_audio_power_on();
5188 + DPRINTK("Going back\n");
5192 +static int sq_post(void)
5194 + audio_stream_t *s = &output_stream;
5195 + audio_buf_t *b = s->buf;
5197 + DPRINTK("sq_post\n");
5199 + if (!s->buffers) {
5203 + /* Send half-full buffers */
5204 + if (b->size != 0) {
5205 + DPRINTK("half-full_buf\n");
5208 + /* Auto Power off cancel */
5209 +// autoPowerCancel = 0;
5213 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL,
5214 + (void *) b, b->dma_addr, b->size);
5221 +static int sq_fsync(void)
5223 + audio_stream_t *s = &output_stream;
5224 + audio_buf_t *b = s->buf;
5226 + DPRINTK("sq_fsync\n");
5228 + if (!s->buffers) {
5232 + /* Send half-full buffers */
5233 + if (b->size != 0) {
5234 + DPRINTK("half-full_buf\n");
5237 + /* Auto Power off cancel */
5238 +// autoPowerCancel = 0;
5242 + sa1100_dma_queue_buffer(COLLIE_BUZZER_DMA_CHANNEL,
5243 + (void *) b, b->dma_addr, b->size);
5249 + * Let's wait for the last buffer we sent i.e. the one before the
5250 + * current buf_idx. When we acquire the semaphore, this means either:
5251 + * - DMA on the buffer completed or
5252 + * - the buffer was already free thus nothing else to sync.
5254 + b = s->buffers + ((s->nbfrags + s->buf_idx - 1) % s->nbfrags);
5255 + if (down_interruptible(&b->sem)) {
5262 +static int sq_release(struct inode *inode, struct file *file)
5264 + DPRINTK("speaker_sq_release\n");
5266 + switch (collie_tc_status) {
5269 + sa1100_dma_set_spin(COLLIE_BUZZER_DMA_CHANNEL,0,0);
5270 + sq_clean_buffers(&input_stream);
5271 + Collie_recording_off();
5275 + sq_clean_buffers(&output_stream);
5280 + audio_refcount = 0;
5281 + collie_tc_status=NA;
5282 + sa1100_dma_stop(COLLIE_BUZZER_DMA_CHANNEL);
5283 + Collie_audio_power_off();
5284 + sa1100_dma_stop(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5285 + MOD_DEC_USE_COUNT;
5289 +/* Buzzer compatibility */
5290 +#include "colliebuzzer.h"
5293 +static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
5298 +// audio_buf_info abinfo;
5300 + DPRINTK("Got ioctl %ld \n",cmd);
5304 + sq_write_buzzer(arg);
5307 + case SNDCTL_DSP_RESET:
5308 + switch (collie_tc_status) {
5310 + sq_clean_buffers(&input_stream);
5313 + sq_clean_buffers(&output_stream);
5318 + case SNDCTL_DSP_POST:
5321 + case SNDCTL_DSP_SYNC:
5325 + /* ++TeSche: before changing any of these it's
5326 + * probably wise to wait until sound playing has
5327 + * settled down. */
5328 + case SNDCTL_DSP_SPEED:
5329 +// sq_fsync(file, file->f_dentry);
5330 + IOCTL_IN(arg, data);
5331 + return IOCTL_OUT(arg, sound_set_speed(data));
5333 + case SOUND_PCM_READ_RATE:
5336 + case SNDCTL_DSP_STEREO:
5337 +// sq_fsync(file, file->f_dentry);
5338 + IOCTL_IN(arg, data);
5339 + return IOCTL_OUT(arg, 0);
5340 + case SNDCTL_DSP_CHANNELS:
5341 +// sq_fsync(file, file->f_dentry);
5342 + IOCTL_IN(arg, data);
5343 + return IOCTL_OUT(arg, 1);
5344 + case SNDCTL_DSP_SETFMT:
5345 +// sq_fsync(file, file->f_dentry);
5346 + IOCTL_IN(arg, data);
5347 + return IOCTL_OUT(arg, CollieSetFormat(data));
5348 + case SNDCTL_DSP_GETFMTS:
5349 + fmt = AFMT_S16_LE;
5350 + return IOCTL_OUT(arg, fmt);
5351 + case SNDCTL_DSP_GETBLKSIZE:
5352 + return IOCTL_OUT(arg, audio_fragsize);
5353 + case SNDCTL_DSP_SUBDIVIDE:
5355 + case SNDCTL_DSP_SETFRAGMENT:
5356 +/* if (output_stream.buffers) {
5359 + get_user(val, (long *) arg);
5360 + audio_fragsize = 1 << (val & 0xFFFF);
5361 + if (audio_fragsize < 256)
5362 + audio_fragsize = 256;
5363 + if (audio_fragsize > 16384)
5364 + audio_fragsize = 16384;
5365 + audio_nbfrags = (val >> 16) & 0x7FFF;
5366 + if (audio_nbfrags < 2)
5367 + audio_nbfrags = 2;
5368 + if (audio_nbfrags * audio_fragsize > 128 * 1024)
5369 + audio_nbfrags = 128 * 1024 / audio_fragsize;
5370 + if (sq_allocate_buffers(&output_stream)) {
5374 + case SNDCTL_DSP_GETOSPACE:
5375 + abinfo.fragsize = audio_fragsize;
5376 + abinfo.fragstotal = audio_nbfrags;
5377 + abinfo.fragments = lastsent-output_stream.buf_idx;
5378 + if (abinfo.fragments<0)
5379 + abinfo.fragments += abinfo.fragstotal;
5380 + abinfo.bytes = abinfo.fragments*abinfo.fragsize;
5381 + return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
5384 + case SNDCTL_DSP_GETOSPACE:
5386 + audio_stream_t *s = &output_stream;
5387 + audio_buf_info *inf = (audio_buf_info *) arg;
5388 + int err = verify_area(VERIFY_WRITE, inf, sizeof(*inf));
5390 + int frags = 0, bytes = 0;
5394 + if (output_stream.buffers) {
5395 + for (i = 0; i < s->nbfrags; i++) {
5396 + if (atomic_read(&s->buffers[i].sem.count) > 0) {
5397 + if (s->buffers[i].size == 0) frags++;
5398 + bytes += s->fragsize - s->buffers[i].size;
5401 + put_user(s->nbfrags, &inf->fragstotal);
5402 + put_user(s->fragsize, &inf->fragsize);
5404 + frags=audio_nbfrags;
5405 + bytes=frags*audio_fragsize;
5406 + put_user(frags, &inf->fragstotal);
5407 + put_user(audio_fragsize, &inf->fragsize);
5409 + put_user(frags, &inf->fragments);
5410 + return put_user(bytes, &inf->bytes);
5413 + case SNDCTL_DSP_GETISPACE:
5415 + audio_stream_t *s = &input_stream;
5416 + audio_buf_info *inf = (audio_buf_info *) arg;
5417 + int err = verify_area(VERIFY_WRITE, inf, sizeof(*inf));
5419 + int frags = 0, bytes = 0;
5423 + if (input_stream.buffers)
5424 + for (i = 0; i < s->nbfrags; i++) {
5425 + if (atomic_read(&s->buffers[i].sem.count) > 0) {
5426 + if (s->buffers[i].size == s->fragsize) frags++;
5427 + bytes += s->buffers[i].size;
5434 + put_user(frags, &inf->fragments);
5435 + put_user(s->nbfrags, &inf->fragstotal);
5436 + put_user(s->fragsize, &inf->fragsize);
5437 + return put_user(bytes, &inf->bytes);
5441 + ret = mixer_ioctl(inode, file, cmd, arg);
5442 + DPRINTK("Returning after mixer_ioctl\n");
5448 +static struct file_operations sq_fops =
5450 + llseek: sound_lseek,
5456 + release: sq_release,
5460 +static void __init sq_init(void)
5462 + sq_unit = register_sound_dsp(&sq_fops, -1);
5463 + if (sq_unit < 0) {
5467 + sound.format = AFMT_S16_LE;
5469 + sound.speed = 22050;
5471 + CollieSetFormat(sound.format);
5472 + Collie_audio_power_off();
5473 + input_stream.buf=input_stream.buffers=output_stream.buf=output_stream.buffers=NULL;
5477 +/*** Common stuff ********************************************************/
5479 +static long long sound_lseek(struct file *file, long long offset, int orig)
5484 +/*** Power Management ****************************************************/
5487 +static int collie_sound_pm_callback(struct pm_dev *pm_dev,
5488 + pm_request_t req, void *data)
5492 + if (audio_refcount == 1) {
5493 + sa1100_dma_sleep((dmach_t)COLLIE_BUZZER_DMA_CHANNEL);
5494 + sa1100_dma_sleep((dmach_t)COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5495 + Collie_audio_power_off();
5497 + sa1100_dma_sleep((dmach_t)COLLIE_BUZZER_DMA_CHANNEL);
5498 + sa1100_dma_sleep((dmach_t)COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5502 + Collie_sound_hard_init();
5503 +// Collie_audio_power_off();
5504 + if (audio_refcount == 1) {
5505 + Collie_audio_power_on();
5506 + sa1100_dma_wakeup((dmach_t)COLLIE_BUZZER_DMA_CHANNEL);
5507 + sa1100_dma_wakeup((dmach_t)COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5509 + sa1100_dma_wakeup((dmach_t)COLLIE_BUZZER_DMA_CHANNEL);
5510 + sa1100_dma_wakeup((dmach_t)COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5518 +/*** Config & Setup ******************************************************/
5520 +int __init Collie_sound_init(void)
5522 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19))
5523 + ucbstruct = ucb1x00_get();
5525 + if (!CollieIrqInit()) {
5526 + printk("Sound driver: Interrupt initialization failed\n");
5529 + Ser4MCDR0 = 0; /* ucb1200_sa1100_set_mcdr0(0); */
5531 + Collie_sound_hard_init();
5533 + /* Set default settings. */
5535 + /* Set up /dev/mixer. */
5538 + irq_installed = 1;
5540 + printk("Collie tc35143af Sound Driver Installed\n");
5542 + collie_sound_pm_dev = pm_register(PM_SYS_DEV, 0,
5543 + collie_sound_pm_callback);
5549 +static int collie_tc35143_init_module(void)
5551 + Collie_sound_init();
5552 + sq_allocate_buffers(&output_stream);
5553 + sq_allocate_buffers(&input_stream);
5557 +static void collie_tc35143_cleanup_module(void)
5560 + pm_unregister(collie_sound_pm_dev);
5562 + if (irq_installed) {
5563 + sa1100_free_dma(COLLIE_BUZZER_DMA_CHANNEL);
5564 + sa1100_free_dma(COLLIE_BUZZER_DMA_CHANNEL_INPUT);
5567 + sq_release_buffers(&output_stream);
5568 + sq_release_buffers(&input_stream);
5569 + unregister_sound_mixer(mixer_unit);
5570 + unregister_sound_special(state_unit);
5571 + unregister_sound_dsp(sq_unit);
5572 + printk("collie_tc35143af has to go now, see you later!\n");
5575 +module_init(collie_tc35143_init_module);
5576 +module_exit(collie_tc35143_cleanup_module);
5577 +MODULE_DESCRIPTION("Collie tc35143af 16bit sound driver");
5578 +MODULE_AUTHOR("SHARP");
5579 +MODULE_LICENSE("GPL");
5580 +#endif /* MODULE */
5582 diff -Nuar linux-2.4.18/drivers/sound/Makefile linux-2.4.18p/drivers/sound/Makefile
5583 --- linux-2.4.18/drivers/sound/Makefile 2003-05-13 11:18:36.000000000 +0200
5584 +++ linux-2.4.18p/drivers/sound/Makefile 2004-10-12 23:11:29.000000000 +0200
5586 msnd.o opl3.o sb_common.o sequencer_syms.o \
5587 sound_core.o sound_syms.o uart401.o \
5588 nm256_audio.o ac97.o ac97_codec.o aci.o \
5589 - sa1100-audio.o pxa-audio.o pxa-ac97.o
5590 + sa1100-audio.o pxa-audio.o pxa-ac97.o collie_ssp.o
5592 # Each configuration option enables a list of files.
5595 obj-$(CONFIG_SOUND_SA1111_UDA1341) += sa1111-uda1341.o
5596 obj-$(CONFIG_SOUND_SA1100SSP) += sa1100ssp.o
5597 obj-$(CONFIG_SOUND_COLLIE_SSP) += collie_ssp.o
5598 -obj-$(CONFIG_SOUND_COLLIE_TC35143) += collie-tc35143.o
5599 +obj-$(CONFIG_SOUND_COLLIE_TC35143) += collie_tc35143af.o
5600 obj-$(CONFIG_SOUND_PXA_AC97)+= pxa-ac97.o pxa-audio.o ac97_codec.o
5601 obj-$(CONFIG_SOUND_EMU10K1) += ac97_codec.o
5602 obj-$(CONFIG_SOUND_RME96XX) += rme96xx.o