diff options
Diffstat (limited to 'drivers/media/radio/radio-gemtek.c')
-rw-r--r-- | drivers/media/radio/radio-gemtek.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 47173be97b9f..162f37d8bf96 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> |
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/io.h> /* outb, outb_p */ | 22 | #include <asm/io.h> /* outb, outb_p */ |
23 | #include <asm/uaccess.h> /* copy to/from user */ | 23 | #include <asm/uaccess.h> /* copy to/from user */ |
24 | #include <linux/videodev.h> /* kernel radio structs */ | 24 | #include <linux/videodev.h> /* kernel radio structs */ |
25 | #include <media/v4l2-common.h> | ||
25 | #include <linux/config.h> /* CONFIG_RADIO_GEMTEK_PORT */ | 26 | #include <linux/config.h> /* CONFIG_RADIO_GEMTEK_PORT */ |
26 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
27 | 28 | ||
@@ -29,7 +30,7 @@ | |||
29 | #define CONFIG_RADIO_GEMTEK_PORT -1 | 30 | #define CONFIG_RADIO_GEMTEK_PORT -1 |
30 | #endif | 31 | #endif |
31 | 32 | ||
32 | static int io = CONFIG_RADIO_GEMTEK_PORT; | 33 | static int io = CONFIG_RADIO_GEMTEK_PORT; |
33 | static int radio_nr = -1; | 34 | static int radio_nr = -1; |
34 | static spinlock_t lock; | 35 | static spinlock_t lock; |
35 | 36 | ||
@@ -48,7 +49,7 @@ struct gemtek_device | |||
48 | */ | 49 | */ |
49 | static void gemtek_mute(struct gemtek_device *dev) | 50 | static void gemtek_mute(struct gemtek_device *dev) |
50 | { | 51 | { |
51 | if(dev->muted) | 52 | if(dev->muted) |
52 | return; | 53 | return; |
53 | spin_lock(&lock); | 54 | spin_lock(&lock); |
54 | outb(0x10, io); | 55 | outb(0x10, io); |
@@ -94,20 +95,20 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq) | |||
94 | freq /= 100000; | 95 | freq /= 100000; |
95 | 96 | ||
96 | spin_lock(&lock); | 97 | spin_lock(&lock); |
97 | 98 | ||
98 | /* 2 start bits */ | 99 | /* 2 start bits */ |
99 | outb_p(0x03, io); | 100 | outb_p(0x03, io); |
100 | udelay(5); | 101 | udelay(5); |
101 | outb_p(0x07, io); | 102 | outb_p(0x07, io); |
102 | udelay(5); | 103 | udelay(5); |
103 | 104 | ||
104 | /* 28 frequency bits (lsb first) */ | 105 | /* 28 frequency bits (lsb first) */ |
105 | for (i = 0; i < 14; i++) | 106 | for (i = 0; i < 14; i++) |
106 | if (freq & (1 << i)) | 107 | if (freq & (1 << i)) |
107 | one(); | 108 | one(); |
108 | else | 109 | else |
109 | zero(); | 110 | zero(); |
110 | /* 36 unknown bits */ | 111 | /* 36 unknown bits */ |
111 | for (i = 0; i < 11; i++) | 112 | for (i = 0; i < 11; i++) |
112 | zero(); | 113 | zero(); |
113 | one(); | 114 | one(); |
@@ -123,7 +124,7 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq) | |||
123 | udelay(5); | 124 | udelay(5); |
124 | 125 | ||
125 | spin_unlock(&lock); | 126 | spin_unlock(&lock); |
126 | 127 | ||
127 | return 0; | 128 | return 0; |
128 | } | 129 | } |
129 | 130 | ||
@@ -159,7 +160,7 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file, | |||
159 | case VIDIOCGTUNER: | 160 | case VIDIOCGTUNER: |
160 | { | 161 | { |
161 | struct video_tuner *v = arg; | 162 | struct video_tuner *v = arg; |
162 | if(v->tuner) /* Only 1 tuner */ | 163 | if(v->tuner) /* Only 1 tuner */ |
163 | return -EINVAL; | 164 | return -EINVAL; |
164 | v->rangelow=87*16000; | 165 | v->rangelow=87*16000; |
165 | v->rangehigh=108*16000; | 166 | v->rangehigh=108*16000; |
@@ -193,25 +194,25 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file, | |||
193 | return 0; | 194 | return 0; |
194 | } | 195 | } |
195 | case VIDIOCGAUDIO: | 196 | case VIDIOCGAUDIO: |
196 | { | 197 | { |
197 | struct video_audio *v = arg; | 198 | struct video_audio *v = arg; |
198 | memset(v,0, sizeof(*v)); | 199 | memset(v,0, sizeof(*v)); |
199 | v->flags|=VIDEO_AUDIO_MUTABLE; | 200 | v->flags|=VIDEO_AUDIO_MUTABLE; |
200 | v->volume=1; | 201 | v->volume=1; |
201 | v->step=65535; | 202 | v->step=65535; |
202 | strcpy(v->name, "Radio"); | 203 | strcpy(v->name, "Radio"); |
203 | return 0; | 204 | return 0; |
204 | } | 205 | } |
205 | case VIDIOCSAUDIO: | 206 | case VIDIOCSAUDIO: |
206 | { | 207 | { |
207 | struct video_audio *v = arg; | 208 | struct video_audio *v = arg; |
208 | if(v->audio) | 209 | if(v->audio) |
209 | return -EINVAL; | 210 | return -EINVAL; |
210 | 211 | ||
211 | if(v->flags&VIDEO_AUDIO_MUTE) | 212 | if(v->flags&VIDEO_AUDIO_MUTE) |
212 | gemtek_mute(rt); | 213 | gemtek_mute(rt); |
213 | else | 214 | else |
214 | gemtek_unmute(rt); | 215 | gemtek_unmute(rt); |
215 | 216 | ||
216 | return 0; | 217 | return 0; |
217 | } | 218 | } |
@@ -254,14 +255,14 @@ static int __init gemtek_init(void) | |||
254 | return -EINVAL; | 255 | return -EINVAL; |
255 | } | 256 | } |
256 | 257 | ||
257 | if (!request_region(io, 4, "gemtek")) | 258 | if (!request_region(io, 4, "gemtek")) |
258 | { | 259 | { |
259 | printk(KERN_ERR "gemtek: port 0x%x already in use\n", io); | 260 | printk(KERN_ERR "gemtek: port 0x%x already in use\n", io); |
260 | return -EBUSY; | 261 | return -EBUSY; |
261 | } | 262 | } |
262 | 263 | ||
263 | gemtek_radio.priv=&gemtek_unit; | 264 | gemtek_radio.priv=&gemtek_unit; |
264 | 265 | ||
265 | if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 266 | if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1) |
266 | { | 267 | { |
267 | release_region(io, 4); | 268 | release_region(io, 4); |
@@ -274,7 +275,7 @@ static int __init gemtek_init(void) | |||
274 | /* this is _maybe_ unnecessary */ | 275 | /* this is _maybe_ unnecessary */ |
275 | outb(0x01, io); | 276 | outb(0x01, io); |
276 | 277 | ||
277 | /* mute card - prevents noisy bootups */ | 278 | /* mute card - prevents noisy bootups */ |
278 | gemtek_unit.muted = 0; | 279 | gemtek_unit.muted = 0; |
279 | gemtek_mute(&gemtek_unit); | 280 | gemtek_mute(&gemtek_unit); |
280 | 281 | ||