aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/qcserial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/qcserial.c')
-rw-r--r--drivers/usb/serial/qcserial.c134
1 files changed, 66 insertions, 68 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index f98800f2324c..0206b10c9e6e 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -24,39 +24,44 @@
24 24
25static bool debug; 25static bool debug;
26 26
27#define DEVICE_G1K(v, p) \
28 USB_DEVICE(v, p), .driver_info = 1
29
27static const struct usb_device_id id_table[] = { 30static const struct usb_device_id id_table[] = {
28 {USB_DEVICE(0x05c6, 0x9211)}, /* Acer Gobi QDL device */ 31 /* Gobi 1000 devices */
29 {USB_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 32 {DEVICE_G1K(0x05c6, 0x9211)}, /* Acer Gobi QDL device */
30 {USB_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 33 {DEVICE_G1K(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
31 {USB_DEVICE(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */ 34 {DEVICE_G1K(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
32 {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ 35 {DEVICE_G1K(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */
33 {USB_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 36 {DEVICE_G1K(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
34 {USB_DEVICE(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */ 37 {DEVICE_G1K(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */
35 {USB_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ 38 {DEVICE_G1K(0x413c, 0x8172)}, /* Dell Gobi Modem device */
36 {USB_DEVICE(0x413c, 0x8171)}, /* Dell Gobi QDL device */ 39 {DEVICE_G1K(0x413c, 0x8171)}, /* Dell Gobi QDL device */
37 {USB_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ 40 {DEVICE_G1K(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
38 {USB_DEVICE(0x1410, 0xa008)}, /* Novatel Gobi QDL device */ 41 {DEVICE_G1K(0x1410, 0xa008)}, /* Novatel Gobi QDL device */
39 {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi QDL device */ 42 {DEVICE_G1K(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
40 {USB_DEVICE(0x1410, 0xa011)}, /* Novatel Gobi QDL device */ 43 {DEVICE_G1K(0x0b05, 0x1774)}, /* Asus Gobi QDL device */
41 {USB_DEVICE(0x1410, 0xa012)}, /* Novatel Gobi QDL device */ 44 {DEVICE_G1K(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
42 {USB_DEVICE(0x1410, 0xa013)}, /* Novatel Gobi QDL device */ 45 {DEVICE_G1K(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */
43 {USB_DEVICE(0x1410, 0xa014)}, /* Novatel Gobi QDL device */ 46 {DEVICE_G1K(0x1557, 0x0a80)}, /* OQO Gobi QDL device */
44 {USB_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ 47 {DEVICE_G1K(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
45 {USB_DEVICE(0x0b05, 0x1774)}, /* Asus Gobi QDL device */ 48 {DEVICE_G1K(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
46 {USB_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ 49 {DEVICE_G1K(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
47 {USB_DEVICE(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */ 50 {DEVICE_G1K(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
48 {USB_DEVICE(0x1557, 0x0a80)}, /* OQO Gobi QDL device */ 51 {DEVICE_G1K(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
49 {USB_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ 52 {DEVICE_G1K(0x05c6, 0x9008)}, /* Generic Gobi QDL device */
50 {USB_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ 53 {DEVICE_G1K(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
51 {USB_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ 54 {DEVICE_G1K(0x05c6, 0x9201)}, /* Generic Gobi QDL device */
52 {USB_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ 55 {DEVICE_G1K(0x05c6, 0x9221)}, /* Generic Gobi QDL device */
53 {USB_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ 56 {DEVICE_G1K(0x05c6, 0x9231)}, /* Generic Gobi QDL device */
54 {USB_DEVICE(0x05c6, 0x9008)}, /* Generic Gobi QDL device */ 57 {DEVICE_G1K(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */
55 {USB_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ 58
56 {USB_DEVICE(0x05c6, 0x9201)}, /* Generic Gobi QDL device */ 59 /* Gobi 2000 devices */
57 {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ 60 {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi 2000 QDL device */
58 {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ 61 {USB_DEVICE(0x1410, 0xa011)}, /* Novatel Gobi 2000 QDL device */
59 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ 62 {USB_DEVICE(0x1410, 0xa012)}, /* Novatel Gobi 2000 QDL device */
63 {USB_DEVICE(0x1410, 0xa013)}, /* Novatel Gobi 2000 QDL device */
64 {USB_DEVICE(0x1410, 0xa014)}, /* Novatel Gobi 2000 QDL device */
60 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ 65 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */
61 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 66 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
62 {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */ 67 {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */
@@ -92,6 +97,8 @@ static const struct usb_device_id id_table[] = {
92 {USB_DEVICE(0x05c6, 0x9204)}, /* Gobi 2000 QDL device */ 97 {USB_DEVICE(0x05c6, 0x9204)}, /* Gobi 2000 QDL device */
93 {USB_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ 98 {USB_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
94 99
100 /* Gobi 3000 devices */
101 {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Gobi 3000 QDL */
95 {USB_DEVICE(0x05c6, 0x920c)}, /* Gobi 3000 QDL */ 102 {USB_DEVICE(0x05c6, 0x920c)}, /* Gobi 3000 QDL */
96 {USB_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */ 103 {USB_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */
97 {USB_DEVICE(0x1410, 0xa020)}, /* Novatel Gobi 3000 QDL */ 104 {USB_DEVICE(0x1410, 0xa020)}, /* Novatel Gobi 3000 QDL */
@@ -122,8 +129,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
122 int retval = -ENODEV; 129 int retval = -ENODEV;
123 __u8 nintf; 130 __u8 nintf;
124 __u8 ifnum; 131 __u8 ifnum;
132 bool is_gobi1k = id->driver_info ? true : false;
125 133
126 dbg("%s", __func__); 134 dbg("%s", __func__);
135 dbg("Is Gobi 1000 = %d", is_gobi1k);
127 136
128 nintf = serial->dev->actconfig->desc.bNumInterfaces; 137 nintf = serial->dev->actconfig->desc.bNumInterfaces;
129 dbg("Num Interfaces = %d", nintf); 138 dbg("Num Interfaces = %d", nintf);
@@ -169,15 +178,25 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
169 178
170 case 3: 179 case 3:
171 case 4: 180 case 4:
172 /* Composite mode */ 181 /* Composite mode; don't bind to the QMI/net interface as that
173 /* ifnum == 0 is a broadband network adapter */ 182 * gets handled by other drivers.
174 if (ifnum == 1) { 183 */
175 /* 184
176 * Diagnostics Monitor (serial line 9600 8N1) 185 /* Gobi 1K USB layout:
177 * Qualcomm DM protocol 186 * 0: serial port (doesn't respond)
178 * use "libqcdm" (ModemManager) for communication 187 * 1: serial port (doesn't respond)
179 */ 188 * 2: AT-capable modem port
180 dbg("Diagnostics Monitor found"); 189 * 3: QMI/net
190 *
191 * Gobi 2K+ USB layout:
192 * 0: QMI/net
193 * 1: DM/DIAG (use libqcdm from ModemManager for communication)
194 * 2: AT-capable modem port
195 * 3: NMEA
196 */
197
198 if (ifnum == 1 && !is_gobi1k) {
199 dbg("Gobi 2K+ DM/DIAG interface found");
181 retval = usb_set_interface(serial->dev, ifnum, 0); 200 retval = usb_set_interface(serial->dev, ifnum, 0);
182 if (retval < 0) { 201 if (retval < 0) {
183 dev_err(&serial->dev->dev, 202 dev_err(&serial->dev->dev,
@@ -196,13 +215,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
196 retval = -ENODEV; 215 retval = -ENODEV;
197 kfree(data); 216 kfree(data);
198 } 217 }
199 } else if (ifnum==3) { 218 } else if (ifnum==3 && !is_gobi1k) {
200 /* 219 /*
201 * NMEA (serial line 9600 8N1) 220 * NMEA (serial line 9600 8N1)
202 * # echo "\$GPS_START" > /dev/ttyUSBx 221 * # echo "\$GPS_START" > /dev/ttyUSBx
203 * # echo "\$GPS_STOP" > /dev/ttyUSBx 222 * # echo "\$GPS_STOP" > /dev/ttyUSBx
204 */ 223 */
205 dbg("NMEA GPS interface found"); 224 dbg("Gobi 2K+ NMEA GPS interface found");
206 retval = usb_set_interface(serial->dev, ifnum, 0); 225 retval = usb_set_interface(serial->dev, ifnum, 0);
207 if (retval < 0) { 226 if (retval < 0) {
208 dev_err(&serial->dev->dev, 227 dev_err(&serial->dev->dev,
@@ -246,7 +265,6 @@ static struct usb_serial_driver qcdevice = {
246 }, 265 },
247 .description = "Qualcomm USB modem", 266 .description = "Qualcomm USB modem",
248 .id_table = id_table, 267 .id_table = id_table,
249 .usb_driver = &qcdriver,
250 .num_ports = 1, 268 .num_ports = 1,
251 .probe = qcprobe, 269 .probe = qcprobe,
252 .open = usb_wwan_open, 270 .open = usb_wwan_open,
@@ -263,31 +281,11 @@ static struct usb_serial_driver qcdevice = {
263#endif 281#endif
264}; 282};
265 283
266static int __init qcinit(void) 284static struct usb_serial_driver * const serial_drivers[] = {
267{ 285 &qcdevice, NULL
268 int retval; 286};
269
270 retval = usb_serial_register(&qcdevice);
271 if (retval)
272 return retval;
273
274 retval = usb_register(&qcdriver);
275 if (retval) {
276 usb_serial_deregister(&qcdevice);
277 return retval;
278 }
279
280 return 0;
281}
282
283static void __exit qcexit(void)
284{
285 usb_deregister(&qcdriver);
286 usb_serial_deregister(&qcdevice);
287}
288 287
289module_init(qcinit); 288module_usb_serial_driver(qcdriver, serial_drivers);
290module_exit(qcexit);
291 289
292MODULE_AUTHOR(DRIVER_AUTHOR); 290MODULE_AUTHOR(DRIVER_AUTHOR);
293MODULE_DESCRIPTION(DRIVER_DESC); 291MODULE_DESCRIPTION(DRIVER_DESC);