blob: b60012ce4c91237e1d82846686d03d181e5901e5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * USB Keyspan PDA / Xircom / Entregra Converter driver
3 *
4 * Copyright (C) 1999 - 2001 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 1999, 2000 Brian Warner <warner@lothar.com>
6 * Copyright (C) 2000 Al Borchers <borchers@steinerpoint.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
Alan Cox9e70f312008-07-22 11:13:42 +010013 * See Documentation/usb/usb-serial.txt for more information on using this
14 * driver
15 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 * (09/07/2001) gkh
17 * cleaned up the Xircom support. Added ids for Entregra device which is
18 * the same as the Xircom device. Enabled the code to be compiled for
19 * either Xircom or Keyspan devices.
20 *
21 * (08/11/2001) Cristian M. Craciunescu
22 * support for Xircom PGSDB9
23 *
24 * (05/31/2001) gkh
Alan Cox9e70f312008-07-22 11:13:42 +010025 * switched from using spinlock to a semaphore, which fixes lots of
26 * problems.
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 *
28 * (04/08/2001) gb
29 * Identify version on module load.
Alan Cox9e70f312008-07-22 11:13:42 +010030 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 * (11/01/2000) Adam J. Richter
32 * usb_device_id table support
Alan Cox9e70f312008-07-22 11:13:42 +010033 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 * (10/05/2000) gkh
35 * Fixed bug with urb->dev not being set properly, now that the usb
36 * core needs it.
Alan Cox9e70f312008-07-22 11:13:42 +010037 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 * (08/28/2000) gkh
39 * Added locks for SMP safeness.
Alan Cox9e70f312008-07-22 11:13:42 +010040 * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 * than once.
Alan Cox9e70f312008-07-22 11:13:42 +010042 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 * (07/20/2000) borchers
44 * - keyspan_pda_write no longer sleeps if it is called on interrupt time;
45 * PPP and the line discipline with stty echo on can call write on
46 * interrupt time and this would cause an oops if write slept
47 * - if keyspan_pda_write is in an interrupt, it will not call
48 * usb_control_msg (which sleeps) to query the room in the device
49 * buffer, it simply uses the current room value it has
50 * - if the urb is busy or if it is throttled keyspan_pda_write just
51 * returns 0, rather than sleeping to wait for this to change; the
52 * write_chan code in n_tty.c will sleep if needed before calling
53 * keyspan_pda_write again
54 * - if the device needs to be unthrottled, write now queues up the
55 * call to usb_control_msg (which sleeps) to unthrottle the device
56 * - the wakeups from keyspan_pda_write_bulk_callback are queued rather
57 * than done directly from the callback to avoid the race in write_chan
58 * - keyspan_pda_chars_in_buffer also indicates its buffer is full if the
59 * urb status is -EINPROGRESS, meaning it cannot write at the moment
Alan Cox9e70f312008-07-22 11:13:42 +010060 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 * (07/19/2000) gkh
62 * Added module_init and module_exit functions to handle the fact that this
63 * driver is a loadable module now.
64 *
65 * (03/26/2000) gkh
66 * Split driver up into device specific pieces.
Alan Cox9e70f312008-07-22 11:13:42 +010067 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 */
69
70
Linus Torvalds1da177e2005-04-16 15:20:36 -070071#include <linux/kernel.h>
72#include <linux/errno.h>
73#include <linux/init.h>
74#include <linux/slab.h>
75#include <linux/tty.h>
76#include <linux/tty_driver.h>
77#include <linux/tty_flip.h>
78#include <linux/module.h>
79#include <linux/spinlock.h>
80#include <linux/workqueue.h>
David Woodhouse3edbf982008-05-30 15:15:13 +030081#include <linux/firmware.h>
82#include <linux/ihex.h>
Alan Cox9e70f312008-07-22 11:13:42 +010083#include <linux/uaccess.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#include <linux/usb.h>
Greg Kroah-Hartmana9698882006-07-11 21:22:58 -070085#include <linux/usb/serial.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
87static int debug;
88
Linus Torvalds1da177e2005-04-16 15:20:36 -070089/* make a simple define to handle if we are compiling keyspan_pda or xircom support */
90#if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE)
91 #define KEYSPAN
92#else
93 #undef KEYSPAN
94#endif
95#if defined(CONFIG_USB_SERIAL_XIRCOM) || defined(CONFIG_USB_SERIAL_XIRCOM_MODULE)
96 #define XIRCOM
97#else
98 #undef XIRCOM
99#endif
100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101/*
102 * Version Information
103 */
104#define DRIVER_VERSION "v1.1"
105#define DRIVER_AUTHOR "Brian Warner <warner@lothar.com>"
106#define DRIVER_DESC "USB Keyspan PDA Converter driver"
107
108struct keyspan_pda_private {
109 int tx_room;
110 int tx_throttled;
111 struct work_struct wakeup_work;
112 struct work_struct unthrottle_work;
David Howellsc4028952006-11-22 14:57:56 +0000113 struct usb_serial *serial;
114 struct usb_serial_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115};
116
117
118#define KEYSPAN_VENDOR_ID 0x06cd
119#define KEYSPAN_PDA_FAKE_ID 0x0103
120#define KEYSPAN_PDA_ID 0x0104 /* no clue */
121
122/* For Xircom PGSDB9 and older Entregra version of the same device */
123#define XIRCOM_VENDOR_ID 0x085a
124#define XIRCOM_FAKE_ID 0x8027
125#define ENTREGRA_VENDOR_ID 0x1645
126#define ENTREGRA_FAKE_ID 0x8093
127
128static struct usb_device_id id_table_combined [] = {
129#ifdef KEYSPAN
130 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
131#endif
132#ifdef XIRCOM
133 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
134 { USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
135#endif
136 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
137 { } /* Terminating entry */
138};
139
Alan Cox9e70f312008-07-22 11:13:42 +0100140MODULE_DEVICE_TABLE(usb, id_table_combined);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142static struct usb_driver keyspan_pda_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 .name = "keyspan_pda",
144 .probe = usb_serial_probe,
145 .disconnect = usb_serial_disconnect,
146 .id_table = id_table_combined,
Greg Kroah-Hartmanba9dc652005-11-16 13:41:28 -0800147 .no_dynamic_id = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148};
149
150static struct usb_device_id id_table_std [] = {
151 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
152 { } /* Terminating entry */
153};
154
155#ifdef KEYSPAN
156static struct usb_device_id id_table_fake [] = {
157 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
158 { } /* Terminating entry */
159};
160#endif
161
162#ifdef XIRCOM
163static struct usb_device_id id_table_fake_xircom [] = {
Alan Cox9e70f312008-07-22 11:13:42 +0100164 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
165 { USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
166 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167};
168#endif
169
David Howellsc4028952006-11-22 14:57:56 +0000170static void keyspan_pda_wakeup_write(struct work_struct *work)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171{
David Howellsc4028952006-11-22 14:57:56 +0000172 struct keyspan_pda_private *priv =
173 container_of(work, struct keyspan_pda_private, wakeup_work);
174 struct usb_serial_port *port = priv->port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Alan Cox95da3102008-07-22 11:09:07 +0100176 tty_wakeup(port->port.tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177}
178
David Howellsc4028952006-11-22 14:57:56 +0000179static void keyspan_pda_request_unthrottle(struct work_struct *work)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180{
David Howellsc4028952006-11-22 14:57:56 +0000181 struct keyspan_pda_private *priv =
182 container_of(work, struct keyspan_pda_private, unthrottle_work);
183 struct usb_serial *serial = priv->serial;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 int result;
185
186 dbg(" request_unthrottle");
187 /* ask the device to tell us when the tx buffer becomes
188 sufficiently empty */
Alan Cox9e70f312008-07-22 11:13:42 +0100189 result = usb_control_msg(serial->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 usb_sndctrlpipe(serial->dev, 0),
191 7, /* request_unthrottle */
192 USB_TYPE_VENDOR | USB_RECIP_INTERFACE
193 | USB_DIR_OUT,
194 16, /* value: threshold */
195 0, /* index */
196 NULL,
197 0,
198 2000);
199 if (result < 0)
Alan Cox9e70f312008-07-22 11:13:42 +0100200 dbg("%s - error %d from usb_control_msg",
Harvey Harrison441b62c2008-03-03 16:08:34 -0800201 __func__, result);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202}
203
204
Alan Cox9e70f312008-07-22 11:13:42 +0100205static void keyspan_pda_rx_interrupt(struct urb *urb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206{
Ming Leicdc97792008-02-24 18:41:47 +0800207 struct usb_serial_port *port = urb->context;
Alan Cox9e70f312008-07-22 11:13:42 +0100208 struct tty_struct *tty = port->port.tty;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 unsigned char *data = urb->transfer_buffer;
210 int i;
Greg Kroah-Hartman23189ae2007-06-15 15:44:13 -0700211 int retval;
212 int status = urb->status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 struct keyspan_pda_private *priv;
214 priv = usb_get_serial_port_data(port);
215
Greg Kroah-Hartman23189ae2007-06-15 15:44:13 -0700216 switch (status) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 case 0:
218 /* success */
219 break;
220 case -ECONNRESET:
221 case -ENOENT:
222 case -ESHUTDOWN:
223 /* this urb is terminated, clean up */
Greg Kroah-Hartman23189ae2007-06-15 15:44:13 -0700224 dbg("%s - urb shutting down with status: %d",
Harvey Harrison441b62c2008-03-03 16:08:34 -0800225 __func__, status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 return;
227 default:
Greg Kroah-Hartman23189ae2007-06-15 15:44:13 -0700228 dbg("%s - nonzero urb status received: %d",
Harvey Harrison441b62c2008-03-03 16:08:34 -0800229 __func__, status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 goto exit;
231 }
232
Alan Cox9e70f312008-07-22 11:13:42 +0100233 /* see if the message is data or a status interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 switch (data[0]) {
235 case 0:
236 /* rest of message is rx data */
237 if (urb->actual_length) {
Alan Cox9e70f312008-07-22 11:13:42 +0100238 for (i = 1; i < urb->actual_length ; ++i)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 tty_insert_flip_char(tty, data[i], 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 tty_flip_buffer_push(tty);
241 }
242 break;
243 case 1:
244 /* status interrupt */
245 dbg(" rx int, d1=%d, d2=%d", data[1], data[2]);
246 switch (data[1]) {
247 case 1: /* modemline change */
248 break;
249 case 2: /* tx unthrottle interrupt */
250 priv->tx_throttled = 0;
251 /* queue up a wakeup at scheduler time */
252 schedule_work(&priv->wakeup_work);
253 break;
254 default:
255 break;
256 }
257 break;
258 default:
259 break;
260 }
261
262exit:
Alan Cox9e70f312008-07-22 11:13:42 +0100263 retval = usb_submit_urb(urb, GFP_ATOMIC);
Greg Kroah-Hartman23189ae2007-06-15 15:44:13 -0700264 if (retval)
Alan Cox9e70f312008-07-22 11:13:42 +0100265 err("%s - usb_submit_urb failed with result %d",
Harvey Harrison441b62c2008-03-03 16:08:34 -0800266 __func__, retval);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267}
268
269
Alan Cox95da3102008-07-22 11:09:07 +0100270static void keyspan_pda_rx_throttle(struct tty_struct *tty)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271{
272 /* stop receiving characters. We just turn off the URB request, and
273 let chars pile up in the device. If we're doing hardware
274 flowcontrol, the device will signal the other end when its buffer
275 fills up. If we're doing XON/XOFF, this would be a good time to
276 send an XOFF, although it might make sense to foist that off
277 upon the device too. */
Alan Cox95da3102008-07-22 11:09:07 +0100278 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 dbg("keyspan_pda_rx_throttle port %d", port->number);
280 usb_kill_urb(port->interrupt_in_urb);
281}
282
283
Alan Cox95da3102008-07-22 11:09:07 +0100284static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285{
Alan Cox95da3102008-07-22 11:09:07 +0100286 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 /* just restart the receive interrupt URB */
288 dbg("keyspan_pda_rx_unthrottle port %d", port->number);
289 port->interrupt_in_urb->dev = port->serial->dev;
290 if (usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC))
291 dbg(" usb_submit_urb(read urb) failed");
292 return;
293}
294
295
Alan Cox9e70f312008-07-22 11:13:42 +0100296static speed_t keyspan_pda_setbaud(struct usb_serial *serial, speed_t baud)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297{
298 int rc;
299 int bindex;
300
Alan Cox9e70f312008-07-22 11:13:42 +0100301 switch (baud) {
302 case 110:
303 bindex = 0;
304 break;
305 case 300:
306 bindex = 1;
307 break;
308 case 1200:
309 bindex = 2;
310 break;
311 case 2400:
312 bindex = 3;
313 break;
314 case 4800:
315 bindex = 4;
316 break;
317 case 9600:
318 bindex = 5;
319 break;
320 case 19200:
321 bindex = 6;
322 break;
323 case 38400:
324 bindex = 7;
325 break;
326 case 57600:
327 bindex = 8;
328 break;
329 case 115200:
330 bindex = 9;
331 break;
332 default:
333 bindex = 5; /* Default to 9600 */
334 baud = 9600;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 }
336
337 /* rather than figure out how to sleep while waiting for this
338 to complete, I just use the "legacy" API. */
339 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
340 0, /* set baud */
Alan Cox9e70f312008-07-22 11:13:42 +0100341 USB_TYPE_VENDOR
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 | USB_RECIP_INTERFACE
343 | USB_DIR_OUT, /* type */
344 bindex, /* value */
345 0, /* index */
346 NULL, /* &data */
347 0, /* size */
348 2000); /* timeout */
Alan Coxe7806e32007-12-13 16:15:28 -0800349 if (rc < 0)
350 return 0;
351 return baud;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352}
353
354
Alan Cox95da3102008-07-22 11:09:07 +0100355static void keyspan_pda_break_ctl(struct tty_struct *tty, int break_state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356{
Alan Cox95da3102008-07-22 11:09:07 +0100357 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 struct usb_serial *serial = port->serial;
359 int value;
360 int result;
361
362 if (break_state == -1)
363 value = 1; /* start break */
364 else
365 value = 0; /* clear break */
366 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
Alan Cox9e70f312008-07-22 11:13:42 +0100367 4, /* set break */
368 USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT,
369 value, 0, NULL, 0, 2000);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 if (result < 0)
Alan Cox9e70f312008-07-22 11:13:42 +0100371 dbg("%s - error %d from usb_control_msg",
Harvey Harrison441b62c2008-03-03 16:08:34 -0800372 __func__, result);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 /* there is something funky about this.. the TCSBRK that 'cu' performs
374 ought to translate into a break_ctl(-1),break_ctl(0) pair HZ/4
375 seconds apart, but it feels like the break sent isn't as long as it
376 is on /dev/ttyS0 */
377}
378
379
Alan Cox95da3102008-07-22 11:09:07 +0100380static void keyspan_pda_set_termios(struct tty_struct *tty,
381 struct usb_serial_port *port, struct ktermios *old_termios)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382{
383 struct usb_serial *serial = port->serial;
Alan Coxe7806e32007-12-13 16:15:28 -0800384 speed_t speed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385
386 /* cflag specifies lots of stuff: number of stop bits, parity, number
387 of data bits, baud. What can the device actually handle?:
388 CSTOPB (1 stop bit or 2)
389 PARENB (parity)
390 CSIZE (5bit .. 8bit)
391 There is minimal hw support for parity (a PSW bit seems to hold the
392 parity of whatever is in the accumulator). The UART either deals
393 with 10 bits (start, 8 data, stop) or 11 bits (start, 8 data,
394 1 special, stop). So, with firmware changes, we could do:
395 8N1: 10 bit
396 8N2: 11 bit, extra bit always (mark?)
397 8[EOMS]1: 11 bit, extra bit is parity
398 7[EOMS]1: 10 bit, b0/b7 is parity
399 7[EOMS]2: 11 bit, b0/b7 is parity, extra bit always (mark?)
400
401 HW flow control is dictated by the tty->termios->c_cflags & CRTSCTS
402 bit.
403
404 For now, just do baud. */
405
Alan Cox95da3102008-07-22 11:09:07 +0100406 speed = tty_get_baud_rate(tty);
Alan Coxe7806e32007-12-13 16:15:28 -0800407 speed = keyspan_pda_setbaud(serial, speed);
408
409 if (speed == 0) {
410 dbg("can't handle requested baud rate");
411 /* It hasn't changed so.. */
412 speed = tty_termios_baud_rate(old_termios);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 }
Alan Coxe7806e32007-12-13 16:15:28 -0800414 /* Only speed can change so copy the old h/w parameters
415 then encode the new speed */
Alan Cox95da3102008-07-22 11:09:07 +0100416 tty_termios_copy_hw(tty->termios, old_termios);
417 tty_encode_baud_rate(tty, speed, speed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418}
419
420
421/* modem control pins: DTR and RTS are outputs and can be controlled.
422 DCD, RI, DSR, CTS are inputs and can be read. All outputs can also be
423 read. The byte passed is: DTR(b7) DCD RI DSR CTS RTS(b2) unused unused */
424
425static int keyspan_pda_get_modem_info(struct usb_serial *serial,
426 unsigned char *value)
427{
428 int rc;
429 unsigned char data;
430 rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
431 3, /* get pins */
432 USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
433 0, 0, &data, 1, 2000);
Benny Halevy3b36a8f2008-06-27 12:22:32 +0300434 if (rc >= 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 *value = data;
436 return rc;
437}
438
439
440static int keyspan_pda_set_modem_info(struct usb_serial *serial,
441 unsigned char value)
442{
443 int rc;
444 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
445 3, /* set pins */
446 USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_OUT,
447 value, 0, NULL, 0, 2000);
448 return rc;
449}
450
Alan Cox95da3102008-07-22 11:09:07 +0100451static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452{
Alan Cox95da3102008-07-22 11:09:07 +0100453 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 struct usb_serial *serial = port->serial;
455 int rc;
456 unsigned char status;
457 int value;
458
459 rc = keyspan_pda_get_modem_info(serial, &status);
460 if (rc < 0)
461 return rc;
462 value =
463 ((status & (1<<7)) ? TIOCM_DTR : 0) |
464 ((status & (1<<6)) ? TIOCM_CAR : 0) |
465 ((status & (1<<5)) ? TIOCM_RNG : 0) |
466 ((status & (1<<4)) ? TIOCM_DSR : 0) |
467 ((status & (1<<3)) ? TIOCM_CTS : 0) |
468 ((status & (1<<2)) ? TIOCM_RTS : 0);
469 return value;
470}
471
Alan Cox95da3102008-07-22 11:09:07 +0100472static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 unsigned int set, unsigned int clear)
474{
Alan Cox95da3102008-07-22 11:09:07 +0100475 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 struct usb_serial *serial = port->serial;
477 int rc;
478 unsigned char status;
479
480 rc = keyspan_pda_get_modem_info(serial, &status);
481 if (rc < 0)
482 return rc;
483
484 if (set & TIOCM_RTS)
485 status |= (1<<2);
486 if (set & TIOCM_DTR)
487 status |= (1<<7);
488
489 if (clear & TIOCM_RTS)
490 status &= ~(1<<2);
491 if (clear & TIOCM_DTR)
492 status &= ~(1<<7);
493 rc = keyspan_pda_set_modem_info(serial, status);
494 return rc;
495}
496
Alan Cox95da3102008-07-22 11:09:07 +0100497static int keyspan_pda_write(struct tty_struct *tty,
498 struct usb_serial_port *port, const unsigned char *buf, int count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499{
500 struct usb_serial *serial = port->serial;
501 int request_unthrottle = 0;
502 int rc = 0;
503 struct keyspan_pda_private *priv;
504
505 priv = usb_get_serial_port_data(port);
506 /* guess how much room is left in the device's ring buffer, and if we
507 want to send more than that, check first, updating our notion of
508 what is left. If our write will result in no room left, ask the
509 device to give us an interrupt when the room available rises above
510 a threshold, and hold off all writers (eventually, those using
511 select() or poll() too) until we receive that unthrottle interrupt.
512 Block if we can't write anything at all, otherwise write as much as
513 we can. */
Alan Cox9e70f312008-07-22 11:13:42 +0100514 dbg("keyspan_pda_write(%d)", count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 if (count == 0) {
516 dbg(" write request of 0 bytes");
Alan Cox9e70f312008-07-22 11:13:42 +0100517 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 }
519
520 /* we might block because of:
521 the TX urb is in-flight (wait until it completes)
522 the device is full (wait until it says there is room)
523 */
Peter Zijlstrae81ee632006-09-25 12:51:41 +0200524 spin_lock_bh(&port->lock);
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700525 if (port->write_urb_busy || priv->tx_throttled) {
Peter Zijlstrae81ee632006-09-25 12:51:41 +0200526 spin_unlock_bh(&port->lock);
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700527 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 }
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700529 port->write_urb_busy = 1;
Peter Zijlstrae81ee632006-09-25 12:51:41 +0200530 spin_unlock_bh(&port->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531
532 /* At this point the URB is in our control, nobody else can submit it
533 again (the only sudden transition was the one from EINPROGRESS to
534 finished). Also, the tx process is not throttled. So we are
535 ready to write. */
536
537 count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
538
539 /* Check if we might overrun the Tx buffer. If so, ask the
540 device how much room it really has. This is done only on
541 scheduler time, since usb_control_msg() sleeps. */
542 if (count > priv->tx_room && !in_interrupt()) {
543 unsigned char room;
Alan Cox9e70f312008-07-22 11:13:42 +0100544 rc = usb_control_msg(serial->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 usb_rcvctrlpipe(serial->dev, 0),
546 6, /* write_room */
547 USB_TYPE_VENDOR | USB_RECIP_INTERFACE
548 | USB_DIR_IN,
549 0, /* value: 0 means "remaining room" */
550 0, /* index */
551 &room,
552 1,
553 2000);
554 if (rc < 0) {
555 dbg(" roomquery failed");
556 goto exit;
557 }
558 if (rc == 0) {
559 dbg(" roomquery returned 0 bytes");
560 rc = -EIO; /* device didn't return any data */
561 goto exit;
562 }
563 dbg(" roomquery says %d", room);
564 priv->tx_room = room;
565 }
566 if (count > priv->tx_room) {
567 /* we're about to completely fill the Tx buffer, so
568 we'll be throttled afterwards. */
569 count = priv->tx_room;
570 request_unthrottle = 1;
571 }
572
573 if (count) {
574 /* now transfer data */
Alan Cox9e70f312008-07-22 11:13:42 +0100575 memcpy(port->write_urb->transfer_buffer, buf, count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 /* send the data out the bulk port */
577 port->write_urb->transfer_buffer_length = count;
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700578
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 priv->tx_room -= count;
580
581 port->write_urb->dev = port->serial->dev;
582 rc = usb_submit_urb(port->write_urb, GFP_ATOMIC);
583 if (rc) {
584 dbg(" usb_submit_urb(write bulk) failed");
585 goto exit;
586 }
Alan Cox9e70f312008-07-22 11:13:42 +0100587 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 /* There wasn't any room left, so we are throttled until
589 the buffer empties a bit */
590 request_unthrottle = 1;
591 }
592
593 if (request_unthrottle) {
594 priv->tx_throttled = 1; /* block writers */
595 schedule_work(&priv->unthrottle_work);
596 }
597
598 rc = count;
599exit:
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700600 if (rc < 0)
601 port->write_urb_busy = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 return rc;
603}
604
605
Alan Cox9e70f312008-07-22 11:13:42 +0100606static void keyspan_pda_write_bulk_callback(struct urb *urb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607{
Ming Leicdc97792008-02-24 18:41:47 +0800608 struct usb_serial_port *port = urb->context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 struct keyspan_pda_private *priv;
610
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700611 port->write_urb_busy = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 priv = usb_get_serial_port_data(port);
613
614 /* queue up a wakeup at scheduler time */
615 schedule_work(&priv->wakeup_work);
616}
617
618
Alan Cox95da3102008-07-22 11:09:07 +0100619static int keyspan_pda_write_room(struct tty_struct *tty)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620{
Alan Cox95da3102008-07-22 11:09:07 +0100621 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622 struct keyspan_pda_private *priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 priv = usb_get_serial_port_data(port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 /* used by n_tty.c for processing of tabs and such. Giving it our
625 conservative guess is probably good enough, but needs testing by
626 running a console through the device. */
Alan Cox9e70f312008-07-22 11:13:42 +0100627 return priv->tx_room;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628}
629
630
Alan Cox95da3102008-07-22 11:09:07 +0100631static int keyspan_pda_chars_in_buffer(struct tty_struct *tty)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632{
Alan Cox95da3102008-07-22 11:09:07 +0100633 struct usb_serial_port *port = tty->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 struct keyspan_pda_private *priv;
Alan Coxa5b6f602008-04-08 17:16:06 +0100635 unsigned long flags;
636 int ret = 0;
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700637
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700639
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 /* when throttled, return at least WAKEUP_CHARS to tell select() (via
641 n_tty.c:normal_poll() ) that we're not writeable. */
Alan Coxa5b6f602008-04-08 17:16:06 +0100642
643 spin_lock_irqsave(&port->lock, flags);
Greg Kroah-Hartman507ca9b2005-04-23 12:49:16 -0700644 if (port->write_urb_busy || priv->tx_throttled)
Alan Coxa5b6f602008-04-08 17:16:06 +0100645 ret = 256;
646 spin_unlock_irqrestore(&port->lock, flags);
647 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648}
649
650
Alan Cox95da3102008-07-22 11:09:07 +0100651static int keyspan_pda_open(struct tty_struct *tty,
652 struct usb_serial_port *port, struct file *filp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653{
654 struct usb_serial *serial = port->serial;
655 unsigned char room;
656 int rc = 0;
657 struct keyspan_pda_private *priv;
658
659 /* find out how much room is in the Tx ring */
660 rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
661 6, /* write_room */
662 USB_TYPE_VENDOR | USB_RECIP_INTERFACE
663 | USB_DIR_IN,
664 0, /* value */
665 0, /* index */
666 &room,
667 1,
668 2000);
669 if (rc < 0) {
Harvey Harrison441b62c2008-03-03 16:08:34 -0800670 dbg("%s - roomquery failed", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 goto error;
672 }
673 if (rc == 0) {
Harvey Harrison441b62c2008-03-03 16:08:34 -0800674 dbg("%s - roomquery returned 0 bytes", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 rc = -EIO;
676 goto error;
677 }
678 priv = usb_get_serial_port_data(port);
679 priv->tx_room = room;
680 priv->tx_throttled = room ? 0 : 1;
681
682 /* the normal serial device seems to always turn on DTR and RTS here,
683 so do the same */
Alan Cox95da3102008-07-22 11:09:07 +0100684 if (tty && (tty->termios->c_cflag & CBAUD))
Alan Cox9e70f312008-07-22 11:13:42 +0100685 keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 else
687 keyspan_pda_set_modem_info(serial, 0);
688
689 /*Start reading from the device*/
690 port->interrupt_in_urb->dev = serial->dev;
691 rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
692 if (rc) {
Harvey Harrison441b62c2008-03-03 16:08:34 -0800693 dbg("%s - usb_submit_urb(read int) failed", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 goto error;
695 }
696
697error:
698 return rc;
699}
700
701
Alan Cox95da3102008-07-22 11:09:07 +0100702static void keyspan_pda_close(struct tty_struct *tty,
703 struct usb_serial_port *port, struct file *filp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704{
705 struct usb_serial *serial = port->serial;
706
707 if (serial->dev) {
Alan Cox9e70f312008-07-22 11:13:42 +0100708 /* the normal serial device seems to always shut
709 off DTR and RTS now */
Alan Cox95da3102008-07-22 11:09:07 +0100710 if (tty->termios->c_cflag & HUPCL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 keyspan_pda_set_modem_info(serial, 0);
712
713 /* shutdown our bulk reads and writes */
714 usb_kill_urb(port->write_urb);
715 usb_kill_urb(port->interrupt_in_urb);
716 }
717}
718
719
720/* download the firmware to a "fake" device (pre-renumeration) */
Alan Cox9e70f312008-07-22 11:13:42 +0100721static int keyspan_pda_fake_startup(struct usb_serial *serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722{
723 int response;
David Woodhouse3edbf982008-05-30 15:15:13 +0300724 const char *fw_name;
725 const struct ihex_binrec *record;
726 const struct firmware *fw;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727
728 /* download the firmware here ... */
729 response = ezusb_set_reset(serial, 1);
730
David Woodhouse3edbf982008-05-30 15:15:13 +0300731 if (0) { ; }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732#ifdef KEYSPAN
David Woodhouse3edbf982008-05-30 15:15:13 +0300733 else if (le16_to_cpu(serial->dev->descriptor.idVendor) == KEYSPAN_VENDOR_ID)
734 fw_name = "keyspan_pda/keyspan_pda.fw";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735#endif
736#ifdef XIRCOM
David Woodhouse3edbf982008-05-30 15:15:13 +0300737 else if ((le16_to_cpu(serial->dev->descriptor.idVendor) == XIRCOM_VENDOR_ID) ||
738 (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGRA_VENDOR_ID))
739 fw_name = "keyspan_pda/xircom_pgs.fw";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740#endif
David Woodhouse3edbf982008-05-30 15:15:13 +0300741 else {
Harvey Harrison441b62c2008-03-03 16:08:34 -0800742 err("%s: unknown vendor, aborting.", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 return -ENODEV;
744 }
David Woodhouse3edbf982008-05-30 15:15:13 +0300745 if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) {
746 err("failed to load firmware \"%s\"\n", fw_name);
747 return -ENOENT;
748 }
749 record = (const struct ihex_binrec *)fw->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750
David Woodhouse3edbf982008-05-30 15:15:13 +0300751 while (record) {
752 response = ezusb_writememory(serial, be32_to_cpu(record->addr),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753 (unsigned char *)record->data,
David Woodhouse3edbf982008-05-30 15:15:13 +0300754 be16_to_cpu(record->len), 0xa0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 if (response < 0) {
756 err("ezusb_writememory failed for Keyspan PDA "
757 "firmware (%d %04X %p %d)",
David Woodhouse3edbf982008-05-30 15:15:13 +0300758 response, be32_to_cpu(record->addr),
759 record->data, be16_to_cpu(record->len));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 break;
761 }
David Woodhouse3edbf982008-05-30 15:15:13 +0300762 record = ihex_next_binrec(record);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 }
David Woodhouse3edbf982008-05-30 15:15:13 +0300764 release_firmware(fw);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 /* bring device out of reset. Renumeration will occur in a moment
766 and the new device will bind to the real driver */
767 response = ezusb_set_reset(serial, 0);
768
769 /* we want this device to fail to have a driver assigned to it. */
Alan Cox9e70f312008-07-22 11:13:42 +0100770 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771}
772
Alan Cox9e70f312008-07-22 11:13:42 +0100773static int keyspan_pda_startup(struct usb_serial *serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774{
775
776 struct keyspan_pda_private *priv;
777
778 /* allocate the private data structures for all ports. Well, for all
779 one ports. */
780
781 priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
782 if (!priv)
Alan Cox9e70f312008-07-22 11:13:42 +0100783 return 1; /* error */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784 usb_set_serial_port_data(serial->port[0], priv);
785 init_waitqueue_head(&serial->port[0]->write_wait);
David Howellsc4028952006-11-22 14:57:56 +0000786 INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
787 INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
788 priv->serial = serial;
789 priv->port = serial->port[0];
Alan Cox9e70f312008-07-22 11:13:42 +0100790 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791}
792
Alan Cox9e70f312008-07-22 11:13:42 +0100793static void keyspan_pda_shutdown(struct usb_serial *serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794{
Harvey Harrison441b62c2008-03-03 16:08:34 -0800795 dbg("%s", __func__);
Alan Cox9e70f312008-07-22 11:13:42 +0100796
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 kfree(usb_get_serial_port_data(serial->port[0]));
798}
799
800#ifdef KEYSPAN
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700801static struct usb_serial_driver keyspan_pda_fake_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700802 .driver = {
803 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700804 .name = "keyspan_pda_pre",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700805 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700806 .description = "Keyspan PDA - (prerenumeration)",
Johannes Hölzld9b1b782006-12-17 21:50:24 +0100807 .usb_driver = &keyspan_pda_driver,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 .id_table = id_table_fake,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 .num_ports = 1,
810 .attach = keyspan_pda_fake_startup,
811};
812#endif
813
814#ifdef XIRCOM
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700815static struct usb_serial_driver xircom_pgs_fake_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700816 .driver = {
817 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700818 .name = "xircom_no_firm",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700819 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700820 .description = "Xircom / Entregra PGS - (prerenumeration)",
Johannes Hölzld9b1b782006-12-17 21:50:24 +0100821 .usb_driver = &keyspan_pda_driver,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822 .id_table = id_table_fake_xircom,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 .num_ports = 1,
824 .attach = keyspan_pda_fake_startup,
825};
826#endif
827
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700828static struct usb_serial_driver keyspan_pda_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700829 .driver = {
830 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700831 .name = "keyspan_pda",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700832 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700833 .description = "Keyspan PDA",
Johannes Hölzld9b1b782006-12-17 21:50:24 +0100834 .usb_driver = &keyspan_pda_driver,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 .id_table = id_table_std,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 .num_ports = 1,
837 .open = keyspan_pda_open,
838 .close = keyspan_pda_close,
839 .write = keyspan_pda_write,
840 .write_room = keyspan_pda_write_room,
841 .write_bulk_callback = keyspan_pda_write_bulk_callback,
842 .read_int_callback = keyspan_pda_rx_interrupt,
843 .chars_in_buffer = keyspan_pda_chars_in_buffer,
844 .throttle = keyspan_pda_rx_throttle,
845 .unthrottle = keyspan_pda_rx_unthrottle,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 .set_termios = keyspan_pda_set_termios,
847 .break_ctl = keyspan_pda_break_ctl,
848 .tiocmget = keyspan_pda_tiocmget,
849 .tiocmset = keyspan_pda_tiocmset,
850 .attach = keyspan_pda_startup,
851 .shutdown = keyspan_pda_shutdown,
852};
853
854
Alan Cox9e70f312008-07-22 11:13:42 +0100855static int __init keyspan_pda_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856{
857 int retval;
858 retval = usb_serial_register(&keyspan_pda_device);
859 if (retval)
860 goto failed_pda_register;
861#ifdef KEYSPAN
862 retval = usb_serial_register(&keyspan_pda_fake_device);
863 if (retval)
864 goto failed_pda_fake_register;
865#endif
866#ifdef XIRCOM
867 retval = usb_serial_register(&xircom_pgs_fake_device);
868 if (retval)
869 goto failed_xircom_register;
870#endif
871 retval = usb_register(&keyspan_pda_driver);
872 if (retval)
873 goto failed_usb_register;
874 info(DRIVER_DESC " " DRIVER_VERSION);
875 return 0;
Alan Cox9e70f312008-07-22 11:13:42 +0100876failed_usb_register:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700877#ifdef XIRCOM
878 usb_serial_deregister(&xircom_pgs_fake_device);
879failed_xircom_register:
880#endif /* XIRCOM */
881#ifdef KEYSPAN
882 usb_serial_deregister(&keyspan_pda_fake_device);
883#endif
884#ifdef KEYSPAN
885failed_pda_fake_register:
886#endif
887 usb_serial_deregister(&keyspan_pda_device);
888failed_pda_register:
889 return retval;
890}
891
892
Alan Cox9e70f312008-07-22 11:13:42 +0100893static void __exit keyspan_pda_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894{
Alan Cox9e70f312008-07-22 11:13:42 +0100895 usb_deregister(&keyspan_pda_driver);
896 usb_serial_deregister(&keyspan_pda_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897#ifdef KEYSPAN
Alan Cox9e70f312008-07-22 11:13:42 +0100898 usb_serial_deregister(&keyspan_pda_fake_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700899#endif
900#ifdef XIRCOM
Alan Cox9e70f312008-07-22 11:13:42 +0100901 usb_serial_deregister(&xircom_pgs_fake_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902#endif
903}
904
905
906module_init(keyspan_pda_init);
907module_exit(keyspan_pda_exit);
908
Alan Cox9e70f312008-07-22 11:13:42 +0100909MODULE_AUTHOR(DRIVER_AUTHOR);
910MODULE_DESCRIPTION(DRIVER_DESC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911MODULE_LICENSE("GPL");
912
913module_param(debug, bool, S_IRUGO | S_IWUSR);
914MODULE_PARM_DESC(debug, "Debug enabled or not");
915