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.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 05e832f61c3e..6cc5d130fbc8 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -31,7 +31,6 @@
31#include <linux/module.h> /* Modules */ 31#include <linux/module.h> /* Modules */
32#include <linux/init.h> /* Initdata */ 32#include <linux/init.h> /* Initdata */
33#include <linux/ioport.h> /* request_region */ 33#include <linux/ioport.h> /* request_region */
34#include <linux/delay.h> /* udelay */
35#include <linux/videodev2.h> /* kernel radio structs */ 34#include <linux/videodev2.h> /* kernel radio structs */
36#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 35#include <linux/version.h> /* for KERNEL_VERSION MACRO */
37#include <linux/io.h> /* outb, outb_p */ 36#include <linux/io.h> /* outb, outb_p */
@@ -71,27 +70,17 @@ static struct rtrack rtrack_card;
71 70
72/* local things */ 71/* local things */
73 72
74static void sleep_delay(long n)
75{
76 /* Sleep nicely for 'n' uS */
77 int d = n / msecs_to_jiffies(1000);
78 if (!d)
79 udelay(n);
80 else
81 msleep(jiffies_to_msecs(d));
82}
83
84static void rt_decvol(struct rtrack *rt) 73static void rt_decvol(struct rtrack *rt)
85{ 74{
86 outb(0x58, rt->io); /* volume down + sigstr + on */ 75 outb(0x58, rt->io); /* volume down + sigstr + on */
87 sleep_delay(100000); 76 msleep(100);
88 outb(0xd8, rt->io); /* volume steady + sigstr + on */ 77 outb(0xd8, rt->io); /* volume steady + sigstr + on */
89} 78}
90 79
91static void rt_incvol(struct rtrack *rt) 80static void rt_incvol(struct rtrack *rt)
92{ 81{
93 outb(0x98, rt->io); /* volume up + sigstr + on */ 82 outb(0x98, rt->io); /* volume up + sigstr + on */
94 sleep_delay(100000); 83 msleep(100);
95 outb(0xd8, rt->io); /* volume steady + sigstr + on */ 84 outb(0xd8, rt->io); /* volume steady + sigstr + on */
96} 85}
97 86
@@ -120,7 +109,7 @@ static int rt_setvol(struct rtrack *rt, int vol)
120 109
121 if (vol == 0) { /* volume = 0 means mute the card */ 110 if (vol == 0) { /* volume = 0 means mute the card */
122 outb(0x48, rt->io); /* volume down but still "on" */ 111 outb(0x48, rt->io); /* volume down but still "on" */
123 sleep_delay(2000000); /* make sure it's totally down */ 112 msleep(2000); /* make sure it's totally down */
124 outb(0xd0, rt->io); /* volume steady, off */ 113 outb(0xd0, rt->io); /* volume steady, off */
125 rt->curvol = 0; /* track the volume state! */ 114 rt->curvol = 0; /* track the volume state! */
126 mutex_unlock(&rt->lock); 115 mutex_unlock(&rt->lock);
@@ -155,7 +144,7 @@ static void send_0_byte(struct rtrack *rt)
155 outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */ 144 outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */
156 outb_p(128+64+16+8+2+1, rt->io); /* clock */ 145 outb_p(128+64+16+8+2+1, rt->io); /* clock */
157 } 146 }
158 sleep_delay(1000); 147 msleep(1);
159} 148}
160 149
161static void send_1_byte(struct rtrack *rt) 150static void send_1_byte(struct rtrack *rt)
@@ -169,7 +158,7 @@ static void send_1_byte(struct rtrack *rt)
169 outb_p(128+64+16+8+4+2+1, rt->io); /* clock */ 158 outb_p(128+64+16+8+4+2+1, rt->io); /* clock */
170 } 159 }
171 160
172 sleep_delay(1000); 161 msleep(1);
173} 162}
174 163
175static int rt_setfreq(struct rtrack *rt, unsigned long freq) 164static int rt_setfreq(struct rtrack *rt, unsigned long freq)
@@ -420,7 +409,7 @@ static int __init rtrack_init(void)
420 409
421 /* this ensures that the volume is all the way down */ 410 /* this ensures that the volume is all the way down */
422 outb(0x48, rt->io); /* volume down but still "on" */ 411 outb(0x48, rt->io); /* volume down but still "on" */
423 sleep_delay(2000000); /* make sure it's totally down */ 412 msleep(2000); /* make sure it's totally down */
424 outb(0xc0, rt->io); /* steady volume, mute card */ 413 outb(0xc0, rt->io); /* steady volume, mute card */
425 414
426 if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { 415 if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {