Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 11 | * Jason Lewis (jlewis@twilight.vtc.vsc.edu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Alan Cox | d9b0144 | 2008-10-27 15:13:47 -0300 | [diff] [blame] | 26 | * 2003-01-31 Alan Cox <alan@lxorguk.ukuu.org.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | * Cleaned up locking, delay code, general odds and ends |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 28 | * |
| 29 | * 2006-07-30 Hans J. Koch <koch@hjk-az.de> |
| 30 | * Changed API to V4L2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | */ |
| 32 | |
Andrew Morton | d591b9c | 2006-08-08 10:52:22 -0300 | [diff] [blame] | 33 | #include <linux/version.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <linux/module.h> /* Modules */ |
| 35 | #include <linux/init.h> /* Initdata */ |
Peter Osterlund | fb911ee | 2005-09-13 01:25:15 -0700 | [diff] [blame] | 36 | #include <linux/ioport.h> /* request_region */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <linux/delay.h> /* udelay */ |
| 38 | #include <asm/io.h> /* outb, outb_p */ |
| 39 | #include <asm/uaccess.h> /* copy to/from user */ |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 40 | #include <linux/videodev2.h> /* V4L2 API defs */ |
Mauro Carvalho Chehab | 5e87efa | 2006-06-05 10:26:32 -0300 | [diff] [blame] | 41 | #include <media/v4l2-common.h> |
Hans Verkuil | 35ea11f | 2008-07-20 08:12:02 -0300 | [diff] [blame] | 42 | #include <media/v4l2-ioctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #include <linux/param.h> |
| 44 | #include <linux/pnp.h> |
| 45 | |
| 46 | #define RDS_BUFFER 256 |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 47 | #define RDS_RX_FLAG 1 |
| 48 | #define MBS_RX_FLAG 2 |
| 49 | |
| 50 | #define CADET_VERSION KERNEL_VERSION(0,3,3) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 52 | static struct v4l2_queryctrl radio_qctrl[] = { |
| 53 | { |
| 54 | .id = V4L2_CID_AUDIO_MUTE, |
| 55 | .name = "Mute", |
| 56 | .minimum = 0, |
| 57 | .maximum = 1, |
| 58 | .default_value = 1, |
| 59 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 60 | },{ |
| 61 | .id = V4L2_CID_AUDIO_VOLUME, |
| 62 | .name = "Volume", |
| 63 | .minimum = 0, |
| 64 | .maximum = 0xff, |
| 65 | .step = 1, |
| 66 | .default_value = 0xff, |
| 67 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 68 | } |
| 69 | }; |
| 70 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | static int io=-1; /* default to isapnp activation */ |
| 72 | static int radio_nr = -1; |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 73 | static int users; |
| 74 | static int curtuner; |
| 75 | static int tunestat; |
| 76 | static int sigstrength; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | static wait_queue_head_t read_queue; |
| 78 | static struct timer_list readtimer; |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 79 | static __u8 rdsin, rdsout, rdsstat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | static unsigned char rdsbuf[RDS_BUFFER]; |
| 81 | static spinlock_t cadet_io_lock; |
| 82 | |
| 83 | static int cadet_probe(void); |
| 84 | |
| 85 | /* |
| 86 | * Signal Strength Threshold Values |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 87 | * The V4L API spec does not define any particular unit for the signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | * strength value. These values are in microvolts of RF at the tuner's input. |
| 89 | */ |
| 90 | static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}}; |
| 91 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 92 | |
| 93 | static int |
| 94 | cadet_getstereo(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 96 | int ret = V4L2_TUNER_SUB_MONO; |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 97 | if(curtuner != 0) /* Only FM has stereo capability! */ |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 98 | return V4L2_TUNER_SUB_MONO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
| 100 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 101 | outb(7,io); /* Select tuner control */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | if( (inb(io+1) & 0x40) == 0) |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 103 | ret = V4L2_TUNER_SUB_STEREO; |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 104 | spin_unlock(&cadet_io_lock); |
| 105 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | } |
| 107 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 108 | static unsigned |
| 109 | cadet_gettune(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 111 | int curvol,i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | unsigned fifo=0; |
| 113 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 114 | /* |
| 115 | * Prepare for read |
| 116 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
| 118 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 119 | |
| 120 | outb(7,io); /* Select tuner control */ |
| 121 | curvol=inb(io+1); /* Save current volume/mute setting */ |
| 122 | outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | tunestat=0xffff; |
| 124 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 125 | /* |
| 126 | * Read the shift register |
| 127 | */ |
| 128 | for(i=0;i<25;i++) { |
| 129 | fifo=(fifo<<1)|((inb(io+1)>>7)&0x01); |
| 130 | if(i<24) { |
| 131 | outb(0x01,io+1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | tunestat&=inb(io+1); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 133 | outb(0x00,io+1); |
| 134 | } |
| 135 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 137 | /* |
| 138 | * Restore volume/mute setting |
| 139 | */ |
| 140 | outb(curvol,io+1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | spin_unlock(&cadet_io_lock); |
| 142 | |
| 143 | return fifo; |
| 144 | } |
| 145 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 146 | static unsigned |
| 147 | cadet_getfreq(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 149 | int i; |
| 150 | unsigned freq=0,test,fifo=0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
| 152 | /* |
| 153 | * Read current tuning |
| 154 | */ |
| 155 | fifo=cadet_gettune(); |
| 156 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 157 | /* |
| 158 | * Convert to actual frequency |
| 159 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | if(curtuner==0) { /* FM */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 161 | test=12500; |
| 162 | for(i=0;i<14;i++) { |
| 163 | if((fifo&0x01)!=0) { |
| 164 | freq+=test; |
| 165 | } |
| 166 | test=test<<1; |
| 167 | fifo=fifo>>1; |
| 168 | } |
| 169 | freq-=10700000; /* IF frequency is 10.7 MHz */ |
| 170 | freq=(freq*16)/1000000; /* Make it 1/16 MHz */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | } |
| 172 | if(curtuner==1) { /* AM */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 173 | freq=((fifo&0x7fff)-2010)*16; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | } |
| 175 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 176 | return freq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 179 | static void |
| 180 | cadet_settune(unsigned fifo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 182 | int i; |
| 183 | unsigned test; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
| 185 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 186 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | outb(7,io); /* Select tuner control */ |
| 188 | /* |
| 189 | * Write the shift register |
| 190 | */ |
| 191 | test=0; |
| 192 | test=(fifo>>23)&0x02; /* Align data for SDO */ |
| 193 | test|=0x1c; /* SDM=1, SWE=1, SEN=1, SCK=0 */ |
| 194 | outb(7,io); /* Select tuner control */ |
| 195 | outb(test,io+1); /* Initialize for write */ |
| 196 | for(i=0;i<25;i++) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 197 | test|=0x01; /* Toggle SCK High */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | outb(test,io+1); |
| 199 | test&=0xfe; /* Toggle SCK Low */ |
| 200 | outb(test,io+1); |
| 201 | fifo=fifo<<1; /* Prepare the next bit */ |
| 202 | test=0x1c|((fifo>>23)&0x02); |
| 203 | outb(test,io+1); |
| 204 | } |
| 205 | spin_unlock(&cadet_io_lock); |
| 206 | } |
| 207 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 208 | static void |
| 209 | cadet_setfreq(unsigned freq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 211 | unsigned fifo; |
| 212 | int i,j,test; |
| 213 | int curvol; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 215 | /* |
| 216 | * Formulate a fifo command |
| 217 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | fifo=0; |
| 219 | if(curtuner==0) { /* FM */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 220 | test=102400; |
| 221 | freq=(freq*1000)/16; /* Make it kHz */ |
| 222 | freq+=10700; /* IF is 10700 kHz */ |
| 223 | for(i=0;i<14;i++) { |
| 224 | fifo=fifo<<1; |
| 225 | if(freq>=test) { |
| 226 | fifo|=0x01; |
| 227 | freq-=test; |
| 228 | } |
| 229 | test=test>>1; |
| 230 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | } |
| 232 | if(curtuner==1) { /* AM */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 233 | fifo=(freq/16)+2010; /* Make it kHz */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | fifo|=0x100000; /* Select AM Band */ |
| 235 | } |
| 236 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 237 | /* |
| 238 | * Save current volume/mute setting |
| 239 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
| 241 | spin_lock(&cadet_io_lock); |
| 242 | outb(7,io); /* Select tuner control */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 243 | curvol=inb(io+1); |
| 244 | spin_unlock(&cadet_io_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | |
| 246 | /* |
| 247 | * Tune the card |
| 248 | */ |
| 249 | for(j=3;j>-1;j--) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 250 | cadet_settune(fifo|(j<<16)); |
| 251 | |
| 252 | spin_lock(&cadet_io_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | outb(7,io); /* Select tuner control */ |
| 254 | outb(curvol,io+1); |
| 255 | spin_unlock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 256 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | msleep(100); |
| 258 | |
| 259 | cadet_gettune(); |
| 260 | if((tunestat & 0x40) == 0) { /* Tuned */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 261 | sigstrength=sigtable[curtuner][j]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | return; |
| 263 | } |
| 264 | } |
| 265 | sigstrength=0; |
| 266 | } |
| 267 | |
| 268 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 269 | static int |
| 270 | cadet_getvol(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | { |
| 272 | int ret = 0; |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 275 | |
| 276 | outb(7,io); /* Select tuner control */ |
| 277 | if((inb(io + 1) & 0x20) != 0) |
| 278 | ret = 0xffff; |
| 279 | |
| 280 | spin_unlock(&cadet_io_lock); |
| 281 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 285 | static void |
| 286 | cadet_setvol(int vol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | { |
| 288 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 289 | outb(7,io); /* Select tuner control */ |
| 290 | if(vol>0) |
| 291 | outb(0x20,io+1); |
| 292 | else |
| 293 | outb(0x00,io+1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | spin_unlock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 295 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 297 | static void |
| 298 | cadet_handler(unsigned long data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | { |
| 300 | /* |
| 301 | * Service the RDS fifo |
| 302 | */ |
| 303 | |
| 304 | if(spin_trylock(&cadet_io_lock)) |
| 305 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 306 | outb(0x3,io); /* Select RDS Decoder Control */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | if((inb(io+1)&0x20)!=0) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 308 | printk(KERN_CRIT "cadet: RDS fifo overflow\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | } |
| 310 | outb(0x80,io); /* Select RDS fifo */ |
| 311 | while((inb(io)&0x80)!=0) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 312 | rdsbuf[rdsin]=inb(io+1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | if(rdsin==rdsout) |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 314 | printk(KERN_WARNING "cadet: RDS buffer overflow\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | else |
| 316 | rdsin++; |
| 317 | } |
| 318 | spin_unlock(&cadet_io_lock); |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | * Service pending read |
| 323 | */ |
| 324 | if( rdsin!=rdsout) |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 325 | wake_up_interruptible(&read_queue); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 327 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | * Clean up and exit |
| 329 | */ |
| 330 | init_timer(&readtimer); |
| 331 | readtimer.function=cadet_handler; |
| 332 | readtimer.data=(unsigned long)0; |
Mauro Carvalho Chehab | a2d66a3 | 2007-07-17 16:15:58 -0300 | [diff] [blame] | 333 | readtimer.expires=jiffies+msecs_to_jiffies(50); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | add_timer(&readtimer); |
| 335 | } |
| 336 | |
| 337 | |
| 338 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 339 | static ssize_t |
| 340 | cadet_read(struct file *file, char __user *data, size_t count, loff_t *ppos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 342 | int i=0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | unsigned char readbuf[RDS_BUFFER]; |
| 344 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 345 | if(rdsstat==0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | spin_lock(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 347 | rdsstat=1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | outb(0x80,io); /* Select RDS fifo */ |
| 349 | spin_unlock(&cadet_io_lock); |
| 350 | init_timer(&readtimer); |
| 351 | readtimer.function=cadet_handler; |
| 352 | readtimer.data=(unsigned long)0; |
Mauro Carvalho Chehab | a2d66a3 | 2007-07-17 16:15:58 -0300 | [diff] [blame] | 353 | readtimer.expires=jiffies+msecs_to_jiffies(50); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | add_timer(&readtimer); |
| 355 | } |
| 356 | if(rdsin==rdsout) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 357 | if (file->f_flags & O_NONBLOCK) |
| 358 | return -EWOULDBLOCK; |
| 359 | interruptible_sleep_on(&read_queue); |
| 360 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | while( i<count && rdsin!=rdsout) |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 362 | readbuf[i++]=rdsbuf[rdsout++]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
| 364 | if (copy_to_user(data,readbuf,i)) |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 365 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | return i; |
| 367 | } |
| 368 | |
| 369 | |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 370 | static int vidioc_querycap(struct file *file, void *priv, |
| 371 | struct v4l2_capability *v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 373 | v->capabilities = |
| 374 | V4L2_CAP_TUNER | |
| 375 | V4L2_CAP_READWRITE; |
| 376 | v->version = CADET_VERSION; |
| 377 | strcpy(v->driver, "ADS Cadet"); |
| 378 | strcpy(v->card, "ADS Cadet"); |
| 379 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 382 | static int vidioc_g_tuner(struct file *file, void *priv, |
| 383 | struct v4l2_tuner *v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | { |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 385 | v->type = V4L2_TUNER_RADIO; |
| 386 | switch (v->index) { |
| 387 | case 0: |
| 388 | strcpy(v->name, "FM"); |
| 389 | v->capability = V4L2_TUNER_CAP_STEREO; |
| 390 | v->rangelow = 1400; /* 87.5 MHz */ |
| 391 | v->rangehigh = 1728; /* 108.0 MHz */ |
| 392 | v->rxsubchans=cadet_getstereo(); |
| 393 | switch (v->rxsubchans){ |
| 394 | case V4L2_TUNER_SUB_MONO: |
| 395 | v->audmode = V4L2_TUNER_MODE_MONO; |
| 396 | break; |
| 397 | case V4L2_TUNER_SUB_STEREO: |
| 398 | v->audmode = V4L2_TUNER_MODE_STEREO; |
| 399 | break; |
| 400 | default: ; |
| 401 | } |
| 402 | break; |
| 403 | case 1: |
| 404 | strcpy(v->name, "AM"); |
| 405 | v->capability = V4L2_TUNER_CAP_LOW; |
| 406 | v->rangelow = 8320; /* 520 kHz */ |
| 407 | v->rangehigh = 26400; /* 1650 kHz */ |
| 408 | v->rxsubchans = V4L2_TUNER_SUB_MONO; |
| 409 | v->audmode = V4L2_TUNER_MODE_MONO; |
| 410 | break; |
| 411 | default: |
| 412 | return -EINVAL; |
| 413 | } |
| 414 | v->signal = sigstrength; /* We might need to modify scaling of this */ |
| 415 | return 0; |
| 416 | } |
| 417 | |
| 418 | static int vidioc_s_tuner(struct file *file, void *priv, |
| 419 | struct v4l2_tuner *v) |
| 420 | { |
| 421 | if((v->index != 0)&&(v->index != 1)) |
| 422 | return -EINVAL; |
| 423 | curtuner = v->index; |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | static int vidioc_g_frequency(struct file *file, void *priv, |
| 428 | struct v4l2_frequency *f) |
| 429 | { |
| 430 | f->tuner = curtuner; |
| 431 | f->type = V4L2_TUNER_RADIO; |
| 432 | f->frequency = cadet_getfreq(); |
| 433 | return 0; |
| 434 | } |
| 435 | |
| 436 | |
| 437 | static int vidioc_s_frequency(struct file *file, void *priv, |
| 438 | struct v4l2_frequency *f) |
| 439 | { |
| 440 | if (f->type != V4L2_TUNER_RADIO) |
| 441 | return -EINVAL; |
| 442 | if((curtuner==0)&&((f->frequency<1400)||(f->frequency>1728))) |
| 443 | return -EINVAL; |
| 444 | if((curtuner==1)&&((f->frequency<8320)||(f->frequency>26400))) |
| 445 | return -EINVAL; |
| 446 | cadet_setfreq(f->frequency); |
| 447 | return 0; |
| 448 | } |
| 449 | |
| 450 | static int vidioc_queryctrl(struct file *file, void *priv, |
| 451 | struct v4l2_queryctrl *qc) |
| 452 | { |
| 453 | int i; |
| 454 | |
| 455 | for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { |
| 456 | if (qc->id && qc->id == radio_qctrl[i].id) { |
| 457 | memcpy(qc, &(radio_qctrl[i]), |
| 458 | sizeof(*qc)); |
| 459 | return 0; |
| 460 | } |
| 461 | } |
| 462 | return -EINVAL; |
| 463 | } |
| 464 | |
| 465 | static int vidioc_g_ctrl(struct file *file, void *priv, |
| 466 | struct v4l2_control *ctrl) |
| 467 | { |
| 468 | switch (ctrl->id){ |
| 469 | case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ |
| 470 | ctrl->value = (cadet_getvol() == 0); |
| 471 | break; |
| 472 | case V4L2_CID_AUDIO_VOLUME: |
| 473 | ctrl->value = cadet_getvol(); |
| 474 | break; |
| 475 | default: |
| 476 | return -EINVAL; |
| 477 | } |
| 478 | return 0; |
| 479 | } |
| 480 | |
| 481 | static int vidioc_s_ctrl(struct file *file, void *priv, |
| 482 | struct v4l2_control *ctrl) |
| 483 | { |
| 484 | switch (ctrl->id){ |
| 485 | case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ |
| 486 | if (ctrl->value) |
| 487 | cadet_setvol(0); |
| 488 | else |
| 489 | cadet_setvol(0xffff); |
| 490 | break; |
| 491 | case V4L2_CID_AUDIO_VOLUME: |
| 492 | cadet_setvol(ctrl->value); |
| 493 | break; |
| 494 | default: |
| 495 | return -EINVAL; |
| 496 | } |
| 497 | return 0; |
| 498 | } |
| 499 | |
| 500 | static int vidioc_g_audio(struct file *file, void *priv, |
| 501 | struct v4l2_audio *a) |
| 502 | { |
| 503 | if (a->index > 1) |
| 504 | return -EINVAL; |
| 505 | strcpy(a->name, "Radio"); |
| 506 | a->capability = V4L2_AUDCAP_STEREO; |
| 507 | return 0; |
| 508 | } |
| 509 | |
| 510 | static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) |
| 511 | { |
| 512 | *i = 0; |
| 513 | return 0; |
| 514 | } |
| 515 | |
| 516 | static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) |
| 517 | { |
| 518 | if (i != 0) |
| 519 | return -EINVAL; |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | static int vidioc_s_audio(struct file *file, void *priv, |
| 524 | struct v4l2_audio *a) |
| 525 | { |
| 526 | if (a->index != 0) |
| 527 | return -EINVAL; |
| 528 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | } |
| 530 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 531 | static int |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame^] | 532 | cadet_open(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | users++; |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 535 | if (1 == users) init_waitqueue_head(&read_queue); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | return 0; |
| 537 | } |
| 538 | |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 539 | static int |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame^] | 540 | cadet_release(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | users--; |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 543 | if (0 == users){ |
| 544 | del_timer_sync(&readtimer); |
| 545 | rdsstat=0; |
| 546 | } |
| 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | static unsigned int |
| 551 | cadet_poll(struct file *file, struct poll_table_struct *wait) |
| 552 | { |
| 553 | poll_wait(file,&read_queue,wait); |
| 554 | if(rdsin != rdsout) |
| 555 | return POLLIN | POLLRDNORM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | return 0; |
| 557 | } |
| 558 | |
| 559 | |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame^] | 560 | static const struct v4l2_file_operations cadet_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | .owner = THIS_MODULE, |
| 562 | .open = cadet_open, |
| 563 | .release = cadet_release, |
| 564 | .read = cadet_read, |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 565 | .ioctl = video_ioctl2, |
Hans J. Koch | c0c7fa0 | 2006-08-08 09:10:12 -0300 | [diff] [blame] | 566 | .poll = cadet_poll, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | }; |
| 568 | |
Hans Verkuil | a399810 | 2008-07-21 02:57:38 -0300 | [diff] [blame] | 569 | static const struct v4l2_ioctl_ops cadet_ioctl_ops = { |
Douglas Landgraf | c1c4fd3 | 2007-05-07 16:17:16 -0300 | [diff] [blame] | 570 | .vidioc_querycap = vidioc_querycap, |
| 571 | .vidioc_g_tuner = vidioc_g_tuner, |
| 572 | .vidioc_s_tuner = vidioc_s_tuner, |
| 573 | .vidioc_g_frequency = vidioc_g_frequency, |
| 574 | .vidioc_s_frequency = vidioc_s_frequency, |
| 575 | .vidioc_queryctrl = vidioc_queryctrl, |
| 576 | .vidioc_g_ctrl = vidioc_g_ctrl, |
| 577 | .vidioc_s_ctrl = vidioc_s_ctrl, |
| 578 | .vidioc_g_audio = vidioc_g_audio, |
| 579 | .vidioc_s_audio = vidioc_s_audio, |
| 580 | .vidioc_g_input = vidioc_g_input, |
| 581 | .vidioc_s_input = vidioc_s_input, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | }; |
| 583 | |
Hans Verkuil | a399810 | 2008-07-21 02:57:38 -0300 | [diff] [blame] | 584 | static struct video_device cadet_radio = { |
Hans Verkuil | a399810 | 2008-07-21 02:57:38 -0300 | [diff] [blame] | 585 | .name = "Cadet radio", |
Hans Verkuil | a399810 | 2008-07-21 02:57:38 -0300 | [diff] [blame] | 586 | .fops = &cadet_fops, |
| 587 | .ioctl_ops = &cadet_ioctl_ops, |
Hans Verkuil | aa5e90a | 2008-08-23 06:23:55 -0300 | [diff] [blame] | 588 | .release = video_device_release_empty, |
Hans Verkuil | a399810 | 2008-07-21 02:57:38 -0300 | [diff] [blame] | 589 | }; |
| 590 | |
Bjorn Helgaas | 044dfc9 | 2008-03-31 21:21:48 -0300 | [diff] [blame] | 591 | #ifdef CONFIG_PNP |
| 592 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | static struct pnp_device_id cadet_pnp_devices[] = { |
| 594 | /* ADS Cadet AM/FM Radio Card */ |
| 595 | {.id = "MSM0c24", .driver_data = 0}, |
| 596 | {.id = ""} |
| 597 | }; |
| 598 | |
| 599 | MODULE_DEVICE_TABLE(pnp, cadet_pnp_devices); |
| 600 | |
| 601 | static int cadet_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) |
| 602 | { |
| 603 | if (!dev) |
| 604 | return -ENODEV; |
| 605 | /* only support one device */ |
| 606 | if (io > 0) |
| 607 | return -EBUSY; |
| 608 | |
| 609 | if (!pnp_port_valid(dev, 0)) { |
| 610 | return -ENODEV; |
| 611 | } |
| 612 | |
| 613 | io = pnp_port_start(dev, 0); |
| 614 | |
| 615 | printk ("radio-cadet: PnP reports device at %#x\n", io); |
| 616 | |
| 617 | return io; |
| 618 | } |
| 619 | |
| 620 | static struct pnp_driver cadet_pnp_driver = { |
| 621 | .name = "radio-cadet", |
| 622 | .id_table = cadet_pnp_devices, |
| 623 | .probe = cadet_pnp_probe, |
| 624 | .remove = NULL, |
| 625 | }; |
| 626 | |
Bjorn Helgaas | 044dfc9 | 2008-03-31 21:21:48 -0300 | [diff] [blame] | 627 | #else |
| 628 | static struct pnp_driver cadet_pnp_driver; |
| 629 | #endif |
| 630 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | static int cadet_probe(void) |
| 632 | { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 633 | static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | int i; |
| 635 | |
| 636 | for(i=0;i<8;i++) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 637 | io=iovals[i]; |
Alexey Dobriyan | f1ac046 | 2005-10-14 15:59:04 -0700 | [diff] [blame] | 638 | if (request_region(io, 2, "cadet-probe")) { |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 639 | cadet_setfreq(1410); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | if(cadet_getfreq()==1410) { |
| 641 | release_region(io, 2); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 642 | return io; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | } |
| 644 | release_region(io, 2); |
| 645 | } |
| 646 | } |
| 647 | return -1; |
| 648 | } |
| 649 | |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 650 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | * io should only be set if the user has used something like |
| 652 | * isapnp (the userspace program) to initialize this card for us |
| 653 | */ |
| 654 | |
| 655 | static int __init cadet_init(void) |
| 656 | { |
| 657 | spin_lock_init(&cadet_io_lock); |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 658 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | /* |
| 660 | * If a probe was requested then probe ISAPnP first (safest) |
| 661 | */ |
| 662 | if (io < 0) |
| 663 | pnp_register_driver(&cadet_pnp_driver); |
| 664 | /* |
| 665 | * If that fails then probe unsafely if probe is requested |
| 666 | */ |
| 667 | if(io < 0) |
| 668 | io = cadet_probe (); |
| 669 | |
| 670 | /* |
| 671 | * Else we bail out |
| 672 | */ |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 673 | |
| 674 | if(io < 0) { |
| 675 | #ifdef MODULE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | printk(KERN_ERR "You must set an I/O address with io=0x???\n"); |
| 677 | #endif |
Mauro Carvalho Chehab | 4286c6f | 2006-04-08 16:06:16 -0300 | [diff] [blame] | 678 | goto fail; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | } |
| 680 | if (!request_region(io,2,"cadet")) |
| 681 | goto fail; |
Hans Verkuil | cba99ae | 2008-09-03 17:11:58 -0300 | [diff] [blame] | 682 | if (video_register_device(&cadet_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | release_region(io,2); |
| 684 | goto fail; |
| 685 | } |
| 686 | printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io); |
| 687 | return 0; |
| 688 | fail: |
| 689 | pnp_unregister_driver(&cadet_pnp_driver); |
| 690 | return -1; |
| 691 | } |
| 692 | |
| 693 | |
| 694 | |
| 695 | MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath"); |
| 696 | MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card."); |
| 697 | MODULE_LICENSE("GPL"); |
| 698 | |
| 699 | module_param(io, int, 0); |
| 700 | MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)"); |
| 701 | module_param(radio_nr, int, 0); |
| 702 | |
| 703 | static void __exit cadet_cleanup_module(void) |
| 704 | { |
| 705 | video_unregister_device(&cadet_radio); |
| 706 | release_region(io,2); |
| 707 | pnp_unregister_driver(&cadet_pnp_driver); |
| 708 | } |
| 709 | |
| 710 | module_init(cadet_init); |
| 711 | module_exit(cadet_cleanup_module); |
| 712 | |