diff options
Diffstat (limited to 'drivers/media/radio/radio-aztech.c')
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 44 |
1 files changed, 22 insertions, 22 deletions
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 | ||
42 | static int io = CONFIG_RADIO_AZTECH_PORT; | 42 | static int io = CONFIG_RADIO_AZTECH_PORT; |
43 | static int radio_nr = -1; | 43 | static int radio_nr = -1; |
44 | static int radio_wait_time = 1000; | 44 | static int radio_wait_time = 1000; |
45 | static struct mutex lock; | 45 | static struct mutex lock; |
@@ -53,15 +53,15 @@ struct az_device | |||
53 | 53 | ||
54 | static int volconvert(int level) | 54 | static 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); |