blob: 985359d18aa58fd8e350d0e06b05b66020534bc5 [file] [log] [blame]
Ondrej Zary4b830372009-12-10 17:06:44 -03001/* SF16-FMI and SF16-FMP radio driver for Linux radio support
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * heavily based on rtrack driver...
3 * (c) 1997 M. Kirkwood
4 * (c) 1998 Petr Vandrovec, vandrove@vc.cvut.cz
5 *
Alan Coxd9b01442008-10-27 15:13:47 -03006 * Fitted to new interface by Alan Cox <alan@lxorguk.ukuu.org.uk>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * Made working and cleaned up functions <mikael.hedin@irf.se>
8 * Support for ISAPnP by Ladislav Michl <ladis@psi.cz>
9 *
10 * Notes on the hardware
11 *
12 * Frequency control is done digitally -- ie out(port,encodefreq(95.8));
13 * No volume control - only mute/unmute - you have to use line volume
Ondrej Zary4b830372009-12-10 17:06:44 -030014 * control on SB-part of SF16-FMI/SF16-FMP
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -030015 *
Mauro Carvalho Chehaba2ef73a2006-08-08 09:10:02 -030016 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
18
Andrew Morton2cd885a2006-08-08 09:10:09 -030019#include <linux/version.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/kernel.h> /* __setup */
21#include <linux/module.h> /* Modules */
22#include <linux/init.h> /* Initdata */
Peter Osterlundfb911ee2005-09-13 01:25:15 -070023#include <linux/ioport.h> /* request_region */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <linux/delay.h> /* udelay */
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/isapnp.h>
Ingo Molnar3593cab2006-02-07 06:49:14 -020026#include <linux/mutex.h>
Hans Verkuilc41269f2009-03-06 13:52:34 -030027#include <linux/videodev2.h> /* kernel radio structs */
28#include <linux/io.h> /* outb, outb_p */
Hans Verkuilc41269f2009-03-06 13:52:34 -030029#include <media/v4l2-device.h>
30#include <media/v4l2-ioctl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Hans Verkuilc41269f2009-03-06 13:52:34 -030032MODULE_AUTHOR("Petr Vandrovec, vandrove@vc.cvut.cz and M. Kirkwood");
Ondrej Zary4b830372009-12-10 17:06:44 -030033MODULE_DESCRIPTION("A driver for the SF16-FMI and SF16-FMP radio.");
Hans Verkuilc41269f2009-03-06 13:52:34 -030034MODULE_LICENSE("GPL");
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -030036static int io = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037static int radio_nr = -1;
Hans Verkuilc41269f2009-03-06 13:52:34 -030038
39module_param(io, int, 0);
Ondrej Zary4b830372009-12-10 17:06:44 -030040MODULE_PARM_DESC(io, "I/O address of the SF16-FMI or SF16-FMP card (0x284 or 0x384)");
Hans Verkuilc41269f2009-03-06 13:52:34 -030041module_param(radio_nr, int, 0);
42
43#define RADIO_VERSION KERNEL_VERSION(0, 0, 2)
44
45struct fmi
46{
47 struct v4l2_device v4l2_dev;
48 struct video_device vdev;
49 int io;
Ondrej Zary4b830372009-12-10 17:06:44 -030050 bool mute;
Hans Verkuilc41269f2009-03-06 13:52:34 -030051 unsigned long curfreq; /* freq in kHz */
Hans Verkuilc41269f2009-03-06 13:52:34 -030052 struct mutex lock;
53};
54
55static struct fmi fmi_card;
56static struct pnp_dev *dev;
Ondrej Zary67cabf52009-12-10 17:12:32 -030057bool pnp_attached;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
Hans Verkuil1d80db52009-05-02 12:04:13 -030060/* It is only useful to give freq in interval of 800 (=0.05Mhz),
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -030061 * other bits will be truncated, e.g 92.7400016 -> 92.7, but
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 * 92.7400017 -> 92.75
63 */
Hans Verkuilc41269f2009-03-06 13:52:34 -030064#define RSF16_ENCODE(x) ((x) / 800 + 214)
65#define RSF16_MINFREQ (87 * 16000)
66#define RSF16_MAXFREQ (108 * 16000)
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Hans Verkuilc41269f2009-03-06 13:52:34 -030068static void outbits(int bits, unsigned int data, int io)
Linus Torvalds1da177e2005-04-16 15:20:36 -070069{
Hans Verkuilc41269f2009-03-06 13:52:34 -030070 while (bits--) {
71 if (data & 1) {
72 outb(5, io);
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 udelay(6);
Hans Verkuilc41269f2009-03-06 13:52:34 -030074 outb(7, io);
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 udelay(6);
76 } else {
Hans Verkuilc41269f2009-03-06 13:52:34 -030077 outb(1, io);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 udelay(6);
Hans Verkuilc41269f2009-03-06 13:52:34 -030079 outb(3, io);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 udelay(6);
81 }
Hans Verkuilc41269f2009-03-06 13:52:34 -030082 data >>= 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 }
84}
85
Hans Verkuilc41269f2009-03-06 13:52:34 -030086static inline void fmi_mute(struct fmi *fmi)
Linus Torvalds1da177e2005-04-16 15:20:36 -070087{
Hans Verkuilc41269f2009-03-06 13:52:34 -030088 mutex_lock(&fmi->lock);
89 outb(0x00, fmi->io);
90 mutex_unlock(&fmi->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
92
Hans Verkuilc41269f2009-03-06 13:52:34 -030093static inline void fmi_unmute(struct fmi *fmi)
Linus Torvalds1da177e2005-04-16 15:20:36 -070094{
Hans Verkuilc41269f2009-03-06 13:52:34 -030095 mutex_lock(&fmi->lock);
96 outb(0x08, fmi->io);
97 mutex_unlock(&fmi->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070098}
99
Hans Verkuilc41269f2009-03-06 13:52:34 -0300100static inline int fmi_setfreq(struct fmi *fmi, unsigned long freq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300102 mutex_lock(&fmi->lock);
103 fmi->curfreq = freq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104
Hans Verkuilc41269f2009-03-06 13:52:34 -0300105 outbits(16, RSF16_ENCODE(freq), fmi->io);
106 outbits(8, 0xC0, fmi->io);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 msleep(143); /* was schedule_timeout(HZ/7) */
Hans Verkuilc41269f2009-03-06 13:52:34 -0300108 mutex_unlock(&fmi->lock);
Ondrej Zary4b830372009-12-10 17:06:44 -0300109 if (!fmi->mute)
Hans Verkuilc41269f2009-03-06 13:52:34 -0300110 fmi_unmute(fmi);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 return 0;
112}
113
Hans Verkuilc41269f2009-03-06 13:52:34 -0300114static inline int fmi_getsigstr(struct fmi *fmi)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115{
116 int val;
117 int res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Hans Verkuilc41269f2009-03-06 13:52:34 -0300119 mutex_lock(&fmi->lock);
Ondrej Zary4b830372009-12-10 17:06:44 -0300120 val = fmi->mute ? 0x00 : 0x08; /* mute/unmute */
Hans Verkuilc41269f2009-03-06 13:52:34 -0300121 outb(val, fmi->io);
122 outb(val | 0x10, fmi->io);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 msleep(143); /* was schedule_timeout(HZ/7) */
Hans Verkuilc41269f2009-03-06 13:52:34 -0300124 res = (int)inb(fmi->io + 1);
125 outb(val, fmi->io);
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -0300126
Hans Verkuilc41269f2009-03-06 13:52:34 -0300127 mutex_unlock(&fmi->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 return (res & 2) ? 0 : 0xFFFF;
129}
130
Douglas Landgrafc123b862007-04-23 17:52:12 -0300131static int vidioc_querycap(struct file *file, void *priv,
132 struct v4l2_capability *v)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133{
Douglas Landgrafc123b862007-04-23 17:52:12 -0300134 strlcpy(v->driver, "radio-sf16fmi", sizeof(v->driver));
135 strlcpy(v->card, "SF16-FMx radio", sizeof(v->card));
Hans Verkuilc41269f2009-03-06 13:52:34 -0300136 strlcpy(v->bus_info, "ISA", sizeof(v->bus_info));
Douglas Landgrafc123b862007-04-23 17:52:12 -0300137 v->version = RADIO_VERSION;
Hans Verkuilc41269f2009-03-06 13:52:34 -0300138 v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300139 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140}
141
Douglas Landgrafc123b862007-04-23 17:52:12 -0300142static int vidioc_g_tuner(struct file *file, void *priv,
143 struct v4l2_tuner *v)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300145 struct fmi *fmi = video_drvdata(file);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300146
147 if (v->index > 0)
148 return -EINVAL;
149
Hans Verkuilc41269f2009-03-06 13:52:34 -0300150 strlcpy(v->name, "FM", sizeof(v->name));
Douglas Landgrafc123b862007-04-23 17:52:12 -0300151 v->type = V4L2_TUNER_RADIO;
Hans Verkuil1d80db52009-05-02 12:04:13 -0300152 v->rangelow = RSF16_MINFREQ;
153 v->rangehigh = RSF16_MAXFREQ;
Hans Verkuildc47b772009-05-02 11:52:35 -0300154 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
Hans Verkuil38092a42009-05-02 12:06:15 -0300155 v->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LOW;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300156 v->audmode = V4L2_TUNER_MODE_STEREO;
157 v->signal = fmi_getsigstr(fmi);
158 return 0;
159}
160
161static int vidioc_s_tuner(struct file *file, void *priv,
162 struct v4l2_tuner *v)
163{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300164 return v->index ? -EINVAL : 0;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300165}
166
167static int vidioc_s_frequency(struct file *file, void *priv,
168 struct v4l2_frequency *f)
169{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300170 struct fmi *fmi = video_drvdata(file);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300171
Hans Verkuila3a9e282009-11-27 04:33:25 -0300172 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
173 return -EINVAL;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300174 if (f->frequency < RSF16_MINFREQ ||
Hans Verkuilc41269f2009-03-06 13:52:34 -0300175 f->frequency > RSF16_MAXFREQ)
Douglas Landgrafc123b862007-04-23 17:52:12 -0300176 return -EINVAL;
Hans Verkuilc41269f2009-03-06 13:52:34 -0300177 /* rounding in steps of 800 to match the freq
178 that will be used */
179 fmi_setfreq(fmi, (f->frequency / 800) * 800);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300180 return 0;
181}
182
183static int vidioc_g_frequency(struct file *file, void *priv,
184 struct v4l2_frequency *f)
185{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300186 struct fmi *fmi = video_drvdata(file);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300187
Hans Verkuila3a9e282009-11-27 04:33:25 -0300188 if (f->tuner != 0)
189 return -EINVAL;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300190 f->type = V4L2_TUNER_RADIO;
191 f->frequency = fmi->curfreq;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300192 return 0;
193}
194
195static int vidioc_queryctrl(struct file *file, void *priv,
196 struct v4l2_queryctrl *qc)
197{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300198 switch (qc->id) {
199 case V4L2_CID_AUDIO_MUTE:
200 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300201 }
202 return -EINVAL;
203}
204
205static int vidioc_g_ctrl(struct file *file, void *priv,
206 struct v4l2_control *ctrl)
207{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300208 struct fmi *fmi = video_drvdata(file);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300209
210 switch (ctrl->id) {
211 case V4L2_CID_AUDIO_MUTE:
Ondrej Zary4b830372009-12-10 17:06:44 -0300212 ctrl->value = fmi->mute;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300213 return 0;
214 }
215 return -EINVAL;
216}
217
218static int vidioc_s_ctrl(struct file *file, void *priv,
219 struct v4l2_control *ctrl)
220{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300221 struct fmi *fmi = video_drvdata(file);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300222
223 switch (ctrl->id) {
224 case V4L2_CID_AUDIO_MUTE:
225 if (ctrl->value)
Hans Verkuilc41269f2009-03-06 13:52:34 -0300226 fmi_mute(fmi);
Douglas Landgrafc123b862007-04-23 17:52:12 -0300227 else
Hans Verkuilc41269f2009-03-06 13:52:34 -0300228 fmi_unmute(fmi);
Ondrej Zary4b830372009-12-10 17:06:44 -0300229 fmi->mute = ctrl->value;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300230 return 0;
231 }
232 return -EINVAL;
233}
234
Douglas Landgrafc123b862007-04-23 17:52:12 -0300235static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
236{
237 *i = 0;
238 return 0;
239}
240
241static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
242{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300243 return i ? -EINVAL : 0;
244}
245
246static int vidioc_g_audio(struct file *file, void *priv,
247 struct v4l2_audio *a)
248{
249 a->index = 0;
250 strlcpy(a->name, "Radio", sizeof(a->name));
251 a->capability = V4L2_AUDCAP_STEREO;
Douglas Landgrafc123b862007-04-23 17:52:12 -0300252 return 0;
253}
254
255static int vidioc_s_audio(struct file *file, void *priv,
256 struct v4l2_audio *a)
257{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300258 return a->index ? -EINVAL : 0;
259}
260
Hans Verkuilbec43662008-12-30 06:58:20 -0300261static const struct v4l2_file_operations fmi_fops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 .owner = THIS_MODULE,
Douglas Landgrafc123b862007-04-23 17:52:12 -0300263 .ioctl = video_ioctl2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264};
265
Hans Verkuila3998102008-07-21 02:57:38 -0300266static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
Douglas Landgrafc123b862007-04-23 17:52:12 -0300267 .vidioc_querycap = vidioc_querycap,
268 .vidioc_g_tuner = vidioc_g_tuner,
269 .vidioc_s_tuner = vidioc_s_tuner,
270 .vidioc_g_audio = vidioc_g_audio,
271 .vidioc_s_audio = vidioc_s_audio,
272 .vidioc_g_input = vidioc_g_input,
273 .vidioc_s_input = vidioc_s_input,
274 .vidioc_g_frequency = vidioc_g_frequency,
275 .vidioc_s_frequency = vidioc_s_frequency,
276 .vidioc_queryctrl = vidioc_queryctrl,
277 .vidioc_g_ctrl = vidioc_g_ctrl,
278 .vidioc_s_ctrl = vidioc_s_ctrl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279};
280
281/* ladis: this is my card. does any other types exist? */
282static struct isapnp_device_id id_table[] __devinitdata = {
283 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
284 ISAPNP_VENDOR('M','F','R'), ISAPNP_FUNCTION(0xad10), 0},
285 { ISAPNP_CARD_END, },
286};
287
288MODULE_DEVICE_TABLE(isapnp, id_table);
289
Randy Dunlapa9993372008-01-23 02:39:39 -0300290static int __init isapnp_fmi_probe(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291{
292 int i = 0;
293
294 while (id_table[i].card_vendor != 0 && dev == NULL) {
295 dev = pnp_find_dev(NULL, id_table[i].vendor,
296 id_table[i].function, NULL);
297 i++;
298 }
299
300 if (!dev)
301 return -ENODEV;
302 if (pnp_device_attach(dev) < 0)
303 return -EAGAIN;
304 if (pnp_activate_dev(dev) < 0) {
Hans Verkuilc41269f2009-03-06 13:52:34 -0300305 printk(KERN_ERR "radio-sf16fmi: PnP configure failed (out of resources?)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 pnp_device_detach(dev);
307 return -ENOMEM;
308 }
309 if (!pnp_port_valid(dev, 0)) {
310 pnp_device_detach(dev);
311 return -ENODEV;
312 }
313
314 i = pnp_port_start(dev, 0);
Hans Verkuilc41269f2009-03-06 13:52:34 -0300315 printk(KERN_INFO "radio-sf16fmi: PnP reports card at %#x\n", i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316
317 return i;
318}
319
320static int __init fmi_init(void)
321{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300322 struct fmi *fmi = &fmi_card;
323 struct v4l2_device *v4l2_dev = &fmi->v4l2_dev;
Ondrej Zary67cabf52009-12-10 17:12:32 -0300324 int res, i;
325 int probe_ports[] = { 0, 0x284, 0x384 };
Hans Verkuilc41269f2009-03-06 13:52:34 -0300326
Ondrej Zary67cabf52009-12-10 17:12:32 -0300327 if (io < 0) {
328 for (i = 0; i < ARRAY_SIZE(probe_ports); i++) {
329 io = probe_ports[i];
330 if (io == 0) {
331 io = isapnp_fmi_probe();
332 if (io < 0)
333 continue;
334 pnp_attached = 1;
335 }
336 if (!request_region(io, 2, "radio-sf16fmi")) {
337 if (pnp_attached)
338 pnp_device_detach(dev);
339 io = -1;
340 continue;
341 }
342 if (pnp_attached ||
343 ((inb(io) & 0xf9) == 0xf9 && (inb(io) & 0x4) == 0))
344 break;
345 release_region(io, 2);
346 io = -1;
347 }
348 } else {
349 if (!request_region(io, 2, "radio-sf16fmi")) {
350 printk(KERN_ERR "radio-sf16fmi: port %#x already in use\n", io);
351 return -EBUSY;
352 }
353 if (inb(io) == 0xff) {
354 printk(KERN_ERR "radio-sf16fmi: card not present at %#x\n", io);
355 release_region(io, 2);
356 return -ENODEV;
357 }
358 }
359 if (io < 0) {
360 printk(KERN_ERR "radio-sf16fmi: no cards found\n");
361 return -ENODEV;
362 }
363
Hans Verkuilc41269f2009-03-06 13:52:34 -0300364 strlcpy(v4l2_dev->name, "sf16fmi", sizeof(v4l2_dev->name));
365 fmi->io = io;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366
Hans Verkuilc41269f2009-03-06 13:52:34 -0300367 res = v4l2_device_register(NULL, v4l2_dev);
368 if (res < 0) {
369 release_region(fmi->io, 2);
Ondrej Zary67cabf52009-12-10 17:12:32 -0300370 if (pnp_attached)
371 pnp_device_detach(dev);
Hans Verkuilc41269f2009-03-06 13:52:34 -0300372 v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
373 return res;
374 }
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -0300375
Hans Verkuilc41269f2009-03-06 13:52:34 -0300376 strlcpy(fmi->vdev.name, v4l2_dev->name, sizeof(fmi->vdev.name));
377 fmi->vdev.v4l2_dev = v4l2_dev;
378 fmi->vdev.fops = &fmi_fops;
379 fmi->vdev.ioctl_ops = &fmi_ioctl_ops;
380 fmi->vdev.release = video_device_release_empty;
381 video_set_drvdata(&fmi->vdev, fmi);
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -0300382
Hans Verkuilc41269f2009-03-06 13:52:34 -0300383 mutex_init(&fmi->lock);
384
385 if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
386 v4l2_device_unregister(v4l2_dev);
387 release_region(fmi->io, 2);
Ondrej Zary67cabf52009-12-10 17:12:32 -0300388 if (pnp_attached)
389 pnp_device_detach(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 return -EINVAL;
391 }
Mauro Carvalho Chehab4286c6f2006-04-08 16:06:16 -0300392
Hans Verkuilc41269f2009-03-06 13:52:34 -0300393 v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 /* mute card - prevents noisy bootups */
Hans Verkuilc41269f2009-03-06 13:52:34 -0300395 fmi_mute(fmi);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 return 0;
397}
398
Hans Verkuilc41269f2009-03-06 13:52:34 -0300399static void __exit fmi_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400{
Hans Verkuilc41269f2009-03-06 13:52:34 -0300401 struct fmi *fmi = &fmi_card;
402
403 video_unregister_device(&fmi->vdev);
404 v4l2_device_unregister(&fmi->v4l2_dev);
405 release_region(fmi->io, 2);
Ondrej Zary67cabf52009-12-10 17:12:32 -0300406 if (dev && pnp_attached)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 pnp_device_detach(dev);
408}
409
410module_init(fmi_init);
Hans Verkuilc41269f2009-03-06 13:52:34 -0300411module_exit(fmi_exit);