v2.4.9.9 -> v2.4.9.10
[opensuse:kernel.git] / drivers / usb / serial / whiteheat.c
1 /*
2  * USB ConnectTech WhiteHEAT driver
3  *
4  *      Copyright (C) 1999 - 2001
5  *          Greg Kroah-Hartman (greg@kroah.com)
6  *
7  *      This program is free software; you can redistribute it and/or modify
8  *      it under the terms of the GNU General Public License as published by
9  *      the Free Software Foundation; either version 2 of the License, or
10  *      (at your option) any later version.
11  *
12  * See Documentation/usb/usb-serial.txt for more information on using this driver
13  *
14  * (05/30/2001) gkh
15  *      switched from using spinlock to a semaphore, which fixes lots of problems.
16  *
17  * (04/08/2001) gb
18  *      Identify version on module load.
19  * 
20  * 2001_Mar_19 gkh
21  *      Fixed MOD_INC and MOD_DEC logic, the ability to open a port more 
22  *      than once, and the got the proper usb_device_id table entries so
23  *      the driver works again.
24  *
25  * (11/01/2000) Adam J. Richter
26  *      usb_device_id table support
27  * 
28  * (10/05/2000) gkh
29  *      Fixed bug with urb->dev not being set properly, now that the usb
30  *      core needs it.
31  * 
32  * (10/03/2000) smd
33  *      firmware is improved to guard against crap sent to device
34  *      firmware now replies CMD_FAILURE on bad things
35  *      read_callback fix you provided for private info struct
36  *      command_finished now indicates success or fail
37  *      setup_port struct now packed to avoid gcc padding
38  *      firmware uses 1 based port numbering, driver now handles that
39  *
40  * (09/11/2000) gkh
41  *      Removed DEBUG #ifdefs with call to usb_serial_debug_data
42  *
43  * (07/19/2000) gkh
44  *      Added module_init and module_exit functions to handle the fact that this
45  *      driver is a loadable module now.
46  *      Fixed bug with port->minor that was found by Al Borchers
47  *
48  * (07/04/2000) gkh
49  *      Added support for port settings. Baud rate can now be changed. Line signals
50  *      are not transferred to and from the tty layer yet, but things seem to be 
51  *      working well now.
52  *
53  * (05/04/2000) gkh
54  *      First cut at open and close commands. Data can flow through the ports at
55  *      default speeds now.
56  *
57  * (03/26/2000) gkh
58  *      Split driver up into device specific pieces.
59  * 
60  */
61
62 #include <linux/config.h>
63 #include <linux/kernel.h>
64 #include <linux/sched.h>
65 #include <linux/signal.h>
66 #include <linux/errno.h>
67 #include <linux/poll.h>
68 #include <linux/init.h>
69 #include <linux/slab.h>
70 #include <linux/fcntl.h>
71 #include <linux/tty.h>
72 #include <linux/tty_driver.h>
73 #include <linux/tty_flip.h>
74 #include <linux/module.h>
75 #include <linux/spinlock.h>
76 #include <linux/usb.h>
77
78 #ifdef CONFIG_USB_SERIAL_DEBUG
79         static int debug = 1;
80 #else
81         static int debug;
82 #endif
83
84 #include "usb-serial.h"
85 #include "whiteheat_fw.h"               /* firmware for the ConnectTech WhiteHEAT device */
86 #include "whiteheat.h"                  /* WhiteHEAT specific commands */
87
88 /*
89  * Version Information
90  */
91 #define DRIVER_VERSION "v1.1"
92 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
93 #define DRIVER_DESC "USB ConnectTech WhiteHEAT driver"
94
95 #define CONNECT_TECH_VENDOR_ID          0x0710
96 #define CONNECT_TECH_FAKE_WHITE_HEAT_ID 0x0001
97 #define CONNECT_TECH_WHITE_HEAT_ID      0x8001
98
99 /*
100    ID tables for whiteheat are unusual, because we want to different
101    things for different versions of the device.  Eventually, this
102    will be doable from a single table.  But, for now, we define two
103    separate ID tables, and then a third table that combines them
104    just for the purpose of exporting the autoloading information.
105 */
106 static __devinitdata struct usb_device_id id_table_std [] = {
107         { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_WHITE_HEAT_ID) },
108         { }                                             /* Terminating entry */
109 };
110
111 static __devinitdata struct usb_device_id id_table_prerenumeration [] = {
112         { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_FAKE_WHITE_HEAT_ID) },
113         { }                                             /* Terminating entry */
114 };
115
116 static __devinitdata struct usb_device_id id_table_combined [] = {
117         { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_WHITE_HEAT_ID) },
118         { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_FAKE_WHITE_HEAT_ID) },
119         { }                                             /* Terminating entry */
120 };
121
122 MODULE_DEVICE_TABLE (usb, id_table_combined);
123
124 /* function prototypes for the Connect Tech WhiteHEAT serial converter */
125 static int  whiteheat_open              (struct usb_serial_port *port, struct file *filp);
126 static void whiteheat_close             (struct usb_serial_port *port, struct file *filp);
127 static int  whiteheat_ioctl             (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
128 static void whiteheat_set_termios       (struct usb_serial_port *port, struct termios * old);
129 static void whiteheat_throttle          (struct usb_serial_port *port);
130 static void whiteheat_unthrottle        (struct usb_serial_port *port);
131 static int  whiteheat_startup           (struct usb_serial *serial);
132 static void whiteheat_shutdown          (struct usb_serial *serial);
133
134 struct usb_serial_device_type whiteheat_fake_device = {
135         name:                   "Connect Tech - WhiteHEAT - (prerenumeration)",
136         id_table:               id_table_prerenumeration,
137         needs_interrupt_in:     DONT_CARE,                              /* don't have to have an interrupt in endpoint */
138         needs_bulk_in:          DONT_CARE,                              /* don't have to have a bulk in endpoint */
139         needs_bulk_out:         DONT_CARE,                              /* don't have to have a bulk out endpoint */
140         num_interrupt_in:       NUM_DONT_CARE,
141         num_bulk_in:            NUM_DONT_CARE,
142         num_bulk_out:           NUM_DONT_CARE,
143         num_ports:              1,
144         startup:                whiteheat_startup       
145 };
146
147 struct usb_serial_device_type whiteheat_device = {
148         name:                   "Connect Tech - WhiteHEAT",
149         id_table:               id_table_std,
150         needs_interrupt_in:     DONT_CARE,                              /* don't have to have an interrupt in endpoint */
151         needs_bulk_in:          DONT_CARE,                              /* don't have to have a bulk in endpoint */
152         needs_bulk_out:         DONT_CARE,                              /* don't have to have a bulk out endpoint */
153         num_interrupt_in:       NUM_DONT_CARE,
154         num_bulk_in:            NUM_DONT_CARE,
155         num_bulk_out:           NUM_DONT_CARE,
156         num_ports:              4,
157         open:                   whiteheat_open,
158         close:                  whiteheat_close,
159         throttle:               whiteheat_throttle,
160         unthrottle:             whiteheat_unthrottle,
161         ioctl:                  whiteheat_ioctl,
162         set_termios:            whiteheat_set_termios,
163         shutdown:               whiteheat_shutdown,
164 };
165
166 struct whiteheat_private {
167         __u8                    command_finished;
168         wait_queue_head_t       wait_command;   /* for handling sleeping while waiting for a command to finish */
169 };
170
171
172 /* local function prototypes */
173 static inline void set_rts      (struct usb_serial_port *port, unsigned char rts);
174 static inline void set_dtr      (struct usb_serial_port *port, unsigned char dtr);
175 static inline void set_break    (struct usb_serial_port *port, unsigned char brk);
176
177
178
179 #define COMMAND_PORT            4
180 #define COMMAND_TIMEOUT         (2*HZ)  /* 2 second timeout for a command */
181
182 /*****************************************************************************
183  * Connect Tech's White Heat specific driver functions
184  *****************************************************************************/
185 static void command_port_write_callback (struct urb *urb)
186 {
187         dbg (__FUNCTION__);
188
189         if (urb->status) {
190                 dbg ("nonzero urb status: %d", urb->status);
191                 return;
192         }
193
194         usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
195
196         return;
197 }
198
199
200 static void command_port_read_callback (struct urb *urb)
201 {
202         struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
203         struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
204         struct whiteheat_private *info;
205         unsigned char *data = urb->transfer_buffer;
206         int result;
207
208         dbg (__FUNCTION__);
209
210         if (urb->status) {
211                 dbg (__FUNCTION__ " - nonzero urb status: %d", urb->status);
212                 return;
213         }
214
215         if (!serial) {
216                 dbg(__FUNCTION__ " - bad serial pointer, exiting");
217                 return;
218         }
219         
220         usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
221
222         info = (struct whiteheat_private *)port->private;
223         if (!info) {
224                 dbg (__FUNCTION__ " - info is NULL, exiting.");
225                 return;
226         }
227
228         /* right now, if the command is COMMAND_COMPLETE, just flip the bit saying the command finished */
229         /* in the future we're going to have to pay attention to the actual command that completed */
230         if (data[0] == WHITEHEAT_CMD_COMPLETE) {
231                 info->command_finished = WHITEHEAT_CMD_COMPLETE;
232                 wake_up_interruptible(&info->wait_command);
233         }
234         
235         if (data[0] == WHITEHEAT_CMD_FAILURE) {
236                 info->command_finished = WHITEHEAT_CMD_FAILURE;
237                 wake_up_interruptible(&info->wait_command);
238         }
239         
240         /* Continue trying to always read */
241         FILL_BULK_URB(port->read_urb, serial->dev, 
242                       usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
243                       port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
244                       command_port_read_callback, port);
245         result = usb_submit_urb(port->read_urb);
246         if (result)
247                 dbg(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
248 }
249
250
251 static int whiteheat_send_cmd (struct usb_serial *serial, __u8 command, __u8 *data, __u8 datasize)
252 {
253         struct whiteheat_private *info;
254         struct usb_serial_port *port;
255         int timeout;
256         __u8 *transfer_buffer;
257         int retval = 0;
258
259         dbg(__FUNCTION__" - command %d", command);
260
261         port = &serial->port[COMMAND_PORT];
262         info = (struct whiteheat_private *)port->private;
263         info->command_finished = FALSE;
264         
265         transfer_buffer = (__u8 *)port->write_urb->transfer_buffer;
266         transfer_buffer[0] = command;
267         memcpy (&transfer_buffer[1], data, datasize);
268         port->write_urb->transfer_buffer_length = datasize + 1;
269         port->write_urb->dev = serial->dev;
270         retval = usb_submit_urb (port->write_urb);
271         if (retval) {
272                 dbg (__FUNCTION__" - submit urb failed");
273                 goto exit;
274         }
275
276         /* wait for the command to complete */
277         timeout = COMMAND_TIMEOUT;
278         while (timeout && (info->command_finished == FALSE)) {
279                 timeout = interruptible_sleep_on_timeout (&info->wait_command, timeout);
280         }
281
282         if (info->command_finished == FALSE) {
283                 dbg (__FUNCTION__ " - command timed out.");
284                 retval = -ETIMEDOUT;
285                 goto exit;
286         }
287
288         if (info->command_finished == WHITEHEAT_CMD_FAILURE) {
289                 dbg (__FUNCTION__ " - command failed.");
290                 retval = -EIO;
291                 goto exit;
292         }
293
294         if (info->command_finished == WHITEHEAT_CMD_COMPLETE)
295                 dbg (__FUNCTION__ " - command completed.");
296
297 exit:
298         return retval;
299 }
300
301
302 static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
303 {
304         struct whiteheat_min_set        open_command;
305         struct usb_serial_port          *command_port;
306         struct whiteheat_private        *info;
307         int                             retval = 0;
308
309         dbg(__FUNCTION__" - port %d", port->number);
310
311         down (&port->sem);
312
313         ++port->open_count;
314         MOD_INC_USE_COUNT;
315         
316         if (!port->active) {
317                 port->active = 1;
318
319                 /* set up some stuff for our command port */
320                 command_port = &port->serial->port[COMMAND_PORT];
321                 if (command_port->private == NULL) {
322                         info = (struct whiteheat_private *)kmalloc (sizeof(struct whiteheat_private), GFP_KERNEL);
323                         if (info == NULL) {
324                                 err(__FUNCTION__ " - out of memory");
325                                 retval = -ENOMEM;
326                                 goto error_exit;
327                         }
328                         
329                         init_waitqueue_head(&info->wait_command);
330                         command_port->private = info;
331                         command_port->write_urb->complete = command_port_write_callback;
332                         command_port->read_urb->complete = command_port_read_callback;
333                         command_port->read_urb->dev = port->serial->dev;
334                         command_port->tty = port->tty;          /* need this to "fake" our our sanity check macros */
335                         retval = usb_submit_urb (command_port->read_urb);
336                         if (retval) {
337                                 err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
338                                 goto error_exit;
339                         }
340                 }
341                 
342                 /* Start reading from the device */
343                 port->read_urb->dev = port->serial->dev;
344                 retval = usb_submit_urb(port->read_urb);
345                 if (retval) {
346                         err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
347                         goto error_exit;
348                 }
349         
350                 /* send an open port command */
351                 /* firmware uses 1 based port numbering */
352                 open_command.port = port->number - port->serial->minor + 1;
353                 retval = whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
354                 if (retval)
355                         goto error_exit;
356         
357                 /* Need to do device specific setup here (control lines, baud rate, etc.) */
358                 /* FIXME!!! */
359         }
360
361         dbg(__FUNCTION__ " - exit");
362         up (&port->sem);
363         
364         return retval;
365
366 error_exit:
367         --port->open_count;
368         MOD_DEC_USE_COUNT;
369
370         dbg(__FUNCTION__ " - error_exit");
371         up (&port->sem);
372         
373         return retval;
374 }
375
376
377 static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
378 {
379         struct whiteheat_min_set        close_command;
380         
381         dbg(__FUNCTION__ " - port %d", port->number);
382         
383         down (&port->sem);
384         --port->open_count;
385
386         if (port->open_count <= 0) {
387                 /* send a close command to the port */
388                 /* firmware uses 1 based port numbering */
389                 close_command.port = port->number - port->serial->minor + 1;
390                 whiteheat_send_cmd (port->serial, WHITEHEAT_CLOSE, (__u8 *)&close_command, sizeof(close_command));
391         
392                 /* Need to change the control lines here */
393                 /* FIXME */
394                 
395                 /* shutdown our bulk reads and writes */
396                 usb_unlink_urb (port->write_urb);
397                 usb_unlink_urb (port->read_urb);
398                 port->active = 0;
399         }
400         MOD_DEC_USE_COUNT;
401         up (&port->sem);
402 }
403
404
405 static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg)
406 {
407         dbg(__FUNCTION__ " - port %d, cmd 0x%.4x", port->number, cmd);
408
409         return -ENOIOCTLCMD;
410 }
411
412
413 static void whiteheat_set_termios (struct usb_serial_port *port, struct termios *old_termios)
414 {
415         unsigned int cflag;
416         struct whiteheat_port_settings port_settings;
417
418         dbg(__FUNCTION__ " -port %d", port->number);
419
420         down (&port->sem);
421
422         if ((!port->tty) || (!port->tty->termios)) {
423                 dbg(__FUNCTION__" - no tty structures");
424                 goto exit;
425         }
426         
427         cflag = port->tty->termios->c_cflag;
428         /* check that they really want us to change something */
429         if (old_termios) {
430                 if ((cflag == old_termios->c_cflag) &&
431                     (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) {
432                         dbg(__FUNCTION__ " - nothing to change...");
433                         goto exit;
434                 }
435         }
436
437         /* set the port number */
438         /* firmware uses 1 based port numbering */
439         port_settings.port = port->number + 1;
440
441         /* get the byte size */
442         switch (cflag & CSIZE) {
443                 case CS5:       port_settings.bits = 5;   break;
444                 case CS6:       port_settings.bits = 6;   break;
445                 case CS7:       port_settings.bits = 7;   break;
446                 default:
447                 case CS8:       port_settings.bits = 8;   break;
448         }
449         dbg(__FUNCTION__ " - data bits = %d", port_settings.bits);
450         
451         /* determine the parity */
452         if (cflag & PARENB)
453                 if (cflag & PARODD)
454                         port_settings.parity = 'o';
455                 else
456                         port_settings.parity = 'e';
457         else
458                 port_settings.parity = 'n';
459         dbg(__FUNCTION__ " - parity = %c", port_settings.parity);
460
461         /* figure out the stop bits requested */
462         if (cflag & CSTOPB)
463                 port_settings.stop = 2;
464         else
465                 port_settings.stop = 1;
466         dbg(__FUNCTION__ " - stop bits = %d", port_settings.stop);
467
468         
469         /* figure out the flow control settings */
470         if (cflag & CRTSCTS)
471                 port_settings.hflow = (WHITEHEAT_CTS_FLOW | WHITEHEAT_RTS_FLOW);
472         else
473                 port_settings.hflow = 0;
474         dbg(__FUNCTION__ " - hardware flow control = %s %s %s %s",
475             (port_settings.hflow & WHITEHEAT_CTS_FLOW) ? "CTS" : "",
476             (port_settings.hflow & WHITEHEAT_RTS_FLOW) ? "RTS" : "",
477             (port_settings.hflow & WHITEHEAT_DSR_FLOW) ? "DSR" : "",
478             (port_settings.hflow & WHITEHEAT_DTR_FLOW) ? "DTR" : "");
479         
480         /* determine software flow control */
481         if (I_IXOFF(port->tty))
482                 port_settings.sflow = 'b';
483         else
484                 port_settings.sflow = 'n';
485         dbg(__FUNCTION__ " - software flow control = %c", port_settings.sflow);
486         
487         port_settings.xon = START_CHAR(port->tty);
488         port_settings.xoff = STOP_CHAR(port->tty);
489         dbg(__FUNCTION__ " - XON = %2x, XOFF = %2x", port_settings.xon, port_settings.xoff);
490
491         /* get the baud rate wanted */
492         port_settings.baud = tty_get_baud_rate(port->tty);
493         dbg(__FUNCTION__ " - baud rate = %d", port_settings.baud);
494
495         /* handle any settings that aren't specified in the tty structure */
496         port_settings.lloop = 0;
497         
498         /* now send the message to the device */
499         whiteheat_send_cmd (port->serial, WHITEHEAT_SETUP_PORT, (__u8 *)&port_settings, sizeof(port_settings));
500         
501 exit:
502         up (&port->sem);
503         return;
504 }
505
506
507 static void whiteheat_throttle (struct usb_serial_port *port)
508 {
509         dbg(__FUNCTION__" - port %d", port->number);
510
511         /* Change the control signals */
512         /* FIXME!!! */
513
514         return;
515 }
516
517
518 static void whiteheat_unthrottle (struct usb_serial_port *port)
519 {
520         dbg(__FUNCTION__" - port %d", port->number);
521
522         /* Change the control signals */
523         /* FIXME!!! */
524
525         return;
526 }
527
528
529 /* steps to download the firmware to the WhiteHEAT device:
530  - hold the reset (by writing to the reset bit of the CPUCS register)
531  - download the VEND_AX.HEX file to the chip using VENDOR_REQUEST-ANCHOR_LOAD
532  - release the reset (by writing to the CPUCS register)
533  - download the WH.HEX file for all addresses greater than 0x1b3f using
534    VENDOR_REQUEST-ANCHOR_EXTERNAL_RAM_LOAD
535  - hold the reset
536  - download the WH.HEX file for all addresses less than 0x1b40 using
537    VENDOR_REQUEST_ANCHOR_LOAD
538  - release the reset
539  - device renumerated itself and comes up as new device id with all
540    firmware download completed.
541 */
542 static int  whiteheat_startup (struct usb_serial *serial)
543 {
544         int response;
545         const struct whiteheat_hex_record *record;
546         
547         dbg(__FUNCTION__);
548         
549         response = ezusb_set_reset (serial, 1);
550
551         record = &whiteheat_loader[0];
552         while (record->address != 0xffff) {
553                 response = ezusb_writememory (serial, record->address, 
554                                 (unsigned char *)record->data, record->data_size, 0xa0);
555                 if (response < 0) {
556                         err(__FUNCTION__ " - ezusb_writememory failed for loader (%d %04X %p %d)", 
557                                 response, record->address, record->data, record->data_size);
558                         break;
559                 }
560                 ++record;
561         }
562
563         response = ezusb_set_reset (serial, 0);
564
565         record = &whiteheat_firmware[0];
566         while (record->address < 0x1b40) {
567                 ++record;
568         }
569         while (record->address != 0xffff) {
570                 response = ezusb_writememory (serial, record->address, 
571                                 (unsigned char *)record->data, record->data_size, 0xa3);
572                 if (response < 0) {
573                         err(__FUNCTION__ " - ezusb_writememory failed for first firmware step (%d %04X %p %d)", 
574                                 response, record->address, record->data, record->data_size);
575                         break;
576                 }
577                 ++record;
578         }
579         
580         response = ezusb_set_reset (serial, 1);
581
582         record = &whiteheat_firmware[0];
583         while (record->address < 0x1b40) {
584                 response = ezusb_writememory (serial, record->address, 
585                                 (unsigned char *)record->data, record->data_size, 0xa0);
586                 if (response < 0) {
587                         err(__FUNCTION__" - ezusb_writememory failed for second firmware step (%d %04X %p %d)", 
588                                 response, record->address, record->data, record->data_size);
589                         break;
590                 }
591                 ++record;
592         }
593
594         response = ezusb_set_reset (serial, 0);
595
596         /* we want this device to fail to have a driver assigned to it. */
597         return 1;
598 }
599
600
601 static void whiteheat_shutdown (struct usb_serial *serial)
602 {
603         struct usb_serial_port          *command_port;
604         int i;
605
606         dbg(__FUNCTION__);
607
608         /* stop reads and writes on all ports */
609         for (i=0; i < serial->num_ports; ++i) {
610                 while (serial->port[i].open_count > 0) {
611                         whiteheat_close (&serial->port[i], NULL);
612                 }
613         }
614
615         /* free up our private data for our command port */
616         command_port = &serial->port[COMMAND_PORT];
617         if (command_port->private != NULL) {
618                 kfree (command_port->private);
619                 command_port->private = NULL;
620         }
621
622         return;
623 }
624
625
626
627
628 static void set_command (struct usb_serial_port *port, unsigned char state, unsigned char command)
629 {
630         struct whiteheat_rdb_set rdb_command;
631         
632         /* send a set rts command to the port */
633         /* firmware uses 1 based port numbering */
634         rdb_command.port = port->number - port->serial->minor + 1;
635         rdb_command.state = state;
636
637         whiteheat_send_cmd (port->serial, command, (__u8 *)&rdb_command, sizeof(rdb_command));
638 }
639
640
641 static inline void set_rts (struct usb_serial_port *port, unsigned char rts)
642 {
643         set_command (port, rts, WHITEHEAT_SET_RTS);
644 }
645
646
647 static inline void set_dtr (struct usb_serial_port *port, unsigned char dtr)
648 {
649         set_command (port, dtr, WHITEHEAT_SET_DTR);
650 }
651
652
653 static inline void set_break (struct usb_serial_port *port, unsigned char brk)
654 {
655         set_command (port, brk, WHITEHEAT_SET_BREAK);
656 }
657
658
659 static int __init whiteheat_init (void)
660 {
661         usb_serial_register (&whiteheat_fake_device);
662         usb_serial_register (&whiteheat_device);
663         info(DRIVER_VERSION ":" DRIVER_DESC);
664         return 0;
665 }
666
667
668 static void __exit whiteheat_exit (void)
669 {
670         usb_serial_deregister (&whiteheat_fake_device);
671         usb_serial_deregister (&whiteheat_device);
672 }
673
674
675 module_init(whiteheat_init);
676 module_exit(whiteheat_exit);
677
678 MODULE_AUTHOR( DRIVER_AUTHOR );
679 MODULE_DESCRIPTION( DRIVER_DESC );
680 MODULE_LICENSE("GPL");
681
682 MODULE_PARM(debug, "i");
683 MODULE_PARM_DESC(debug, "Debug enabled or not");
684