aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-cadet.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:09:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:09:31 -0400
commit25581ad107be24b89d805da51a03d616f8f3d1be (patch)
tree36e2bd32667b5dd5a39e1939c1c5162f18967715 /drivers/media/radio/radio-cadet.c
parent72cf2709bf8e0410800f118c4298bfbf8715b303 (diff)
parent7477ddaa4d2d69bbcd49e12990af158dbb03f2f2 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (244 commits) V4L/DVB (4210b): git-dvb: tea575x-tuner build fix V4L/DVB (4210a): git-dvb versus matroxfb V4L/DVB (4209): Added some BTTV PCI IDs for newer boards Fixes some sync issues between V4L/DVB development and GIT V4L/DVB (4206): Cx88-blackbird: always set encoder height based on tvnorm->id V4L/DVB (4205): Merge tda9887 module into tuner. V4L/DVB (4203): Explicitly set the enum values. V4L/DVB (4202): allow selecting CX2341x port mode V4L/DVB (4200): Disable bitrate_mode when encoding mpeg-1. V4L/DVB (4199): Add cx2341x-specific control array to cx2341x.c V4L/DVB (4198): Avoid newer usages of obsoleted experimental MPEGCOMP API V4L/DVB (4197): Port new MPEG API to saa7134-empress with saa6752hs V4L/DVB (4196): Port cx88-blackbird to the new MPEG API. V4L/DVB (4193): Update cx2341x fw encoding API doc. V4L/DVB (4192): Use control helpers for saa7115, cx25840, msp3400. V4L/DVB (4191): Add CX2341X MPEG encoder module. V4L/DVB (4190): Add helper functions for control processing to v4l2-common. V4L/DVB (4189): Add videodev support for VIDIOC_S/G/TRY_EXT_CTRLS. V4L/DVB (4188): Add new MPEG control/ioctl definitions to videodev2.h V4L/DVB (4186): Add support for the DNTV Live! mini DVB-T card. ...
Diffstat (limited to 'drivers/media/radio/radio-cadet.c')
-rw-r--r--drivers/media/radio/radio-cadet.c317
1 files changed, 159 insertions, 158 deletions
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index f1b5ac81e9d..8641aec7baf 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 *
@@ -34,6 +34,7 @@
34#include <asm/io.h> /* outb, outb_p */ 34#include <asm/io.h> /* outb, outb_p */
35#include <asm/uaccess.h> /* copy to/from user */ 35#include <asm/uaccess.h> /* copy to/from user */
36#include <linux/videodev.h> /* kernel radio structs */ 36#include <linux/videodev.h> /* kernel radio structs */
37#include <media/v4l2-common.h>
37#include <linux/param.h> 38#include <linux/param.h>
38#include <linux/pnp.h> 39#include <linux/pnp.h>
39 40
@@ -55,29 +56,29 @@ static int cadet_probe(void);
55 56
56/* 57/*
57 * Signal Strength Threshold Values 58 * Signal Strength Threshold Values
58 * The V4L API spec does not define any particular unit for the signal 59 * 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. 60 * strength value. These values are in microvolts of RF at the tuner's input.
60 */ 61 */
61static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}}; 62static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}};
62 63
63static int cadet_getrds(void) 64static int cadet_getrds(void)
64{ 65{
65 int rdsstat=0; 66 int rdsstat=0;
66 67
67 spin_lock(&cadet_io_lock); 68 spin_lock(&cadet_io_lock);
68 outb(3,io); /* Select Decoder Control/Status */ 69 outb(3,io); /* Select Decoder Control/Status */
69 outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */ 70 outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */
70 spin_unlock(&cadet_io_lock); 71 spin_unlock(&cadet_io_lock);
71 72
72 msleep(100); 73 msleep(100);
73 74
74 spin_lock(&cadet_io_lock); 75 spin_lock(&cadet_io_lock);
75 outb(3,io); /* Select Decoder Control/Status */ 76 outb(3,io); /* Select Decoder Control/Status */
76 if((inb(io+1)&0x80)!=0) { 77 if((inb(io+1)&0x80)!=0) {
77 rdsstat|=VIDEO_TUNER_RDS_ON; 78 rdsstat|=VIDEO_TUNER_RDS_ON;
78 } 79 }
79 if((inb(io+1)&0x10)!=0) { 80 if((inb(io+1)&0x10)!=0) {
80 rdsstat|=VIDEO_TUNER_MBS_ON; 81 rdsstat|=VIDEO_TUNER_MBS_ON;
81 } 82 }
82 spin_unlock(&cadet_io_lock); 83 spin_unlock(&cadet_io_lock);
83 return rdsstat; 84 return rdsstat;
@@ -86,49 +87,49 @@ static int cadet_getrds(void)
86static int cadet_getstereo(void) 87static int cadet_getstereo(void)
87{ 88{
88 int ret = 0; 89 int ret = 0;
89 if(curtuner != 0) /* Only FM has stereo capability! */ 90 if(curtuner != 0) /* Only FM has stereo capability! */
90 return 0; 91 return 0;
91 92
92 spin_lock(&cadet_io_lock); 93 spin_lock(&cadet_io_lock);
93 outb(7,io); /* Select tuner control */ 94 outb(7,io); /* Select tuner control */
94 if( (inb(io+1) & 0x40) == 0) 95 if( (inb(io+1) & 0x40) == 0)
95 ret = 1; 96 ret = 1;
96 spin_unlock(&cadet_io_lock); 97 spin_unlock(&cadet_io_lock);
97 return ret; 98 return ret;
98} 99}
99 100
100static unsigned cadet_gettune(void) 101static unsigned cadet_gettune(void)
101{ 102{
102 int curvol,i; 103 int curvol,i;
103 unsigned fifo=0; 104 unsigned fifo=0;
104 105
105 /* 106 /*
106 * Prepare for read 107 * Prepare for read
107 */ 108 */
108 109
109 spin_lock(&cadet_io_lock); 110 spin_lock(&cadet_io_lock);
110 111
111 outb(7,io); /* Select tuner control */ 112 outb(7,io); /* Select tuner control */
112 curvol=inb(io+1); /* Save current volume/mute setting */ 113 curvol=inb(io+1); /* Save current volume/mute setting */
113 outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */ 114 outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */
114 tunestat=0xffff; 115 tunestat=0xffff;
115 116
116 /* 117 /*
117 * Read the shift register 118 * Read the shift register
118 */ 119 */
119 for(i=0;i<25;i++) { 120 for(i=0;i<25;i++) {
120 fifo=(fifo<<1)|((inb(io+1)>>7)&0x01); 121 fifo=(fifo<<1)|((inb(io+1)>>7)&0x01);
121 if(i<24) { 122 if(i<24) {
122 outb(0x01,io+1); 123 outb(0x01,io+1);
123 tunestat&=inb(io+1); 124 tunestat&=inb(io+1);
124 outb(0x00,io+1); 125 outb(0x00,io+1);
125 } 126 }
126 } 127 }
127 128
128 /* 129 /*
129 * Restore volume/mute setting 130 * Restore volume/mute setting
130 */ 131 */
131 outb(curvol,io+1); 132 outb(curvol,io+1);
132 spin_unlock(&cadet_io_lock); 133 spin_unlock(&cadet_io_lock);
133 134
134 return fifo; 135 return fifo;
@@ -136,43 +137,43 @@ static unsigned cadet_gettune(void)
136 137
137static unsigned cadet_getfreq(void) 138static unsigned cadet_getfreq(void)
138{ 139{
139 int i; 140 int i;
140 unsigned freq=0,test,fifo=0; 141 unsigned freq=0,test,fifo=0;
141 142
142 /* 143 /*
143 * Read current tuning 144 * Read current tuning
144 */ 145 */
145 fifo=cadet_gettune(); 146 fifo=cadet_gettune();
146 147
147 /* 148 /*
148 * Convert to actual frequency 149 * Convert to actual frequency
149 */ 150 */
150 if(curtuner==0) { /* FM */ 151 if(curtuner==0) { /* FM */
151 test=12500; 152 test=12500;
152 for(i=0;i<14;i++) { 153 for(i=0;i<14;i++) {
153 if((fifo&0x01)!=0) { 154 if((fifo&0x01)!=0) {
154 freq+=test; 155 freq+=test;
155 } 156 }
156 test=test<<1; 157 test=test<<1;
157 fifo=fifo>>1; 158 fifo=fifo>>1;
158 } 159 }
159 freq-=10700000; /* IF frequency is 10.7 MHz */ 160 freq-=10700000; /* IF frequency is 10.7 MHz */
160 freq=(freq*16)/1000000; /* Make it 1/16 MHz */ 161 freq=(freq*16)/1000000; /* Make it 1/16 MHz */
161 } 162 }
162 if(curtuner==1) { /* AM */ 163 if(curtuner==1) { /* AM */
163 freq=((fifo&0x7fff)-2010)*16; 164 freq=((fifo&0x7fff)-2010)*16;
164 } 165 }
165 166
166 return freq; 167 return freq;
167} 168}
168 169
169static void cadet_settune(unsigned fifo) 170static void cadet_settune(unsigned fifo)
170{ 171{
171 int i; 172 int i;
172 unsigned test; 173 unsigned test;
173 174
174 spin_lock(&cadet_io_lock); 175 spin_lock(&cadet_io_lock);
175 176
176 outb(7,io); /* Select tuner control */ 177 outb(7,io); /* Select tuner control */
177 /* 178 /*
178 * Write the shift register 179 * Write the shift register
@@ -183,7 +184,7 @@ static void cadet_settune(unsigned fifo)
183 outb(7,io); /* Select tuner control */ 184 outb(7,io); /* Select tuner control */
184 outb(test,io+1); /* Initialize for write */ 185 outb(test,io+1); /* Initialize for write */
185 for(i=0;i<25;i++) { 186 for(i=0;i<25;i++) {
186 test|=0x01; /* Toggle SCK High */ 187 test|=0x01; /* Toggle SCK High */
187 outb(test,io+1); 188 outb(test,io+1);
188 test&=0xfe; /* Toggle SCK Low */ 189 test&=0xfe; /* Toggle SCK Low */
189 outb(test,io+1); 190 outb(test,io+1);
@@ -196,57 +197,57 @@ static void cadet_settune(unsigned fifo)
196 197
197static void cadet_setfreq(unsigned freq) 198static void cadet_setfreq(unsigned freq)
198{ 199{
199 unsigned fifo; 200 unsigned fifo;
200 int i,j,test; 201 int i,j,test;
201 int curvol; 202 int curvol;
202 203
203 /* 204 /*
204 * Formulate a fifo command 205 * Formulate a fifo command
205 */ 206 */
206 fifo=0; 207 fifo=0;
207 if(curtuner==0) { /* FM */ 208 if(curtuner==0) { /* FM */
208 test=102400; 209 test=102400;
209 freq=(freq*1000)/16; /* Make it kHz */ 210 freq=(freq*1000)/16; /* Make it kHz */
210 freq+=10700; /* IF is 10700 kHz */ 211 freq+=10700; /* IF is 10700 kHz */
211 for(i=0;i<14;i++) { 212 for(i=0;i<14;i++) {
212 fifo=fifo<<1; 213 fifo=fifo<<1;
213 if(freq>=test) { 214 if(freq>=test) {
214 fifo|=0x01; 215 fifo|=0x01;
215 freq-=test; 216 freq-=test;
216 } 217 }
217 test=test>>1; 218 test=test>>1;
218 } 219 }
219 } 220 }
220 if(curtuner==1) { /* AM */ 221 if(curtuner==1) { /* AM */
221 fifo=(freq/16)+2010; /* Make it kHz */ 222 fifo=(freq/16)+2010; /* Make it kHz */
222 fifo|=0x100000; /* Select AM Band */ 223 fifo|=0x100000; /* Select AM Band */
223 } 224 }
224 225
225 /* 226 /*
226 * Save current volume/mute setting 227 * Save current volume/mute setting
227 */ 228 */
228 229
229 spin_lock(&cadet_io_lock); 230 spin_lock(&cadet_io_lock);
230 outb(7,io); /* Select tuner control */ 231 outb(7,io); /* Select tuner control */
231 curvol=inb(io+1); 232 curvol=inb(io+1);
232 spin_unlock(&cadet_io_lock); 233 spin_unlock(&cadet_io_lock);
233 234
234 /* 235 /*
235 * Tune the card 236 * Tune the card
236 */ 237 */
237 for(j=3;j>-1;j--) { 238 for(j=3;j>-1;j--) {
238 cadet_settune(fifo|(j<<16)); 239 cadet_settune(fifo|(j<<16));
239 240
240 spin_lock(&cadet_io_lock); 241 spin_lock(&cadet_io_lock);
241 outb(7,io); /* Select tuner control */ 242 outb(7,io); /* Select tuner control */
242 outb(curvol,io+1); 243 outb(curvol,io+1);
243 spin_unlock(&cadet_io_lock); 244 spin_unlock(&cadet_io_lock);
244 245
245 msleep(100); 246 msleep(100);
246 247
247 cadet_gettune(); 248 cadet_gettune();
248 if((tunestat & 0x40) == 0) { /* Tuned */ 249 if((tunestat & 0x40) == 0) { /* Tuned */
249 sigstrength=sigtable[curtuner][j]; 250 sigstrength=sigtable[curtuner][j];
250 return; 251 return;
251 } 252 }
252 } 253 }
@@ -257,28 +258,28 @@ static void cadet_setfreq(unsigned freq)
257static int cadet_getvol(void) 258static int cadet_getvol(void)
258{ 259{
259 int ret = 0; 260 int ret = 0;
260 261
261 spin_lock(&cadet_io_lock); 262 spin_lock(&cadet_io_lock);
262 263
263 outb(7,io); /* Select tuner control */ 264 outb(7,io); /* Select tuner control */
264 if((inb(io + 1) & 0x20) != 0) 265 if((inb(io + 1) & 0x20) != 0)
265 ret = 0xffff; 266 ret = 0xffff;
266 267
267 spin_unlock(&cadet_io_lock); 268 spin_unlock(&cadet_io_lock);
268 return ret; 269 return ret;
269} 270}
270 271
271 272
272static void cadet_setvol(int vol) 273static void cadet_setvol(int vol)
273{ 274{
274 spin_lock(&cadet_io_lock); 275 spin_lock(&cadet_io_lock);
275 outb(7,io); /* Select tuner control */ 276 outb(7,io); /* Select tuner control */
276 if(vol>0) 277 if(vol>0)
277 outb(0x20,io+1); 278 outb(0x20,io+1);
278 else 279 else
279 outb(0x00,io+1); 280 outb(0x00,io+1);
280 spin_unlock(&cadet_io_lock); 281 spin_unlock(&cadet_io_lock);
281} 282}
282 283
283static void cadet_handler(unsigned long data) 284static void cadet_handler(unsigned long data)
284{ 285{
@@ -288,15 +289,15 @@ static void cadet_handler(unsigned long data)
288 289
289 if(spin_trylock(&cadet_io_lock)) 290 if(spin_trylock(&cadet_io_lock))
290 { 291 {
291 outb(0x3,io); /* Select RDS Decoder Control */ 292 outb(0x3,io); /* Select RDS Decoder Control */
292 if((inb(io+1)&0x20)!=0) { 293 if((inb(io+1)&0x20)!=0) {
293 printk(KERN_CRIT "cadet: RDS fifo overflow\n"); 294 printk(KERN_CRIT "cadet: RDS fifo overflow\n");
294 } 295 }
295 outb(0x80,io); /* Select RDS fifo */ 296 outb(0x80,io); /* Select RDS fifo */
296 while((inb(io)&0x80)!=0) { 297 while((inb(io)&0x80)!=0) {
297 rdsbuf[rdsin]=inb(io+1); 298 rdsbuf[rdsin]=inb(io+1);
298 if(rdsin==rdsout) 299 if(rdsin==rdsout)
299 printk(KERN_WARNING "cadet: RDS buffer overflow\n"); 300 printk(KERN_WARNING "cadet: RDS buffer overflow\n");
300 else 301 else
301 rdsin++; 302 rdsin++;
302 } 303 }
@@ -307,9 +308,9 @@ static void cadet_handler(unsigned long data)
307 * Service pending read 308 * Service pending read
308 */ 309 */
309 if( rdsin!=rdsout) 310 if( rdsin!=rdsout)
310 wake_up_interruptible(&read_queue); 311 wake_up_interruptible(&read_queue);
311 312
312 /* 313 /*
313 * Clean up and exit 314 * Clean up and exit
314 */ 315 */
315 init_timer(&readtimer); 316 init_timer(&readtimer);
@@ -324,12 +325,12 @@ static void cadet_handler(unsigned long data)
324static ssize_t cadet_read(struct file *file, char __user *data, 325static ssize_t cadet_read(struct file *file, char __user *data,
325 size_t count, loff_t *ppos) 326 size_t count, loff_t *ppos)
326{ 327{
327 int i=0; 328 int i=0;
328 unsigned char readbuf[RDS_BUFFER]; 329 unsigned char readbuf[RDS_BUFFER];
329 330
330 if(rdsstat==0) { 331 if(rdsstat==0) {
331 spin_lock(&cadet_io_lock); 332 spin_lock(&cadet_io_lock);
332 rdsstat=1; 333 rdsstat=1;
333 outb(0x80,io); /* Select RDS fifo */ 334 outb(0x80,io); /* Select RDS fifo */
334 spin_unlock(&cadet_io_lock); 335 spin_unlock(&cadet_io_lock);
335 init_timer(&readtimer); 336 init_timer(&readtimer);
@@ -339,15 +340,15 @@ static ssize_t cadet_read(struct file *file, char __user *data,
339 add_timer(&readtimer); 340 add_timer(&readtimer);
340 } 341 }
341 if(rdsin==rdsout) { 342 if(rdsin==rdsout) {
342 if (file->f_flags & O_NONBLOCK) 343 if (file->f_flags & O_NONBLOCK)
343 return -EWOULDBLOCK; 344 return -EWOULDBLOCK;
344 interruptible_sleep_on(&read_queue); 345 interruptible_sleep_on(&read_queue);
345 } 346 }
346 while( i<count && rdsin!=rdsout) 347 while( i<count && rdsin!=rdsout)
347 readbuf[i++]=rdsbuf[rdsout++]; 348 readbuf[i++]=rdsbuf[rdsout++];
348 349
349 if (copy_to_user(data,readbuf,i)) 350 if (copy_to_user(data,readbuf,i))
350 return -EFAULT; 351 return -EFAULT;
351 return i; 352 return i;
352} 353}
353 354
@@ -375,29 +376,29 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file,
375 return -EINVAL; 376 return -EINVAL;
376 } 377 }
377 switch(v->tuner) { 378 switch(v->tuner) {
378 case 0: 379 case 0:
379 strcpy(v->name,"FM"); 380 strcpy(v->name,"FM");
380 v->rangelow=1400; /* 87.5 MHz */ 381 v->rangelow=1400; /* 87.5 MHz */
381 v->rangehigh=1728; /* 108.0 MHz */ 382 v->rangehigh=1728; /* 108.0 MHz */
382 v->flags=0; 383 v->flags=0;
383 v->mode=0; 384 v->mode=0;
384 v->mode|=VIDEO_MODE_AUTO; 385 v->mode|=VIDEO_MODE_AUTO;
385 v->signal=sigstrength; 386 v->signal=sigstrength;
386 if(cadet_getstereo()==1) { 387 if(cadet_getstereo()==1) {
387 v->flags|=VIDEO_TUNER_STEREO_ON; 388 v->flags|=VIDEO_TUNER_STEREO_ON;
388 } 389 }
389 v->flags|=cadet_getrds(); 390 v->flags|=cadet_getrds();
390 break; 391 break;
391 case 1: 392 case 1:
392 strcpy(v->name,"AM"); 393 strcpy(v->name,"AM");
393 v->rangelow=8320; /* 520 kHz */ 394 v->rangelow=8320; /* 520 kHz */
394 v->rangehigh=26400; /* 1650 kHz */ 395 v->rangehigh=26400; /* 1650 kHz */
395 v->flags=0; 396 v->flags=0;
396 v->flags|=VIDEO_TUNER_LOW; 397 v->flags|=VIDEO_TUNER_LOW;
397 v->mode=0; 398 v->mode=0;
398 v->mode|=VIDEO_MODE_AUTO; 399 v->mode|=VIDEO_MODE_AUTO;
399 v->signal=sigstrength; 400 v->signal=sigstrength;
400 break; 401 break;
401 } 402 }
402 return 0; 403 return 0;
403 } 404 }
@@ -407,49 +408,49 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file,
407 if((v->tuner<0)||(v->tuner>1)) { 408 if((v->tuner<0)||(v->tuner>1)) {
408 return -EINVAL; 409 return -EINVAL;
409 } 410 }
410 curtuner=v->tuner; 411 curtuner=v->tuner;
411 return 0; 412 return 0;
412 } 413 }
413 case VIDIOCGFREQ: 414 case VIDIOCGFREQ:
414 { 415 {
415 unsigned long *freq = arg; 416 unsigned long *freq = arg;
416 *freq = cadet_getfreq(); 417 *freq = cadet_getfreq();
417 return 0; 418 return 0;
418 } 419 }
419 case VIDIOCSFREQ: 420 case VIDIOCSFREQ:
420 { 421 {
421 unsigned long *freq = arg; 422 unsigned long *freq = arg;
422 if((curtuner==0)&&((*freq<1400)||(*freq>1728))) { 423 if((curtuner==0)&&((*freq<1400)||(*freq>1728))) {
423 return -EINVAL; 424 return -EINVAL;
424 } 425 }
425 if((curtuner==1)&&((*freq<8320)||(*freq>26400))) { 426 if((curtuner==1)&&((*freq<8320)||(*freq>26400))) {
426 return -EINVAL; 427 return -EINVAL;
427 } 428 }
428 cadet_setfreq(*freq); 429 cadet_setfreq(*freq);
429 return 0; 430 return 0;
430 } 431 }
431 case VIDIOCGAUDIO: 432 case VIDIOCGAUDIO:
432 { 433 {
433 struct video_audio *v = arg; 434 struct video_audio *v = arg;
434 memset(v,0, sizeof(*v)); 435 memset(v,0, sizeof(*v));
435 v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; 436 v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
436 if(cadet_getstereo()==0) { 437 if(cadet_getstereo()==0) {
437 v->mode=VIDEO_SOUND_MONO; 438 v->mode=VIDEO_SOUND_MONO;
438 } else { 439 } else {
439 v->mode=VIDEO_SOUND_STEREO; 440 v->mode=VIDEO_SOUND_STEREO;
440 } 441 }
441 v->volume=cadet_getvol(); 442 v->volume=cadet_getvol();
442 v->step=0xffff; 443 v->step=0xffff;
443 strcpy(v->name, "Radio"); 444 strcpy(v->name, "Radio");
444 return 0; 445 return 0;
445 } 446 }
446 case VIDIOCSAUDIO: 447 case VIDIOCSAUDIO:
447 { 448 {
448 struct video_audio *v = arg; 449 struct video_audio *v = arg;
449 if(v->audio) 450 if(v->audio)
450 return -EINVAL; 451 return -EINVAL;
451 cadet_setvol(v->volume); 452 cadet_setvol(v->volume);
452 if(v->flags&VIDEO_AUDIO_MUTE) 453 if(v->flags&VIDEO_AUDIO_MUTE)
453 cadet_setvol(0); 454 cadet_setvol(0);
454 else 455 else
455 cadet_setvol(0xffff); 456 cadet_setvol(0xffff);
@@ -539,16 +540,16 @@ static struct pnp_driver cadet_pnp_driver = {
539 540
540static int cadet_probe(void) 541static int cadet_probe(void)
541{ 542{
542 static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e}; 543 static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
543 int i; 544 int i;
544 545
545 for(i=0;i<8;i++) { 546 for(i=0;i<8;i++) {
546 io=iovals[i]; 547 io=iovals[i];
547 if (request_region(io, 2, "cadet-probe")) { 548 if (request_region(io, 2, "cadet-probe")) {
548 cadet_setfreq(1410); 549 cadet_setfreq(1410);
549 if(cadet_getfreq()==1410) { 550 if(cadet_getfreq()==1410) {
550 release_region(io, 2); 551 release_region(io, 2);
551 return io; 552 return io;
552 } 553 }
553 release_region(io, 2); 554 release_region(io, 2);
554 } 555 }
@@ -556,7 +557,7 @@ static int cadet_probe(void)
556 return -1; 557 return -1;
557} 558}
558 559
559/* 560/*
560 * io should only be set if the user has used something like 561 * io should only be set if the user has used something like
561 * isapnp (the userspace program) to initialize this card for us 562 * isapnp (the userspace program) to initialize this card for us
562 */ 563 */
@@ -564,7 +565,7 @@ static int cadet_probe(void)
564static int __init cadet_init(void) 565static int __init cadet_init(void)
565{ 566{
566 spin_lock_init(&cadet_io_lock); 567 spin_lock_init(&cadet_io_lock);
567 568
568 /* 569 /*
569 * If a probe was requested then probe ISAPnP first (safest) 570 * If a probe was requested then probe ISAPnP first (safest)
570 */ 571 */
@@ -579,12 +580,12 @@ static int __init cadet_init(void)
579 /* 580 /*
580 * Else we bail out 581 * Else we bail out
581 */ 582 */
582 583
583 if(io < 0) { 584 if(io < 0) {
584#ifdef MODULE 585#ifdef MODULE
585 printk(KERN_ERR "You must set an I/O address with io=0x???\n"); 586 printk(KERN_ERR "You must set an I/O address with io=0x???\n");
586#endif 587#endif
587 goto fail; 588 goto fail;
588 } 589 }
589 if (!request_region(io,2,"cadet")) 590 if (!request_region(io,2,"cadet"))
590 goto fail; 591 goto fail;