aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-aimslab.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio/radio-aimslab.c')
-rw-r--r--drivers/media/radio/radio-aimslab.c50
1 files changed, 25 insertions, 25 deletions
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" */