diff options
Diffstat (limited to 'drivers/media/radio/radio-aztech.c')
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 83bdae23417d..95e6322133ee 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 | * |
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/io.h> /* outb, outb_p */ | 31 | #include <asm/io.h> /* outb, outb_p */ |
32 | #include <asm/uaccess.h> /* copy to/from user */ | 32 | #include <asm/uaccess.h> /* copy to/from user */ |
33 | #include <linux/videodev.h> /* kernel radio structs */ | 33 | #include <linux/videodev.h> /* kernel radio structs */ |
34 | #include <media/v4l2-common.h> | ||
34 | #include <linux/config.h> /* CONFIG_RADIO_AZTECH_PORT */ | 35 | #include <linux/config.h> /* CONFIG_RADIO_AZTECH_PORT */ |
35 | 36 | ||
36 | /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ | 37 | /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ |
@@ -39,7 +40,7 @@ | |||
39 | #define CONFIG_RADIO_AZTECH_PORT -1 | 40 | #define CONFIG_RADIO_AZTECH_PORT -1 |
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | static int io = CONFIG_RADIO_AZTECH_PORT; | 43 | static int io = CONFIG_RADIO_AZTECH_PORT; |
43 | static int radio_nr = -1; | 44 | static int radio_nr = -1; |
44 | static int radio_wait_time = 1000; | 45 | static int radio_wait_time = 1000; |
45 | static struct mutex lock; | 46 | static struct mutex lock; |
@@ -53,15 +54,15 @@ struct az_device | |||
53 | 54 | ||
54 | static int volconvert(int level) | 55 | static int volconvert(int level) |
55 | { | 56 | { |
56 | level>>=14; /* Map 16bits down to 2 bit */ | 57 | level>>=14; /* Map 16bits down to 2 bit */ |
57 | level&=3; | 58 | level&=3; |
58 | 59 | ||
59 | /* convert to card-friendly values */ | 60 | /* convert to card-friendly values */ |
60 | switch (level) | 61 | switch (level) |
61 | { | 62 | { |
62 | case 0: | 63 | case 0: |
63 | return 0; | 64 | return 0; |
64 | case 1: | 65 | case 1: |
65 | return 1; | 66 | return 1; |
66 | case 2: | 67 | case 2: |
67 | return 4; | 68 | return 4; |
@@ -121,9 +122,9 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency) | |||
121 | 122 | ||
122 | frequency += 171200; /* Add 10.7 MHz IF */ | 123 | frequency += 171200; /* Add 10.7 MHz IF */ |
123 | frequency /= 800; /* Convert to 50 kHz units */ | 124 | frequency /= 800; /* Convert to 50 kHz units */ |
124 | 125 | ||
125 | mutex_lock(&lock); | 126 | mutex_lock(&lock); |
126 | 127 | ||
127 | send_0_byte (dev); /* 0: LSB of frequency */ | 128 | send_0_byte (dev); /* 0: LSB of frequency */ |
128 | 129 | ||
129 | for (i = 0; i < 13; i++) /* : frequency bits (1-13) */ | 130 | for (i = 0; i < 13; i++) /* : frequency bits (1-13) */ |
@@ -151,7 +152,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency) | |||
151 | 152 | ||
152 | udelay (radio_wait_time); | 153 | udelay (radio_wait_time); |
153 | outb_p(128+64+volconvert(dev->curvol), io); | 154 | outb_p(128+64+volconvert(dev->curvol), io); |
154 | 155 | ||
155 | mutex_unlock(&lock); | 156 | mutex_unlock(&lock); |
156 | 157 | ||
157 | return 0; | 158 | return 0; |
@@ -162,7 +163,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file, | |||
162 | { | 163 | { |
163 | struct video_device *dev = video_devdata(file); | 164 | struct video_device *dev = video_devdata(file); |
164 | struct az_device *az = dev->priv; | 165 | struct az_device *az = dev->priv; |
165 | 166 | ||
166 | switch(cmd) | 167 | switch(cmd) |
167 | { | 168 | { |
168 | case VIDIOCGCAP: | 169 | case VIDIOCGCAP: |
@@ -178,7 +179,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file, | |||
178 | case VIDIOCGTUNER: | 179 | case VIDIOCGTUNER: |
179 | { | 180 | { |
180 | struct video_tuner *v = arg; | 181 | struct video_tuner *v = arg; |
181 | if(v->tuner) /* Only 1 tuner */ | 182 | if(v->tuner) /* Only 1 tuner */ |
182 | return -EINVAL; | 183 | return -EINVAL; |
183 | v->rangelow=(87*16000); | 184 | v->rangelow=(87*16000); |
184 | v->rangehigh=(108*16000); | 185 | v->rangehigh=(108*16000); |
@@ -211,7 +212,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file, | |||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
213 | case VIDIOCGAUDIO: | 214 | case VIDIOCGAUDIO: |
214 | { | 215 | { |
215 | struct video_audio *v = arg; | 216 | struct video_audio *v = arg; |
216 | memset(v,0, sizeof(*v)); | 217 | memset(v,0, sizeof(*v)); |
217 | v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; | 218 | v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; |
@@ -222,17 +223,17 @@ static int az_do_ioctl(struct inode *inode, struct file *file, | |||
222 | v->volume=az->curvol; | 223 | v->volume=az->curvol; |
223 | v->step=16384; | 224 | v->step=16384; |
224 | strcpy(v->name, "Radio"); | 225 | strcpy(v->name, "Radio"); |
225 | return 0; | 226 | return 0; |
226 | } | 227 | } |
227 | case VIDIOCSAUDIO: | 228 | case VIDIOCSAUDIO: |
228 | { | 229 | { |
229 | struct video_audio *v = arg; | 230 | struct video_audio *v = arg; |
230 | if(v->audio) | 231 | if(v->audio) |
231 | return -EINVAL; | 232 | return -EINVAL; |
232 | az->curvol=v->volume; | 233 | az->curvol=v->volume; |
233 | 234 | ||
234 | az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0; | 235 | az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0; |
235 | if(v->flags&VIDEO_AUDIO_MUTE) | 236 | if(v->flags&VIDEO_AUDIO_MUTE) |
236 | az_setvol(az,0); | 237 | az_setvol(az,0); |
237 | else | 238 | else |
238 | az_setvol(az,az->curvol); | 239 | az_setvol(az,az->curvol); |
@@ -277,7 +278,7 @@ static int __init aztech_init(void) | |||
277 | return -EINVAL; | 278 | return -EINVAL; |
278 | } | 279 | } |
279 | 280 | ||
280 | if (!request_region(io, 2, "aztech")) | 281 | if (!request_region(io, 2, "aztech")) |
281 | { | 282 | { |
282 | printk(KERN_ERR "aztech: port 0x%x already in use\n", io); | 283 | printk(KERN_ERR "aztech: port 0x%x already in use\n", io); |
283 | return -EBUSY; | 284 | return -EBUSY; |
@@ -285,13 +286,13 @@ static int __init aztech_init(void) | |||
285 | 286 | ||
286 | mutex_init(&lock); | 287 | mutex_init(&lock); |
287 | aztech_radio.priv=&aztech_unit; | 288 | aztech_radio.priv=&aztech_unit; |
288 | 289 | ||
289 | if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 290 | if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) |
290 | { | 291 | { |
291 | release_region(io,2); | 292 | release_region(io,2); |
292 | return -EINVAL; | 293 | return -EINVAL; |
293 | } | 294 | } |
294 | 295 | ||
295 | printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); | 296 | printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); |
296 | /* mute card - prevents noisy bootups */ | 297 | /* mute card - prevents noisy bootups */ |
297 | outb (0, io); | 298 | outb (0, io); |