2 * Qualcomm Serial USB driver
4 * Copyright (c) 2008 QUALCOMM Incorporated.
5 * Copyright (c) 2009 Greg Kroah-Hartman <gregkh@suse.de>
6 * Copyright (c) 2009 Novell Inc.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
14 #include <linux/tty.h>
15 #include <linux/tty_flip.h>
16 #include <linux/usb.h>
17 #include <linux/usb/serial.h>
19 #define DRIVER_AUTHOR "Qualcomm Inc"
20 #define DRIVER_DESC "Qualcomm USB Serial driver"
24 static struct usb_device_id id_table[] = {
25 {USB_DEVICE(0x05c6, 0x9211)}, /* Acer Gobi QDL device */
26 {USB_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
27 {USB_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
28 {USB_DEVICE(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */
29 { } /* Terminating entry */
31 MODULE_DEVICE_TABLE(usb, id_table);
33 static struct usb_driver qcdriver = {
35 .probe = usb_serial_probe,
36 .disconnect = usb_serial_disconnect,
38 .suspend = usb_serial_suspend,
39 .resume = usb_serial_resume,
40 .supports_autosuspend = true,
43 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
51 nintf = serial->dev->actconfig->desc.bNumInterfaces;
52 dbg("Num Interfaces = %d", nintf);
53 ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
54 dbg("This Interface = %d", ifnum);
59 if (serial->interface->num_altsetting == 2) {
60 struct usb_host_interface *intf;
62 intf = &serial->interface->altsetting[1];
63 if (intf->desc.bNumEndpoints == 2) {
64 if (usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) &&
65 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
66 dbg("QDL port found");
67 retval = usb_set_interface(serial->dev, ifnum, 1);
69 dev_err(&serial->dev->dev,
70 "Could not set interface, error %d\n",
83 dbg("Modem port found");
84 retval = usb_set_interface(serial->dev, ifnum, 0);
86 dev_err(&serial->dev->dev,
87 "Could not set interface, error %d\n",
96 dev_err(&serial->dev->dev,
97 "unknown number of interfaces: %d\n", nintf);
104 static struct usb_serial_driver qcdevice = {
106 .owner = THIS_MODULE,
109 .description = "Qualcomm USB modem",
110 .id_table = id_table,
111 .usb_driver = &qcdriver,
116 static int __init qcinit(void)
120 retval = usb_serial_register(&qcdevice);
124 retval = usb_register(&qcdriver);
126 usb_serial_deregister(&qcdevice);
133 static void __exit qcexit(void)
135 usb_deregister(&qcdriver);
136 usb_serial_deregister(&qcdevice);
142 MODULE_AUTHOR(DRIVER_AUTHOR);
143 MODULE_DESCRIPTION(DRIVER_DESC);
144 MODULE_LICENSE("GPL v2");
146 module_param(debug, bool, S_IRUGO | S_IWUSR);
147 MODULE_PARM_DESC(debug, "Debug enabled or not");