| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Belkin USB Serial Adapter Driver | 
 | 3 |  * | 
 | 4 |  *  Copyright (C) 2000		William Greathouse (wgreathouse@smva.com) | 
 | 5 |  *  Copyright (C) 2000-2001 	Greg Kroah-Hartman (greg@kroah.com) | 
 | 6 |  * | 
 | 7 |  *  This program is largely derived from work by the linux-usb group | 
 | 8 |  *  and associated source files.  Please see the usb/serial files for | 
 | 9 |  *  individual credits and copyrights. | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 10 |  * | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 |  * 	This program is free software; you can redistribute it and/or modify | 
 | 12 |  * 	it under the terms of the GNU General Public License as published by | 
 | 13 |  * 	the Free Software Foundation; either version 2 of the License, or | 
 | 14 |  * 	(at your option) any later version. | 
 | 15 |  * | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 16 |  * See Documentation/usb/usb-serial.txt for more information on using this | 
 | 17 |  * driver | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 |  * | 
 | 19 |  * TODO: | 
 | 20 |  * -- Add true modem contol line query capability.  Currently we track the | 
 | 21 |  *    states reported by the interrupt and the states we request. | 
 | 22 |  * -- Add error reporting back to application for UART error conditions. | 
 | 23 |  *    Just point me at how to implement this and I'll do it. I've put the | 
 | 24 |  *    framework in, but haven't analyzed the "tty_flip" interface yet. | 
 | 25 |  * -- Add support for flush commands | 
 | 26 |  * -- Add everything that is missing :) | 
 | 27 |  * | 
 | 28 |  * 27-Nov-2001 gkh | 
 | 29 |  * 	compressed all the differnent device entries into 1. | 
 | 30 |  * | 
 | 31 |  * 30-May-2001 gkh | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 32 |  *	switched from using spinlock to a semaphore, which fixes lots of | 
 | 33 |  *	problems. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 |  * | 
 | 35 |  * 08-Apr-2001 gb | 
 | 36 |  *	- Identify version on module load. | 
 | 37 |  * | 
 | 38 |  * 12-Mar-2001 gkh | 
 | 39 |  *	- Added support for the GoHubs GO-COM232 device which is the same as the | 
 | 40 |  *	  Peracom device. | 
 | 41 |  * | 
 | 42 |  * 06-Nov-2000 gkh | 
 | 43 |  *	- Added support for the old Belkin and Peracom devices. | 
 | 44 |  *	- Made the port able to be opened multiple times. | 
 | 45 |  *	- Added some defaults incase the line settings are things these devices | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 46 |  *	  can't support. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 |  * | 
 | 48 |  * 18-Oct-2000 William Greathouse | 
 | 49 |  *    Released into the wild (linux-usb-devel) | 
 | 50 |  * | 
 | 51 |  * 17-Oct-2000 William Greathouse | 
 | 52 |  *    Add code to recognize firmware version and set hardware flow control | 
 | 53 |  *    appropriately.  Belkin states that firmware prior to 3.05 does not | 
 | 54 |  *    operate correctly in hardware handshake mode.  I have verified this | 
 | 55 |  *    on firmware 2.05 -- for both RTS and DTR input flow control, the control | 
 | 56 |  *    line is not reset.  The test performed by the Belkin Win* driver is | 
 | 57 |  *    to enable hardware flow control for firmware 2.06 or greater and | 
 | 58 |  *    for 1.00 or prior.  I am only enabling for 2.06 or greater. | 
 | 59 |  * | 
 | 60 |  * 12-Oct-2000 William Greathouse | 
 | 61 |  *    First cut at supporting Belkin USB Serial Adapter F5U103 | 
 | 62 |  *    I did not have a copy of the original work to support this | 
 | 63 |  *    adapter, so pardon any stupid mistakes.  All of the information | 
 | 64 |  *    I am using to write this driver was acquired by using a modified | 
 | 65 |  *    UsbSnoop on Windows2000 and from examining the other USB drivers. | 
 | 66 |  */ | 
 | 67 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | #include <linux/kernel.h> | 
 | 69 | #include <linux/errno.h> | 
 | 70 | #include <linux/init.h> | 
 | 71 | #include <linux/slab.h> | 
 | 72 | #include <linux/tty.h> | 
 | 73 | #include <linux/tty_driver.h> | 
 | 74 | #include <linux/tty_flip.h> | 
 | 75 | #include <linux/module.h> | 
 | 76 | #include <linux/spinlock.h> | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 77 | #include <linux/uaccess.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #include <linux/usb.h> | 
| Greg Kroah-Hartman | a969888 | 2006-07-11 21:22:58 -0700 | [diff] [blame] | 79 | #include <linux/usb/serial.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | #include "belkin_sa.h" | 
 | 81 |  | 
 | 82 | static int debug; | 
 | 83 |  | 
 | 84 | /* | 
 | 85 |  * Version Information | 
 | 86 |  */ | 
 | 87 | #define DRIVER_VERSION "v1.2" | 
 | 88 | #define DRIVER_AUTHOR "William Greathouse <wgreathouse@smva.com>" | 
 | 89 | #define DRIVER_DESC "USB Belkin Serial converter driver" | 
 | 90 |  | 
 | 91 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 92 | static int  belkin_sa_startup(struct usb_serial *serial); | 
 | 93 | static void belkin_sa_shutdown(struct usb_serial *serial); | 
 | 94 | static int  belkin_sa_open(struct tty_struct *tty, | 
 | 95 | 			struct usb_serial_port *port, struct file *filp); | 
 | 96 | static void belkin_sa_close(struct tty_struct *tty, | 
 | 97 | 			struct usb_serial_port *port, struct file *filp); | 
 | 98 | static void belkin_sa_read_int_callback(struct urb *urb); | 
 | 99 | static void belkin_sa_set_termios(struct tty_struct *tty, | 
 | 100 | 			struct usb_serial_port *port, struct ktermios * old); | 
 | 101 | static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); | 
 | 102 | static int  belkin_sa_tiocmget(struct tty_struct *tty, struct file *file); | 
 | 103 | static int  belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, | 
 | 104 | 					unsigned int set, unsigned int clear); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 |  | 
 | 106 |  | 
 | 107 | static struct usb_device_id id_table_combined [] = { | 
 | 108 | 	{ USB_DEVICE(BELKIN_SA_VID, BELKIN_SA_PID) }, | 
 | 109 | 	{ USB_DEVICE(BELKIN_OLD_VID, BELKIN_OLD_PID) }, | 
 | 110 | 	{ USB_DEVICE(PERACOM_VID, PERACOM_PID) }, | 
 | 111 | 	{ USB_DEVICE(GOHUBS_VID, GOHUBS_PID) }, | 
 | 112 | 	{ USB_DEVICE(GOHUBS_VID, HANDYLINK_PID) }, | 
 | 113 | 	{ USB_DEVICE(BELKIN_DOCKSTATION_VID, BELKIN_DOCKSTATION_PID) }, | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 114 | 	{ }	/* Terminating entry */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | }; | 
 | 116 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 117 | MODULE_DEVICE_TABLE(usb, id_table_combined); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 |  | 
 | 119 | static struct usb_driver belkin_driver = { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | 	.name =		"belkin", | 
 | 121 | 	.probe =	usb_serial_probe, | 
 | 122 | 	.disconnect =	usb_serial_disconnect, | 
 | 123 | 	.id_table =	id_table_combined, | 
| Greg Kroah-Hartman | ba9dc65 | 2005-11-16 13:41:28 -0800 | [diff] [blame] | 124 | 	.no_dynamic_id = 	1, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | }; | 
 | 126 |  | 
 | 127 | /* All of the device info needed for the serial converters */ | 
| Greg Kroah-Hartman | ea65370 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 128 | static struct usb_serial_driver belkin_device = { | 
| Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 129 | 	.driver = { | 
 | 130 | 		.owner =	THIS_MODULE, | 
| Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 131 | 		.name =		"belkin", | 
| Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 132 | 	}, | 
| Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 133 | 	.description =		"Belkin / Peracom / GoHubs USB Serial Adapter", | 
| Johannes Hölzl | d9b1b78 | 2006-12-17 21:50:24 +0100 | [diff] [blame] | 134 | 	.usb_driver =		&belkin_driver, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | 	.id_table =		id_table_combined, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | 	.num_ports =		1, | 
 | 137 | 	.open =			belkin_sa_open, | 
 | 138 | 	.close =		belkin_sa_close, | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 139 | 	.read_int_callback =	belkin_sa_read_int_callback, | 
 | 140 | 					/* How we get the status info */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | 	.set_termios =		belkin_sa_set_termios, | 
 | 142 | 	.break_ctl =		belkin_sa_break_ctl, | 
 | 143 | 	.tiocmget =		belkin_sa_tiocmget, | 
 | 144 | 	.tiocmset =		belkin_sa_tiocmset, | 
 | 145 | 	.attach =		belkin_sa_startup, | 
 | 146 | 	.shutdown =		belkin_sa_shutdown, | 
 | 147 | }; | 
 | 148 |  | 
 | 149 |  | 
 | 150 | struct belkin_sa_private { | 
 | 151 | 	spinlock_t		lock; | 
 | 152 | 	unsigned long		control_state; | 
 | 153 | 	unsigned char		last_lsr; | 
 | 154 | 	unsigned char		last_msr; | 
 | 155 | 	int			bad_flow_control; | 
 | 156 | }; | 
 | 157 |  | 
 | 158 |  | 
 | 159 | /* | 
 | 160 |  * *************************************************************************** | 
 | 161 |  * Belkin USB Serial Adapter F5U103 specific driver functions | 
 | 162 |  * *************************************************************************** | 
 | 163 |  */ | 
 | 164 |  | 
 | 165 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 
 | 166 |  | 
 | 167 | /* assumes that struct usb_serial *serial is available */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 168 | #define BSA_USB_CMD(c, v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | 					    (c), BELKIN_SA_SET_REQUEST_TYPE, \ | 
 | 170 | 					    (v), 0, NULL, 0, WDR_TIMEOUT) | 
 | 171 |  | 
 | 172 | /* do some startup allocations not currently performed by usb_serial_probe() */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 173 | static int belkin_sa_startup(struct usb_serial *serial) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | { | 
 | 175 | 	struct usb_device *dev = serial->dev; | 
 | 176 | 	struct belkin_sa_private *priv; | 
 | 177 |  | 
 | 178 | 	/* allocate the private data structure */ | 
 | 179 | 	priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); | 
 | 180 | 	if (!priv) | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 181 | 		return -1; /* error */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | 	/* set initial values for control structures */ | 
 | 183 | 	spin_lock_init(&priv->lock); | 
 | 184 | 	priv->control_state = 0; | 
 | 185 | 	priv->last_lsr = 0; | 
 | 186 | 	priv->last_msr = 0; | 
 | 187 | 	/* see comments at top of file */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 188 | 	priv->bad_flow_control = | 
 | 189 | 		(le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0; | 
 | 190 | 	info("bcdDevice: %04x, bfc: %d", | 
 | 191 | 					le16_to_cpu(dev->descriptor.bcdDevice), | 
 | 192 | 					priv->bad_flow_control); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 |  | 
 | 194 | 	init_waitqueue_head(&serial->port[0]->write_wait); | 
 | 195 | 	usb_set_serial_port_data(serial->port[0], priv); | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 196 |  | 
 | 197 | 	return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | } | 
 | 199 |  | 
 | 200 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 201 | static void belkin_sa_shutdown(struct usb_serial *serial) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | { | 
 | 203 | 	struct belkin_sa_private *priv; | 
 | 204 | 	int i; | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 205 |  | 
 | 206 | 	dbg("%s", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 |  | 
 | 208 | 	/* stop reads and writes on all ports */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 209 | 	for (i = 0; i < serial->num_ports; ++i) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | 		/* My special items, the standard routines free my urbs */ | 
 | 211 | 		priv = usb_get_serial_port_data(serial->port[i]); | 
| Jesper Juhl | 1bc3c9e | 2005-04-18 17:39:34 -0700 | [diff] [blame] | 212 | 		kfree(priv); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | 	} | 
 | 214 | } | 
 | 215 |  | 
 | 216 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 217 | static int  belkin_sa_open(struct tty_struct *tty, | 
 | 218 | 			struct usb_serial_port *port, struct file *filp) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | { | 
 | 220 | 	int retval = 0; | 
 | 221 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 222 | 	dbg("%s port %d", __func__, port->number); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 |  | 
 | 224 | 	/*Start reading from the device*/ | 
 | 225 | 	/* TODO: Look at possibility of submitting multiple URBs to device to | 
 | 226 | 	 *       enhance buffering.  Win trace shows 16 initial read URBs. | 
 | 227 | 	 */ | 
 | 228 | 	port->read_urb->dev = port->serial->dev; | 
 | 229 | 	retval = usb_submit_urb(port->read_urb, GFP_KERNEL); | 
 | 230 | 	if (retval) { | 
 | 231 | 		err("usb_submit_urb(read bulk) failed"); | 
 | 232 | 		goto exit; | 
 | 233 | 	} | 
 | 234 |  | 
 | 235 | 	port->interrupt_in_urb->dev = port->serial->dev; | 
 | 236 | 	retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 
 | 237 | 	if (retval) { | 
 | 238 | 		usb_kill_urb(port->read_urb); | 
 | 239 | 		err(" usb_submit_urb(read int) failed"); | 
 | 240 | 	} | 
 | 241 |  | 
 | 242 | exit: | 
 | 243 | 	return retval; | 
 | 244 | } /* belkin_sa_open */ | 
 | 245 |  | 
 | 246 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 247 | static void belkin_sa_close(struct tty_struct *tty, | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 248 | 			struct usb_serial_port *port, struct file *filp) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | { | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 250 | 	dbg("%s port %d", __func__, port->number); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 |  | 
 | 252 | 	/* shutdown our bulk reads and writes */ | 
 | 253 | 	usb_kill_urb(port->write_urb); | 
 | 254 | 	usb_kill_urb(port->read_urb); | 
 | 255 | 	usb_kill_urb(port->interrupt_in_urb); | 
 | 256 | } /* belkin_sa_close */ | 
 | 257 |  | 
 | 258 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 259 | static void belkin_sa_read_int_callback(struct urb *urb) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | { | 
| Ming Lei | cdc9779 | 2008-02-24 18:41:47 +0800 | [diff] [blame] | 261 | 	struct usb_serial_port *port = urb->context; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | 	struct belkin_sa_private *priv; | 
 | 263 | 	unsigned char *data = urb->transfer_buffer; | 
 | 264 | 	int retval; | 
| Greg Kroah-Hartman | f26aad2 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 265 | 	int status = urb->status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | 	unsigned long flags; | 
 | 267 |  | 
| Greg Kroah-Hartman | f26aad2 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 268 | 	switch (status) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | 	case 0: | 
 | 270 | 		/* success */ | 
 | 271 | 		break; | 
 | 272 | 	case -ECONNRESET: | 
 | 273 | 	case -ENOENT: | 
 | 274 | 	case -ESHUTDOWN: | 
 | 275 | 		/* this urb is terminated, clean up */ | 
| Greg Kroah-Hartman | f26aad2 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 276 | 		dbg("%s - urb shutting down with status: %d", | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 277 | 		    __func__, status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | 		return; | 
 | 279 | 	default: | 
| Greg Kroah-Hartman | f26aad2 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 280 | 		dbg("%s - nonzero urb status received: %d", | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 281 | 		    __func__, status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | 		goto exit; | 
 | 283 | 	} | 
 | 284 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 285 | 	usb_serial_debug_data(debug, &port->dev, __func__, | 
 | 286 | 					urb->actual_length, data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 |  | 
 | 288 | 	/* Handle known interrupt data */ | 
 | 289 | 	/* ignore data[0] and data[1] */ | 
 | 290 |  | 
 | 291 | 	priv = usb_get_serial_port_data(port); | 
 | 292 | 	spin_lock_irqsave(&priv->lock, flags); | 
 | 293 | 	priv->last_msr = data[BELKIN_SA_MSR_INDEX]; | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 294 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | 	/* Record Control Line states */ | 
 | 296 | 	if (priv->last_msr & BELKIN_SA_MSR_DSR) | 
 | 297 | 		priv->control_state |= TIOCM_DSR; | 
 | 298 | 	else | 
 | 299 | 		priv->control_state &= ~TIOCM_DSR; | 
 | 300 |  | 
 | 301 | 	if (priv->last_msr & BELKIN_SA_MSR_CTS) | 
 | 302 | 		priv->control_state |= TIOCM_CTS; | 
 | 303 | 	else | 
 | 304 | 		priv->control_state &= ~TIOCM_CTS; | 
 | 305 |  | 
 | 306 | 	if (priv->last_msr & BELKIN_SA_MSR_RI) | 
 | 307 | 		priv->control_state |= TIOCM_RI; | 
 | 308 | 	else | 
 | 309 | 		priv->control_state &= ~TIOCM_RI; | 
 | 310 |  | 
 | 311 | 	if (priv->last_msr & BELKIN_SA_MSR_CD) | 
 | 312 | 		priv->control_state |= TIOCM_CD; | 
 | 313 | 	else | 
 | 314 | 		priv->control_state &= ~TIOCM_CD; | 
 | 315 |  | 
 | 316 | 	/* Now to report any errors */ | 
 | 317 | 	priv->last_lsr = data[BELKIN_SA_LSR_INDEX]; | 
 | 318 | #if 0 | 
 | 319 | 	/* | 
 | 320 | 	 * fill in the flip buffer here, but I do not know the relation | 
 | 321 | 	 * to the current/next receive buffer or characters.  I need | 
 | 322 | 	 * to look in to this before committing any code. | 
 | 323 | 	 */ | 
 | 324 | 	if (priv->last_lsr & BELKIN_SA_LSR_ERR) { | 
| Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 325 | 		tty = tty_port_tty_get(&port->port); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | 		/* Overrun Error */ | 
 | 327 | 		if (priv->last_lsr & BELKIN_SA_LSR_OE) { | 
 | 328 | 		} | 
 | 329 | 		/* Parity Error */ | 
 | 330 | 		if (priv->last_lsr & BELKIN_SA_LSR_PE) { | 
 | 331 | 		} | 
 | 332 | 		/* Framing Error */ | 
 | 333 | 		if (priv->last_lsr & BELKIN_SA_LSR_FE) { | 
 | 334 | 		} | 
 | 335 | 		/* Break Indicator */ | 
 | 336 | 		if (priv->last_lsr & BELKIN_SA_LSR_BI) { | 
 | 337 | 		} | 
| Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 338 | 		tty_kref_put(tty); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | 	} | 
 | 340 | #endif | 
 | 341 | 	spin_unlock_irqrestore(&priv->lock, flags); | 
 | 342 | exit: | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 343 | 	retval = usb_submit_urb(urb, GFP_ATOMIC); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | 	if (retval) | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 345 | 		err("%s - usb_submit_urb failed with result %d", | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 346 | 		     __func__, retval); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | } | 
 | 348 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 349 | static void belkin_sa_set_termios(struct tty_struct *tty, | 
 | 350 | 		struct usb_serial_port *port, struct ktermios *old_termios) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | { | 
 | 352 | 	struct usb_serial *serial = port->serial; | 
 | 353 | 	struct belkin_sa_private *priv = usb_get_serial_port_data(port); | 
 | 354 | 	unsigned int iflag; | 
 | 355 | 	unsigned int cflag; | 
 | 356 | 	unsigned int old_iflag = 0; | 
 | 357 | 	unsigned int old_cflag = 0; | 
 | 358 | 	__u16 urb_value = 0; /* Will hold the new flags */ | 
 | 359 | 	unsigned long flags; | 
 | 360 | 	unsigned long control_state; | 
 | 361 | 	int bad_flow_control; | 
| Alan Cox | 9a8baec | 2007-06-22 14:40:18 +0100 | [diff] [blame] | 362 | 	speed_t baud; | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 363 | 	struct ktermios *termios = tty->termios; | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 364 |  | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 365 | 	iflag = termios->c_iflag; | 
 | 366 | 	cflag = termios->c_cflag; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 |  | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 368 | 	termios->c_cflag &= ~CMSPAR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 |  | 
 | 370 | 	/* get a local copy of the current port settings */ | 
 | 371 | 	spin_lock_irqsave(&priv->lock, flags); | 
 | 372 | 	control_state = priv->control_state; | 
 | 373 | 	bad_flow_control = priv->bad_flow_control; | 
 | 374 | 	spin_unlock_irqrestore(&priv->lock, flags); | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 375 |  | 
| Alan Cox | 9a8baec | 2007-06-22 14:40:18 +0100 | [diff] [blame] | 376 | 	old_iflag = old_termios->c_iflag; | 
 | 377 | 	old_cflag = old_termios->c_cflag; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 |  | 
 | 379 | 	/* Set the baud rate */ | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 380 | 	if ((cflag & CBAUD) != (old_cflag & CBAUD)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | 		/* reassert DTR and (maybe) RTS on transition from B0 */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 382 | 		if ((old_cflag & CBAUD) == B0) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | 			control_state |= (TIOCM_DTR|TIOCM_RTS); | 
 | 384 | 			if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) | 
 | 385 | 				err("Set DTR error"); | 
 | 386 | 			/* don't set RTS if using hardware flow control */ | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 387 | 			if (!(old_cflag & CRTSCTS)) | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 388 | 				if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST | 
 | 389 | 								, 1) < 0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | 					err("Set RTS error"); | 
 | 391 | 		} | 
| Alan Cox | 9a8baec | 2007-06-22 14:40:18 +0100 | [diff] [blame] | 392 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 394 | 	baud = tty_get_baud_rate(tty); | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 395 | 	if (baud) { | 
 | 396 | 		urb_value = BELKIN_SA_BAUD(baud); | 
 | 397 | 		/* Clip to maximum speed */ | 
 | 398 | 		if (urb_value == 0) | 
 | 399 | 			urb_value = 1; | 
 | 400 | 		/* Turn it back into a resulting real baud rate */ | 
 | 401 | 		baud = BELKIN_SA_BAUD(urb_value); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 |  | 
| Alan Cox | 3ec466b | 2007-12-13 16:15:26 -0800 | [diff] [blame] | 403 | 		/* Report the actual baud rate back to the caller */ | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 404 | 		tty_encode_baud_rate(tty, baud, baud); | 
| Alan Cox | 9a8baec | 2007-06-22 14:40:18 +0100 | [diff] [blame] | 405 | 		if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0) | 
 | 406 | 			err("Set baudrate error"); | 
 | 407 | 	} else { | 
 | 408 | 		/* Disable flow control */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 409 | 		if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, | 
 | 410 | 						BELKIN_SA_FLOW_NONE) < 0) | 
| Alan Cox | 9a8baec | 2007-06-22 14:40:18 +0100 | [diff] [blame] | 411 | 			err("Disable flowcontrol error"); | 
 | 412 | 		/* Drop RTS and DTR */ | 
 | 413 | 		control_state &= ~(TIOCM_DTR | TIOCM_RTS); | 
 | 414 | 		if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0) < 0) | 
 | 415 | 			err("DTR LOW error"); | 
 | 416 | 		if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0) < 0) | 
 | 417 | 			err("RTS LOW error"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | 	} | 
 | 419 |  | 
 | 420 | 	/* set the parity */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 421 | 	if ((cflag ^ old_cflag) & (PARENB | PARODD)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | 		if (cflag & PARENB) | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 423 | 			urb_value = (cflag & PARODD) ?  BELKIN_SA_PARITY_ODD | 
 | 424 | 						: BELKIN_SA_PARITY_EVEN; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | 		else | 
 | 426 | 			urb_value = BELKIN_SA_PARITY_NONE; | 
 | 427 | 		if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) | 
 | 428 | 			err("Set parity error"); | 
 | 429 | 	} | 
 | 430 |  | 
 | 431 | 	/* set the number of data bits */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 432 | 	if ((cflag & CSIZE) != (old_cflag & CSIZE)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | 		switch (cflag & CSIZE) { | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 434 | 		case CS5: | 
 | 435 | 			urb_value = BELKIN_SA_DATA_BITS(5); | 
 | 436 | 			break; | 
 | 437 | 		case CS6: | 
 | 438 | 			urb_value = BELKIN_SA_DATA_BITS(6); | 
 | 439 | 			break; | 
 | 440 | 		case CS7: | 
 | 441 | 			urb_value = BELKIN_SA_DATA_BITS(7); | 
 | 442 | 			break; | 
 | 443 | 		case CS8: | 
 | 444 | 			urb_value = BELKIN_SA_DATA_BITS(8); | 
 | 445 | 			break; | 
 | 446 | 		default: dbg("CSIZE was not CS5-CS8, using default of 8"); | 
 | 447 | 			urb_value = BELKIN_SA_DATA_BITS(8); | 
 | 448 | 			break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | 		} | 
 | 450 | 		if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) | 
 | 451 | 			err("Set data bits error"); | 
 | 452 | 	} | 
 | 453 |  | 
 | 454 | 	/* set the number of stop bits */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 455 | 	if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { | 
 | 456 | 		urb_value = (cflag & CSTOPB) ? BELKIN_SA_STOP_BITS(2) | 
 | 457 | 						: BELKIN_SA_STOP_BITS(1); | 
 | 458 | 		if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, | 
 | 459 | 							urb_value) < 0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | 			err("Set stop bits error"); | 
 | 461 | 	} | 
 | 462 |  | 
 | 463 | 	/* Set flow control */ | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 464 | 	if (((iflag ^ old_iflag) & (IXOFF | IXON)) || | 
 | 465 | 		((cflag ^ old_cflag) & CRTSCTS)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | 		urb_value = 0; | 
 | 467 | 		if ((iflag & IXOFF) || (iflag & IXON)) | 
 | 468 | 			urb_value |= (BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); | 
 | 469 | 		else | 
 | 470 | 			urb_value &= ~(BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); | 
 | 471 |  | 
 | 472 | 		if (cflag & CRTSCTS) | 
 | 473 | 			urb_value |=  (BELKIN_SA_FLOW_OCTS | BELKIN_SA_FLOW_IRTS); | 
 | 474 | 		else | 
 | 475 | 			urb_value &= ~(BELKIN_SA_FLOW_OCTS | BELKIN_SA_FLOW_IRTS); | 
 | 476 |  | 
 | 477 | 		if (bad_flow_control) | 
 | 478 | 			urb_value &= ~(BELKIN_SA_FLOW_IRTS); | 
 | 479 |  | 
 | 480 | 		if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, urb_value) < 0) | 
 | 481 | 			err("Set flow control error"); | 
 | 482 | 	} | 
 | 483 |  | 
 | 484 | 	/* save off the modified port settings */ | 
 | 485 | 	spin_lock_irqsave(&priv->lock, flags); | 
 | 486 | 	priv->control_state = control_state; | 
 | 487 | 	spin_unlock_irqrestore(&priv->lock, flags); | 
 | 488 | } /* belkin_sa_set_termios */ | 
 | 489 |  | 
 | 490 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 491 | static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | { | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 493 | 	struct usb_serial_port *port = tty->driver_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | 	struct usb_serial *serial = port->serial; | 
 | 495 |  | 
 | 496 | 	if (BSA_USB_CMD(BELKIN_SA_SET_BREAK_REQUEST, break_state ? 1 : 0) < 0) | 
 | 497 | 		err("Set break_ctl %d", break_state); | 
 | 498 | } | 
 | 499 |  | 
 | 500 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 501 | static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | { | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 503 | 	struct usb_serial_port *port = tty->driver_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | 	struct belkin_sa_private *priv = usb_get_serial_port_data(port); | 
 | 505 | 	unsigned long control_state; | 
 | 506 | 	unsigned long flags; | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 507 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 508 | 	dbg("%s", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 |  | 
 | 510 | 	spin_lock_irqsave(&priv->lock, flags); | 
 | 511 | 	control_state = priv->control_state; | 
 | 512 | 	spin_unlock_irqrestore(&priv->lock, flags); | 
 | 513 |  | 
 | 514 | 	return control_state; | 
 | 515 | } | 
 | 516 |  | 
 | 517 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 518 | static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | 			       unsigned int set, unsigned int clear) | 
 | 520 | { | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 521 | 	struct usb_serial_port *port = tty->driver_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | 	struct usb_serial *serial = port->serial; | 
 | 523 | 	struct belkin_sa_private *priv = usb_get_serial_port_data(port); | 
 | 524 | 	unsigned long control_state; | 
 | 525 | 	unsigned long flags; | 
 | 526 | 	int retval; | 
 | 527 | 	int rts = 0; | 
 | 528 | 	int dtr = 0; | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 529 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 530 | 	dbg("%s", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 |  | 
 | 532 | 	spin_lock_irqsave(&priv->lock, flags); | 
 | 533 | 	control_state = priv->control_state; | 
 | 534 |  | 
 | 535 | 	if (set & TIOCM_RTS) { | 
 | 536 | 		control_state |= TIOCM_RTS; | 
 | 537 | 		rts = 1; | 
 | 538 | 	} | 
 | 539 | 	if (set & TIOCM_DTR) { | 
 | 540 | 		control_state |= TIOCM_DTR; | 
 | 541 | 		dtr = 1; | 
 | 542 | 	} | 
 | 543 | 	if (clear & TIOCM_RTS) { | 
 | 544 | 		control_state &= ~TIOCM_RTS; | 
 | 545 | 		rts = 0; | 
 | 546 | 	} | 
 | 547 | 	if (clear & TIOCM_DTR) { | 
 | 548 | 		control_state &= ~TIOCM_DTR; | 
 | 549 | 		dtr = 0; | 
 | 550 | 	} | 
 | 551 |  | 
 | 552 | 	priv->control_state = control_state; | 
 | 553 | 	spin_unlock_irqrestore(&priv->lock, flags); | 
 | 554 |  | 
 | 555 | 	retval = BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, rts); | 
 | 556 | 	if (retval < 0) { | 
 | 557 | 		err("Set RTS error %d", retval); | 
 | 558 | 		goto exit; | 
 | 559 | 	} | 
 | 560 |  | 
 | 561 | 	retval = BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, dtr); | 
 | 562 | 	if (retval < 0) { | 
 | 563 | 		err("Set DTR error %d", retval); | 
 | 564 | 		goto exit; | 
 | 565 | 	} | 
 | 566 | exit: | 
 | 567 | 	return retval; | 
 | 568 | } | 
 | 569 |  | 
 | 570 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 571 | static int __init belkin_sa_init(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | { | 
 | 573 | 	int retval; | 
 | 574 | 	retval = usb_serial_register(&belkin_device); | 
 | 575 | 	if (retval) | 
 | 576 | 		goto failed_usb_serial_register; | 
 | 577 | 	retval = usb_register(&belkin_driver); | 
 | 578 | 	if (retval) | 
 | 579 | 		goto failed_usb_register; | 
 | 580 | 	info(DRIVER_DESC " " DRIVER_VERSION); | 
 | 581 | 	return 0; | 
 | 582 | failed_usb_register: | 
 | 583 | 	usb_serial_deregister(&belkin_device); | 
 | 584 | failed_usb_serial_register: | 
 | 585 | 	return retval; | 
 | 586 | } | 
 | 587 |  | 
 | 588 |  | 
 | 589 | static void __exit belkin_sa_exit (void) | 
 | 590 | { | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 591 | 	usb_deregister(&belkin_driver); | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 592 | 	usb_serial_deregister(&belkin_device); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | } | 
 | 594 |  | 
 | 595 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 596 | module_init(belkin_sa_init); | 
 | 597 | module_exit(belkin_sa_exit); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 |  | 
| Alan Cox | b69c149 | 2008-07-22 11:09:39 +0100 | [diff] [blame] | 599 | MODULE_AUTHOR(DRIVER_AUTHOR); | 
 | 600 | MODULE_DESCRIPTION(DRIVER_DESC); | 
 | 601 | MODULE_VERSION(DRIVER_VERSION); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | MODULE_LICENSE("GPL"); | 
 | 603 |  | 
 | 604 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 
 | 605 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |