1 /* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card 2 * 3 * by Fred Gleason <fredg@wava.com> 4 * Version 0.3.3 5 * 6 * (Loosely) based on code for the Aztech radio card by 7 * 8 * Russell Kroll (rkroll@exploits.org) 9 * Quay Ly 10 * Donald Song 11 * Jason Lewis (jlewis@twilight.vtc.vsc.edu) 12 * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) 13 * William McGrath (wmcgrath@twilight.vtc.vsc.edu) 14 * 15 * History: 16 * 2000-04-29 Russell Kroll <rkroll@exploits.org> 17 * Added ISAPnP detection for Linux 2.3/2.4 18 * 19 * 2001-01-10 Russell Kroll <rkroll@exploits.org> 20 * Removed dead CONFIG_RADIO_CADET_PORT code 21 * PnP detection on load is now default (no args necessary) 22 * 23 * 2002-01-17 Adam Belay <ambx1@neo.rr.com> 24 * Updated to latest pnp code 25 * 26 * 2003-01-31 Alan Cox <alan@lxorguk.ukuu.org.uk> 27 * Cleaned up locking, delay code, general odds and ends 28 * 29 * 2006-07-30 Hans J. Koch <koch@hjk-az.de> 30 * Changed API to V4L2 31 */ 32 33 #include <linux/module.h> /* Modules */ 34 #include <linux/init.h> /* Initdata */ 35 #include <linux/ioport.h> /* request_region */ 36 #include <linux/delay.h> /* udelay */ 37 #include <linux/videodev2.h> /* V4L2 API defs */ 38 #include <linux/param.h> 39 #include <linux/pnp.h> 40 #include <linux/sched.h> 41 #include <linux/io.h> /* outb, outb_p */ 42 #include <media/v4l2-device.h> 43 #include <media/v4l2-ioctl.h> 44 #include <media/v4l2-ctrls.h> 45 #include <media/v4l2-fh.h> 46 #include <media/v4l2-event.h> 47 48 MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath"); 49 MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card."); 50 MODULE_LICENSE("GPL"); 51 MODULE_VERSION("0.3.4"); 52 53 static int io = -1; /* default to isapnp activation */ 54 static int radio_nr = -1; 55 56 module_param(io, int, 0); 57 MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)"); 58 module_param(radio_nr, int, 0); 59 60 #define RDS_BUFFER 256 61 #define RDS_RX_FLAG 1 62 #define MBS_RX_FLAG 2 63 64 struct cadet { 65 struct v4l2_device v4l2_dev; 66 struct video_device vdev; 67 struct v4l2_ctrl_handler ctrl_handler; 68 int io; 69 bool is_fm_band; 70 u32 curfreq; 71 int tunestat; 72 int sigstrength; 73 wait_queue_head_t read_queue; 74 struct timer_list readtimer; 75 u8 rdsin, rdsout, rdsstat; 76 unsigned char rdsbuf[RDS_BUFFER]; 77 struct mutex lock; 78 int reading; 79 }; 80 81 static struct cadet cadet_card; 82 83 /* 84 * Signal Strength Threshold Values 85 * The V4L API spec does not define any particular unit for the signal 86 * strength value. These values are in microvolts of RF at the tuner's input. 87 */ 88 static u16 sigtable[2][4] = { 89 { 1835, 2621, 4128, 65535 }, 90 { 2185, 4369, 13107, 65535 }, 91 }; 92 93 static const struct v4l2_frequency_band bands[] = { 94 { 95 .index = 0, 96 .type = V4L2_TUNER_RADIO, 97 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS, 98 .rangelow = 8320, /* 520 kHz */ 99 .rangehigh = 26400, /* 1650 kHz */ 100 .modulation = V4L2_BAND_MODULATION_AM, 101 }, { 102 .index = 1, 103 .type = V4L2_TUNER_RADIO, 104 .capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS | 105 V4L2_TUNER_CAP_RDS_BLOCK_IO | V4L2_TUNER_CAP_LOW | 106 V4L2_TUNER_CAP_FREQ_BANDS, 107 .rangelow = 1400000, /* 87.5 MHz */ 108 .rangehigh = 1728000, /* 108.0 MHz */ 109 .modulation = V4L2_BAND_MODULATION_FM, 110 }, 111 }; 112 113 114 static int cadet_getstereo(struct cadet *dev) 115 { 116 int ret = V4L2_TUNER_SUB_MONO; 117 118 if (!dev->is_fm_band) /* Only FM has stereo capability! */ 119 return V4L2_TUNER_SUB_MONO; 120 121 outb(7, dev->io); /* Select tuner control */ 122 if ((inb(dev->io + 1) & 0x40) == 0) 123 ret = V4L2_TUNER_SUB_STEREO; 124 return ret; 125 } 126 127 static unsigned cadet_gettune(struct cadet *dev) 128 { 129 int curvol, i; 130 unsigned fifo = 0; 131 132 /* 133 * Prepare for read 134 */ 135 136 outb(7, dev->io); /* Select tuner control */ 137 curvol = inb(dev->io + 1); /* Save current volume/mute setting */ 138 outb(0x00, dev->io + 1); /* Ensure WRITE-ENABLE is LOW */ 139 dev->tunestat = 0xffff; 140 141 /* 142 * Read the shift register 143 */ 144 for (i = 0; i < 25; i++) { 145 fifo = (fifo << 1) | ((inb(dev->io + 1) >> 7) & 0x01); 146 if (i < 24) { 147 outb(0x01, dev->io + 1); 148 dev->tunestat &= inb(dev->io + 1); 149 outb(0x00, dev->io + 1); 150 } 151 } 152 153 /* 154 * Restore volume/mute setting 155 */ 156 outb(curvol, dev->io + 1); 157 return fifo; 158 } 159 160 static unsigned cadet_getfreq(struct cadet *dev) 161 { 162 int i; 163 unsigned freq = 0, test, fifo = 0; 164 165 /* 166 * Read current tuning 167 */ 168 fifo = cadet_gettune(dev); 169 170 /* 171 * Convert to actual frequency 172 */ 173 if (!dev->is_fm_band) /* AM */ 174 return ((fifo & 0x7fff) - 450) * 16; 175 176 test = 12500; 177 for (i = 0; i < 14; i++) { 178 if ((fifo & 0x01) != 0) 179 freq += test; 180 test = test << 1; 181 fifo = fifo >> 1; 182 } 183 freq -= 10700000; /* IF frequency is 10.7 MHz */ 184 freq = (freq * 16) / 1000; /* Make it 1/16 kHz */ 185 return freq; 186 } 187 188 static void cadet_settune(struct cadet *dev, unsigned fifo) 189 { 190 int i; 191 unsigned test; 192 193 outb(7, dev->io); /* Select tuner control */ 194 /* 195 * Write the shift register 196 */ 197 test = 0; 198 test = (fifo >> 23) & 0x02; /* Align data for SDO */ 199 test |= 0x1c; /* SDM=1, SWE=1, SEN=1, SCK=0 */ 200 outb(7, dev->io); /* Select tuner control */ 201 outb(test, dev->io + 1); /* Initialize for write */ 202 for (i = 0; i < 25; i++) { 203 test |= 0x01; /* Toggle SCK High */ 204 outb(test, dev->io + 1); 205 test &= 0xfe; /* Toggle SCK Low */ 206 outb(test, dev->io + 1); 207 fifo = fifo << 1; /* Prepare the next bit */ 208 test = 0x1c | ((fifo >> 23) & 0x02); 209 outb(test, dev->io + 1); 210 } 211 } 212 213 static void cadet_setfreq(struct cadet *dev, unsigned freq) 214 { 215 unsigned fifo; 216 int i, j, test; 217 int curvol; 218 219 freq = clamp(freq, bands[dev->is_fm_band].rangelow, 220 bands[dev->is_fm_band].rangehigh); 221 dev->curfreq = freq; 222 /* 223 * Formulate a fifo command 224 */ 225 fifo = 0; 226 if (dev->is_fm_band) { /* FM */ 227 test = 102400; 228 freq = freq / 16; /* Make it kHz */ 229 freq += 10700; /* IF is 10700 kHz */ 230 for (i = 0; i < 14; i++) { 231 fifo = fifo << 1; 232 if (freq >= test) { 233 fifo |= 0x01; 234 freq -= test; 235 } 236 test = test >> 1; 237 } 238 } else { /* AM */ 239 fifo = (freq / 16) + 450; /* Make it kHz */ 240 fifo |= 0x100000; /* Select AM Band */ 241 } 242 243 /* 244 * Save current volume/mute setting 245 */ 246 247 outb(7, dev->io); /* Select tuner control */ 248 curvol = inb(dev->io + 1); 249 250 /* 251 * Tune the card 252 */ 253 for (j = 3; j > -1; j--) { 254 cadet_settune(dev, fifo | (j << 16)); 255 256 outb(7, dev->io); /* Select tuner control */ 257 outb(curvol, dev->io + 1); 258 259 msleep(100); 260 261 cadet_gettune(dev); 262 if ((dev->tunestat & 0x40) == 0) { /* Tuned */ 263 dev->sigstrength = sigtable[dev->is_fm_band][j]; 264 goto reset_rds; 265 } 266 } 267 dev->sigstrength = 0; 268 reset_rds: 269 outb(3, dev->io); 270 outb(inb(dev->io + 1) & 0x7f, dev->io + 1); 271 } 272 273 static bool cadet_has_rds_data(struct cadet *dev) 274 { 275 bool result; 276 277 mutex_lock(&dev->lock); 278 result = dev->rdsin != dev->rdsout; 279 mutex_unlock(&dev->lock); 280 return result; 281 } 282 283 284 static void cadet_handler(unsigned long data) 285 { 286 struct cadet *dev = (void *)data; 287 288 /* Service the RDS fifo */ 289 if (mutex_trylock(&dev->lock)) { 290 outb(0x3, dev->io); /* Select RDS Decoder Control */ 291 if ((inb(dev->io + 1) & 0x20) != 0) 292 pr_err("cadet: RDS fifo overflow\n"); 293 outb(0x80, dev->io); /* Select RDS fifo */ 294 295 while ((inb(dev->io) & 0x80) != 0) { 296 dev->rdsbuf[dev->rdsin] = inb(dev->io + 1); 297 if (dev->rdsin + 1 != dev->rdsout) 298 dev->rdsin++; 299 } 300 mutex_unlock(&dev->lock); 301 } 302 303 /* 304 * Service pending read 305 */ 306 if (cadet_has_rds_data(dev)) 307 wake_up_interruptible(&dev->read_queue); 308 309 /* 310 * Clean up and exit 311 */ 312 setup_timer(&dev->readtimer, cadet_handler, data); 313 dev->readtimer.expires = jiffies + msecs_to_jiffies(50); 314 add_timer(&dev->readtimer); 315 } 316 317 static void cadet_start_rds(struct cadet *dev) 318 { 319 dev->rdsstat = 1; 320 outb(0x80, dev->io); /* Select RDS fifo */ 321 setup_timer(&dev->readtimer, cadet_handler, (unsigned long)dev); 322 dev->readtimer.expires = jiffies + msecs_to_jiffies(50); 323 add_timer(&dev->readtimer); 324 } 325 326 static ssize_t cadet_read(struct file *file, char __user *data, size_t count, loff_t *ppos) 327 { 328 struct cadet *dev = video_drvdata(file); 329 unsigned char readbuf[RDS_BUFFER]; 330 int i = 0; 331 332 mutex_lock(&dev->lock); 333 if (dev->rdsstat == 0) 334 cadet_start_rds(dev); 335 mutex_unlock(&dev->lock); 336 337 if (!cadet_has_rds_data(dev) && (file->f_flags & O_NONBLOCK)) 338 return -EWOULDBLOCK; 339 i = wait_event_interruptible(dev->read_queue, cadet_has_rds_data(dev)); 340 if (i) 341 return i; 342 343 mutex_lock(&dev->lock); 344 while (i < count && dev->rdsin != dev->rdsout) 345 readbuf[i++] = dev->rdsbuf[dev->rdsout++]; 346 mutex_unlock(&dev->lock); 347 348 if (i && copy_to_user(data, readbuf, i)) 349 return -EFAULT; 350 return i; 351 } 352 353 354 static int vidioc_querycap(struct file *file, void *priv, 355 struct v4l2_capability *v) 356 { 357 strlcpy(v->driver, "ADS Cadet", sizeof(v->driver)); 358 strlcpy(v->card, "ADS Cadet", sizeof(v->card)); 359 strlcpy(v->bus_info, "ISA:radio-cadet", sizeof(v->bus_info)); 360 v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO | 361 V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE; 362 v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS; 363 return 0; 364 } 365 366 static int vidioc_g_tuner(struct file *file, void *priv, 367 struct v4l2_tuner *v) 368 { 369 struct cadet *dev = video_drvdata(file); 370 371 if (v->index) 372 return -EINVAL; 373 v->type = V4L2_TUNER_RADIO; 374 strlcpy(v->name, "Radio", sizeof(v->name)); 375 v->capability = bands[0].capability | bands[1].capability; 376 v->rangelow = bands[0].rangelow; /* 520 kHz (start of AM band) */ 377 v->rangehigh = bands[1].rangehigh; /* 108.0 MHz (end of FM band) */ 378 if (dev->is_fm_band) { 379 v->rxsubchans = cadet_getstereo(dev); 380 outb(3, dev->io); 381 outb(inb(dev->io + 1) & 0x7f, dev->io + 1); 382 mdelay(100); 383 outb(3, dev->io); 384 if (inb(dev->io + 1) & 0x80) 385 v->rxsubchans |= V4L2_TUNER_SUB_RDS; 386 } else { 387 v->rangelow = 8320; /* 520 kHz */ 388 v->rangehigh = 26400; /* 1650 kHz */ 389 v->rxsubchans = V4L2_TUNER_SUB_MONO; 390 } 391 v->audmode = V4L2_TUNER_MODE_STEREO; 392 v->signal = dev->sigstrength; /* We might need to modify scaling of this */ 393 return 0; 394 } 395 396 static int vidioc_s_tuner(struct file *file, void *priv, 397 const struct v4l2_tuner *v) 398 { 399 return v->index ? -EINVAL : 0; 400 } 401 402 static int vidioc_enum_freq_bands(struct file *file, void *priv, 403 struct v4l2_frequency_band *band) 404 { 405 if (band->tuner) 406 return -EINVAL; 407 if (band->index >= ARRAY_SIZE(bands)) 408 return -EINVAL; 409 *band = bands[band->index]; 410 return 0; 411 } 412 413 static int vidioc_g_frequency(struct file *file, void *priv, 414 struct v4l2_frequency *f) 415 { 416 struct cadet *dev = video_drvdata(file); 417 418 if (f->tuner) 419 return -EINVAL; 420 f->type = V4L2_TUNER_RADIO; 421 f->frequency = dev->curfreq; 422 return 0; 423 } 424 425 426 static int vidioc_s_frequency(struct file *file, void *priv, 427 const struct v4l2_frequency *f) 428 { 429 struct cadet *dev = video_drvdata(file); 430 431 if (f->tuner) 432 return -EINVAL; 433 dev->is_fm_band = 434 f->frequency >= (bands[0].rangehigh + bands[1].rangelow) / 2; 435 cadet_setfreq(dev, f->frequency); 436 return 0; 437 } 438 439 static int cadet_s_ctrl(struct v4l2_ctrl *ctrl) 440 { 441 struct cadet *dev = container_of(ctrl->handler, struct cadet, ctrl_handler); 442 443 switch (ctrl->id) { 444 case V4L2_CID_AUDIO_MUTE: 445 outb(7, dev->io); /* Select tuner control */ 446 if (ctrl->val) 447 outb(0x00, dev->io + 1); 448 else 449 outb(0x20, dev->io + 1); 450 return 0; 451 } 452 return -EINVAL; 453 } 454 455 static int cadet_open(struct file *file) 456 { 457 struct cadet *dev = video_drvdata(file); 458 int err; 459 460 mutex_lock(&dev->lock); 461 err = v4l2_fh_open(file); 462 if (err) 463 goto fail; 464 if (v4l2_fh_is_singular_file(file)) 465 init_waitqueue_head(&dev->read_queue); 466 fail: 467 mutex_unlock(&dev->lock); 468 return err; 469 } 470 471 static int cadet_release(struct file *file) 472 { 473 struct cadet *dev = video_drvdata(file); 474 475 mutex_lock(&dev->lock); 476 if (v4l2_fh_is_singular_file(file) && dev->rdsstat) { 477 del_timer_sync(&dev->readtimer); 478 dev->rdsstat = 0; 479 } 480 v4l2_fh_release(file); 481 mutex_unlock(&dev->lock); 482 return 0; 483 } 484 485 static unsigned int cadet_poll(struct file *file, struct poll_table_struct *wait) 486 { 487 struct cadet *dev = video_drvdata(file); 488 unsigned long req_events = poll_requested_events(wait); 489 unsigned int res = v4l2_ctrl_poll(file, wait); 490 491 poll_wait(file, &dev->read_queue, wait); 492 if (dev->rdsstat == 0 && (req_events & (POLLIN | POLLRDNORM))) { 493 mutex_lock(&dev->lock); 494 if (dev->rdsstat == 0) 495 cadet_start_rds(dev); 496 mutex_unlock(&dev->lock); 497 } 498 if (cadet_has_rds_data(dev)) 499 res |= POLLIN | POLLRDNORM; 500 return res; 501 } 502 503 504 static const struct v4l2_file_operations cadet_fops = { 505 .owner = THIS_MODULE, 506 .open = cadet_open, 507 .release = cadet_release, 508 .read = cadet_read, 509 .unlocked_ioctl = video_ioctl2, 510 .poll = cadet_poll, 511 }; 512 513 static const struct v4l2_ioctl_ops cadet_ioctl_ops = { 514 .vidioc_querycap = vidioc_querycap, 515 .vidioc_g_tuner = vidioc_g_tuner, 516 .vidioc_s_tuner = vidioc_s_tuner, 517 .vidioc_g_frequency = vidioc_g_frequency, 518 .vidioc_s_frequency = vidioc_s_frequency, 519 .vidioc_enum_freq_bands = vidioc_enum_freq_bands, 520 .vidioc_log_status = v4l2_ctrl_log_status, 521 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, 522 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 523 }; 524 525 static const struct v4l2_ctrl_ops cadet_ctrl_ops = { 526 .s_ctrl = cadet_s_ctrl, 527 }; 528 529 #ifdef CONFIG_PNP 530 531 static struct pnp_device_id cadet_pnp_devices[] = { 532 /* ADS Cadet AM/FM Radio Card */ 533 {.id = "MSM0c24", .driver_data = 0}, 534 {.id = ""} 535 }; 536 537 MODULE_DEVICE_TABLE(pnp, cadet_pnp_devices); 538 539 static int cadet_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) 540 { 541 if (!dev) 542 return -ENODEV; 543 /* only support one device */ 544 if (io > 0) 545 return -EBUSY; 546 547 if (!pnp_port_valid(dev, 0)) 548 return -ENODEV; 549 550 io = pnp_port_start(dev, 0); 551 552 printk(KERN_INFO "radio-cadet: PnP reports device at %#x\n", io); 553 554 return io; 555 } 556 557 static struct pnp_driver cadet_pnp_driver = { 558 .name = "radio-cadet", 559 .id_table = cadet_pnp_devices, 560 .probe = cadet_pnp_probe, 561 .remove = NULL, 562 }; 563 564 #else 565 static struct pnp_driver cadet_pnp_driver; 566 #endif 567 568 static void cadet_probe(struct cadet *dev) 569 { 570 static int iovals[8] = { 0x330, 0x332, 0x334, 0x336, 0x338, 0x33a, 0x33c, 0x33e }; 571 int i; 572 573 for (i = 0; i < 8; i++) { 574 dev->io = iovals[i]; 575 if (request_region(dev->io, 2, "cadet-probe")) { 576 cadet_setfreq(dev, bands[1].rangelow); 577 if (cadet_getfreq(dev) == bands[1].rangelow) { 578 release_region(dev->io, 2); 579 return; 580 } 581 release_region(dev->io, 2); 582 } 583 } 584 dev->io = -1; 585 } 586 587 /* 588 * io should only be set if the user has used something like 589 * isapnp (the userspace program) to initialize this card for us 590 */ 591 592 static int __init cadet_init(void) 593 { 594 struct cadet *dev = &cadet_card; 595 struct v4l2_device *v4l2_dev = &dev->v4l2_dev; 596 struct v4l2_ctrl_handler *hdl; 597 int res = -ENODEV; 598 599 strlcpy(v4l2_dev->name, "cadet", sizeof(v4l2_dev->name)); 600 mutex_init(&dev->lock); 601 602 /* If a probe was requested then probe ISAPnP first (safest) */ 603 if (io < 0) 604 pnp_register_driver(&cadet_pnp_driver); 605 dev->io = io; 606 607 /* If that fails then probe unsafely if probe is requested */ 608 if (dev->io < 0) 609 cadet_probe(dev); 610 611 /* Else we bail out */ 612 if (dev->io < 0) { 613 #ifdef MODULE 614 v4l2_err(v4l2_dev, "you must set an I/O address with io=0x330, 0x332, 0x334,\n"); 615 v4l2_err(v4l2_dev, "0x336, 0x338, 0x33a, 0x33c or 0x33e\n"); 616 #endif 617 goto fail; 618 } 619 if (!request_region(dev->io, 2, "cadet")) 620 goto fail; 621 622 res = v4l2_device_register(NULL, v4l2_dev); 623 if (res < 0) { 624 release_region(dev->io, 2); 625 v4l2_err(v4l2_dev, "could not register v4l2_device\n"); 626 goto fail; 627 } 628 629 hdl = &dev->ctrl_handler; 630 v4l2_ctrl_handler_init(hdl, 2); 631 v4l2_ctrl_new_std(hdl, &cadet_ctrl_ops, 632 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); 633 v4l2_dev->ctrl_handler = hdl; 634 if (hdl->error) { 635 res = hdl->error; 636 v4l2_err(v4l2_dev, "Could not register controls\n"); 637 goto err_hdl; 638 } 639 640 dev->is_fm_band = true; 641 dev->curfreq = bands[dev->is_fm_band].rangelow; 642 cadet_setfreq(dev, dev->curfreq); 643 strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name)); 644 dev->vdev.v4l2_dev = v4l2_dev; 645 dev->vdev.fops = &cadet_fops; 646 dev->vdev.ioctl_ops = &cadet_ioctl_ops; 647 dev->vdev.release = video_device_release_empty; 648 dev->vdev.lock = &dev->lock; 649 video_set_drvdata(&dev->vdev, dev); 650 651 res = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); 652 if (res < 0) 653 goto err_hdl; 654 v4l2_info(v4l2_dev, "ADS Cadet Radio Card at 0x%x\n", dev->io); 655 return 0; 656 err_hdl: 657 v4l2_ctrl_handler_free(hdl); 658 v4l2_device_unregister(v4l2_dev); 659 release_region(dev->io, 2); 660 fail: 661 pnp_unregister_driver(&cadet_pnp_driver); 662 return res; 663 } 664 665 static void __exit cadet_exit(void) 666 { 667 struct cadet *dev = &cadet_card; 668 669 video_unregister_device(&dev->vdev); 670 v4l2_ctrl_handler_free(&dev->ctrl_handler); 671 v4l2_device_unregister(&dev->v4l2_dev); 672 outb(7, dev->io); /* Mute */ 673 outb(0x00, dev->io + 1); 674 release_region(dev->io, 2); 675 pnp_unregister_driver(&cadet_pnp_driver); 676 } 677 678 module_init(cadet_init); 679 module_exit(cadet_exit); 680 681