aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-04-08 15:06:16 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:57:53 -0400
commit4286c6f65ec01efa8f5108cadea402ecf3b12279 (patch)
tree080fc6a8f55f0ed1c9b06b5ee8421225ebe21b5b /drivers/media/radio
parentdcdda65fd5e70a698dd3d7e65762e178290284b7 (diff)
V4L/DVB (3753): Whitespace cleanups at media/radio
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/Kconfig2
-rw-r--r--drivers/media/radio/miropcm20-radio.c14
-rw-r--r--drivers/media/radio/miropcm20-rds-core.c32
-rw-r--r--drivers/media/radio/miropcm20-rds.c2
-rw-r--r--drivers/media/radio/radio-aimslab.c50
-rw-r--r--drivers/media/radio/radio-aztech.c44
-rw-r--r--drivers/media/radio/radio-cadet.c316
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c46
-rw-r--r--drivers/media/radio/radio-gemtek.c32
-rw-r--r--drivers/media/radio/radio-maestro.c8
-rw-r--r--drivers/media/radio/radio-maxiradio.c80
-rw-r--r--drivers/media/radio/radio-rtrack2.c34
-rw-r--r--drivers/media/radio/radio-sf16fmi.c40
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c4
-rw-r--r--drivers/media/radio/radio-terratec.c62
-rw-r--r--drivers/media/radio/radio-trust.c26
-rw-r--r--drivers/media/radio/radio-typhoon.c2
-rw-r--r--drivers/media/radio/radio-zoltrix.c30
18 files changed, 412 insertions, 412 deletions
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 3fff75763693..de3128a31de8 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -136,7 +136,7 @@ config RADIO_GEMTEK_PCI
136 Choose Y here if you have this PCI FM radio card. 136 Choose Y here if you have this PCI FM radio card.
137 137
138 In order to control your radio card, you will need to use programs 138 In order to control your radio card, you will need to use programs
139 that are compatible with the Video for Linux API. Information on 139 that are compatible with the Video for Linux API. Information on
140 this API and pointers to "v4l" programs may be found at 140 this API and pointers to "v4l" programs may be found at
141 <file:Documentation/video4linux/API.html>. 141 <file:Documentation/video4linux/API.html>.
142 142
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c
index dc292da2605f..ba1f0c105099 100644
--- a/drivers/media/radio/miropcm20-radio.c
+++ b/drivers/media/radio/miropcm20-radio.c
@@ -16,7 +16,7 @@
16 16
17/* What ever you think about the ACI, version 0x07 is not very well! 17/* What ever you think about the ACI, version 0x07 is not very well!
18 * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono 18 * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
19 * conditions... Robert 19 * conditions... Robert
20 */ 20 */
21 21
22#include <linux/module.h> 22#include <linux/module.h>
@@ -123,7 +123,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
123 struct video_device *dev = video_devdata(file); 123 struct video_device *dev = video_devdata(file);
124 struct pcm20_device *pcm20 = dev->priv; 124 struct pcm20_device *pcm20 = dev->priv;
125 int i; 125 int i;
126 126
127 switch(cmd) 127 switch(cmd)
128 { 128 {
129 case VIDIOCGCAP: 129 case VIDIOCGCAP:
@@ -139,7 +139,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
139 case VIDIOCGTUNER: 139 case VIDIOCGTUNER:
140 { 140 {
141 struct video_tuner *v = arg; 141 struct video_tuner *v = arg;
142 if(v->tuner) /* Only 1 tuner */ 142 if(v->tuner) /* Only 1 tuner */
143 return -EINVAL; 143 return -EINVAL;
144 v->rangelow=87*16000; 144 v->rangelow=87*16000;
145 v->rangehigh=108*16000; 145 v->rangehigh=108*16000;
@@ -172,7 +172,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
172 return i; 172 return i;
173 } 173 }
174 case VIDIOCGAUDIO: 174 case VIDIOCGAUDIO:
175 { 175 {
176 struct video_audio *v = arg; 176 struct video_audio *v = arg;
177 memset(v,0, sizeof(*v)); 177 memset(v,0, sizeof(*v));
178 v->flags=VIDEO_AUDIO_MUTABLE; 178 v->flags=VIDEO_AUDIO_MUTABLE;
@@ -183,12 +183,12 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
183 v->mode|=VIDEO_SOUND_MONO; 183 v->mode|=VIDEO_SOUND_MONO;
184 /* v->step=2048; */ 184 /* v->step=2048; */
185 strcpy(v->name, "Radio"); 185 strcpy(v->name, "Radio");
186 return 0; 186 return 0;
187 } 187 }
188 case VIDIOCSAUDIO: 188 case VIDIOCSAUDIO:
189 { 189 {
190 struct video_audio *v = arg; 190 struct video_audio *v = arg;
191 if(v->audio) 191 if(v->audio)
192 return -EINVAL; 192 return -EINVAL;
193 193
194 pcm20_mute(pcm20, !!(v->flags&VIDEO_AUDIO_MUTE)); 194 pcm20_mute(pcm20, !!(v->flags&VIDEO_AUDIO_MUTE));
@@ -237,7 +237,7 @@ static int __init pcm20_init(void)
237{ 237{
238 if(video_register_device(&pcm20_radio, VFL_TYPE_RADIO, radio_nr)==-1) 238 if(video_register_device(&pcm20_radio, VFL_TYPE_RADIO, radio_nr)==-1)
239 goto video_register_device; 239 goto video_register_device;
240 240
241 if(attach_aci_rds()<0) 241 if(attach_aci_rds()<0)
242 goto attach_aci_rds; 242 goto attach_aci_rds;
243 243
diff --git a/drivers/media/radio/miropcm20-rds-core.c b/drivers/media/radio/miropcm20-rds-core.c
index b602c73e2309..dfb8252b23ef 100644
--- a/drivers/media/radio/miropcm20-rds-core.c
+++ b/drivers/media/radio/miropcm20-rds-core.c
@@ -33,24 +33,24 @@ static struct mutex aci_rds_mutex;
33#define RDS_BUSYMASK 0x10 /* Bit 4 */ 33#define RDS_BUSYMASK 0x10 /* Bit 4 */
34#define RDS_CLOCKMASK 0x08 /* Bit 3 */ 34#define RDS_CLOCKMASK 0x08 /* Bit 3 */
35 35
36#define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1) 36#define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1)
37 37
38 38
39#if DEBUG 39#if DEBUG
40static void print_matrix(char array[], unsigned int length) 40static void print_matrix(char array[], unsigned int length)
41{ 41{
42 int i, j; 42 int i, j;
43 43
44 for (i=0; i<length; i++) { 44 for (i=0; i<length; i++) {
45 printk(KERN_DEBUG "aci-rds: "); 45 printk(KERN_DEBUG "aci-rds: ");
46 for (j=7; j>=0; j--) { 46 for (j=7; j>=0; j--) {
47 printk("%d", (array[i] >> j) & 0x1); 47 printk("%d", (array[i] >> j) & 0x1);
48 } 48 }
49 if (i%8 == 0) 49 if (i%8 == 0)
50 printk(" byte-border\n"); 50 printk(" byte-border\n");
51 else 51 else
52 printk("\n"); 52 printk("\n");
53 } 53 }
54} 54}
55#endif /* DEBUG */ 55#endif /* DEBUG */
56 56
@@ -114,7 +114,7 @@ static int rds_write(unsigned char cmd)
114{ 114{
115 unsigned char sendbuffer[8]; 115 unsigned char sendbuffer[8];
116 int i; 116 int i;
117 117
118 if (byte2trans(cmd, sendbuffer, 8) != 0){ 118 if (byte2trans(cmd, sendbuffer, 8) != 0){
119 return -1; 119 return -1;
120 } else { 120 } else {
@@ -151,7 +151,7 @@ static int rds_read(unsigned char databuffer[], int datasize)
151 I have to waitread() here */ 151 I have to waitread() here */
152 if (rds_waitread() < 0) 152 if (rds_waitread() < 0)
153 return -1; 153 return -1;
154 154
155 memset(databuffer, 0, datasize); 155 memset(databuffer, 0, datasize);
156 156
157 for (i=0; i< READSIZE; i++) 157 for (i=0; i< READSIZE; i++)
@@ -194,7 +194,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize)
194 ret = 0; 194 ret = 0;
195 195
196 mutex_unlock(&aci_rds_mutex); 196 mutex_unlock(&aci_rds_mutex);
197 197
198 return ret; 198 return ret;
199} 199}
200EXPORT_SYMBOL(aci_rds_cmd); 200EXPORT_SYMBOL(aci_rds_cmd);
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c
index e09214082e01..87b37b7691da 100644
--- a/drivers/media/radio/miropcm20-rds.c
+++ b/drivers/media/radio/miropcm20-rds.c
@@ -48,7 +48,7 @@ static int rds_f_release(struct inode *in, struct file *fi)
48 48
49static void print_matrix(char *ch, char out[]) 49static void print_matrix(char *ch, char out[])
50{ 50{
51 int j; 51 int j;
52 52
53 for (j=7; j>=0; j--) { 53 for (j=7; j>=0; j--) {
54 out[7-j] = ((*ch >> j) & 0x1) + '0'; 54 out[7-j] = ((*ch >> j) & 0x1) + '0';
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 557fb5c4af38..36119d77f868 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -24,7 +24,7 @@
24 * out(port, start_increasing_volume); 24 * out(port, start_increasing_volume);
25 * wait(a_wee_while); 25 * wait(a_wee_while);
26 * out(port, stop_changing_the_volume); 26 * out(port, stop_changing_the_volume);
27 * 27 *
28 */ 28 */
29 29
30#include <linux/module.h> /* Modules */ 30#include <linux/module.h> /* Modules */
@@ -41,7 +41,7 @@
41#define CONFIG_RADIO_RTRACK_PORT -1 41#define CONFIG_RADIO_RTRACK_PORT -1
42#endif 42#endif
43 43
44static int io = CONFIG_RADIO_RTRACK_PORT; 44static int io = CONFIG_RADIO_RTRACK_PORT;
45static int radio_nr = -1; 45static int radio_nr = -1;
46static struct mutex lock; 46static struct mutex lock;
47 47
@@ -93,12 +93,12 @@ static int rt_setvol(struct rt_device *dev, int vol)
93 int i; 93 int i;
94 94
95 mutex_lock(&lock); 95 mutex_lock(&lock);
96 96
97 if(vol == dev->curvol) { /* requested volume = current */ 97 if(vol == dev->curvol) { /* requested volume = current */
98 if (dev->muted) { /* user is unmuting the card */ 98 if (dev->muted) { /* user is unmuting the card */
99 dev->muted = 0; 99 dev->muted = 0;
100 outb (0xd8, io); /* enable card */ 100 outb (0xd8, io); /* enable card */
101 } 101 }
102 mutex_unlock(&lock); 102 mutex_unlock(&lock);
103 return 0; 103 return 0;
104 } 104 }
@@ -114,10 +114,10 @@ static int rt_setvol(struct rt_device *dev, int vol)
114 114
115 dev->muted = 0; 115 dev->muted = 0;
116 if(vol > dev->curvol) 116 if(vol > dev->curvol)
117 for(i = dev->curvol; i < vol; i++) 117 for(i = dev->curvol; i < vol; i++)
118 rt_incvol(); 118 rt_incvol();
119 else 119 else
120 for(i = dev->curvol; i > vol; i--) 120 for(i = dev->curvol; i > vol; i--)
121 rt_decvol(); 121 rt_decvol();
122 122
123 dev->curvol = vol; 123 dev->curvol = vol;
@@ -125,7 +125,7 @@ static int rt_setvol(struct rt_device *dev, int vol)
125 return 0; 125 return 0;
126} 126}
127 127
128/* the 128+64 on these outb's is to keep the volume stable while tuning 128/* the 128+64 on these outb's is to keep the volume stable while tuning
129 * without them, the volume _will_ creep up with each frequency change 129 * without them, the volume _will_ creep up with each frequency change
130 * and bit 4 (+16) is to keep the signal strength meter enabled 130 * and bit 4 (+16) is to keep the signal strength meter enabled
131 */ 131 */
@@ -140,7 +140,7 @@ static void send_0_byte(int port, struct rt_device *dev)
140 outb_p(128+64+16+8+ 1, port); /* on + wr-enable + data low */ 140 outb_p(128+64+16+8+ 1, port); /* on + wr-enable + data low */
141 outb_p(128+64+16+8+2+1, port); /* clock */ 141 outb_p(128+64+16+8+2+1, port); /* clock */
142 } 142 }
143 sleep_delay(1000); 143 sleep_delay(1000);
144} 144}
145 145
146static void send_1_byte(int port, struct rt_device *dev) 146static void send_1_byte(int port, struct rt_device *dev)
@@ -148,13 +148,13 @@ static void send_1_byte(int port, struct rt_device *dev)
148 if ((dev->curvol == 0) || (dev->muted)) { 148 if ((dev->curvol == 0) || (dev->muted)) {
149 outb_p(128+64+16+4 +1, port); /* wr-enable+data high */ 149 outb_p(128+64+16+4 +1, port); /* wr-enable+data high */
150 outb_p(128+64+16+4+2+1, port); /* clock */ 150 outb_p(128+64+16+4+2+1, port); /* clock */
151 } 151 }
152 else { 152 else {
153 outb_p(128+64+16+8+4 +1, port); /* on+wr-enable+data high */ 153 outb_p(128+64+16+8+4 +1, port); /* on+wr-enable+data high */
154 outb_p(128+64+16+8+4+2+1, port); /* clock */ 154 outb_p(128+64+16+8+4+2+1, port); /* clock */
155 } 155 }
156 156
157 sleep_delay(1000); 157 sleep_delay(1000);
158} 158}
159 159
160static int rt_setfreq(struct rt_device *dev, unsigned long freq) 160static int rt_setfreq(struct rt_device *dev, unsigned long freq)
@@ -167,9 +167,9 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
167 167
168 freq += 171200; /* Add 10.7 MHz IF */ 168 freq += 171200; /* Add 10.7 MHz IF */
169 freq /= 800; /* Convert to 50 kHz units */ 169 freq /= 800; /* Convert to 50 kHz units */
170 170
171 mutex_lock(&lock); /* Stop other ops interfering */ 171 mutex_lock(&lock); /* Stop other ops interfering */
172 172
173 send_0_byte (io, dev); /* 0: LSB of frequency */ 173 send_0_byte (io, dev); /* 0: LSB of frequency */
174 174
175 for (i = 0; i < 13; i++) /* : frequency bits (1-13) */ 175 for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
@@ -195,7 +195,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
195 outb (0xd0, io); /* volume steady + sigstr */ 195 outb (0xd0, io); /* volume steady + sigstr */
196 else 196 else
197 outb (0xd8, io); /* volume steady + sigstr + on */ 197 outb (0xd8, io); /* volume steady + sigstr + on */
198 198
199 mutex_unlock(&lock); 199 mutex_unlock(&lock);
200 200
201 return 0; 201 return 0;
@@ -213,7 +213,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
213{ 213{
214 struct video_device *dev = video_devdata(file); 214 struct video_device *dev = video_devdata(file);
215 struct rt_device *rt=dev->priv; 215 struct rt_device *rt=dev->priv;
216 216
217 switch(cmd) 217 switch(cmd)
218 { 218 {
219 case VIDIOCGCAP: 219 case VIDIOCGCAP:
@@ -229,7 +229,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
229 case VIDIOCGTUNER: 229 case VIDIOCGTUNER:
230 { 230 {
231 struct video_tuner *v = arg; 231 struct video_tuner *v = arg;
232 if(v->tuner) /* Only 1 tuner */ 232 if(v->tuner) /* Only 1 tuner */
233 return -EINVAL; 233 return -EINVAL;
234 v->rangelow=(87*16000); 234 v->rangelow=(87*16000);
235 v->rangehigh=(108*16000); 235 v->rangehigh=(108*16000);
@@ -261,21 +261,21 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
261 return 0; 261 return 0;
262 } 262 }
263 case VIDIOCGAUDIO: 263 case VIDIOCGAUDIO:
264 { 264 {
265 struct video_audio *v = arg; 265 struct video_audio *v = arg;
266 memset(v,0, sizeof(*v)); 266 memset(v,0, sizeof(*v));
267 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; 267 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
268 v->volume=rt->curvol * 6554; 268 v->volume=rt->curvol * 6554;
269 v->step=6554; 269 v->step=6554;
270 strcpy(v->name, "Radio"); 270 strcpy(v->name, "Radio");
271 return 0; 271 return 0;
272 } 272 }
273 case VIDIOCSAUDIO: 273 case VIDIOCSAUDIO:
274 { 274 {
275 struct video_audio *v = arg; 275 struct video_audio *v = arg;
276 if(v->audio) 276 if(v->audio)
277 return -EINVAL; 277 return -EINVAL;
278 if(v->flags&VIDEO_AUDIO_MUTE) 278 if(v->flags&VIDEO_AUDIO_MUTE)
279 rt_mute(rt); 279 rt_mute(rt);
280 else 280 else
281 rt_setvol(rt,v->volume/6554); 281 rt_setvol(rt,v->volume/6554);
@@ -298,7 +298,7 @@ static struct file_operations rtrack_fops = {
298 .owner = THIS_MODULE, 298 .owner = THIS_MODULE,
299 .open = video_exclusive_open, 299 .open = video_exclusive_open,
300 .release = video_exclusive_release, 300 .release = video_exclusive_release,
301 .ioctl = rt_ioctl, 301 .ioctl = rt_ioctl,
302 .compat_ioctl = v4l_compat_ioctl32, 302 .compat_ioctl = v4l_compat_ioctl32,
303 .llseek = no_llseek, 303 .llseek = no_llseek,
304}; 304};
@@ -320,14 +320,14 @@ static int __init rtrack_init(void)
320 return -EINVAL; 320 return -EINVAL;
321 } 321 }
322 322
323 if (!request_region(io, 2, "rtrack")) 323 if (!request_region(io, 2, "rtrack"))
324 { 324 {
325 printk(KERN_ERR "rtrack: port 0x%x already in use\n", io); 325 printk(KERN_ERR "rtrack: port 0x%x already in use\n", io);
326 return -EBUSY; 326 return -EBUSY;
327 } 327 }
328 328
329 rtrack_radio.priv=&rtrack_unit; 329 rtrack_radio.priv=&rtrack_unit;
330 330
331 if(video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr)==-1) 331 if(video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr)==-1)
332 { 332 {
333 release_region(io, 2); 333 release_region(io, 2);
@@ -336,10 +336,10 @@ static int __init rtrack_init(void)
336 printk(KERN_INFO "AIMSlab RadioTrack/RadioReveal card driver.\n"); 336 printk(KERN_INFO "AIMSlab RadioTrack/RadioReveal card driver.\n");
337 337
338 /* Set up the I/O locking */ 338 /* Set up the I/O locking */
339 339
340 mutex_init(&lock); 340 mutex_init(&lock);
341 341
342 /* mute card - prevents noisy bootups */ 342 /* mute card - prevents noisy bootups */
343 343
344 /* this ensures that the volume is all the way down */ 344 /* this ensures that the volume is all the way down */
345 outb(0x48, io); /* volume down but still "on" */ 345 outb(0x48, io); /* volume down but still "on" */
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index 83bdae23417d..ca676245c071 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -1,11 +1,11 @@
1/* radio-aztech.c - Aztech radio card driver for Linux 2.2 1/* radio-aztech.c - Aztech radio card driver for Linux 2.2
2 * 2 *
3 * Adapted to support the Video for Linux API by 3 * Adapted to support the Video for Linux API by
4 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by: 4 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
5 * 5 *
6 * Quay Ly 6 * Quay Ly
7 * Donald Song 7 * Donald Song
8 * Jason Lewis (jlewis@twilight.vtc.vsc.edu) 8 * Jason Lewis (jlewis@twilight.vtc.vsc.edu)
9 * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) 9 * Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
10 * William McGrath (wmcgrath@twilight.vtc.vsc.edu) 10 * William McGrath (wmcgrath@twilight.vtc.vsc.edu)
11 * 11 *
@@ -39,7 +39,7 @@
39#define CONFIG_RADIO_AZTECH_PORT -1 39#define CONFIG_RADIO_AZTECH_PORT -1
40#endif 40#endif
41 41
42static int io = CONFIG_RADIO_AZTECH_PORT; 42static int io = CONFIG_RADIO_AZTECH_PORT;
43static int radio_nr = -1; 43static int radio_nr = -1;
44static int radio_wait_time = 1000; 44static int radio_wait_time = 1000;
45static struct mutex lock; 45static struct mutex lock;
@@ -53,15 +53,15 @@ struct az_device
53 53
54static int volconvert(int level) 54static int volconvert(int level)
55{ 55{
56 level>>=14; /* Map 16bits down to 2 bit */ 56 level>>=14; /* Map 16bits down to 2 bit */
57 level&=3; 57 level&=3;
58 58
59 /* convert to card-friendly values */ 59 /* convert to card-friendly values */
60 switch (level) 60 switch (level)
61 { 61 {
62 case 0: 62 case 0:
63 return 0; 63 return 0;
64 case 1: 64 case 1:
65 return 1; 65 return 1;
66 case 2: 66 case 2:
67 return 4; 67 return 4;
@@ -121,9 +121,9 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
121 121
122 frequency += 171200; /* Add 10.7 MHz IF */ 122 frequency += 171200; /* Add 10.7 MHz IF */
123 frequency /= 800; /* Convert to 50 kHz units */ 123 frequency /= 800; /* Convert to 50 kHz units */
124 124
125 mutex_lock(&lock); 125 mutex_lock(&lock);
126 126
127 send_0_byte (dev); /* 0: LSB of frequency */ 127 send_0_byte (dev); /* 0: LSB of frequency */
128 128
129 for (i = 0; i < 13; i++) /* : frequency bits (1-13) */ 129 for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
@@ -151,7 +151,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
151 151
152 udelay (radio_wait_time); 152 udelay (radio_wait_time);
153 outb_p(128+64+volconvert(dev->curvol), io); 153 outb_p(128+64+volconvert(dev->curvol), io);
154 154
155 mutex_unlock(&lock); 155 mutex_unlock(&lock);
156 156
157 return 0; 157 return 0;
@@ -162,7 +162,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
162{ 162{
163 struct video_device *dev = video_devdata(file); 163 struct video_device *dev = video_devdata(file);
164 struct az_device *az = dev->priv; 164 struct az_device *az = dev->priv;
165 165
166 switch(cmd) 166 switch(cmd)
167 { 167 {
168 case VIDIOCGCAP: 168 case VIDIOCGCAP:
@@ -178,7 +178,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
178 case VIDIOCGTUNER: 178 case VIDIOCGTUNER:
179 { 179 {
180 struct video_tuner *v = arg; 180 struct video_tuner *v = arg;
181 if(v->tuner) /* Only 1 tuner */ 181 if(v->tuner) /* Only 1 tuner */
182 return -EINVAL; 182 return -EINVAL;
183 v->rangelow=(87*16000); 183 v->rangelow=(87*16000);
184 v->rangehigh=(108*16000); 184 v->rangehigh=(108*16000);
@@ -211,7 +211,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
211 return 0; 211 return 0;
212 } 212 }
213 case VIDIOCGAUDIO: 213 case VIDIOCGAUDIO:
214 { 214 {
215 struct video_audio *v = arg; 215 struct video_audio *v = arg;
216 memset(v,0, sizeof(*v)); 216 memset(v,0, sizeof(*v));
217 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; 217 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
@@ -222,17 +222,17 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
222 v->volume=az->curvol; 222 v->volume=az->curvol;
223 v->step=16384; 223 v->step=16384;
224 strcpy(v->name, "Radio"); 224 strcpy(v->name, "Radio");
225 return 0; 225 return 0;
226 } 226 }
227 case VIDIOCSAUDIO: 227 case VIDIOCSAUDIO:
228 { 228 {
229 struct video_audio *v = arg; 229 struct video_audio *v = arg;
230 if(v->audio) 230 if(v->audio)
231 return -EINVAL; 231 return -EINVAL;
232 az->curvol=v->volume; 232 az->curvol=v->volume;
233 233
234 az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0; 234 az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0;
235 if(v->flags&VIDEO_AUDIO_MUTE) 235 if(v->flags&VIDEO_AUDIO_MUTE)
236 az_setvol(az,0); 236 az_setvol(az,0);
237 else 237 else
238 az_setvol(az,az->curvol); 238 az_setvol(az,az->curvol);
@@ -277,7 +277,7 @@ static int __init aztech_init(void)
277 return -EINVAL; 277 return -EINVAL;
278 } 278 }
279 279
280 if (!request_region(io, 2, "aztech")) 280 if (!request_region(io, 2, "aztech"))
281 { 281 {
282 printk(KERN_ERR "aztech: port 0x%x already in use\n", io); 282 printk(KERN_ERR "aztech: port 0x%x already in use\n", io);
283 return -EBUSY; 283 return -EBUSY;
@@ -285,13 +285,13 @@ static int __init aztech_init(void)
285 285
286 mutex_init(&lock); 286 mutex_init(&lock);
287 aztech_radio.priv=&aztech_unit; 287 aztech_radio.priv=&aztech_unit;
288 288
289 if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) 289 if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1)
290 { 290 {
291 release_region(io,2); 291 release_region(io,2);
292 return -EINVAL; 292 return -EINVAL;
293 } 293 }
294 294
295 printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); 295 printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n");
296 /* mute card - prevents noisy bootups */ 296 /* mute card - prevents noisy bootups */
297 outb (0, io); 297 outb (0, io);
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 */
61static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}}; 61static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}};
62 62
63static int cadet_getrds(void) 63static 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)
86static int cadet_getstereo(void) 86static 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
100static unsigned cadet_gettune(void) 100static 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
137static unsigned cadet_getfreq(void) 137static 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
169static void cadet_settune(unsigned fifo) 169static 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
197static void cadet_setfreq(unsigned freq) 197static 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)
257static int cadet_getvol(void) 257static 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
272static void cadet_setvol(int vol) 272static 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
283static void cadet_handler(unsigned long data) 283static 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)
324static ssize_t cadet_read(struct file *file, char __user *data, 324static 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
540static int cadet_probe(void) 540static 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)
564static int __init cadet_init(void) 564static 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;
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index 8e499b8f64c7..d5c3c4b878c7 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -1,6 +1,6 @@
1/* 1/*
2 *************************************************************************** 2 ***************************************************************************
3 * 3 *
4 * radio-gemtek-pci.c - Gemtek PCI Radio driver 4 * radio-gemtek-pci.c - Gemtek PCI Radio driver
5 * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru> 5 * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru>
6 * 6 *
@@ -31,7 +31,7 @@
31 * radio device driver. 31 * radio device driver.
32 * 32 *
33 * Please, let me know if this piece of code was useful :) 33 * Please, let me know if this piece of code was useful :)
34 * 34 *
35 * TODO: multiple device support and portability were not tested 35 * TODO: multiple device support and portability were not tested
36 * 36 *
37 *************************************************************************** 37 ***************************************************************************
@@ -69,18 +69,18 @@
69#define TRUE (1) 69#define TRUE (1)
70#endif 70#endif
71 71
72#ifndef FALSE 72#ifndef FALSE
73#define FALSE (0) 73#define FALSE (0)
74#endif 74#endif
75 75
76struct gemtek_pci_card { 76struct gemtek_pci_card {
77 struct video_device *videodev; 77 struct video_device *videodev;
78 78
79 u32 iobase; 79 u32 iobase;
80 u32 length; 80 u32 length;
81 u8 chiprev; 81 u8 chiprev;
82 u16 model; 82 u16 model;
83 83
84 u32 current_frequency; 84 u32 current_frequency;
85 u8 mute; 85 u8 mute;
86}; 86};
@@ -96,7 +96,7 @@ static inline u8 gemtek_pci_out( u16 value, u32 port )
96 return (u8)value; 96 return (u8)value;
97} 97}
98 98
99#define _b0( v ) *((u8 *)&v) 99#define _b0( v ) *((u8 *)&v)
100static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep ) 100static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
101{ 101{
102 register u8 byte = *last_byte; 102 register u8 byte = *last_byte;
@@ -104,7 +104,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
104 if ( !value ) { 104 if ( !value ) {
105 if ( !keep ) 105 if ( !keep )
106 value = (u16)port; 106 value = (u16)port;
107 byte &= 0xfd; 107 byte &= 0xfd;
108 } else 108 } else
109 byte |= 2; 109 byte |= 2;
110 110
@@ -116,7 +116,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
116 byte &= 0xfe; 116 byte &= 0xfe;
117 _b0( value ) = byte; 117 _b0( value ) = byte;
118 outw( value, port ); 118 outw( value, port );
119 119
120 *last_byte = byte; 120 *last_byte = byte;
121} 121}
122 122
@@ -193,13 +193,13 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
193 c->audios = 1; 193 c->audios = 1;
194 strcpy( c->name, "Gemtek PCI Radio" ); 194 strcpy( c->name, "Gemtek PCI Radio" );
195 return 0; 195 return 0;
196 } 196 }
197 197
198 case VIDIOCGTUNER: 198 case VIDIOCGTUNER:
199 { 199 {
200 struct video_tuner *t = arg; 200 struct video_tuner *t = arg;
201 201
202 if ( t->tuner ) 202 if ( t->tuner )
203 return -EINVAL; 203 return -EINVAL;
204 204
205 t->rangelow = GEMTEK_PCI_RANGE_LOW; 205 t->rangelow = GEMTEK_PCI_RANGE_LOW;
@@ -228,7 +228,7 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
228 case VIDIOCSFREQ: 228 case VIDIOCSFREQ:
229 { 229 {
230 unsigned long *freq = arg; 230 unsigned long *freq = arg;
231 231
232 if ( (*freq < GEMTEK_PCI_RANGE_LOW) || 232 if ( (*freq < GEMTEK_PCI_RANGE_LOW) ||
233 (*freq > GEMTEK_PCI_RANGE_HIGH) ) 233 (*freq > GEMTEK_PCI_RANGE_HIGH) )
234 return -EINVAL; 234 return -EINVAL;
@@ -239,9 +239,9 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
239 239
240 return 0; 240 return 0;
241 } 241 }
242 242
243 case VIDIOCGAUDIO: 243 case VIDIOCGAUDIO:
244 { 244 {
245 struct video_audio *a = arg; 245 struct video_audio *a = arg;
246 246
247 memset( a, 0, sizeof( *a ) ); 247 memset( a, 0, sizeof( *a ) );
@@ -249,17 +249,17 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
249 a->volume = 1; 249 a->volume = 1;
250 a->step = 65535; 250 a->step = 65535;
251 strcpy( a->name, "Radio" ); 251 strcpy( a->name, "Radio" );
252 return 0; 252 return 0;
253 } 253 }
254 254
255 case VIDIOCSAUDIO: 255 case VIDIOCSAUDIO:
256 { 256 {
257 struct video_audio *a = arg; 257 struct video_audio *a = arg;
258 258
259 if ( a->audio ) 259 if ( a->audio )
260 return -EINVAL; 260 return -EINVAL;
261 261
262 if ( a->flags & VIDEO_AUDIO_MUTE ) 262 if ( a->flags & VIDEO_AUDIO_MUTE )
263 gemtek_pci_mute( card ); 263 gemtek_pci_mute( card );
264 else 264 else
265 gemtek_pci_unmute( card ); 265 gemtek_pci_unmute( card );
@@ -323,9 +323,9 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
323 return -ENOMEM; 323 return -ENOMEM;
324 } 324 }
325 325
326 if ( pci_enable_device( pci_dev ) ) 326 if ( pci_enable_device( pci_dev ) )
327 goto err_pci; 327 goto err_pci;
328 328
329 card->iobase = pci_resource_start( pci_dev, 0 ); 329 card->iobase = pci_resource_start( pci_dev, 0 );
330 card->length = pci_resource_len( pci_dev, 0 ); 330 card->length = pci_resource_len( pci_dev, 0 );
331 331
@@ -338,7 +338,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
338 pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model ); 338 pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model );
339 339
340 pci_set_drvdata( pci_dev, card ); 340 pci_set_drvdata( pci_dev, card );
341 341
342 if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) { 342 if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) {
343 printk( KERN_ERR "gemtek_pci: out of memory\n" ); 343 printk( KERN_ERR "gemtek_pci: out of memory\n" );
344 goto err_video; 344 goto err_video;
@@ -354,7 +354,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
354 devradio->priv = card; 354 devradio->priv = card;
355 gemtek_pci_mute( card ); 355 gemtek_pci_mute( card );
356 356
357 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", 357 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
358 card->chiprev, card->iobase, card->iobase + card->length - 1 ); 358 card->chiprev, card->iobase, card->iobase + card->length - 1 );
359 359
360 return 0; 360 return 0;
@@ -364,7 +364,7 @@ err_video:
364 364
365err_pci: 365err_pci:
366 kfree( card ); 366 kfree( card );
367 return -ENODEV; 367 return -ENODEV;
368} 368}
369 369
370static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev ) 370static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev )
@@ -375,12 +375,12 @@ static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev )
375 kfree( card->videodev ); 375 kfree( card->videodev );
376 376
377 release_region( card->iobase, card->length ); 377 release_region( card->iobase, card->length );
378 378
379 if ( mx ) 379 if ( mx )
380 gemtek_pci_mute( card ); 380 gemtek_pci_mute( card );
381 381
382 kfree( card ); 382 kfree( card );
383 383
384 pci_set_drvdata( pci_dev, NULL ); 384 pci_set_drvdata( pci_dev, NULL );
385} 385}
386 386
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 47173be97b9f..77a1e12333a3 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -6,7 +6,7 @@
6 * Besides the protocol changes, this is mostly a copy of: 6 * Besides the protocol changes, this is mostly a copy of:
7 * 7 *
8 * RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff 8 * RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
9 * 9 *
10 * Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood 10 * Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
11 * Converted to new API by Alan Cox <Alan.Cox@linux.org> 11 * Converted to new API by Alan Cox <Alan.Cox@linux.org>
12 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org> 12 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
@@ -29,7 +29,7 @@
29#define CONFIG_RADIO_GEMTEK_PORT -1 29#define CONFIG_RADIO_GEMTEK_PORT -1
30#endif 30#endif
31 31
32static int io = CONFIG_RADIO_GEMTEK_PORT; 32static int io = CONFIG_RADIO_GEMTEK_PORT;
33static int radio_nr = -1; 33static int radio_nr = -1;
34static spinlock_t lock; 34static spinlock_t lock;
35 35
@@ -48,7 +48,7 @@ struct gemtek_device
48 */ 48 */
49static void gemtek_mute(struct gemtek_device *dev) 49static void gemtek_mute(struct gemtek_device *dev)
50{ 50{
51 if(dev->muted) 51 if(dev->muted)
52 return; 52 return;
53 spin_lock(&lock); 53 spin_lock(&lock);
54 outb(0x10, io); 54 outb(0x10, io);
@@ -94,20 +94,20 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq)
94 freq /= 100000; 94 freq /= 100000;
95 95
96 spin_lock(&lock); 96 spin_lock(&lock);
97 97
98 /* 2 start bits */ 98 /* 2 start bits */
99 outb_p(0x03, io); 99 outb_p(0x03, io);
100 udelay(5); 100 udelay(5);
101 outb_p(0x07, io); 101 outb_p(0x07, io);
102 udelay(5); 102 udelay(5);
103 103
104 /* 28 frequency bits (lsb first) */ 104 /* 28 frequency bits (lsb first) */
105 for (i = 0; i < 14; i++) 105 for (i = 0; i < 14; i++)
106 if (freq & (1 << i)) 106 if (freq & (1 << i))
107 one(); 107 one();
108 else 108 else
109 zero(); 109 zero();
110 /* 36 unknown bits */ 110 /* 36 unknown bits */
111 for (i = 0; i < 11; i++) 111 for (i = 0; i < 11; i++)
112 zero(); 112 zero();
113 one(); 113 one();
@@ -123,7 +123,7 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq)
123 udelay(5); 123 udelay(5);
124 124
125 spin_unlock(&lock); 125 spin_unlock(&lock);
126 126
127 return 0; 127 return 0;
128} 128}
129 129
@@ -159,7 +159,7 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file,
159 case VIDIOCGTUNER: 159 case VIDIOCGTUNER:
160 { 160 {
161 struct video_tuner *v = arg; 161 struct video_tuner *v = arg;
162 if(v->tuner) /* Only 1 tuner */ 162 if(v->tuner) /* Only 1 tuner */
163 return -EINVAL; 163 return -EINVAL;
164 v->rangelow=87*16000; 164 v->rangelow=87*16000;
165 v->rangehigh=108*16000; 165 v->rangehigh=108*16000;
@@ -193,25 +193,25 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file,
193 return 0; 193 return 0;
194 } 194 }
195 case VIDIOCGAUDIO: 195 case VIDIOCGAUDIO:
196 { 196 {
197 struct video_audio *v = arg; 197 struct video_audio *v = arg;
198 memset(v,0, sizeof(*v)); 198 memset(v,0, sizeof(*v));
199 v->flags|=VIDEO_AUDIO_MUTABLE; 199 v->flags|=VIDEO_AUDIO_MUTABLE;
200 v->volume=1; 200 v->volume=1;
201 v->step=65535; 201 v->step=65535;
202 strcpy(v->name, "Radio"); 202 strcpy(v->name, "Radio");
203 return 0; 203 return 0;
204 } 204 }
205 case VIDIOCSAUDIO: 205 case VIDIOCSAUDIO:
206 { 206 {
207 struct video_audio *v = arg; 207 struct video_audio *v = arg;
208 if(v->audio) 208 if(v->audio)
209 return -EINVAL; 209 return -EINVAL;
210 210
211 if(v->flags&VIDEO_AUDIO_MUTE) 211 if(v->flags&VIDEO_AUDIO_MUTE)
212 gemtek_mute(rt); 212 gemtek_mute(rt);
213 else 213 else
214 gemtek_unmute(rt); 214 gemtek_unmute(rt);
215 215
216 return 0; 216 return 0;
217 } 217 }
@@ -254,14 +254,14 @@ static int __init gemtek_init(void)
254 return -EINVAL; 254 return -EINVAL;
255 } 255 }
256 256
257 if (!request_region(io, 4, "gemtek")) 257 if (!request_region(io, 4, "gemtek"))
258 { 258 {
259 printk(KERN_ERR "gemtek: port 0x%x already in use\n", io); 259 printk(KERN_ERR "gemtek: port 0x%x already in use\n", io);
260 return -EBUSY; 260 return -EBUSY;
261 } 261 }
262 262
263 gemtek_radio.priv=&gemtek_unit; 263 gemtek_radio.priv=&gemtek_unit;
264 264
265 if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1) 265 if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1)
266 { 266 {
267 release_region(io, 4); 267 release_region(io, 4);
@@ -274,7 +274,7 @@ static int __init gemtek_init(void)
274 /* this is _maybe_ unnecessary */ 274 /* this is _maybe_ unnecessary */
275 outb(0x01, io); 275 outb(0x01, io);
276 276
277 /* mute card - prevents noisy bootups */ 277 /* mute card - prevents noisy bootups */
278 gemtek_unit.muted = 0; 278 gemtek_unit.muted = 0;
279 gemtek_mute(&gemtek_unit); 279 gemtek_mute(&gemtek_unit);
280 280
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index 39c1d9118636..2501792e1fa8 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -2,7 +2,7 @@
2 * (c) 2000 A. Tlalka, atlka@pg.gda.pl 2 * (c) 2000 A. Tlalka, atlka@pg.gda.pl
3 * Notes on the hardware 3 * Notes on the hardware
4 * 4 *
5 * + Frequency control is done digitally 5 * + Frequency control is done digitally
6 * + No volume control - only mute/unmute - you have to use Aux line volume 6 * + No volume control - only mute/unmute - you have to use Aux line volume
7 * control on Maestro card to set the volume 7 * control on Maestro card to set the volume
8 * + Radio status (tuned/not_tuned and stereo/mono) is valid some time after 8 * + Radio status (tuned/not_tuned and stereo/mono) is valid some time after
@@ -103,7 +103,7 @@ static struct video_device maestro_radio = {
103struct radio_device { 103struct radio_device {
104 u16 io, /* base of Maestro card radio io (GPIO_DATA)*/ 104 u16 io, /* base of Maestro card radio io (GPIO_DATA)*/
105 muted, /* VIDEO_AUDIO_MUTE */ 105 muted, /* VIDEO_AUDIO_MUTE */
106 stereo, /* VIDEO_TUNER_STEREO_ON */ 106 stereo, /* VIDEO_TUNER_STEREO_ON */
107 tuned; /* signal strength (0 or 0xffff) */ 107 tuned; /* signal strength (0 or 0xffff) */
108 struct mutex lock; 108 struct mutex lock;
109}; 109};
@@ -122,14 +122,14 @@ static u32 radio_bits_get(struct radio_device *dev)
122 for (l=24;l--;) { 122 for (l=24;l--;) {
123 outw(STR_CLK, io); /* HI state */ 123 outw(STR_CLK, io); /* HI state */
124 udelay(2); 124 udelay(2);
125 if(!l) 125 if(!l)
126 dev->tuned = inw(io) & STR_MOST ? 0 : 0xffff; 126 dev->tuned = inw(io) & STR_MOST ? 0 : 0xffff;
127 outw(0, io); /* LO state */ 127 outw(0, io); /* LO state */
128 udelay(2); 128 udelay(2);
129 data <<= 1; /* shift data */ 129 data <<= 1; /* shift data */
130 rdata = inw(io); 130 rdata = inw(io);
131 if(!l) 131 if(!l)
132 dev->stereo = rdata & STR_MOST ? 132 dev->stereo = rdata & STR_MOST ?
133 0 : VIDEO_TUNER_STEREO_ON; 133 0 : VIDEO_TUNER_STEREO_ON;
134 else 134 else
135 if(rdata & STR_DATA) 135 if(rdata & STR_DATA)
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index f0bf47bcb64c..fe2552569690 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -1,15 +1,15 @@
1/* 1/*
2 * Guillemot Maxi Radio FM 2000 PCI radio card driver for Linux 2 * Guillemot Maxi Radio FM 2000 PCI radio card driver for Linux
3 * (C) 2001 Dimitromanolakis Apostolos <apdim@grecian.net> 3 * (C) 2001 Dimitromanolakis Apostolos <apdim@grecian.net>
4 * 4 *
5 * Based in the radio Maestro PCI driver. Actually it uses the same chip 5 * Based in the radio Maestro PCI driver. Actually it uses the same chip
6 * for radio but different pci controller. 6 * for radio but different pci controller.
7 * 7 *
8 * I didn't have any specs I reversed engineered the protocol from 8 * I didn't have any specs I reversed engineered the protocol from
9 * the windows driver (radio.dll). 9 * the windows driver (radio.dll).
10 * 10 *
11 * The card uses the TEA5757 chip that includes a search function but it 11 * The card uses the TEA5757 chip that includes a search function but it
12 * is useless as I haven't found any way to read back the frequency. If 12 * is useless as I haven't found any way to read back the frequency. If
13 * anybody does please mail me. 13 * anybody does please mail me.
14 * 14 *
15 * For the pdf file see: 15 * For the pdf file see:
@@ -24,7 +24,7 @@
24 * - tiding up 24 * - tiding up
25 * - removed support for multiple devices as it didn't work anyway 25 * - removed support for multiple devices as it didn't work anyway
26 * 26 *
27 * BUGS: 27 * BUGS:
28 * - card unmutes if you change frequency 28 * - card unmutes if you change frequency
29 * 29 *
30 */ 30 */
@@ -80,7 +80,7 @@ static struct file_operations maxiradio_fops = {
80 .owner = THIS_MODULE, 80 .owner = THIS_MODULE,
81 .open = video_exclusive_open, 81 .open = video_exclusive_open,
82 .release = video_exclusive_release, 82 .release = video_exclusive_release,
83 .ioctl = radio_ioctl, 83 .ioctl = radio_ioctl,
84 .compat_ioctl = v4l_compat_ioctl32, 84 .compat_ioctl = v4l_compat_ioctl32,
85 .llseek = no_llseek, 85 .llseek = no_llseek,
86}; 86};
@@ -97,11 +97,11 @@ static struct radio_device
97{ 97{
98 __u16 io, /* base of radio io */ 98 __u16 io, /* base of radio io */
99 muted, /* VIDEO_AUDIO_MUTE */ 99 muted, /* VIDEO_AUDIO_MUTE */
100 stereo, /* VIDEO_TUNER_STEREO_ON */ 100 stereo, /* VIDEO_TUNER_STEREO_ON */
101 tuned; /* signal strength (0 or 0xffff) */ 101 tuned; /* signal strength (0 or 0xffff) */
102 102
103 unsigned long freq; 103 unsigned long freq;
104 104
105 struct mutex lock; 105 struct mutex lock;
106} radio_unit = {0, 0, 0, 0, }; 106} radio_unit = {0, 0, 0, 0, };
107 107
@@ -114,7 +114,7 @@ static void outbit(unsigned long bit, __u16 io)
114 outb( power|wren|data|clk ,io); udelay(4); 114 outb( power|wren|data|clk ,io); udelay(4);
115 outb( power|wren|data ,io); udelay(4); 115 outb( power|wren|data ,io); udelay(4);
116 } 116 }
117 else 117 else
118 { 118 {
119 outb( power|wren ,io); udelay(4); 119 outb( power|wren ,io); udelay(4);
120 outb( power|wren|clk ,io); udelay(4); 120 outb( power|wren|clk ,io); udelay(4);
@@ -132,12 +132,12 @@ static void set_freq(__u16 io, __u32 data)
132{ 132{
133 unsigned long int si; 133 unsigned long int si;
134 int bl; 134 int bl;
135 135
136 /* TEA5757 shift register bits (see pdf) */ 136 /* TEA5757 shift register bits (see pdf) */
137 137
138 outbit(0,io); // 24 search 138 outbit(0,io); // 24 search
139 outbit(1,io); // 23 search up/down 139 outbit(1,io); // 23 search up/down
140 140
141 outbit(0,io); // 22 stereo/mono 141 outbit(0,io); // 22 stereo/mono
142 142
143 outbit(0,io); // 21 band 143 outbit(0,io); // 21 band
@@ -145,24 +145,24 @@ static void set_freq(__u16 io, __u32 data)
145 145
146 outbit(0,io); // 19 port ? 146 outbit(0,io); // 19 port ?
147 outbit(0,io); // 18 port ? 147 outbit(0,io); // 18 port ?
148 148
149 outbit(0,io); // 17 search level 149 outbit(0,io); // 17 search level
150 outbit(0,io); // 16 search level 150 outbit(0,io); // 16 search level
151 151
152 si = 0x8000; 152 si = 0x8000;
153 for(bl = 1; bl <= 16 ; bl++) { outbit(data & si,io); si >>=1; } 153 for(bl = 1; bl <= 16 ; bl++) { outbit(data & si,io); si >>=1; }
154 154
155 outb(power,io); 155 outb(power,io);
156} 156}
157 157
158static int get_stereo(__u16 io) 158static int get_stereo(__u16 io)
159{ 159{
160 outb(power,io); udelay(4); 160 outb(power,io); udelay(4);
161 return !(inb(io) & mo_st); 161 return !(inb(io) & mo_st);
162} 162}
163 163
164static int get_tune(__u16 io) 164static int get_tune(__u16 io)
165{ 165{
166 outb(power+clk,io); udelay(4); 166 outb(power+clk,io); udelay(4);
167 return !(inb(io) & mo_st); 167 return !(inb(io) & mo_st);
168} 168}
@@ -177,7 +177,7 @@ static inline int radio_function(struct inode *inode, struct file *file,
177 switch(cmd) { 177 switch(cmd) {
178 case VIDIOCGCAP: { 178 case VIDIOCGCAP: {
179 struct video_capability *v = arg; 179 struct video_capability *v = arg;
180 180
181 memset(v,0,sizeof(*v)); 181 memset(v,0,sizeof(*v));
182 strcpy(v->name, "Maxi Radio FM2000 radio"); 182 strcpy(v->name, "Maxi Radio FM2000 radio");
183 v->type=VID_TYPE_TUNER; 183 v->type=VID_TYPE_TUNER;
@@ -186,22 +186,22 @@ static inline int radio_function(struct inode *inode, struct file *file,
186 } 186 }
187 case VIDIOCGTUNER: { 187 case VIDIOCGTUNER: {
188 struct video_tuner *v = arg; 188 struct video_tuner *v = arg;
189 189
190 if(v->tuner) 190 if(v->tuner)
191 return -EINVAL; 191 return -EINVAL;
192 192
193 card->stereo = 0xffff * get_stereo(card->io); 193 card->stereo = 0xffff * get_stereo(card->io);
194 card->tuned = 0xffff * get_tune(card->io); 194 card->tuned = 0xffff * get_tune(card->io);
195 195
196 v->flags = VIDEO_TUNER_LOW | card->stereo; 196 v->flags = VIDEO_TUNER_LOW | card->stereo;
197 v->signal = card->tuned; 197 v->signal = card->tuned;
198 198
199 strcpy(v->name, "FM"); 199 strcpy(v->name, "FM");
200 200
201 v->rangelow = FREQ_LO; 201 v->rangelow = FREQ_LO;
202 v->rangehigh = FREQ_HI; 202 v->rangehigh = FREQ_HI;
203 v->mode = VIDEO_MODE_AUTO; 203 v->mode = VIDEO_MODE_AUTO;
204 204
205 return 0; 205 return 0;
206 } 206 }
207 case VIDIOCSTUNER: { 207 case VIDIOCSTUNER: {
@@ -212,13 +212,13 @@ static inline int radio_function(struct inode *inode, struct file *file,
212 } 212 }
213 case VIDIOCGFREQ: { 213 case VIDIOCGFREQ: {
214 unsigned long *freq = arg; 214 unsigned long *freq = arg;
215 215
216 *freq = card->freq; 216 *freq = card->freq;
217 return 0; 217 return 0;
218 } 218 }
219 case VIDIOCSFREQ: { 219 case VIDIOCSFREQ: {
220 unsigned long *freq = arg; 220 unsigned long *freq = arg;
221 221
222 if (*freq < FREQ_LO || *freq > FREQ_HI) 222 if (*freq < FREQ_LO || *freq > FREQ_HI)
223 return -EINVAL; 223 return -EINVAL;
224 card->freq = *freq; 224 card->freq = *freq;
@@ -226,18 +226,18 @@ static inline int radio_function(struct inode *inode, struct file *file,
226 msleep(125); 226 msleep(125);
227 return 0; 227 return 0;
228 } 228 }
229 case VIDIOCGAUDIO: { 229 case VIDIOCGAUDIO: {
230 struct video_audio *v = arg; 230 struct video_audio *v = arg;
231 memset(v,0,sizeof(*v)); 231 memset(v,0,sizeof(*v));
232 strcpy(v->name, "Radio"); 232 strcpy(v->name, "Radio");
233 v->flags=VIDEO_AUDIO_MUTABLE | card->muted; 233 v->flags=VIDEO_AUDIO_MUTABLE | card->muted;
234 v->mode=VIDEO_SOUND_STEREO; 234 v->mode=VIDEO_SOUND_STEREO;
235 return 0; 235 return 0;
236 } 236 }
237 237
238 case VIDIOCSAUDIO: { 238 case VIDIOCSAUDIO: {
239 struct video_audio *v = arg; 239 struct video_audio *v = arg;
240 240
241 if(v->audio) 241 if(v->audio)
242 return -EINVAL; 242 return -EINVAL;
243 card->muted = v->flags & VIDEO_AUDIO_MUTE; 243 card->muted = v->flags & VIDEO_AUDIO_MUTE;
@@ -249,13 +249,13 @@ static inline int radio_function(struct inode *inode, struct file *file,
249 } 249 }
250 case VIDIOCGUNIT: { 250 case VIDIOCGUNIT: {
251 struct video_unit *v = arg; 251 struct video_unit *v = arg;
252 252
253 v->video=VIDEO_NO_UNIT; 253 v->video=VIDEO_NO_UNIT;
254 v->vbi=VIDEO_NO_UNIT; 254 v->vbi=VIDEO_NO_UNIT;
255 v->radio=dev->minor; 255 v->radio=dev->minor;
256 v->audio=0; 256 v->audio=0;
257 v->teletext=VIDEO_NO_UNIT; 257 v->teletext=VIDEO_NO_UNIT;
258 return 0; 258 return 0;
259 } 259 }
260 default: return -ENOIOCTLCMD; 260 default: return -ENOIOCTLCMD;
261 } 261 }
@@ -267,7 +267,7 @@ static int radio_ioctl(struct inode *inode, struct file *file,
267 struct video_device *dev = video_devdata(file); 267 struct video_device *dev = video_devdata(file);
268 struct radio_device *card=dev->priv; 268 struct radio_device *card=dev->priv;
269 int ret; 269 int ret;
270 270
271 mutex_lock(&card->lock); 271 mutex_lock(&card->lock);
272 ret = video_usercopy(inode, file, cmd, arg, radio_function); 272 ret = video_usercopy(inode, file, cmd, arg, radio_function);
273 mutex_unlock(&card->lock); 273 mutex_unlock(&card->lock);
@@ -282,21 +282,21 @@ MODULE_LICENSE("GPL");
282static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 282static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
283{ 283{
284 if(!request_region(pci_resource_start(pdev, 0), 284 if(!request_region(pci_resource_start(pdev, 0),
285 pci_resource_len(pdev, 0), "Maxi Radio FM 2000")) { 285 pci_resource_len(pdev, 0), "Maxi Radio FM 2000")) {
286 printk(KERN_ERR "radio-maxiradio: can't reserve I/O ports\n"); 286 printk(KERN_ERR "radio-maxiradio: can't reserve I/O ports\n");
287 goto err_out; 287 goto err_out;
288 } 288 }
289 289
290 if (pci_enable_device(pdev)) 290 if (pci_enable_device(pdev))
291 goto err_out_free_region; 291 goto err_out_free_region;
292 292
293 radio_unit.io = pci_resource_start(pdev, 0); 293 radio_unit.io = pci_resource_start(pdev, 0);
294 mutex_init(&radio_unit.lock); 294 mutex_init(&radio_unit.lock);
295 maxiradio_radio.priv = &radio_unit; 295 maxiradio_radio.priv = &radio_unit;
296 296
297 if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) { 297 if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) {
298 printk("radio-maxiradio: can't register device!"); 298 printk("radio-maxiradio: can't register device!");
299 goto err_out_free_region; 299 goto err_out_free_region;
300 } 300 }
301 301
302 printk(KERN_INFO "radio-maxiradio: version " 302 printk(KERN_INFO "radio-maxiradio: version "
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index 28a47c9e7a81..3821d25ed411 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -1,5 +1,5 @@
1/* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff 1/* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
2 * 2 *
3 * Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood 3 * Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
4 * Converted to new API by Alan Cox <Alan.Cox@linux.org> 4 * Converted to new API by Alan Cox <Alan.Cox@linux.org>
5 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org> 5 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
@@ -22,7 +22,7 @@
22#define CONFIG_RADIO_RTRACK2_PORT -1 22#define CONFIG_RADIO_RTRACK2_PORT -1
23#endif 23#endif
24 24
25static int io = CONFIG_RADIO_RTRACK2_PORT; 25static int io = CONFIG_RADIO_RTRACK2_PORT;
26static int radio_nr = -1; 26static int radio_nr = -1;
27static spinlock_t lock; 27static spinlock_t lock;
28 28
@@ -38,7 +38,7 @@ struct rt_device
38 38
39static void rt_mute(struct rt_device *dev) 39static void rt_mute(struct rt_device *dev)
40{ 40{
41 if(dev->muted) 41 if(dev->muted)
42 return; 42 return;
43 spin_lock(&lock); 43 spin_lock(&lock);
44 outb(1, io); 44 outb(1, io);
@@ -58,14 +58,14 @@ static void rt_unmute(struct rt_device *dev)
58 58
59static void zero(void) 59static void zero(void)
60{ 60{
61 outb_p(1, io); 61 outb_p(1, io);
62 outb_p(3, io); 62 outb_p(3, io);
63 outb_p(1, io); 63 outb_p(1, io);
64} 64}
65 65
66static void one(void) 66static void one(void)
67{ 67{
68 outb_p(5, io); 68 outb_p(5, io);
69 outb_p(7, io); 69 outb_p(7, io);
70 outb_p(5, io); 70 outb_p(5, io);
71} 71}
@@ -75,7 +75,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
75 int i; 75 int i;
76 76
77 freq = freq / 200 + 856; 77 freq = freq / 200 + 856;
78 78
79 spin_lock(&lock); 79 spin_lock(&lock);
80 80
81 outb_p(0xc8, io); 81 outb_p(0xc8, io);
@@ -94,7 +94,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
94 outb_p(0xc8, io); 94 outb_p(0xc8, io);
95 if (!dev->muted) 95 if (!dev->muted)
96 outb_p(0, io); 96 outb_p(0, io);
97 97
98 spin_unlock(&lock); 98 spin_unlock(&lock);
99 return 0; 99 return 0;
100} 100}
@@ -127,7 +127,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
127 case VIDIOCGTUNER: 127 case VIDIOCGTUNER:
128 { 128 {
129 struct video_tuner *v = arg; 129 struct video_tuner *v = arg;
130 if(v->tuner) /* Only 1 tuner */ 130 if(v->tuner) /* Only 1 tuner */
131 return -EINVAL; 131 return -EINVAL;
132 v->rangelow=88*16000; 132 v->rangelow=88*16000;
133 v->rangehigh=108*16000; 133 v->rangehigh=108*16000;
@@ -159,25 +159,25 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
159 return 0; 159 return 0;
160 } 160 }
161 case VIDIOCGAUDIO: 161 case VIDIOCGAUDIO:
162 { 162 {
163 struct video_audio *v = arg; 163 struct video_audio *v = arg;
164 memset(v,0, sizeof(*v)); 164 memset(v,0, sizeof(*v));
165 v->flags|=VIDEO_AUDIO_MUTABLE; 165 v->flags|=VIDEO_AUDIO_MUTABLE;
166 v->volume=1; 166 v->volume=1;
167 v->step=65535; 167 v->step=65535;
168 strcpy(v->name, "Radio"); 168 strcpy(v->name, "Radio");
169 return 0; 169 return 0;
170 } 170 }
171 case VIDIOCSAUDIO: 171 case VIDIOCSAUDIO:
172 { 172 {
173 struct video_audio *v = arg; 173 struct video_audio *v = arg;
174 if(v->audio) 174 if(v->audio)
175 return -EINVAL; 175 return -EINVAL;
176 176
177 if(v->flags&VIDEO_AUDIO_MUTE) 177 if(v->flags&VIDEO_AUDIO_MUTE)
178 rt_mute(rt); 178 rt_mute(rt);
179 else 179 else
180 rt_unmute(rt); 180 rt_unmute(rt);
181 181
182 return 0; 182 return 0;
183 } 183 }
@@ -219,7 +219,7 @@ static int __init rtrack2_init(void)
219 printk(KERN_ERR "You must set an I/O address with io=0x20c or io=0x30c\n"); 219 printk(KERN_ERR "You must set an I/O address with io=0x20c or io=0x30c\n");
220 return -EINVAL; 220 return -EINVAL;
221 } 221 }
222 if (!request_region(io, 4, "rtrack2")) 222 if (!request_region(io, 4, "rtrack2"))
223 { 223 {
224 printk(KERN_ERR "rtrack2: port 0x%x already in use\n", io); 224 printk(KERN_ERR "rtrack2: port 0x%x already in use\n", io);
225 return -EBUSY; 225 return -EBUSY;
@@ -227,16 +227,16 @@ static int __init rtrack2_init(void)
227 227
228 rtrack2_radio.priv=&rtrack2_unit; 228 rtrack2_radio.priv=&rtrack2_unit;
229 229
230 spin_lock_init(&lock); 230 spin_lock_init(&lock);
231 if(video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr)==-1) 231 if(video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr)==-1)
232 { 232 {
233 release_region(io, 4); 233 release_region(io, 4);
234 return -EINVAL; 234 return -EINVAL;
235 } 235 }
236 236
237 printk(KERN_INFO "AIMSlab Radiotrack II card driver.\n"); 237 printk(KERN_INFO "AIMSlab Radiotrack II card driver.\n");
238 238
239 /* mute card - prevents noisy bootups */ 239 /* mute card - prevents noisy bootups */
240 outb(1, io); 240 outb(1, io);
241 rtrack2_unit.muted = 1; 241 rtrack2_unit.muted = 1;
242 242
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 53073b424107..70cfbc3910dd 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -12,7 +12,7 @@
12 * Frequency control is done digitally -- ie out(port,encodefreq(95.8)); 12 * Frequency control is done digitally -- ie out(port,encodefreq(95.8));
13 * No volume control - only mute/unmute - you have to use line volume 13 * No volume control - only mute/unmute - you have to use line volume
14 * control on SB-part of SF16FMI 14 * control on SB-part of SF16FMI
15 * 15 *
16 */ 16 */
17 17
18#include <linux/kernel.h> /* __setup */ 18#include <linux/kernel.h> /* __setup */
@@ -29,19 +29,19 @@
29struct fmi_device 29struct fmi_device
30{ 30{
31 int port; 31 int port;
32 int curvol; /* 1 or 0 */ 32 int curvol; /* 1 or 0 */
33 unsigned long curfreq; /* freq in kHz */ 33 unsigned long curfreq; /* freq in kHz */
34 __u32 flags; 34 __u32 flags;
35}; 35};
36 36
37static int io = -1; 37static int io = -1;
38static int radio_nr = -1; 38static int radio_nr = -1;
39static struct pnp_dev *dev = NULL; 39static struct pnp_dev *dev = NULL;
40static struct mutex lock; 40static struct mutex lock;
41 41
42/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */ 42/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
43/* It is only useful to give freq in intervall of 800 (=0.05Mhz), 43/* It is only useful to give freq in intervall of 800 (=0.05Mhz),
44 * other bits will be truncated, e.g 92.7400016 -> 92.7, but 44 * other bits will be truncated, e.g 92.7400016 -> 92.7, but
45 * 92.7400017 -> 92.75 45 * 92.7400017 -> 92.75
46 */ 46 */
47#define RSF16_ENCODE(x) ((x)/800+214) 47#define RSF16_ENCODE(x) ((x)/800+214)
@@ -51,7 +51,7 @@ static struct mutex lock;
51static void outbits(int bits, unsigned int data, int port) 51static void outbits(int bits, unsigned int data, int port)
52{ 52{
53 while(bits--) { 53 while(bits--) {
54 if(data & 1) { 54 if(data & 1) {
55 outb(5, port); 55 outb(5, port);
56 udelay(6); 56 udelay(6);
57 outb(7, port); 57 outb(7, port);
@@ -101,7 +101,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
101 int res; 101 int res;
102 int myport = dev->port; 102 int myport = dev->port;
103 103
104 104
105 mutex_lock(&lock); 105 mutex_lock(&lock);
106 val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */ 106 val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */
107 outb(val, myport); 107 outb(val, myport);
@@ -109,7 +109,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
109 msleep(143); /* was schedule_timeout(HZ/7) */ 109 msleep(143); /* was schedule_timeout(HZ/7) */
110 res = (int)inb(myport+1); 110 res = (int)inb(myport+1);
111 outb(val, myport); 111 outb(val, myport);
112 112
113 mutex_unlock(&lock); 113 mutex_unlock(&lock);
114 return (res & 2) ? 0 : 0xFFFF; 114 return (res & 2) ? 0 : 0xFFFF;
115} 115}
@@ -119,7 +119,7 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
119{ 119{
120 struct video_device *dev = video_devdata(file); 120 struct video_device *dev = video_devdata(file);
121 struct fmi_device *fmi=dev->priv; 121 struct fmi_device *fmi=dev->priv;
122 122
123 switch(cmd) 123 switch(cmd)
124 { 124 {
125 case VIDIOCGCAP: 125 case VIDIOCGCAP:
@@ -174,18 +174,18 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
174 return -EINVAL; 174 return -EINVAL;
175 /*rounding in steps of 800 to match th freq 175 /*rounding in steps of 800 to match th freq
176 that will be used */ 176 that will be used */
177 fmi->curfreq = (*freq/800)*800; 177 fmi->curfreq = (*freq/800)*800;
178 fmi_setfreq(fmi); 178 fmi_setfreq(fmi);
179 return 0; 179 return 0;
180 } 180 }
181 case VIDIOCGAUDIO: 181 case VIDIOCGAUDIO:
182 { 182 {
183 struct video_audio *v = arg; 183 struct video_audio *v = arg;
184 memset(v,0,sizeof(*v)); 184 memset(v,0,sizeof(*v));
185 v->flags=( (!fmi->curvol)*VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE); 185 v->flags=( (!fmi->curvol)*VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE);
186 strcpy(v->name, "Radio"); 186 strcpy(v->name, "Radio");
187 v->mode=VIDEO_SOUND_STEREO; 187 v->mode=VIDEO_SOUND_STEREO;
188 return 0; 188 return 0;
189 } 189 }
190 case VIDIOCSAUDIO: 190 case VIDIOCSAUDIO:
191 { 191 {
@@ -193,19 +193,19 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
193 if(v->audio) 193 if(v->audio)
194 return -EINVAL; 194 return -EINVAL;
195 fmi->curvol= v->flags&VIDEO_AUDIO_MUTE ? 0 : 1; 195 fmi->curvol= v->flags&VIDEO_AUDIO_MUTE ? 0 : 1;
196 fmi->curvol ? 196 fmi->curvol ?
197 fmi_unmute(fmi->port) : fmi_mute(fmi->port); 197 fmi_unmute(fmi->port) : fmi_mute(fmi->port);
198 return 0; 198 return 0;
199 } 199 }
200 case VIDIOCGUNIT: 200 case VIDIOCGUNIT:
201 { 201 {
202 struct video_unit *v = arg; 202 struct video_unit *v = arg;
203 v->video=VIDEO_NO_UNIT; 203 v->video=VIDEO_NO_UNIT;
204 v->vbi=VIDEO_NO_UNIT; 204 v->vbi=VIDEO_NO_UNIT;
205 v->radio=dev->minor; 205 v->radio=dev->minor;
206 v->audio=0; /* How do we find out this??? */ 206 v->audio=0; /* How do we find out this??? */
207 v->teletext=VIDEO_NO_UNIT; 207 v->teletext=VIDEO_NO_UNIT;
208 return 0; 208 return 0;
209 } 209 }
210 default: 210 default:
211 return -ENOIOCTLCMD; 211 return -ENOIOCTLCMD;
@@ -295,14 +295,14 @@ static int __init fmi_init(void)
295 fmi_unit.curfreq = 0; 295 fmi_unit.curfreq = 0;
296 fmi_unit.flags = VIDEO_TUNER_LOW; 296 fmi_unit.flags = VIDEO_TUNER_LOW;
297 fmi_radio.priv = &fmi_unit; 297 fmi_radio.priv = &fmi_unit;
298 298
299 mutex_init(&lock); 299 mutex_init(&lock);
300 300
301 if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) { 301 if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) {
302 release_region(io, 2); 302 release_region(io, 2);
303 return -EINVAL; 303 return -EINVAL;
304 } 304 }
305 305
306 printk(KERN_INFO "SF16FMx radio card driver at 0x%x\n", io); 306 printk(KERN_INFO "SF16FMx radio card driver at 0x%x\n", io);
307 /* mute card - prevents noisy bootups */ 307 /* mute card - prevents noisy bootups */
308 fmi_mute(io); 308 fmi_mute(io);
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index bcebd8cb19ad..ca560a4cd41f 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -202,7 +202,7 @@ static int fmr2_setvolume(struct fmr2_device *dev)
202} 202}
203 203
204static int fmr2_do_ioctl(struct inode *inode, struct file *file, 204static int fmr2_do_ioctl(struct inode *inode, struct file *file,
205 unsigned int cmd, void *arg) 205 unsigned int cmd, void *arg)
206{ 206{
207 struct video_device *dev = video_devdata(file); 207 struct video_device *dev = video_devdata(file);
208 struct fmr2_device *fmr2 = dev->priv; 208 struct fmr2_device *fmr2 = dev->priv;
@@ -344,7 +344,7 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file,
344} 344}
345 345
346static int fmr2_ioctl(struct inode *inode, struct file *file, 346static int fmr2_ioctl(struct inode *inode, struct file *file,
347 unsigned int cmd, unsigned long arg) 347 unsigned int cmd, unsigned long arg)
348 { 348 {
349 return video_usercopy(inode, file, cmd, arg, fmr2_do_ioctl); 349 return video_usercopy(inode, file, cmd, arg, fmr2_do_ioctl);
350} 350}
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index fcfde2e4f195..3ac0c361b9a2 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -2,11 +2,11 @@
2 * (c) 1999 R. Offermanns (rolf@offermanns.de) 2 * (c) 1999 R. Offermanns (rolf@offermanns.de)
3 * based on the aimslab radio driver from M. Kirkwood 3 * based on the aimslab radio driver from M. Kirkwood
4 * many thanks to Michael Becker and Friedhelm Birth (from TerraTec) 4 * many thanks to Michael Becker and Friedhelm Birth (from TerraTec)
5 * 5 *
6 * 6 *
7 * History: 7 * History:
8 * 1999-05-21 First preview release 8 * 1999-05-21 First preview release
9 * 9 *
10 * Notes on the hardware: 10 * Notes on the hardware:
11 * There are two "main" chips on the card: 11 * There are two "main" chips on the card:
12 * - Philips OM5610 (http://www-us.semiconductors.philips.com/acrobat/datasheets/OM5610_2.pdf) 12 * - Philips OM5610 (http://www-us.semiconductors.philips.com/acrobat/datasheets/OM5610_2.pdf)
@@ -20,7 +20,7 @@
20 * (as soon i have understand how to get started :) 20 * (as soon i have understand how to get started :)
21 * If you can help me out with that, please contact me!! 21 * If you can help me out with that, please contact me!!
22 * 22 *
23 * 23 *
24 */ 24 */
25 25
26#include <linux/module.h> /* Modules */ 26#include <linux/module.h> /* Modules */
@@ -49,7 +49,7 @@
49#define WRT_EN 0x10 49#define WRT_EN 0x10
50/*******************************************************************/ 50/*******************************************************************/
51 51
52static int io = CONFIG_RADIO_TERRATEC_PORT; 52static int io = CONFIG_RADIO_TERRATEC_PORT;
53static int radio_nr = -1; 53static int radio_nr = -1;
54static spinlock_t lock; 54static spinlock_t lock;
55 55
@@ -88,15 +88,15 @@ static void tt_mute(struct tt_device *dev)
88 88
89static int tt_setvol(struct tt_device *dev, int vol) 89static int tt_setvol(struct tt_device *dev, int vol)
90{ 90{
91 91
92// printk(KERN_ERR "setvol called, vol = %d\n", vol); 92// printk(KERN_ERR "setvol called, vol = %d\n", vol);
93 93
94 if(vol == dev->curvol) { /* requested volume = current */ 94 if(vol == dev->curvol) { /* requested volume = current */
95 if (dev->muted) { /* user is unmuting the card */ 95 if (dev->muted) { /* user is unmuting the card */
96 dev->muted = 0; 96 dev->muted = 0;
97 cardWriteVol(vol); /* enable card */ 97 cardWriteVol(vol); /* enable card */
98 } 98 }
99 99
100 return 0; 100 return 0;
101 } 101 }
102 102
@@ -107,9 +107,9 @@ static int tt_setvol(struct tt_device *dev, int vol)
107 } 107 }
108 108
109 dev->muted = 0; 109 dev->muted = 0;
110 110
111 cardWriteVol(vol); 111 cardWriteVol(vol);
112 112
113 dev->curvol = vol; 113 dev->curvol = vol;
114 114
115 return 0; 115 return 0;
@@ -121,13 +121,13 @@ static int tt_setvol(struct tt_device *dev, int vol)
121/* many more or less strange things are going on here, but hey, it works :) */ 121/* many more or less strange things are going on here, but hey, it works :) */
122 122
123static int tt_setfreq(struct tt_device *dev, unsigned long freq1) 123static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
124{ 124{
125 int freq; 125 int freq;
126 int i; 126 int i;
127 int p; 127 int p;
128 int temp; 128 int temp;
129 long rest; 129 long rest;
130 130
131 unsigned char buffer[25]; /* we have to bit shift 25 registers */ 131 unsigned char buffer[25]; /* we have to bit shift 25 registers */
132 freq = freq1/160; /* convert the freq. to a nice to handle value */ 132 freq = freq1/160; /* convert the freq. to a nice to handle value */
133 for(i=24;i>-1;i--) 133 for(i=24;i>-1;i--)
@@ -142,9 +142,9 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
142 { 142 {
143 if (rest%temp == rest) 143 if (rest%temp == rest)
144 buffer[i] = 0; 144 buffer[i] = 0;
145 else 145 else
146 { 146 {
147 buffer[i] = 1; 147 buffer[i] = 1;
148 rest = rest-temp; 148 rest = rest-temp;
149 } 149 }
150 i--; 150 i--;
@@ -153,10 +153,10 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
153 } 153 }
154 154
155 spin_lock(&lock); 155 spin_lock(&lock);
156 156
157 for (i=24;i>-1;i--) /* bit shift the values to the radiocard */ 157 for (i=24;i>-1;i--) /* bit shift the values to the radiocard */
158 { 158 {
159 if (buffer[i]==1) 159 if (buffer[i]==1)
160 { 160 {
161 outb(WRT_EN|DATA, BASEPORT); 161 outb(WRT_EN|DATA, BASEPORT);
162 outb(WRT_EN|DATA|CLK_ON , BASEPORT); 162 outb(WRT_EN|DATA|CLK_ON , BASEPORT);
@@ -168,11 +168,11 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
168 outb(WRT_EN|0x00|CLK_ON , BASEPORT); 168 outb(WRT_EN|0x00|CLK_ON , BASEPORT);
169 } 169 }
170 } 170 }
171 outb(0x00, BASEPORT); 171 outb(0x00, BASEPORT);
172 172
173 spin_unlock(&lock); 173 spin_unlock(&lock);
174 174
175 return 0; 175 return 0;
176} 176}
177 177
178static int tt_getsigstr(struct tt_device *dev) /* TODO */ 178static int tt_getsigstr(struct tt_device *dev) /* TODO */
@@ -190,7 +190,7 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
190{ 190{
191 struct video_device *dev = video_devdata(file); 191 struct video_device *dev = video_devdata(file);
192 struct tt_device *tt=dev->priv; 192 struct tt_device *tt=dev->priv;
193 193
194 switch(cmd) 194 switch(cmd)
195 { 195 {
196 case VIDIOCGCAP: 196 case VIDIOCGCAP:
@@ -206,7 +206,7 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
206 case VIDIOCGTUNER: 206 case VIDIOCGTUNER:
207 { 207 {
208 struct video_tuner *v = arg; 208 struct video_tuner *v = arg;
209 if(v->tuner) /* Only 1 tuner */ 209 if(v->tuner) /* Only 1 tuner */
210 return -EINVAL; 210 return -EINVAL;
211 v->rangelow=(87*16000); 211 v->rangelow=(87*16000);
212 v->rangehigh=(108*16000); 212 v->rangehigh=(108*16000);
@@ -238,21 +238,21 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
238 return 0; 238 return 0;
239 } 239 }
240 case VIDIOCGAUDIO: 240 case VIDIOCGAUDIO:
241 { 241 {
242 struct video_audio *v = arg; 242 struct video_audio *v = arg;
243 memset(v,0, sizeof(*v)); 243 memset(v,0, sizeof(*v));
244 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; 244 v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
245 v->volume=tt->curvol * 6554; 245 v->volume=tt->curvol * 6554;
246 v->step=6554; 246 v->step=6554;
247 strcpy(v->name, "Radio"); 247 strcpy(v->name, "Radio");
248 return 0; 248 return 0;
249 } 249 }
250 case VIDIOCSAUDIO: 250 case VIDIOCSAUDIO:
251 { 251 {
252 struct video_audio *v = arg; 252 struct video_audio *v = arg;
253 if(v->audio) 253 if(v->audio)
254 return -EINVAL; 254 return -EINVAL;
255 if(v->flags&VIDEO_AUDIO_MUTE) 255 if(v->flags&VIDEO_AUDIO_MUTE)
256 tt_mute(tt); 256 tt_mute(tt);
257 else 257 else
258 tt_setvol(tt,v->volume/6554); 258 tt_setvol(tt,v->volume/6554);
@@ -296,25 +296,25 @@ static int __init terratec_init(void)
296 printk(KERN_ERR "You must set an I/O address with io=0x???\n"); 296 printk(KERN_ERR "You must set an I/O address with io=0x???\n");
297 return -EINVAL; 297 return -EINVAL;
298 } 298 }
299 if (!request_region(io, 2, "terratec")) 299 if (!request_region(io, 2, "terratec"))
300 { 300 {
301 printk(KERN_ERR "TerraTec: port 0x%x already in use\n", io); 301 printk(KERN_ERR "TerraTec: port 0x%x already in use\n", io);
302 return -EBUSY; 302 return -EBUSY;
303 } 303 }
304 304
305 terratec_radio.priv=&terratec_unit; 305 terratec_radio.priv=&terratec_unit;
306 306
307 spin_lock_init(&lock); 307 spin_lock_init(&lock);
308 308
309 if(video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr)==-1) 309 if(video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr)==-1)
310 { 310 {
311 release_region(io,2); 311 release_region(io,2);
312 return -EINVAL; 312 return -EINVAL;
313 } 313 }
314 314
315 printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver.\n"); 315 printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver.\n");
316 316
317 /* mute card - prevents noisy bootups */ 317 /* mute card - prevents noisy bootups */
318 318
319 /* this ensures that the volume is all the way down */ 319 /* this ensures that the volume is all the way down */
320 cardWriteVol(0); 320 cardWriteVol(0);
@@ -334,7 +334,7 @@ static void __exit terratec_cleanup_module(void)
334{ 334{
335 video_unregister_device(&terratec_radio); 335 video_unregister_device(&terratec_radio);
336 release_region(io,2); 336 release_region(io,2);
337 printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver unloaded.\n"); 337 printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver unloaded.\n");
338} 338}
339 339
340module_init(terratec_init); 340module_init(terratec_init);
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c
index 5a099a50d4d0..efcec0181c2c 100644
--- a/drivers/media/radio/radio-trust.c
+++ b/drivers/media/radio/radio-trust.c
@@ -1,14 +1,14 @@
1/* radio-trust.c - Trust FM Radio card driver for Linux 2.2 1/* radio-trust.c - Trust FM Radio card driver for Linux 2.2
2 * by Eric Lammerts <eric@scintilla.utwente.nl> 2 * by Eric Lammerts <eric@scintilla.utwente.nl>
3 * 3 *
4 * Based on radio-aztech.c. Original notes: 4 * Based on radio-aztech.c. Original notes:
5 * 5 *
6 * Adapted to support the Video for Linux API by 6 * Adapted to support the Video for Linux API by
7 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by: 7 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
8 * 8 *
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 *
@@ -30,7 +30,7 @@
30#define CONFIG_RADIO_TRUST_PORT -1 30#define CONFIG_RADIO_TRUST_PORT -1
31#endif 31#endif
32 32
33static int io = CONFIG_RADIO_TRUST_PORT; 33static int io = CONFIG_RADIO_TRUST_PORT;
34static int radio_nr = -1; 34static int radio_nr = -1;
35static int ioval = 0xf; 35static int ioval = 0xf;
36static __u16 curvol; 36static __u16 curvol;
@@ -135,7 +135,7 @@ static void tr_setmute(int mute)
135static int tr_getsigstr(void) 135static int tr_getsigstr(void)
136{ 136{
137 int i, v; 137 int i, v;
138 138
139 for(i = 0, v = 0; i < 100; i++) v |= inb(io); 139 for(i = 0, v = 0; i < 100; i++) v |= inb(io);
140 return (v & 1)? 0 : 0xffff; 140 return (v & 1)? 0 : 0xffff;
141} 141}
@@ -175,7 +175,7 @@ static int tr_do_ioctl(struct inode *inode, struct file *file,
175 { 175 {
176 struct video_tuner *v = arg; 176 struct video_tuner *v = arg;
177 177
178 if(v->tuner) /* Only 1 tuner */ 178 if(v->tuner) /* Only 1 tuner */
179 return -EINVAL; 179 return -EINVAL;
180 180
181 v->rangelow = 87500 * 16; 181 v->rangelow = 87500 * 16;
@@ -211,28 +211,28 @@ static int tr_do_ioctl(struct inode *inode, struct file *file,
211 return 0; 211 return 0;
212 } 212 }
213 case VIDIOCGAUDIO: 213 case VIDIOCGAUDIO:
214 { 214 {
215 struct video_audio *v = arg; 215 struct video_audio *v = arg;
216 216
217 memset(v,0, sizeof(*v)); 217 memset(v,0, sizeof(*v));
218 v->flags = VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME | 218 v->flags = VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME |
219 VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE; 219 VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;
220 v->mode = curstereo? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; 220 v->mode = curstereo? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
221 v->volume = curvol * 2048; 221 v->volume = curvol * 2048;
222 v->step = 2048; 222 v->step = 2048;
223 v->bass = curbass * 4370; 223 v->bass = curbass * 4370;
224 v->treble = curtreble * 4370; 224 v->treble = curtreble * 4370;
225 225
226 strcpy(v->name, "Trust FM Radio"); 226 strcpy(v->name, "Trust FM Radio");
227 return 0; 227 return 0;
228 } 228 }
229 case VIDIOCSAUDIO: 229 case VIDIOCSAUDIO:
230 { 230 {
231 struct video_audio *v = arg; 231 struct video_audio *v = arg;
232 232
233 if(v->audio) 233 if(v->audio)
234 return -EINVAL; 234 return -EINVAL;
235 tr_setvol(v->volume); 235 tr_setvol(v->volume);
236 tr_setbass(v->bass); 236 tr_setbass(v->bass);
237 tr_settreble(v->treble); 237 tr_settreble(v->treble);
238 tr_setstereo(v->mode & VIDEO_SOUND_STEREO); 238 tr_setstereo(v->mode & VIDEO_SOUND_STEREO);
@@ -292,7 +292,7 @@ static int __init trust_init(void)
292 write_i2c(2, TDA7318_ADDR, 0xe0); /* speaker att. RR = 0 dB */ 292 write_i2c(2, TDA7318_ADDR, 0xe0); /* speaker att. RR = 0 dB */
293 write_i2c(2, TDA7318_ADDR, 0x40); /* stereo 1 input, gain = 18.75 dB */ 293 write_i2c(2, TDA7318_ADDR, 0x40); /* stereo 1 input, gain = 18.75 dB */
294 294
295 tr_setvol(0x8000); 295 tr_setvol(0x8000);
296 tr_setbass(0x8000); 296 tr_setbass(0x8000);
297 tr_settreble(0x8000); 297 tr_settreble(0x8000);
298 tr_setstereo(1); 298 tr_setstereo(1);
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index e50955836d6b..e42409906682 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -361,7 +361,7 @@ static int __init typhoon_init(void)
361 361
362#ifdef CONFIG_RADIO_TYPHOON_PROC_FS 362#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
363 if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL, 363 if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL,
364 typhoon_get_info)) 364 typhoon_get_info))
365 printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n"); 365 printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n");
366#endif 366#endif
367 367
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 7bf1a4264891..8aceea083980 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -1,7 +1,7 @@
1/* zoltrix radio plus driver for Linux radio support 1/* zoltrix radio plus driver for Linux radio support
2 * (c) 1998 C. van Schaik <carl@leg.uct.ac.za> 2 * (c) 1998 C. van Schaik <carl@leg.uct.ac.za>
3 * 3 *
4 * BUGS 4 * BUGS
5 * Due to the inconsistency in reading from the signal flags 5 * Due to the inconsistency in reading from the signal flags
6 * it is difficult to get an accurate tuned signal. 6 * it is difficult to get an accurate tuned signal.
7 * 7 *
@@ -14,7 +14,7 @@
14 * 14 *
15 * 1999-05-06 - (C. van Schaik) 15 * 1999-05-06 - (C. van Schaik)
16 * - Make signal strength and stereo scans 16 * - Make signal strength and stereo scans
17 * kinder to cpu while in delay 17 * kinder to cpu while in delay
18 * 1999-01-05 - (C. van Schaik) 18 * 1999-01-05 - (C. van Schaik)
19 * - Changed tuning to 1/160Mhz accuracy 19 * - Changed tuning to 1/160Mhz accuracy
20 * - Added stereo support 20 * - Added stereo support
@@ -105,7 +105,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
105 i = 45; 105 i = 45;
106 106
107 mutex_lock(&dev->lock); 107 mutex_lock(&dev->lock);
108 108
109 outb(0, io); 109 outb(0, io);
110 outb(0, io); 110 outb(0, io);
111 inb(io + 3); /* Zoltrix needs to be read to confirm */ 111 inb(io + 3); /* Zoltrix needs to be read to confirm */
@@ -139,8 +139,8 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
139 udelay(1000); 139 udelay(1000);
140 inb(io+2); 140 inb(io+2);
141 141
142 udelay(1000); 142 udelay(1000);
143 143
144 if (dev->muted) 144 if (dev->muted)
145 { 145 {
146 outb(0, io); 146 outb(0, io);
@@ -148,12 +148,12 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
148 inb(io + 3); 148 inb(io + 3);
149 udelay(1000); 149 udelay(1000);
150 } 150 }
151 151
152 mutex_unlock(&dev->lock); 152 mutex_unlock(&dev->lock);
153 153
154 if(!dev->muted) 154 if(!dev->muted)
155 { 155 {
156 zol_setvol(dev, dev->curvol); 156 zol_setvol(dev, dev->curvol);
157 } 157 }
158 return 0; 158 return 0;
159} 159}
@@ -174,14 +174,14 @@ static int zol_getsigstr(struct zol_device *dev)
174 b = inb(io); 174 b = inb(io);
175 175
176 mutex_unlock(&dev->lock); 176 mutex_unlock(&dev->lock);
177 177
178 if (a != b) 178 if (a != b)
179 return (0); 179 return (0);
180 180
181 if ((a == 0xcf) || (a == 0xdf) /* I found this out by playing */ 181 if ((a == 0xcf) || (a == 0xdf) /* I found this out by playing */
182 || (a == 0xef)) /* with a binary scanner on the card io */ 182 || (a == 0xef)) /* with a binary scanner on the card io */
183 return (1); 183 return (1);
184 return (0); 184 return (0);
185} 185}
186 186
187static int zol_is_stereo (struct zol_device *dev) 187static int zol_is_stereo (struct zol_device *dev)
@@ -189,7 +189,7 @@ static int zol_is_stereo (struct zol_device *dev)
189 int x1, x2; 189 int x1, x2;
190 190
191 mutex_lock(&dev->lock); 191 mutex_lock(&dev->lock);
192 192
193 outb(0x00, io); 193 outb(0x00, io);
194 outb(dev->curvol, io); 194 outb(dev->curvol, io);
195 msleep(20); 195 msleep(20);
@@ -199,7 +199,7 @@ static int zol_is_stereo (struct zol_device *dev)
199 x2 = inb(io); 199 x2 = inb(io);
200 200
201 mutex_unlock(&dev->lock); 201 mutex_unlock(&dev->lock);
202 202
203 if ((x1 == x2) && (x1 == 0xcf)) 203 if ((x1 == x2) && (x1 == 0xcf))
204 return 1; 204 return 1;
205 return 0; 205 return 0;
@@ -226,7 +226,7 @@ static int zol_do_ioctl(struct inode *inode, struct file *file,
226 case VIDIOCGTUNER: 226 case VIDIOCGTUNER:
227 { 227 {
228 struct video_tuner *v = arg; 228 struct video_tuner *v = arg;
229 if (v->tuner) 229 if (v->tuner)
230 return -EINVAL; 230 return -EINVAL;
231 strcpy(v->name, "FM"); 231 strcpy(v->name, "FM");
232 v->rangelow = (int) (88.0 * 16000); 232 v->rangelow = (int) (88.0 * 16000);
@@ -351,7 +351,7 @@ static int __init zoltrix_init(void)
351 printk(KERN_INFO "Zoltrix Radio Plus card driver.\n"); 351 printk(KERN_INFO "Zoltrix Radio Plus card driver.\n");
352 352
353 mutex_init(&zoltrix_unit.lock); 353 mutex_init(&zoltrix_unit.lock);
354 354
355 /* mute card - prevents noisy bootups */ 355 /* mute card - prevents noisy bootups */
356 356
357 /* this ensures that the volume is all the way down */ 357 /* this ensures that the volume is all the way down */