Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 1 | /* |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 2 | USB Driver for Sierra Wireless |
| 3 | |
Kevin Lloyd | f3564de | 2008-03-28 10:05:08 -0700 | [diff] [blame] | 4 | Copyright (C) 2006, 2007, 2008 Kevin Lloyd <klloyd@sierrawireless.com> |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 5 | |
| 6 | IMPORTANT DISCLAIMER: This driver is not commercially supported by |
| 7 | Sierra Wireless. Use at your own risk. |
| 8 | |
| 9 | This driver is free software; you can redistribute it and/or modify |
| 10 | it under the terms of Version 2 of the GNU General Public License as |
| 11 | published by the Free Software Foundation. |
| 12 | |
| 13 | Portions based on the option driver by Matthias Urlichs <smurf@smurf.noris.de> |
| 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Elina Pasheva | 212b8f0 | 2009-04-21 17:54:42 -0700 | [diff] [blame] | 17 | #define DRIVER_VERSION "v.1.3.3" |
Kevin Lloyd | f3564de | 2008-03-28 10:05:08 -0700 | [diff] [blame] | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 20 | |
| 21 | #include <linux/kernel.h> |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 22 | #include <linux/jiffies.h> |
| 23 | #include <linux/errno.h> |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 24 | #include <linux/tty.h> |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 25 | #include <linux/tty_flip.h> |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 26 | #include <linux/module.h> |
| 27 | #include <linux/usb.h> |
Greg Kroah-Hartman | a969888 | 2006-07-11 21:22:58 -0700 | [diff] [blame] | 28 | #include <linux/usb/serial.h> |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 29 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 30 | #define SWIMS_USB_REQUEST_SetPower 0x00 |
| 31 | #define SWIMS_USB_REQUEST_SetNmea 0x07 |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 32 | |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 33 | #define N_IN_URB 4 |
| 34 | #define N_OUT_URB 4 |
| 35 | #define IN_BUFLEN 4096 |
| 36 | |
| 37 | static int debug; |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 38 | static int nmea; |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 39 | |
Adrian Bunk | 82a24e6 | 2007-07-29 16:59:02 +0200 | [diff] [blame] | 40 | static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 41 | { |
| 42 | int result; |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 43 | dev_dbg(&udev->dev, "%s", __func__); |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 44 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 45 | SWIMS_USB_REQUEST_SetPower, /* __u8 request */ |
Kevin Lloyd | f3564de | 2008-03-28 10:05:08 -0700 | [diff] [blame] | 46 | USB_TYPE_VENDOR, /* __u8 request type */ |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 47 | swiState, /* __u16 value */ |
| 48 | 0, /* __u16 index */ |
| 49 | NULL, /* void *data */ |
| 50 | 0, /* __u16 size */ |
| 51 | USB_CTRL_SET_TIMEOUT); /* int timeout */ |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 52 | return result; |
| 53 | } |
| 54 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 55 | static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable) |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 56 | { |
| 57 | int result; |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 58 | dev_dbg(&udev->dev, "%s", __func__); |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 59 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
| 60 | SWIMS_USB_REQUEST_SetNmea, /* __u8 request */ |
Kevin Lloyd | f3564de | 2008-03-28 10:05:08 -0700 | [diff] [blame] | 61 | USB_TYPE_VENDOR, /* __u8 request type */ |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 62 | enable, /* __u16 value */ |
| 63 | 0x0000, /* __u16 index */ |
| 64 | NULL, /* void *data */ |
| 65 | 0, /* __u16 size */ |
| 66 | USB_CTRL_SET_TIMEOUT); /* int timeout */ |
| 67 | return result; |
| 68 | } |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 69 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 70 | static int sierra_calc_num_ports(struct usb_serial *serial) |
| 71 | { |
| 72 | int result; |
| 73 | int *num_ports = usb_get_serial_data(serial); |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 74 | dev_dbg(&serial->dev->dev, "%s", __func__); |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 75 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 76 | result = *num_ports; |
| 77 | |
| 78 | if (result) { |
| 79 | kfree(num_ports); |
| 80 | usb_set_serial_data(serial, NULL); |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 83 | return result; |
| 84 | } |
| 85 | |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 86 | static int sierra_calc_interface(struct usb_serial *serial) |
| 87 | { |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 88 | int interface; |
| 89 | struct usb_interface *p_interface; |
| 90 | struct usb_host_interface *p_host_interface; |
| 91 | dev_dbg(&serial->dev->dev, "%s", __func__); |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 92 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 93 | /* Get the interface structure pointer from the serial struct */ |
| 94 | p_interface = serial->interface; |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 95 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 96 | /* Get a pointer to the host interface structure */ |
| 97 | p_host_interface = p_interface->cur_altsetting; |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 98 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 99 | /* read the interface descriptor for this active altsetting |
| 100 | * to find out the interface number we are on |
| 101 | */ |
| 102 | interface = p_host_interface->desc.bInterfaceNumber; |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 103 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 104 | return interface; |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 107 | static int sierra_probe(struct usb_serial *serial, |
| 108 | const struct usb_device_id *id) |
| 109 | { |
| 110 | int result = 0; |
| 111 | struct usb_device *udev; |
| 112 | int *num_ports; |
| 113 | u8 ifnum; |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 114 | u8 numendpoints; |
| 115 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 116 | dev_dbg(&serial->dev->dev, "%s", __func__); |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 117 | |
| 118 | num_ports = kmalloc(sizeof(*num_ports), GFP_KERNEL); |
| 119 | if (!num_ports) |
| 120 | return -ENOMEM; |
| 121 | |
| 122 | ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber; |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 123 | numendpoints = serial->interface->cur_altsetting->desc.bNumEndpoints; |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 124 | udev = serial->dev; |
| 125 | |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 126 | /* Figure out the interface number from the serial structure */ |
| 127 | ifnum = sierra_calc_interface(serial); |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 128 | |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 129 | /* |
| 130 | * If this interface supports more than 1 alternate |
| 131 | * select the 2nd one |
| 132 | */ |
| 133 | if (serial->interface->num_altsetting == 2) { |
| 134 | dev_dbg(&udev->dev, "Selecting alt setting for interface %d\n", |
| 135 | ifnum); |
| 136 | /* We know the alternate setting is 1 for the MC8785 */ |
| 137 | usb_set_interface(udev, ifnum, 1); |
| 138 | } |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 139 | |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 140 | /* Dummy interface present on some SKUs should be ignored */ |
Kevin Lloyd | 0585e4d | 2008-07-10 14:14:54 -0700 | [diff] [blame] | 141 | if (ifnum == 0x99) |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 142 | *num_ports = 0; |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 143 | else if (numendpoints <= 3) |
| 144 | *num_ports = 1; |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 145 | else |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 146 | *num_ports = (numendpoints-1)/2; |
| 147 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 148 | /* |
| 149 | * save off our num_ports info so that we can use it in the |
| 150 | * calc_num_ports callback |
| 151 | */ |
| 152 | usb_set_serial_data(serial, (void *)num_ports); |
| 153 | |
| 154 | return result; |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 155 | } |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 156 | |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 157 | static struct usb_device_id id_table [] = { |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 158 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ |
Kevin Lloyd | e43062d | 2007-01-17 16:04:18 -0800 | [diff] [blame] | 159 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ |
Greg Kroah-Hartman | 90ac3c8 | 2002-04-09 12:14:34 -0700 | [diff] [blame] | 160 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
Tony Murray | f8834f1 | 2008-08-22 17:30:44 -0500 | [diff] [blame] | 161 | { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */ |
Kevin Lloyd | e43062d | 2007-01-17 16:04:18 -0800 | [diff] [blame] | 162 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 163 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ |
agilmore@wirelessbeehive.com | b9e13ac | 2007-12-04 11:37:12 -0700 | [diff] [blame] | 164 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ |
Kevin Lloyd | e43062d | 2007-01-17 16:04:18 -0800 | [diff] [blame] | 165 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ |
| 166 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
Kevin Lloyd | 9454c46 | 2007-07-16 13:49:29 -0700 | [diff] [blame] | 167 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 168 | /* Sierra Wireless C597 */ |
| 169 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 170 | /* Sierra Wireless Device */ |
| 171 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, |
| 172 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ |
Kevin Lloyd | 73b2c20 | 2008-08-25 19:20:40 -0700 | [diff] [blame] | 173 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */ |
| 174 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */ |
Kevin Lloyd | 9454c46 | 2007-07-16 13:49:29 -0700 | [diff] [blame] | 175 | |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 176 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ |
Kevin Lloyd | e43062d | 2007-01-17 16:04:18 -0800 | [diff] [blame] | 177 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 178 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
Kevin Lloyd | 9454c46 | 2007-07-16 13:49:29 -0700 | [diff] [blame] | 179 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 180 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Lenovo) */ |
Kevin Lloyd | 7f170a6 | 2008-03-14 00:53:24 -0700 | [diff] [blame] | 181 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ |
Stefan Seyfried | 8f7f85e | 2008-04-17 07:47:34 +0200 | [diff] [blame] | 182 | { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */ |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 183 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
Kevin Lloyd | 7106967 | 2008-04-02 11:24:56 -0700 | [diff] [blame] | 184 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 185 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ |
| 186 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ |
Kevin Lloyd | b77a5c7 | 2008-09-17 09:03:38 -0700 | [diff] [blame] | 187 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 188 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ |
| 189 | { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */ |
| 190 | { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */ |
| 191 | { USB_DEVICE(0x1199, 0x683E) }, /* Sierra Wireless MC8790 */ |
Kevin Lloyd | 9454c46 | 2007-07-16 13:49:29 -0700 | [diff] [blame] | 192 | { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */ |
| 193 | { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */ |
| 194 | { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880 E */ |
| 195 | { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881 E */ |
Kevin Lloyd | 6835b32 | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 196 | { USB_DEVICE(0x1199, 0x6855) }, /* Sierra Wireless AirCard 880 U */ |
Jessica L. Blank | 62aad3a | 2007-12-30 20:11:35 -0600 | [diff] [blame] | 197 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 198 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ |
| 199 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
| 200 | /* Sierra Wireless C885 */ |
| 201 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
| 202 | /* Sierra Wireless Device */ |
| 203 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, |
| 204 | /* Sierra Wireless Device */ |
Kevin Lloyd | 73b2c20 | 2008-08-25 19:20:40 -0700 | [diff] [blame] | 205 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, |
| 206 | /* Sierra Wireless Device */ |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 207 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 208 | |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 209 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ |
| 210 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 211 | |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 212 | { } |
| 213 | }; |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 214 | MODULE_DEVICE_TABLE(usb, id_table); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 215 | |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 216 | static struct usb_driver sierra_driver = { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 217 | .name = "sierra", |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 218 | .probe = usb_serial_probe, |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 219 | .disconnect = usb_serial_disconnect, |
| 220 | .id_table = id_table, |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 221 | .no_dynamic_id = 1, |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 222 | }; |
| 223 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 224 | struct sierra_port_private { |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 225 | spinlock_t lock; /* lock the structure */ |
| 226 | int outstanding_urbs; /* number of out urbs in flight */ |
| 227 | |
Oliver Neukum | 4f4f9c5 | 2008-03-14 00:53:24 -0700 | [diff] [blame] | 228 | /* Input endpoints and buffers for this port */ |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 229 | struct urb *in_urbs[N_IN_URB]; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 230 | |
| 231 | /* Settings for the port */ |
| 232 | int rts_state; /* Handshaking pins (outputs) */ |
| 233 | int dtr_state; |
| 234 | int cts_state; /* Handshaking pins (inputs) */ |
| 235 | int dsr_state; |
| 236 | int dcd_state; |
| 237 | int ri_state; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 238 | }; |
| 239 | |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 240 | static int sierra_send_setup(struct usb_serial_port *port) |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 241 | { |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 242 | struct usb_serial *serial = port->serial; |
| 243 | struct sierra_port_private *portdata; |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 244 | __u16 interface = 0; |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 245 | int val = 0; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 246 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 247 | dev_dbg(&port->dev, "%s", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 248 | |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 249 | portdata = usb_get_serial_port_data(port); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 250 | |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 251 | if (portdata->dtr_state) |
| 252 | val |= 0x01; |
| 253 | if (portdata->rts_state) |
| 254 | val |= 0x02; |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 255 | |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 256 | /* If composite device then properly report interface */ |
Alan Cox | 00b040d | 2009-06-11 14:29:29 +0100 | [diff] [blame] | 257 | if (serial->num_ports == 1) { |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 258 | interface = sierra_calc_interface(serial); |
Alan Cox | 00b040d | 2009-06-11 14:29:29 +0100 | [diff] [blame] | 259 | /* Control message is sent only to interfaces with |
| 260 | * interrupt_in endpoints |
| 261 | */ |
| 262 | if (port->interrupt_in_urb) { |
| 263 | /* send control message */ |
| 264 | return usb_control_msg(serial->dev, |
| 265 | usb_rcvctrlpipe(serial->dev, 0), |
| 266 | 0x22, 0x21, val, interface, |
| 267 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 268 | } |
| 269 | } |
Kevin Lloyd | e3173b2 | 2008-07-10 14:14:51 -0700 | [diff] [blame] | 270 | |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 271 | /* Otherwise the need to do non-composite mapping */ |
| 272 | else { |
| 273 | if (port->bulk_out_endpointAddress == 2) |
| 274 | interface = 0; |
| 275 | else if (port->bulk_out_endpointAddress == 4) |
| 276 | interface = 1; |
| 277 | else if (port->bulk_out_endpointAddress == 5) |
| 278 | interface = 2; |
Alan Cox | 00b040d | 2009-06-11 14:29:29 +0100 | [diff] [blame] | 279 | return usb_control_msg(serial->dev, |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 280 | usb_rcvctrlpipe(serial->dev, 0), |
| 281 | 0x22, 0x21, val, interface, |
| 282 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
Alan Cox | 00b040d | 2009-06-11 14:29:29 +0100 | [diff] [blame] | 283 | } |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 284 | return 0; |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 285 | } |
| 286 | |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 287 | static void sierra_set_termios(struct tty_struct *tty, |
| 288 | struct usb_serial_port *port, struct ktermios *old_termios) |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 289 | { |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 290 | dev_dbg(&port->dev, "%s", __func__); |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 291 | tty_termios_copy_hw(tty->termios, old_termios); |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 292 | sierra_send_setup(port); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 293 | } |
| 294 | |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 295 | static int sierra_tiocmget(struct tty_struct *tty, struct file *file) |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 296 | { |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 297 | struct usb_serial_port *port = tty->driver_data; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 298 | unsigned int value; |
| 299 | struct sierra_port_private *portdata; |
| 300 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 301 | dev_dbg(&port->dev, "%s", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 302 | portdata = usb_get_serial_port_data(port); |
| 303 | |
| 304 | value = ((portdata->rts_state) ? TIOCM_RTS : 0) | |
| 305 | ((portdata->dtr_state) ? TIOCM_DTR : 0) | |
| 306 | ((portdata->cts_state) ? TIOCM_CTS : 0) | |
| 307 | ((portdata->dsr_state) ? TIOCM_DSR : 0) | |
| 308 | ((portdata->dcd_state) ? TIOCM_CAR : 0) | |
| 309 | ((portdata->ri_state) ? TIOCM_RNG : 0); |
| 310 | |
| 311 | return value; |
| 312 | } |
| 313 | |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 314 | static int sierra_tiocmset(struct tty_struct *tty, struct file *file, |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 315 | unsigned int set, unsigned int clear) |
| 316 | { |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 317 | struct usb_serial_port *port = tty->driver_data; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 318 | struct sierra_port_private *portdata; |
| 319 | |
| 320 | portdata = usb_get_serial_port_data(port); |
| 321 | |
| 322 | if (set & TIOCM_RTS) |
| 323 | portdata->rts_state = 1; |
| 324 | if (set & TIOCM_DTR) |
| 325 | portdata->dtr_state = 1; |
| 326 | |
| 327 | if (clear & TIOCM_RTS) |
| 328 | portdata->rts_state = 0; |
| 329 | if (clear & TIOCM_DTR) |
| 330 | portdata->dtr_state = 0; |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 331 | return sierra_send_setup(port); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 332 | } |
| 333 | |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 334 | static void sierra_release_urb(struct urb *urb) |
| 335 | { |
| 336 | struct usb_serial_port *port; |
| 337 | if (urb) { |
| 338 | port = urb->context; |
| 339 | dev_dbg(&port->dev, "%s: %p\n", __func__, urb); |
| 340 | kfree(urb->transfer_buffer); |
| 341 | usb_free_urb(urb); |
| 342 | } |
| 343 | } |
| 344 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 345 | static void sierra_outdat_callback(struct urb *urb) |
| 346 | { |
| 347 | struct usb_serial_port *port = urb->context; |
| 348 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 349 | int status = urb->status; |
| 350 | unsigned long flags; |
| 351 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 352 | dev_dbg(&port->dev, "%s - port %d", __func__, port->number); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 353 | |
| 354 | /* free up the transfer buffer, as usb_free_urb() does not do this */ |
| 355 | kfree(urb->transfer_buffer); |
| 356 | |
| 357 | if (status) |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 358 | dev_dbg(&port->dev, "%s - nonzero write bulk status " |
| 359 | "received: %d", __func__, status); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 360 | |
| 361 | spin_lock_irqsave(&portdata->lock, flags); |
| 362 | --portdata->outstanding_urbs; |
| 363 | spin_unlock_irqrestore(&portdata->lock, flags); |
| 364 | |
| 365 | usb_serial_port_softint(port); |
| 366 | } |
| 367 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 368 | /* Write */ |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 369 | static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, |
| 370 | const unsigned char *buf, int count) |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 371 | { |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 372 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 373 | struct usb_serial *serial = port->serial; |
| 374 | unsigned long flags; |
| 375 | unsigned char *buffer; |
| 376 | struct urb *urb; |
| 377 | int status; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 378 | |
| 379 | portdata = usb_get_serial_port_data(port); |
| 380 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 381 | dev_dbg(&port->dev, "%s: write (%d chars)", __func__, count); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 382 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 383 | spin_lock_irqsave(&portdata->lock, flags); |
| 384 | if (portdata->outstanding_urbs > N_OUT_URB) { |
| 385 | spin_unlock_irqrestore(&portdata->lock, flags); |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 386 | dev_dbg(&port->dev, "%s - write limit hit\n", __func__); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 387 | return 0; |
| 388 | } |
| 389 | portdata->outstanding_urbs++; |
| 390 | spin_unlock_irqrestore(&portdata->lock, flags); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 391 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 392 | buffer = kmalloc(count, GFP_ATOMIC); |
| 393 | if (!buffer) { |
| 394 | dev_err(&port->dev, "out of memory\n"); |
| 395 | count = -ENOMEM; |
| 396 | goto error_no_buffer; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 397 | } |
| 398 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 399 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 400 | if (!urb) { |
| 401 | dev_err(&port->dev, "no more free urbs\n"); |
| 402 | count = -ENOMEM; |
| 403 | goto error_no_urb; |
| 404 | } |
| 405 | |
| 406 | memcpy(buffer, buf, count); |
| 407 | |
Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 408 | usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 409 | |
| 410 | usb_fill_bulk_urb(urb, serial->dev, |
| 411 | usb_sndbulkpipe(serial->dev, |
| 412 | port->bulk_out_endpointAddress), |
| 413 | buffer, count, sierra_outdat_callback, port); |
| 414 | |
| 415 | /* send it down the pipe */ |
| 416 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| 417 | if (status) { |
| 418 | dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " |
Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 419 | "with status = %d\n", __func__, status); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 420 | count = status; |
| 421 | goto error; |
| 422 | } |
| 423 | |
| 424 | /* we are done with this urb, so let the host driver |
| 425 | * really free it when it is finished with it */ |
| 426 | usb_free_urb(urb); |
| 427 | |
| 428 | return count; |
| 429 | error: |
| 430 | usb_free_urb(urb); |
| 431 | error_no_urb: |
| 432 | kfree(buffer); |
| 433 | error_no_buffer: |
| 434 | spin_lock_irqsave(&portdata->lock, flags); |
| 435 | --portdata->outstanding_urbs; |
| 436 | spin_unlock_irqrestore(&portdata->lock, flags); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 437 | return count; |
| 438 | } |
| 439 | |
| 440 | static void sierra_indat_callback(struct urb *urb) |
| 441 | { |
| 442 | int err; |
| 443 | int endpoint; |
| 444 | struct usb_serial_port *port; |
| 445 | struct tty_struct *tty; |
| 446 | unsigned char *data = urb->transfer_buffer; |
Greg Kroah-Hartman | 17dd221 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 447 | int status = urb->status; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 448 | |
Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 449 | dbg("%s: %p", __func__, urb); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 450 | |
| 451 | endpoint = usb_pipeendpoint(urb->pipe); |
Ming Lei | cdc9779 | 2008-02-24 18:41:47 +0800 | [diff] [blame] | 452 | port = urb->context; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 453 | |
Greg Kroah-Hartman | 17dd221 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 454 | if (status) { |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 455 | dev_dbg(&port->dev, "%s: nonzero status: %d on" |
| 456 | " endpoint %02x.", __func__, status, endpoint); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 457 | } else { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 458 | if (urb->actual_length) { |
Alan Cox | d95186d | 2009-01-02 13:42:56 +0000 | [diff] [blame] | 459 | tty = tty_port_tty_get(&port->port); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 460 | tty_buffer_request_room(tty, urb->actual_length); |
| 461 | tty_insert_flip_string(tty, data, urb->actual_length); |
| 462 | tty_flip_buffer_push(tty); |
Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 463 | tty_kref_put(tty); |
| 464 | } else |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 465 | dev_dbg(&port->dev, "%s: empty read urb" |
| 466 | " received", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 467 | |
| 468 | /* Resubmit urb so we continue receiving */ |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 469 | if (port->port.count && status != -ESHUTDOWN && status != -EPERM) { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 470 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 471 | if (err) |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 472 | dev_err(&port->dev, "resubmit read urb failed." |
Joe Perches | 898eb71 | 2007-10-18 03:06:30 -0700 | [diff] [blame] | 473 | "(%d)\n", err); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 474 | } |
| 475 | } |
| 476 | return; |
| 477 | } |
| 478 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 479 | static void sierra_instat_callback(struct urb *urb) |
| 480 | { |
| 481 | int err; |
Greg Kroah-Hartman | 17dd221 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 482 | int status = urb->status; |
Ming Lei | cdc9779 | 2008-02-24 18:41:47 +0800 | [diff] [blame] | 483 | struct usb_serial_port *port = urb->context; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 484 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 485 | struct usb_serial *serial = port->serial; |
| 486 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 487 | dev_dbg(&port->dev, "%s", __func__); |
| 488 | dev_dbg(&port->dev, "%s: urb %p port %p has data %p", __func__, |
| 489 | urb, port, portdata); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 490 | |
Greg Kroah-Hartman | 17dd221 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 491 | if (status == 0) { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 492 | struct usb_ctrlrequest *req_pkt = |
| 493 | (struct usb_ctrlrequest *)urb->transfer_buffer; |
| 494 | |
| 495 | if (!req_pkt) { |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 496 | dev_dbg(&port->dev, "%s: NULL req_pkt\n", |
| 497 | __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 498 | return; |
| 499 | } |
| 500 | if ((req_pkt->bRequestType == 0xA1) && |
| 501 | (req_pkt->bRequest == 0x20)) { |
| 502 | int old_dcd_state; |
| 503 | unsigned char signals = *((unsigned char *) |
| 504 | urb->transfer_buffer + |
| 505 | sizeof(struct usb_ctrlrequest)); |
Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 506 | struct tty_struct *tty; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 507 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 508 | dev_dbg(&port->dev, "%s: signal x%x", __func__, |
| 509 | signals); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 510 | |
| 511 | old_dcd_state = portdata->dcd_state; |
| 512 | portdata->cts_state = 1; |
| 513 | portdata->dcd_state = ((signals & 0x01) ? 1 : 0); |
| 514 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); |
| 515 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); |
| 516 | |
Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 517 | tty = tty_port_tty_get(&port->port); |
| 518 | if (tty && !C_CLOCAL(tty) && |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 519 | old_dcd_state && !portdata->dcd_state) |
Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 520 | tty_hangup(tty); |
| 521 | tty_kref_put(tty); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 522 | } else { |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 523 | dev_dbg(&port->dev, "%s: type %x req %x", |
| 524 | __func__, req_pkt->bRequestType, |
| 525 | req_pkt->bRequest); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 526 | } |
| 527 | } else |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 528 | dev_dbg(&port->dev, "%s: error %d", __func__, status); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 529 | |
| 530 | /* Resubmit urb so we continue receiving IRQ data */ |
Greg Kroah-Hartman | 17dd221 | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 531 | if (status != -ESHUTDOWN) { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 532 | urb->dev = serial->dev; |
| 533 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 534 | if (err) |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 535 | dev_dbg(&port->dev, "%s: resubmit intr urb " |
| 536 | "failed. (%d)", __func__, err); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 537 | } |
| 538 | } |
| 539 | |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 540 | static int sierra_write_room(struct tty_struct *tty) |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 541 | { |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 542 | struct usb_serial_port *port = tty->driver_data; |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 543 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 544 | unsigned long flags; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 545 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 546 | dev_dbg(&port->dev, "%s - port %d", __func__, port->number); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 547 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 548 | /* try to give a good number back based on if we have any free urbs at |
| 549 | * this point in time */ |
| 550 | spin_lock_irqsave(&portdata->lock, flags); |
| 551 | if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) { |
| 552 | spin_unlock_irqrestore(&portdata->lock, flags); |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 553 | dev_dbg(&port->dev, "%s - write limit hit\n", __func__); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 554 | return 0; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 555 | } |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 556 | spin_unlock_irqrestore(&portdata->lock, flags); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 557 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 558 | return 2048; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 559 | } |
| 560 | |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 561 | static void sierra_stop_rx_urbs(struct usb_serial_port *port) |
| 562 | { |
| 563 | int i; |
| 564 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 565 | |
| 566 | for (i = 0; i < ARRAY_SIZE(portdata->in_urbs); i++) |
| 567 | usb_kill_urb(portdata->in_urbs[i]); |
| 568 | |
| 569 | usb_kill_urb(port->interrupt_in_urb); |
| 570 | } |
| 571 | |
| 572 | static int sierra_submit_rx_urbs(struct usb_serial_port *port, gfp_t mem_flags) |
| 573 | { |
| 574 | int ok_cnt; |
| 575 | int err = -EINVAL; |
| 576 | int i; |
| 577 | struct urb *urb; |
| 578 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
| 579 | |
| 580 | ok_cnt = 0; |
| 581 | for (i = 0; i < ARRAY_SIZE(portdata->in_urbs); i++) { |
| 582 | urb = portdata->in_urbs[i]; |
| 583 | if (!urb) |
| 584 | continue; |
| 585 | err = usb_submit_urb(urb, mem_flags); |
| 586 | if (err) { |
| 587 | dev_err(&port->dev, "%s: submit urb failed: %d\n", |
| 588 | __func__, err); |
| 589 | } else { |
| 590 | ok_cnt++; |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | if (ok_cnt && port->interrupt_in_urb) { |
| 595 | err = usb_submit_urb(port->interrupt_in_urb, mem_flags); |
| 596 | if (err) { |
| 597 | dev_err(&port->dev, "%s: submit intr urb failed: %d\n", |
| 598 | __func__, err); |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | if (ok_cnt > 0) /* at least one rx urb submitted */ |
| 603 | return 0; |
| 604 | else |
| 605 | return err; |
| 606 | } |
| 607 | |
| 608 | static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint, |
| 609 | int dir, void *ctx, int len, |
| 610 | gfp_t mem_flags, |
| 611 | usb_complete_t callback) |
| 612 | { |
| 613 | struct urb *urb; |
| 614 | u8 *buf; |
| 615 | |
| 616 | if (endpoint == -1) |
| 617 | return NULL; |
| 618 | |
| 619 | urb = usb_alloc_urb(0, mem_flags); |
| 620 | if (urb == NULL) { |
| 621 | dev_dbg(&serial->dev->dev, "%s: alloc for endpoint %d failed\n", |
| 622 | __func__, endpoint); |
| 623 | return NULL; |
| 624 | } |
| 625 | |
| 626 | buf = kmalloc(len, mem_flags); |
| 627 | if (buf) { |
| 628 | /* Fill URB using supplied data */ |
| 629 | usb_fill_bulk_urb(urb, serial->dev, |
| 630 | usb_sndbulkpipe(serial->dev, endpoint) | dir, |
| 631 | buf, len, callback, ctx); |
| 632 | |
| 633 | /* debug */ |
| 634 | dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__, |
| 635 | dir == USB_DIR_IN ? 'i' : 'o', urb, buf); |
| 636 | } else { |
| 637 | dev_dbg(&serial->dev->dev, "%s %c u:%p d:%p\n", __func__, |
| 638 | dir == USB_DIR_IN ? 'i' : 'o', urb, buf); |
| 639 | |
| 640 | sierra_release_urb(urb); |
| 641 | urb = NULL; |
| 642 | } |
| 643 | |
| 644 | return urb; |
| 645 | } |
| 646 | |
| 647 | static void sierra_close(struct usb_serial_port *port) |
| 648 | { |
| 649 | int i; |
| 650 | struct usb_serial *serial = port->serial; |
| 651 | struct sierra_port_private *portdata; |
| 652 | |
| 653 | dev_dbg(&port->dev, "%s\n", __func__); |
| 654 | portdata = usb_get_serial_port_data(port); |
| 655 | |
| 656 | portdata->rts_state = 0; |
| 657 | portdata->dtr_state = 0; |
| 658 | |
| 659 | if (serial->dev) { |
| 660 | mutex_lock(&serial->disc_mutex); |
| 661 | if (!serial->disconnected) |
| 662 | sierra_send_setup(port); |
| 663 | mutex_unlock(&serial->disc_mutex); |
| 664 | |
| 665 | /* Stop reading urbs */ |
| 666 | sierra_stop_rx_urbs(port); |
| 667 | /* .. and release them */ |
| 668 | for (i = 0; i < N_IN_URB; i++) { |
| 669 | sierra_release_urb(portdata->in_urbs[i]); |
| 670 | portdata->in_urbs[i] = NULL; |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | |
Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 675 | static int sierra_open(struct tty_struct *tty, |
| 676 | struct usb_serial_port *port, struct file *filp) |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 677 | { |
| 678 | struct sierra_port_private *portdata; |
| 679 | struct usb_serial *serial = port->serial; |
Greg Kroah-Hartman | 9e85c5f | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 680 | int i; |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 681 | int err; |
| 682 | int endpoint; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 683 | struct urb *urb; |
| 684 | |
| 685 | portdata = usb_get_serial_port_data(port); |
| 686 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 687 | dev_dbg(&port->dev, "%s", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 688 | |
| 689 | /* Set some sane defaults */ |
| 690 | portdata->rts_state = 1; |
| 691 | portdata->dtr_state = 1; |
| 692 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 693 | |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 694 | endpoint = port->bulk_in_endpointAddress; |
| 695 | for (i = 0; i < ARRAY_SIZE(portdata->in_urbs); i++) { |
| 696 | urb = sierra_setup_urb(serial, endpoint, USB_DIR_IN, port, |
| 697 | IN_BUFLEN, GFP_KERNEL, |
| 698 | sierra_indat_callback); |
| 699 | portdata->in_urbs[i] = urb; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 700 | } |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 701 | /* clear halt condition */ |
| 702 | usb_clear_halt(serial->dev, |
| 703 | usb_sndbulkpipe(serial->dev, endpoint) | USB_DIR_IN); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 704 | |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 705 | err = sierra_submit_rx_urbs(port, GFP_KERNEL); |
| 706 | if (err) { |
| 707 | /* get rid of everything as in close */ |
| 708 | sierra_close(port); |
| 709 | return err; |
| 710 | } |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 711 | sierra_send_setup(port); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 712 | |
Greg Kroah-Hartman | 9e85c5f | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 713 | return 0; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 714 | } |
| 715 | |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 716 | |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 717 | static void sierra_dtr_rts(struct usb_serial_port *port, int on) |
| 718 | { |
| 719 | struct usb_serial *serial = port->serial; |
| 720 | struct sierra_port_private *portdata; |
| 721 | |
| 722 | portdata = usb_get_serial_port_data(port); |
| 723 | portdata->rts_state = on; |
| 724 | portdata->dtr_state = on; |
| 725 | |
| 726 | if (serial->dev) { |
| 727 | mutex_lock(&serial->disc_mutex); |
| 728 | if (!serial->disconnected) |
| 729 | sierra_send_setup(port); |
| 730 | mutex_unlock(&serial->disc_mutex); |
| 731 | } |
| 732 | } |
| 733 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 734 | static int sierra_startup(struct usb_serial *serial) |
| 735 | { |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 736 | struct usb_serial_port *port; |
| 737 | struct sierra_port_private *portdata; |
Greg Kroah-Hartman | 9e85c5f | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 738 | int i; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 739 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 740 | dev_dbg(&serial->dev->dev, "%s", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 741 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 742 | /* Set Device mode to D0 */ |
Kevin Lloyd | 112225b | 2007-07-16 13:49:27 -0700 | [diff] [blame] | 743 | sierra_set_power_state(serial->dev, 0x0000); |
| 744 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 745 | /* Check NMEA and set */ |
| 746 | if (nmea) |
| 747 | sierra_vsc_set_nmea(serial->dev, 1); |
| 748 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 749 | /* Now setup per port private data */ |
| 750 | for (i = 0; i < serial->num_ports; i++) { |
| 751 | port = serial->port[i]; |
| 752 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
| 753 | if (!portdata) { |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 754 | dev_dbg(&port->dev, "%s: kmalloc for " |
| 755 | "sierra_port_private (%d) failed!.", |
| 756 | __func__, i); |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 757 | return -ENOMEM; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 758 | } |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 759 | spin_lock_init(&portdata->lock); |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 760 | /* Set the port private data pointer */ |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 761 | usb_set_serial_port_data(port, portdata); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 762 | } |
| 763 | |
Greg Kroah-Hartman | 17c2327 | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 764 | return 0; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 765 | } |
| 766 | |
| 767 | static void sierra_shutdown(struct usb_serial *serial) |
| 768 | { |
Elina Pasheva | b9a44bc1 | 2009-06-11 14:30:21 +0100 | [diff] [blame^] | 769 | int i; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 770 | struct usb_serial_port *port; |
| 771 | struct sierra_port_private *portdata; |
| 772 | |
Kevin Lloyd | 7384a92 | 2008-09-16 21:05:24 -0700 | [diff] [blame] | 773 | dev_dbg(&serial->dev->dev, "%s", __func__); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 774 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 775 | for (i = 0; i < serial->num_ports; ++i) { |
| 776 | port = serial->port[i]; |
Greg Kroah-Hartman | f094e4f | 2007-04-26 00:12:01 -0700 | [diff] [blame] | 777 | if (!port) |
| 778 | continue; |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 779 | portdata = usb_get_serial_port_data(port); |
Greg Kroah-Hartman | f094e4f | 2007-04-26 00:12:01 -0700 | [diff] [blame] | 780 | if (!portdata) |
| 781 | continue; |
Greg Kroah-Hartman | 9e85c5f | 2007-06-20 14:22:23 +0900 | [diff] [blame] | 782 | kfree(portdata); |
| 783 | usb_set_serial_port_data(port, NULL); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 784 | } |
| 785 | } |
| 786 | |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 787 | static struct usb_serial_driver sierra_device = { |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 788 | .driver = { |
| 789 | .owner = THIS_MODULE, |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 790 | .name = "sierra", |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 791 | }, |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 792 | .description = "Sierra USB modem", |
| 793 | .id_table = id_table, |
Johannes Hölzl | d9b1b78 | 2006-12-17 21:50:24 +0100 | [diff] [blame] | 794 | .usb_driver = &sierra_driver, |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 795 | .calc_num_ports = sierra_calc_num_ports, |
| 796 | .probe = sierra_probe, |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 797 | .open = sierra_open, |
| 798 | .close = sierra_close, |
Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 799 | .dtr_rts = sierra_dtr_rts, |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 800 | .write = sierra_write, |
| 801 | .write_room = sierra_write_room, |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 802 | .set_termios = sierra_set_termios, |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 803 | .tiocmget = sierra_tiocmget, |
| 804 | .tiocmset = sierra_tiocmset, |
| 805 | .attach = sierra_startup, |
| 806 | .shutdown = sierra_shutdown, |
| 807 | .read_int_callback = sierra_instat_callback, |
| 808 | }; |
| 809 | |
| 810 | /* Functions used by new usb-serial code. */ |
| 811 | static int __init sierra_init(void) |
| 812 | { |
| 813 | int retval; |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 814 | retval = usb_serial_register(&sierra_device); |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 815 | if (retval) |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 816 | goto failed_device_register; |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 817 | |
| 818 | |
| 819 | retval = usb_register(&sierra_driver); |
| 820 | if (retval) |
| 821 | goto failed_driver_register; |
| 822 | |
Greg Kroah-Hartman | c197a8d | 2008-08-18 13:21:04 -0700 | [diff] [blame] | 823 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
| 824 | DRIVER_DESC "\n"); |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 825 | |
| 826 | return 0; |
| 827 | |
| 828 | failed_driver_register: |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 829 | usb_serial_deregister(&sierra_device); |
| 830 | failed_device_register: |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 831 | return retval; |
| 832 | } |
| 833 | |
| 834 | static void __exit sierra_exit(void) |
| 835 | { |
Alan Cox | 9660ea3 | 2008-07-22 11:14:59 +0100 | [diff] [blame] | 836 | usb_deregister(&sierra_driver); |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 837 | usb_serial_deregister(&sierra_device); |
Greg Kroah-Hartman | 964ee1d | 2006-10-17 10:17:58 -0700 | [diff] [blame] | 838 | } |
| 839 | |
| 840 | module_init(sierra_init); |
| 841 | module_exit(sierra_exit); |
| 842 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 843 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 844 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 845 | MODULE_VERSION(DRIVER_VERSION); |
Kevin Lloyd | 69de51f | 2006-06-30 11:17:55 -0700 | [diff] [blame] | 846 | MODULE_LICENSE("GPL"); |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 847 | |
Kevin Lloyd | 4e0fee8 | 2008-07-10 14:14:47 -0700 | [diff] [blame] | 848 | module_param(nmea, bool, S_IRUGO | S_IWUSR); |
Kevin Lloyd | 228426e | 2008-01-10 11:11:04 -0800 | [diff] [blame] | 849 | MODULE_PARM_DESC(nmea, "NMEA streaming"); |
| 850 | |
Kevin Lloyd | 033a3fb | 2006-10-13 23:53:21 -0700 | [diff] [blame] | 851 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
| 852 | MODULE_PARM_DESC(debug, "Debug messages"); |