diff options
Diffstat (limited to 'drivers/media/radio/radio-cadet.c')
-rw-r--r-- | drivers/media/radio/radio-cadet.c | 316 |
1 files changed, 158 insertions, 158 deletions
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index f1b5ac81e9d2..c048454c7ba5 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Russell Kroll (rkroll@exploits.org) | 8 | * Russell Kroll (rkroll@exploits.org) |
9 | * Quay Ly | 9 | * Quay Ly |
10 | * Donald Song | 10 | * Donald Song |
11 | * Jason Lewis (jlewis@twilight.vtc.vsc.edu) | 11 | * Jason Lewis (jlewis@twilight.vtc.vsc.edu) |
12 | * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) | 12 | * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) |
13 | * William McGrath (wmcgrath@twilight.vtc.vsc.edu) | 13 | * William McGrath (wmcgrath@twilight.vtc.vsc.edu) |
14 | * | 14 | * |
@@ -55,29 +55,29 @@ static int cadet_probe(void); | |||
55 | 55 | ||
56 | /* | 56 | /* |
57 | * Signal Strength Threshold Values | 57 | * Signal Strength Threshold Values |
58 | * The V4L API spec does not define any particular unit for the signal | 58 | * The V4L API spec does not define any particular unit for the signal |
59 | * strength value. These values are in microvolts of RF at the tuner's input. | 59 | * strength value. These values are in microvolts of RF at the tuner's input. |
60 | */ | 60 | */ |
61 | static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}}; | 61 | static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}}; |
62 | 62 | ||
63 | static int cadet_getrds(void) | 63 | static int cadet_getrds(void) |
64 | { | 64 | { |
65 | int rdsstat=0; | 65 | int rdsstat=0; |
66 | 66 | ||
67 | spin_lock(&cadet_io_lock); | 67 | spin_lock(&cadet_io_lock); |
68 | outb(3,io); /* Select Decoder Control/Status */ | 68 | outb(3,io); /* Select Decoder Control/Status */ |
69 | outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */ | 69 | outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */ |
70 | spin_unlock(&cadet_io_lock); | 70 | spin_unlock(&cadet_io_lock); |
71 | 71 | ||
72 | msleep(100); | 72 | msleep(100); |
73 | 73 | ||
74 | spin_lock(&cadet_io_lock); | 74 | spin_lock(&cadet_io_lock); |
75 | outb(3,io); /* Select Decoder Control/Status */ | 75 | outb(3,io); /* Select Decoder Control/Status */ |
76 | if((inb(io+1)&0x80)!=0) { | 76 | if((inb(io+1)&0x80)!=0) { |
77 | rdsstat|=VIDEO_TUNER_RDS_ON; | 77 | rdsstat|=VIDEO_TUNER_RDS_ON; |
78 | } | 78 | } |
79 | if((inb(io+1)&0x10)!=0) { | 79 | if((inb(io+1)&0x10)!=0) { |
80 | rdsstat|=VIDEO_TUNER_MBS_ON; | 80 | rdsstat|=VIDEO_TUNER_MBS_ON; |
81 | } | 81 | } |
82 | spin_unlock(&cadet_io_lock); | 82 | spin_unlock(&cadet_io_lock); |
83 | return rdsstat; | 83 | return rdsstat; |
@@ -86,49 +86,49 @@ static int cadet_getrds(void) | |||
86 | static int cadet_getstereo(void) | 86 | static int cadet_getstereo(void) |
87 | { | 87 | { |
88 | int ret = 0; | 88 | int ret = 0; |
89 | if(curtuner != 0) /* Only FM has stereo capability! */ | 89 | if(curtuner != 0) /* Only FM has stereo capability! */ |
90 | return 0; | 90 | return 0; |
91 | 91 | ||
92 | spin_lock(&cadet_io_lock); | 92 | spin_lock(&cadet_io_lock); |
93 | outb(7,io); /* Select tuner control */ | 93 | outb(7,io); /* Select tuner control */ |
94 | if( (inb(io+1) & 0x40) == 0) | 94 | if( (inb(io+1) & 0x40) == 0) |
95 | ret = 1; | 95 | ret = 1; |
96 | spin_unlock(&cadet_io_lock); | 96 | spin_unlock(&cadet_io_lock); |
97 | return ret; | 97 | return ret; |
98 | } | 98 | } |
99 | 99 | ||
100 | static unsigned cadet_gettune(void) | 100 | static unsigned cadet_gettune(void) |
101 | { | 101 | { |
102 | int curvol,i; | 102 | int curvol,i; |
103 | unsigned fifo=0; | 103 | unsigned fifo=0; |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * Prepare for read | 106 | * Prepare for read |
107 | */ | 107 | */ |
108 | 108 | ||
109 | spin_lock(&cadet_io_lock); | 109 | spin_lock(&cadet_io_lock); |
110 | 110 | ||
111 | outb(7,io); /* Select tuner control */ | 111 | outb(7,io); /* Select tuner control */ |
112 | curvol=inb(io+1); /* Save current volume/mute setting */ | 112 | curvol=inb(io+1); /* Save current volume/mute setting */ |
113 | outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */ | 113 | outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */ |
114 | tunestat=0xffff; | 114 | tunestat=0xffff; |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * Read the shift register | 117 | * Read the shift register |
118 | */ | 118 | */ |
119 | for(i=0;i<25;i++) { | 119 | for(i=0;i<25;i++) { |
120 | fifo=(fifo<<1)|((inb(io+1)>>7)&0x01); | 120 | fifo=(fifo<<1)|((inb(io+1)>>7)&0x01); |
121 | if(i<24) { | 121 | if(i<24) { |
122 | outb(0x01,io+1); | 122 | outb(0x01,io+1); |
123 | tunestat&=inb(io+1); | 123 | tunestat&=inb(io+1); |
124 | outb(0x00,io+1); | 124 | outb(0x00,io+1); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * Restore volume/mute setting | 129 | * Restore volume/mute setting |
130 | */ | 130 | */ |
131 | outb(curvol,io+1); | 131 | outb(curvol,io+1); |
132 | spin_unlock(&cadet_io_lock); | 132 | spin_unlock(&cadet_io_lock); |
133 | 133 | ||
134 | return fifo; | 134 | return fifo; |
@@ -136,43 +136,43 @@ static unsigned cadet_gettune(void) | |||
136 | 136 | ||
137 | static unsigned cadet_getfreq(void) | 137 | static unsigned cadet_getfreq(void) |
138 | { | 138 | { |
139 | int i; | 139 | int i; |
140 | unsigned freq=0,test,fifo=0; | 140 | unsigned freq=0,test,fifo=0; |
141 | 141 | ||
142 | /* | 142 | /* |
143 | * Read current tuning | 143 | * Read current tuning |
144 | */ | 144 | */ |
145 | fifo=cadet_gettune(); | 145 | fifo=cadet_gettune(); |
146 | 146 | ||
147 | /* | 147 | /* |
148 | * Convert to actual frequency | 148 | * Convert to actual frequency |
149 | */ | 149 | */ |
150 | if(curtuner==0) { /* FM */ | 150 | if(curtuner==0) { /* FM */ |
151 | test=12500; | 151 | test=12500; |
152 | for(i=0;i<14;i++) { | 152 | for(i=0;i<14;i++) { |
153 | if((fifo&0x01)!=0) { | 153 | if((fifo&0x01)!=0) { |
154 | freq+=test; | 154 | freq+=test; |
155 | } | 155 | } |
156 | test=test<<1; | 156 | test=test<<1; |
157 | fifo=fifo>>1; | 157 | fifo=fifo>>1; |
158 | } | 158 | } |
159 | freq-=10700000; /* IF frequency is 10.7 MHz */ | 159 | freq-=10700000; /* IF frequency is 10.7 MHz */ |
160 | freq=(freq*16)/1000000; /* Make it 1/16 MHz */ | 160 | freq=(freq*16)/1000000; /* Make it 1/16 MHz */ |
161 | } | 161 | } |
162 | if(curtuner==1) { /* AM */ | 162 | if(curtuner==1) { /* AM */ |
163 | freq=((fifo&0x7fff)-2010)*16; | 163 | freq=((fifo&0x7fff)-2010)*16; |
164 | } | 164 | } |
165 | 165 | ||
166 | return freq; | 166 | return freq; |
167 | } | 167 | } |
168 | 168 | ||
169 | static void cadet_settune(unsigned fifo) | 169 | static void cadet_settune(unsigned fifo) |
170 | { | 170 | { |
171 | int i; | 171 | int i; |
172 | unsigned test; | 172 | unsigned test; |
173 | 173 | ||
174 | spin_lock(&cadet_io_lock); | 174 | spin_lock(&cadet_io_lock); |
175 | 175 | ||
176 | outb(7,io); /* Select tuner control */ | 176 | outb(7,io); /* Select tuner control */ |
177 | /* | 177 | /* |
178 | * Write the shift register | 178 | * Write the shift register |
@@ -183,7 +183,7 @@ static void cadet_settune(unsigned fifo) | |||
183 | outb(7,io); /* Select tuner control */ | 183 | outb(7,io); /* Select tuner control */ |
184 | outb(test,io+1); /* Initialize for write */ | 184 | outb(test,io+1); /* Initialize for write */ |
185 | for(i=0;i<25;i++) { | 185 | for(i=0;i<25;i++) { |
186 | test|=0x01; /* Toggle SCK High */ | 186 | test|=0x01; /* Toggle SCK High */ |
187 | outb(test,io+1); | 187 | outb(test,io+1); |
188 | test&=0xfe; /* Toggle SCK Low */ | 188 | test&=0xfe; /* Toggle SCK Low */ |
189 | outb(test,io+1); | 189 | outb(test,io+1); |
@@ -196,57 +196,57 @@ static void cadet_settune(unsigned fifo) | |||
196 | 196 | ||
197 | static void cadet_setfreq(unsigned freq) | 197 | static void cadet_setfreq(unsigned freq) |
198 | { | 198 | { |
199 | unsigned fifo; | 199 | unsigned fifo; |
200 | int i,j,test; | 200 | int i,j,test; |
201 | int curvol; | 201 | int curvol; |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * Formulate a fifo command | 204 | * Formulate a fifo command |
205 | */ | 205 | */ |
206 | fifo=0; | 206 | fifo=0; |
207 | if(curtuner==0) { /* FM */ | 207 | if(curtuner==0) { /* FM */ |
208 | test=102400; | 208 | test=102400; |
209 | freq=(freq*1000)/16; /* Make it kHz */ | 209 | freq=(freq*1000)/16; /* Make it kHz */ |
210 | freq+=10700; /* IF is 10700 kHz */ | 210 | freq+=10700; /* IF is 10700 kHz */ |
211 | for(i=0;i<14;i++) { | 211 | for(i=0;i<14;i++) { |
212 | fifo=fifo<<1; | 212 | fifo=fifo<<1; |
213 | if(freq>=test) { | 213 | if(freq>=test) { |
214 | fifo|=0x01; | 214 | fifo|=0x01; |
215 | freq-=test; | 215 | freq-=test; |
216 | } | 216 | } |
217 | test=test>>1; | 217 | test=test>>1; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | if(curtuner==1) { /* AM */ | 220 | if(curtuner==1) { /* AM */ |
221 | fifo=(freq/16)+2010; /* Make it kHz */ | 221 | fifo=(freq/16)+2010; /* Make it kHz */ |
222 | fifo|=0x100000; /* Select AM Band */ | 222 | fifo|=0x100000; /* Select AM Band */ |
223 | } | 223 | } |
224 | 224 | ||
225 | /* | 225 | /* |
226 | * Save current volume/mute setting | 226 | * Save current volume/mute setting |
227 | */ | 227 | */ |
228 | 228 | ||
229 | spin_lock(&cadet_io_lock); | 229 | spin_lock(&cadet_io_lock); |
230 | outb(7,io); /* Select tuner control */ | 230 | outb(7,io); /* Select tuner control */ |
231 | curvol=inb(io+1); | 231 | curvol=inb(io+1); |
232 | spin_unlock(&cadet_io_lock); | 232 | spin_unlock(&cadet_io_lock); |
233 | 233 | ||
234 | /* | 234 | /* |
235 | * Tune the card | 235 | * Tune the card |
236 | */ | 236 | */ |
237 | for(j=3;j>-1;j--) { | 237 | for(j=3;j>-1;j--) { |
238 | cadet_settune(fifo|(j<<16)); | 238 | cadet_settune(fifo|(j<<16)); |
239 | 239 | ||
240 | spin_lock(&cadet_io_lock); | 240 | spin_lock(&cadet_io_lock); |
241 | outb(7,io); /* Select tuner control */ | 241 | outb(7,io); /* Select tuner control */ |
242 | outb(curvol,io+1); | 242 | outb(curvol,io+1); |
243 | spin_unlock(&cadet_io_lock); | 243 | spin_unlock(&cadet_io_lock); |
244 | 244 | ||
245 | msleep(100); | 245 | msleep(100); |
246 | 246 | ||
247 | cadet_gettune(); | 247 | cadet_gettune(); |
248 | if((tunestat & 0x40) == 0) { /* Tuned */ | 248 | if((tunestat & 0x40) == 0) { /* Tuned */ |
249 | sigstrength=sigtable[curtuner][j]; | 249 | sigstrength=sigtable[curtuner][j]; |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | } | 252 | } |
@@ -257,28 +257,28 @@ static void cadet_setfreq(unsigned freq) | |||
257 | static int cadet_getvol(void) | 257 | static int cadet_getvol(void) |
258 | { | 258 | { |
259 | int ret = 0; | 259 | int ret = 0; |
260 | 260 | ||
261 | spin_lock(&cadet_io_lock); | 261 | spin_lock(&cadet_io_lock); |
262 | 262 | ||
263 | outb(7,io); /* Select tuner control */ | 263 | outb(7,io); /* Select tuner control */ |
264 | if((inb(io + 1) & 0x20) != 0) | 264 | if((inb(io + 1) & 0x20) != 0) |
265 | ret = 0xffff; | 265 | ret = 0xffff; |
266 | 266 | ||
267 | spin_unlock(&cadet_io_lock); | 267 | spin_unlock(&cadet_io_lock); |
268 | return ret; | 268 | return ret; |
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
272 | static void cadet_setvol(int vol) | 272 | static void cadet_setvol(int vol) |
273 | { | 273 | { |
274 | spin_lock(&cadet_io_lock); | 274 | spin_lock(&cadet_io_lock); |
275 | outb(7,io); /* Select tuner control */ | 275 | outb(7,io); /* Select tuner control */ |
276 | if(vol>0) | 276 | if(vol>0) |
277 | outb(0x20,io+1); | 277 | outb(0x20,io+1); |
278 | else | 278 | else |
279 | outb(0x00,io+1); | 279 | outb(0x00,io+1); |
280 | spin_unlock(&cadet_io_lock); | 280 | spin_unlock(&cadet_io_lock); |
281 | } | 281 | } |
282 | 282 | ||
283 | static void cadet_handler(unsigned long data) | 283 | static void cadet_handler(unsigned long data) |
284 | { | 284 | { |
@@ -288,15 +288,15 @@ static void cadet_handler(unsigned long data) | |||
288 | 288 | ||
289 | if(spin_trylock(&cadet_io_lock)) | 289 | if(spin_trylock(&cadet_io_lock)) |
290 | { | 290 | { |
291 | outb(0x3,io); /* Select RDS Decoder Control */ | 291 | outb(0x3,io); /* Select RDS Decoder Control */ |
292 | if((inb(io+1)&0x20)!=0) { | 292 | if((inb(io+1)&0x20)!=0) { |
293 | printk(KERN_CRIT "cadet: RDS fifo overflow\n"); | 293 | printk(KERN_CRIT "cadet: RDS fifo overflow\n"); |
294 | } | 294 | } |
295 | outb(0x80,io); /* Select RDS fifo */ | 295 | outb(0x80,io); /* Select RDS fifo */ |
296 | while((inb(io)&0x80)!=0) { | 296 | while((inb(io)&0x80)!=0) { |
297 | rdsbuf[rdsin]=inb(io+1); | 297 | rdsbuf[rdsin]=inb(io+1); |
298 | if(rdsin==rdsout) | 298 | if(rdsin==rdsout) |
299 | printk(KERN_WARNING "cadet: RDS buffer overflow\n"); | 299 | printk(KERN_WARNING "cadet: RDS buffer overflow\n"); |
300 | else | 300 | else |
301 | rdsin++; | 301 | rdsin++; |
302 | } | 302 | } |
@@ -307,9 +307,9 @@ static void cadet_handler(unsigned long data) | |||
307 | * Service pending read | 307 | * Service pending read |
308 | */ | 308 | */ |
309 | if( rdsin!=rdsout) | 309 | if( rdsin!=rdsout) |
310 | wake_up_interruptible(&read_queue); | 310 | wake_up_interruptible(&read_queue); |
311 | 311 | ||
312 | /* | 312 | /* |
313 | * Clean up and exit | 313 | * Clean up and exit |
314 | */ | 314 | */ |
315 | init_timer(&readtimer); | 315 | init_timer(&readtimer); |
@@ -324,12 +324,12 @@ static void cadet_handler(unsigned long data) | |||
324 | static ssize_t cadet_read(struct file *file, char __user *data, | 324 | static ssize_t cadet_read(struct file *file, char __user *data, |
325 | size_t count, loff_t *ppos) | 325 | size_t count, loff_t *ppos) |
326 | { | 326 | { |
327 | int i=0; | 327 | int i=0; |
328 | unsigned char readbuf[RDS_BUFFER]; | 328 | unsigned char readbuf[RDS_BUFFER]; |
329 | 329 | ||
330 | if(rdsstat==0) { | 330 | if(rdsstat==0) { |
331 | spin_lock(&cadet_io_lock); | 331 | spin_lock(&cadet_io_lock); |
332 | rdsstat=1; | 332 | rdsstat=1; |
333 | outb(0x80,io); /* Select RDS fifo */ | 333 | outb(0x80,io); /* Select RDS fifo */ |
334 | spin_unlock(&cadet_io_lock); | 334 | spin_unlock(&cadet_io_lock); |
335 | init_timer(&readtimer); | 335 | init_timer(&readtimer); |
@@ -339,15 +339,15 @@ static ssize_t cadet_read(struct file *file, char __user *data, | |||
339 | add_timer(&readtimer); | 339 | add_timer(&readtimer); |
340 | } | 340 | } |
341 | if(rdsin==rdsout) { | 341 | if(rdsin==rdsout) { |
342 | if (file->f_flags & O_NONBLOCK) | 342 | if (file->f_flags & O_NONBLOCK) |
343 | return -EWOULDBLOCK; | 343 | return -EWOULDBLOCK; |
344 | interruptible_sleep_on(&read_queue); | 344 | interruptible_sleep_on(&read_queue); |
345 | } | 345 | } |
346 | while( i<count && rdsin!=rdsout) | 346 | while( i<count && rdsin!=rdsout) |
347 | readbuf[i++]=rdsbuf[rdsout++]; | 347 | readbuf[i++]=rdsbuf[rdsout++]; |
348 | 348 | ||
349 | if (copy_to_user(data,readbuf,i)) | 349 | if (copy_to_user(data,readbuf,i)) |
350 | return -EFAULT; | 350 | return -EFAULT; |
351 | return i; | 351 | return i; |
352 | } | 352 | } |
353 | 353 | ||
@@ -375,29 +375,29 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file, | |||
375 | return -EINVAL; | 375 | return -EINVAL; |
376 | } | 376 | } |
377 | switch(v->tuner) { | 377 | switch(v->tuner) { |
378 | case 0: | 378 | case 0: |
379 | strcpy(v->name,"FM"); | 379 | strcpy(v->name,"FM"); |
380 | v->rangelow=1400; /* 87.5 MHz */ | 380 | v->rangelow=1400; /* 87.5 MHz */ |
381 | v->rangehigh=1728; /* 108.0 MHz */ | 381 | v->rangehigh=1728; /* 108.0 MHz */ |
382 | v->flags=0; | 382 | v->flags=0; |
383 | v->mode=0; | 383 | v->mode=0; |
384 | v->mode|=VIDEO_MODE_AUTO; | 384 | v->mode|=VIDEO_MODE_AUTO; |
385 | v->signal=sigstrength; | 385 | v->signal=sigstrength; |
386 | if(cadet_getstereo()==1) { | 386 | if(cadet_getstereo()==1) { |
387 | v->flags|=VIDEO_TUNER_STEREO_ON; | 387 | v->flags|=VIDEO_TUNER_STEREO_ON; |
388 | } | 388 | } |
389 | v->flags|=cadet_getrds(); | 389 | v->flags|=cadet_getrds(); |
390 | break; | 390 | break; |
391 | case 1: | 391 | case 1: |
392 | strcpy(v->name,"AM"); | 392 | strcpy(v->name,"AM"); |
393 | v->rangelow=8320; /* 520 kHz */ | 393 | v->rangelow=8320; /* 520 kHz */ |
394 | v->rangehigh=26400; /* 1650 kHz */ | 394 | v->rangehigh=26400; /* 1650 kHz */ |
395 | v->flags=0; | 395 | v->flags=0; |
396 | v->flags|=VIDEO_TUNER_LOW; | 396 | v->flags|=VIDEO_TUNER_LOW; |
397 | v->mode=0; | 397 | v->mode=0; |
398 | v->mode|=VIDEO_MODE_AUTO; | 398 | v->mode|=VIDEO_MODE_AUTO; |
399 | v->signal=sigstrength; | 399 | v->signal=sigstrength; |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
@@ -407,49 +407,49 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file, | |||
407 | if((v->tuner<0)||(v->tuner>1)) { | 407 | if((v->tuner<0)||(v->tuner>1)) { |
408 | return -EINVAL; | 408 | return -EINVAL; |
409 | } | 409 | } |
410 | curtuner=v->tuner; | 410 | curtuner=v->tuner; |
411 | return 0; | 411 | return 0; |
412 | } | 412 | } |
413 | case VIDIOCGFREQ: | 413 | case VIDIOCGFREQ: |
414 | { | 414 | { |
415 | unsigned long *freq = arg; | 415 | unsigned long *freq = arg; |
416 | *freq = cadet_getfreq(); | 416 | *freq = cadet_getfreq(); |
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | case VIDIOCSFREQ: | 419 | case VIDIOCSFREQ: |
420 | { | 420 | { |
421 | unsigned long *freq = arg; | 421 | unsigned long *freq = arg; |
422 | if((curtuner==0)&&((*freq<1400)||(*freq>1728))) { | 422 | if((curtuner==0)&&((*freq<1400)||(*freq>1728))) { |
423 | return -EINVAL; | 423 | return -EINVAL; |
424 | } | 424 | } |
425 | if((curtuner==1)&&((*freq<8320)||(*freq>26400))) { | 425 | if((curtuner==1)&&((*freq<8320)||(*freq>26400))) { |
426 | return -EINVAL; | 426 | return -EINVAL; |
427 | } | 427 | } |
428 | cadet_setfreq(*freq); | 428 | cadet_setfreq(*freq); |
429 | return 0; | 429 | return 0; |
430 | } | 430 | } |
431 | case VIDIOCGAUDIO: | 431 | case VIDIOCGAUDIO: |
432 | { | 432 | { |
433 | struct video_audio *v = arg; | 433 | struct video_audio *v = arg; |
434 | memset(v,0, sizeof(*v)); | 434 | memset(v,0, sizeof(*v)); |
435 | v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; | 435 | v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; |
436 | if(cadet_getstereo()==0) { | 436 | if(cadet_getstereo()==0) { |
437 | v->mode=VIDEO_SOUND_MONO; | 437 | v->mode=VIDEO_SOUND_MONO; |
438 | } else { | 438 | } else { |
439 | v->mode=VIDEO_SOUND_STEREO; | 439 | v->mode=VIDEO_SOUND_STEREO; |
440 | } | 440 | } |
441 | v->volume=cadet_getvol(); | 441 | v->volume=cadet_getvol(); |
442 | v->step=0xffff; | 442 | v->step=0xffff; |
443 | strcpy(v->name, "Radio"); | 443 | strcpy(v->name, "Radio"); |
444 | return 0; | 444 | return 0; |
445 | } | 445 | } |
446 | case VIDIOCSAUDIO: | 446 | case VIDIOCSAUDIO: |
447 | { | 447 | { |
448 | struct video_audio *v = arg; | 448 | struct video_audio *v = arg; |
449 | if(v->audio) | 449 | if(v->audio) |
450 | return -EINVAL; | 450 | return -EINVAL; |
451 | cadet_setvol(v->volume); | 451 | cadet_setvol(v->volume); |
452 | if(v->flags&VIDEO_AUDIO_MUTE) | 452 | if(v->flags&VIDEO_AUDIO_MUTE) |
453 | cadet_setvol(0); | 453 | cadet_setvol(0); |
454 | else | 454 | else |
455 | cadet_setvol(0xffff); | 455 | cadet_setvol(0xffff); |
@@ -539,16 +539,16 @@ static struct pnp_driver cadet_pnp_driver = { | |||
539 | 539 | ||
540 | static int cadet_probe(void) | 540 | static int cadet_probe(void) |
541 | { | 541 | { |
542 | static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e}; | 542 | static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e}; |
543 | int i; | 543 | int i; |
544 | 544 | ||
545 | for(i=0;i<8;i++) { | 545 | for(i=0;i<8;i++) { |
546 | io=iovals[i]; | 546 | io=iovals[i]; |
547 | if (request_region(io, 2, "cadet-probe")) { | 547 | if (request_region(io, 2, "cadet-probe")) { |
548 | cadet_setfreq(1410); | 548 | cadet_setfreq(1410); |
549 | if(cadet_getfreq()==1410) { | 549 | if(cadet_getfreq()==1410) { |
550 | release_region(io, 2); | 550 | release_region(io, 2); |
551 | return io; | 551 | return io; |
552 | } | 552 | } |
553 | release_region(io, 2); | 553 | release_region(io, 2); |
554 | } | 554 | } |
@@ -556,7 +556,7 @@ static int cadet_probe(void) | |||
556 | return -1; | 556 | return -1; |
557 | } | 557 | } |
558 | 558 | ||
559 | /* | 559 | /* |
560 | * io should only be set if the user has used something like | 560 | * io should only be set if the user has used something like |
561 | * isapnp (the userspace program) to initialize this card for us | 561 | * isapnp (the userspace program) to initialize this card for us |
562 | */ | 562 | */ |
@@ -564,7 +564,7 @@ static int cadet_probe(void) | |||
564 | static int __init cadet_init(void) | 564 | static int __init cadet_init(void) |
565 | { | 565 | { |
566 | spin_lock_init(&cadet_io_lock); | 566 | spin_lock_init(&cadet_io_lock); |
567 | 567 | ||
568 | /* | 568 | /* |
569 | * If a probe was requested then probe ISAPnP first (safest) | 569 | * If a probe was requested then probe ISAPnP first (safest) |
570 | */ | 570 | */ |
@@ -579,12 +579,12 @@ static int __init cadet_init(void) | |||
579 | /* | 579 | /* |
580 | * Else we bail out | 580 | * Else we bail out |
581 | */ | 581 | */ |
582 | 582 | ||
583 | if(io < 0) { | 583 | if(io < 0) { |
584 | #ifdef MODULE | 584 | #ifdef MODULE |
585 | printk(KERN_ERR "You must set an I/O address with io=0x???\n"); | 585 | printk(KERN_ERR "You must set an I/O address with io=0x???\n"); |
586 | #endif | 586 | #endif |
587 | goto fail; | 587 | goto fail; |
588 | } | 588 | } |
589 | if (!request_region(io,2,"cadet")) | 589 | if (!request_region(io,2,"cadet")) |
590 | goto fail; | 590 | goto fail; |