diff options
| -rw-r--r-- | drivers/usb/serial/qcserial.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 7556f343c0f3..a9c4dc4eb05f 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -143,14 +143,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 143 | 143 | ||
| 144 | spin_lock_init(&data->susp_lock); | 144 | spin_lock_init(&data->susp_lock); |
| 145 | 145 | ||
| 146 | switch (nintf) { | 146 | if (nintf == 1) { |
| 147 | case 1: | ||
| 148 | /* QDL mode */ | 147 | /* QDL mode */ |
| 149 | /* Gobi 2000 has a single altsetting, older ones have two */ | 148 | /* Gobi 2000 has a single altsetting, older ones have two */ |
| 150 | if (serial->interface->num_altsetting == 2) | 149 | if (serial->interface->num_altsetting == 2) |
| 151 | intf = &serial->interface->altsetting[1]; | 150 | intf = &serial->interface->altsetting[1]; |
| 152 | else if (serial->interface->num_altsetting > 2) | 151 | else if (serial->interface->num_altsetting > 2) |
| 153 | break; | 152 | goto done; |
| 154 | 153 | ||
| 155 | if (intf->desc.bNumEndpoints == 2 && | 154 | if (intf->desc.bNumEndpoints == 2 && |
| 156 | usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) && | 155 | usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) && |
| @@ -162,10 +161,18 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 162 | else | 161 | else |
| 163 | altsetting = 1; | 162 | altsetting = 1; |
| 164 | } | 163 | } |
| 165 | break; | 164 | goto done; |
| 166 | 165 | ||
| 167 | case 3: | 166 | } |
| 168 | case 4: | 167 | |
| 168 | if (nintf < 3 || nintf > 4) { | ||
| 169 | dev_err(dev, "unknown number of interfaces: %d\n", nintf); | ||
| 170 | goto done; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* default to enabling interface */ | ||
| 174 | altsetting = 0; | ||
| 175 | switch (ifnum) { | ||
| 169 | /* Composite mode; don't bind to the QMI/net interface as that | 176 | /* Composite mode; don't bind to the QMI/net interface as that |
| 170 | * gets handled by other drivers. | 177 | * gets handled by other drivers. |
| 171 | */ | 178 | */ |
| @@ -183,27 +190,28 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 183 | * 3: NMEA | 190 | * 3: NMEA |
| 184 | */ | 191 | */ |
| 185 | 192 | ||
| 186 | if (ifnum == 1 && !is_gobi1k) { | 193 | case 1: |
| 194 | if (is_gobi1k) | ||
| 195 | altsetting = -1; | ||
| 196 | else | ||
| 187 | dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); | 197 | dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); |
| 188 | altsetting = 0; | 198 | break; |
| 189 | } else if (ifnum == 2) { | 199 | case 2: |
| 190 | dev_dbg(dev, "Modem port found\n"); | 200 | dev_dbg(dev, "Modem port found\n"); |
| 191 | altsetting = 0; | 201 | break; |
| 192 | } else if (ifnum==3 && !is_gobi1k) { | 202 | case 3: |
| 203 | if (is_gobi1k) | ||
| 204 | altsetting = -1; | ||
| 205 | else | ||
| 193 | /* | 206 | /* |
| 194 | * NMEA (serial line 9600 8N1) | 207 | * NMEA (serial line 9600 8N1) |
| 195 | * # echo "\$GPS_START" > /dev/ttyUSBx | 208 | * # echo "\$GPS_START" > /dev/ttyUSBx |
| 196 | * # echo "\$GPS_STOP" > /dev/ttyUSBx | 209 | * # echo "\$GPS_STOP" > /dev/ttyUSBx |
| 197 | */ | 210 | */ |
| 198 | dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); | 211 | dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); |
| 199 | altsetting = 0; | ||
| 200 | } | ||
| 201 | break; | ||
| 202 | |||
| 203 | default: | ||
| 204 | dev_err(dev, "unknown number of interfaces: %d\n", nintf); | ||
| 205 | } | 212 | } |
| 206 | 213 | ||
| 214 | done: | ||
| 207 | if (altsetting >= 0) { | 215 | if (altsetting >= 0) { |
| 208 | retval = usb_set_interface(serial->dev, ifnum, altsetting); | 216 | retval = usb_set_interface(serial->dev, ifnum, altsetting); |
| 209 | if (retval < 0) { | 217 | if (retval < 0) { |
