USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx
[firefly-linux-kernel-4.4.55.git] / drivers / usb / serial / qcserial.c
index b2aa003bf41126dc05ef7e9797f21a741887c4df..9c63897b3a564012ea63f99b9e5e73bc48b93d36 100644 (file)
@@ -27,12 +27,15 @@ enum qcserial_layouts {
        QCSERIAL_G2K = 0,       /* Gobi 2000 */
        QCSERIAL_G1K = 1,       /* Gobi 1000 */
        QCSERIAL_SWI = 2,       /* Sierra Wireless */
+       QCSERIAL_HWI = 3,       /* Huawei */
 };
 
 #define DEVICE_G1K(v, p) \
        USB_DEVICE(v, p), .driver_info = QCSERIAL_G1K
 #define DEVICE_SWI(v, p) \
        USB_DEVICE(v, p), .driver_info = QCSERIAL_SWI
+#define DEVICE_HWI(v, p) \
+       USB_DEVICE(v, p), .driver_info = QCSERIAL_HWI
 
 static const struct usb_device_id id_table[] = {
        /* Gobi 1000 devices */
@@ -139,7 +142,6 @@ static const struct usb_device_id id_table[] = {
        {DEVICE_SWI(0x0f3d, 0x68a2)},   /* Sierra Wireless MC7700 */
        {DEVICE_SWI(0x114f, 0x68a2)},   /* Sierra Wireless MC7750 */
        {DEVICE_SWI(0x1199, 0x68a2)},   /* Sierra Wireless MC7710 */
-       {DEVICE_SWI(0x1199, 0x68c0)},   /* Sierra Wireless MC73xx */
        {DEVICE_SWI(0x1199, 0x901c)},   /* Sierra Wireless EM7700 */
        {DEVICE_SWI(0x1199, 0x901f)},   /* Sierra Wireless EM7355 */
        {DEVICE_SWI(0x1199, 0x9040)},   /* Sierra Wireless Modem */
@@ -157,6 +159,9 @@ static const struct usb_device_id id_table[] = {
        {DEVICE_SWI(0x413c, 0x81a8)},   /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
        {DEVICE_SWI(0x413c, 0x81a9)},   /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
 
+       /* Huawei devices */
+       {DEVICE_HWI(0x03f0, 0x581d)},   /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
+
        { }                             /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -287,6 +292,33 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
                        break;
                }
                break;
+       case QCSERIAL_HWI:
+               /*
+                * Huawei layout:
+                * 0: AT-capable modem port
+                * 1: DM/DIAG
+                * 2: AT-capable modem port
+                * 3: CCID-compatible PCSC interface
+                * 4: QMI/net
+                * 5: NMEA
+                */
+               switch (ifnum) {
+               case 0:
+               case 2:
+                       dev_dbg(dev, "Modem port found\n");
+                       break;
+               case 1:
+                       dev_dbg(dev, "DM/DIAG interface found\n");
+                       break;
+               case 5:
+                       dev_dbg(dev, "NMEA GPS interface found\n");
+                       break;
+               default:
+                       /* don't claim any unsupported interface */
+                       altsetting = -1;
+                       break;
+               }
+               break;
        default:
                dev_err(dev, "unsupported device layout type: %lu\n",
                        id->driver_info);