aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/serial
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/Kconfig4
-rw-r--r--drivers/usb/serial/Makefile9
-rw-r--r--drivers/usb/serial/aircable.c4
-rw-r--r--drivers/usb/serial/ark3116.c46
-rw-r--r--drivers/usb/serial/belkin_sa.c8
-rw-r--r--drivers/usb/serial/ch341.c18
-rw-r--r--drivers/usb/serial/cp210x.c45
-rw-r--r--drivers/usb/serial/cypress_m8.c16
-rw-r--r--drivers/usb/serial/digi_acceleport.c24
-rw-r--r--drivers/usb/serial/ftdi_sio.c159
-rw-r--r--drivers/usb/serial/ftdi_sio.h3
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h119
-rw-r--r--drivers/usb/serial/garmin_gps.c21
-rw-r--r--drivers/usb/serial/generic.c20
-rw-r--r--drivers/usb/serial/io_edgeport.c81
-rw-r--r--drivers/usb/serial/io_edgeport.h2
-rw-r--r--drivers/usb/serial/io_tables.h5
-rw-r--r--drivers/usb/serial/io_ti.c41
-rw-r--r--drivers/usb/serial/iuu_phoenix.c6
-rw-r--r--drivers/usb/serial/keyspan.c16
-rw-r--r--drivers/usb/serial/keyspan.h11
-rw-r--r--drivers/usb/serial/keyspan_pda.c37
-rw-r--r--drivers/usb/serial/kl5kusb105.c8
-rw-r--r--drivers/usb/serial/kobil_sct.c14
-rw-r--r--drivers/usb/serial/mct_u232.c122
-rw-r--r--drivers/usb/serial/mct_u232.h9
-rw-r--r--drivers/usb/serial/mos7720.c71
-rw-r--r--drivers/usb/serial/mos7840.c66
-rw-r--r--drivers/usb/serial/moto_modem.c2
-rw-r--r--drivers/usb/serial/omninet.c2
-rw-r--r--drivers/usb/serial/opticon.c161
-rw-r--r--drivers/usb/serial/option.c105
-rw-r--r--drivers/usb/serial/oti6858.c18
-rw-r--r--drivers/usb/serial/pl2303.c18
-rw-r--r--drivers/usb/serial/pl2303.h1
-rw-r--r--drivers/usb/serial/qcaux.c3
-rw-r--r--drivers/usb/serial/qcserial.c64
-rw-r--r--drivers/usb/serial/siemens_mpi.c1
-rw-r--r--drivers/usb/serial/sierra.c25
-rw-r--r--drivers/usb/serial/spcp8x5.c14
-rw-r--r--drivers/usb/serial/ssu100.c110
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c54
-rw-r--r--drivers/usb/serial/usb-serial.c38
-rw-r--r--drivers/usb/serial/usb-wwan.h6
-rw-r--r--drivers/usb/serial/usb_debug.c1
-rw-r--r--drivers/usb/serial/usb_wwan.c141
-rw-r--r--drivers/usb/serial/visor.c23
-rw-r--r--drivers/usb/serial/whiteheat.c18
48 files changed, 1246 insertions, 544 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 916b2b6d765f..b71e309116a3 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -176,7 +176,7 @@ config USB_SERIAL_VISOR
176 help 176 help
177 Say Y here if you want to connect to your HandSpring Visor, Palm 177 Say Y here if you want to connect to your HandSpring Visor, Palm
178 m500 or m505 through its USB docking station. See 178 m500 or m505 through its USB docking station. See
179 <http://usbvisor.sourceforge.net/> for more information on using this 179 <http://usbvisor.sourceforge.net/index.php3> for more information on using this
180 driver. 180 driver.
181 181
182 To compile this driver as a module, choose M here: the 182 To compile this driver as a module, choose M here: the
@@ -289,7 +289,7 @@ config USB_SERIAL_KEYSPAN
289 and was developed with their support. You must also include 289 and was developed with their support. You must also include
290 firmware to support your particular device(s). 290 firmware to support your particular device(s).
291 291
292 See <http://misc.nu/hugh/keyspan.html> for more information. 292 See <http://blemings.org/hugh/keyspan.html> for more information.
293 293
294 To compile this driver as a module, choose M here: the 294 To compile this driver as a module, choose M here: the
295 module will be called keyspan. 295 module will be called keyspan.
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 40ebe17b6ea8..9e536eefb32c 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -6,10 +6,10 @@
6 6
7obj-$(CONFIG_USB_SERIAL) += usbserial.o 7obj-$(CONFIG_USB_SERIAL) += usbserial.o
8 8
9usbserial-obj-$(CONFIG_USB_SERIAL_CONSOLE) += console.o 9usbserial-y := usb-serial.o generic.o bus.o
10usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o
11 10
12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) 11usbserial-$(CONFIG_USB_SERIAL_CONSOLE) += console.o
12usbserial-$(CONFIG_USB_EZUSB) += ezusb.o
13 13
14obj-$(CONFIG_USB_SERIAL_AIRCABLE) += aircable.o 14obj-$(CONFIG_USB_SERIAL_AIRCABLE) += aircable.o
15obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o 15obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o
@@ -58,6 +58,5 @@ obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o
58obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o 58obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
59obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o 59obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
60obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o 60obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o
61obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o 61obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o
62obj-$(CONFIG_USB_SERIAL_ZIO) += zio.o 62obj-$(CONFIG_USB_SERIAL_ZIO) += zio.o
63
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 0db6ace16f7b..aba201cb872c 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -16,7 +16,7 @@
16 * When reading the process is almost equal except that the header starts with 16 * When reading the process is almost equal except that the header starts with
17 * 0x00 0x20. 17 * 0x00 0x20.
18 * 18 *
19 * The device simply need some stuff to understand data comming from the usb 19 * The device simply need some stuff to understand data coming from the usb
20 * buffer: The First and Second byte is used for a Header, the Third and Fourth 20 * buffer: The First and Second byte is used for a Header, the Third and Fourth
21 * tells the device the amount of information the package holds. 21 * tells the device the amount of information the package holds.
22 * Packages are 60 bytes long Header Stuff. 22 * Packages are 60 bytes long Header Stuff.
@@ -30,7 +30,7 @@
30 * one. 30 * one.
31 * 31 *
32 * The driver registers himself with the USB-serial core and the USB Core. I had 32 * The driver registers himself with the USB-serial core and the USB Core. I had
33 * to implement a probe function agains USB-serial, because other way, the 33 * to implement a probe function against USB-serial, because other way, the
34 * driver was attaching himself to both interfaces. I have tryed with different 34 * driver was attaching himself to both interfaces. I have tryed with different
35 * configurations of usb_serial_driver with out exit, only the probe function 35 * configurations of usb_serial_driver with out exit, only the probe function
36 * could handle this correctly. 36 * could handle this correctly.
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 4e41a2a39422..5cdb9d912275 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -411,7 +411,27 @@ err_out:
411 return result; 411 return result;
412} 412}
413 413
414static int ark3116_ioctl(struct tty_struct *tty, struct file *file, 414static int ark3116_get_icount(struct tty_struct *tty,
415 struct serial_icounter_struct *icount)
416{
417 struct usb_serial_port *port = tty->driver_data;
418 struct ark3116_private *priv = usb_get_serial_port_data(port);
419 struct async_icount cnow = priv->icount;
420 icount->cts = cnow.cts;
421 icount->dsr = cnow.dsr;
422 icount->rng = cnow.rng;
423 icount->dcd = cnow.dcd;
424 icount->rx = cnow.rx;
425 icount->tx = cnow.tx;
426 icount->frame = cnow.frame;
427 icount->overrun = cnow.overrun;
428 icount->parity = cnow.parity;
429 icount->brk = cnow.brk;
430 icount->buf_overrun = cnow.buf_overrun;
431 return 0;
432}
433
434static int ark3116_ioctl(struct tty_struct *tty,
415 unsigned int cmd, unsigned long arg) 435 unsigned int cmd, unsigned long arg)
416{ 436{
417 struct usb_serial_port *port = tty->driver_data; 437 struct usb_serial_port *port = tty->driver_data;
@@ -460,31 +480,12 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
460 return 0; 480 return 0;
461 } 481 }
462 break; 482 break;
463 case TIOCGICOUNT: {
464 struct serial_icounter_struct icount;
465 struct async_icount cnow = priv->icount;
466 memset(&icount, 0, sizeof(icount));
467 icount.cts = cnow.cts;
468 icount.dsr = cnow.dsr;
469 icount.rng = cnow.rng;
470 icount.dcd = cnow.dcd;
471 icount.rx = cnow.rx;
472 icount.tx = cnow.tx;
473 icount.frame = cnow.frame;
474 icount.overrun = cnow.overrun;
475 icount.parity = cnow.parity;
476 icount.brk = cnow.brk;
477 icount.buf_overrun = cnow.buf_overrun;
478 if (copy_to_user(user_arg, &icount, sizeof(icount)))
479 return -EFAULT;
480 return 0;
481 }
482 } 483 }
483 484
484 return -ENOIOCTLCMD; 485 return -ENOIOCTLCMD;
485} 486}
486 487
487static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) 488static int ark3116_tiocmget(struct tty_struct *tty)
488{ 489{
489 struct usb_serial_port *port = tty->driver_data; 490 struct usb_serial_port *port = tty->driver_data;
490 struct ark3116_private *priv = usb_get_serial_port_data(port); 491 struct ark3116_private *priv = usb_get_serial_port_data(port);
@@ -510,7 +511,7 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
510 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0); 511 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0);
511} 512}
512 513
513static int ark3116_tiocmset(struct tty_struct *tty, struct file *file, 514static int ark3116_tiocmset(struct tty_struct *tty,
514 unsigned set, unsigned clr) 515 unsigned set, unsigned clr)
515{ 516{
516 struct usb_serial_port *port = tty->driver_data; 517 struct usb_serial_port *port = tty->driver_data;
@@ -736,6 +737,7 @@ static struct usb_serial_driver ark3116_device = {
736 .ioctl = ark3116_ioctl, 737 .ioctl = ark3116_ioctl,
737 .tiocmget = ark3116_tiocmget, 738 .tiocmget = ark3116_tiocmget,
738 .tiocmset = ark3116_tiocmset, 739 .tiocmset = ark3116_tiocmset,
740 .get_icount = ark3116_get_icount,
739 .open = ark3116_open, 741 .open = ark3116_open,
740 .close = ark3116_close, 742 .close = ark3116_close,
741 .break_ctl = ark3116_break_ctl, 743 .break_ctl = ark3116_break_ctl,
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 36df35295db2..d6921fa1403c 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -100,8 +100,8 @@ static void belkin_sa_process_read_urb(struct urb *urb);
100static void belkin_sa_set_termios(struct tty_struct *tty, 100static void belkin_sa_set_termios(struct tty_struct *tty,
101 struct usb_serial_port *port, struct ktermios * old); 101 struct usb_serial_port *port, struct ktermios * old);
102static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); 102static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state);
103static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file); 103static int belkin_sa_tiocmget(struct tty_struct *tty);
104static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, 104static int belkin_sa_tiocmset(struct tty_struct *tty,
105 unsigned int set, unsigned int clear); 105 unsigned int set, unsigned int clear);
106 106
107 107
@@ -497,7 +497,7 @@ static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state)
497 dev_err(&port->dev, "Set break_ctl %d\n", break_state); 497 dev_err(&port->dev, "Set break_ctl %d\n", break_state);
498} 498}
499 499
500static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) 500static int belkin_sa_tiocmget(struct tty_struct *tty)
501{ 501{
502 struct usb_serial_port *port = tty->driver_data; 502 struct usb_serial_port *port = tty->driver_data;
503 struct belkin_sa_private *priv = usb_get_serial_port_data(port); 503 struct belkin_sa_private *priv = usb_get_serial_port_data(port);
@@ -513,7 +513,7 @@ static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file)
513 return control_state; 513 return control_state;
514} 514}
515 515
516static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, 516static int belkin_sa_tiocmset(struct tty_struct *tty,
517 unsigned int set, unsigned int clear) 517 unsigned int set, unsigned int clear)
518{ 518{
519 struct usb_serial_port *port = tty->driver_data; 519 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 63f7cc45bcac..6ae1c0688b5e 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -75,6 +75,7 @@ static int debug;
75static const struct usb_device_id id_table[] = { 75static const struct usb_device_id id_table[] = {
76 { USB_DEVICE(0x4348, 0x5523) }, 76 { USB_DEVICE(0x4348, 0x5523) },
77 { USB_DEVICE(0x1a86, 0x7523) }, 77 { USB_DEVICE(0x1a86, 0x7523) },
78 { USB_DEVICE(0x1a86, 0x5523) },
78 { }, 79 { },
79}; 80};
80MODULE_DEVICE_TABLE(usb, id_table); 81MODULE_DEVICE_TABLE(usb, id_table);
@@ -431,7 +432,7 @@ out:
431 kfree(break_reg); 432 kfree(break_reg);
432} 433}
433 434
434static int ch341_tiocmset(struct tty_struct *tty, struct file *file, 435static int ch341_tiocmset(struct tty_struct *tty,
435 unsigned int set, unsigned int clear) 436 unsigned int set, unsigned int clear)
436{ 437{
437 struct usb_serial_port *port = tty->driver_data; 438 struct usb_serial_port *port = tty->driver_data;
@@ -486,12 +487,22 @@ static void ch341_read_int_callback(struct urb *urb)
486 if (actual_length >= 4) { 487 if (actual_length >= 4) {
487 struct ch341_private *priv = usb_get_serial_port_data(port); 488 struct ch341_private *priv = usb_get_serial_port_data(port);
488 unsigned long flags; 489 unsigned long flags;
490 u8 prev_line_status = priv->line_status;
489 491
490 spin_lock_irqsave(&priv->lock, flags); 492 spin_lock_irqsave(&priv->lock, flags);
491 priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; 493 priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT;
492 if ((data[1] & CH341_MULT_STAT)) 494 if ((data[1] & CH341_MULT_STAT))
493 priv->multi_status_change = 1; 495 priv->multi_status_change = 1;
494 spin_unlock_irqrestore(&priv->lock, flags); 496 spin_unlock_irqrestore(&priv->lock, flags);
497
498 if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) {
499 struct tty_struct *tty = tty_port_tty_get(&port->port);
500 if (tty)
501 usb_serial_handle_dcd_change(port, tty,
502 priv->line_status & CH341_BIT_DCD);
503 tty_kref_put(tty);
504 }
505
495 wake_up_interruptible(&priv->delta_msr_wait); 506 wake_up_interruptible(&priv->delta_msr_wait);
496 } 507 }
497 508
@@ -542,8 +553,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
542 return 0; 553 return 0;
543} 554}
544 555
545/*static int ch341_ioctl(struct usb_serial_port *port, struct file *file,*/ 556static int ch341_ioctl(struct tty_struct *tty,
546static int ch341_ioctl(struct tty_struct *tty, struct file *file,
547 unsigned int cmd, unsigned long arg) 557 unsigned int cmd, unsigned long arg)
548{ 558{
549 struct usb_serial_port *port = tty->driver_data; 559 struct usb_serial_port *port = tty->driver_data;
@@ -562,7 +572,7 @@ static int ch341_ioctl(struct tty_struct *tty, struct file *file,
562 return -ENOIOCTLCMD; 572 return -ENOIOCTLCMD;
563} 573}
564 574
565static int ch341_tiocmget(struct tty_struct *tty, struct file *file) 575static int ch341_tiocmget(struct tty_struct *tty)
566{ 576{
567 struct usb_serial_port *port = tty->driver_data; 577 struct usb_serial_port *port = tty->driver_data;
568 struct ch341_private *priv = usb_get_serial_port_data(port); 578 struct ch341_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4f1744c5871f..fd67cc53545b 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -41,19 +41,18 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
41 unsigned int *cflagp, unsigned int *baudp); 41 unsigned int *cflagp, unsigned int *baudp);
42static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, 42static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
43 struct ktermios*); 43 struct ktermios*);
44static int cp210x_tiocmget(struct tty_struct *, struct file *); 44static int cp210x_tiocmget(struct tty_struct *);
45static int cp210x_tiocmset(struct tty_struct *, struct file *, 45static int cp210x_tiocmset(struct tty_struct *, unsigned int, unsigned int);
46 unsigned int, unsigned int); 46static int cp210x_tiocmset_port(struct usb_serial_port *port,
47static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
48 unsigned int, unsigned int); 47 unsigned int, unsigned int);
49static void cp210x_break_ctl(struct tty_struct *, int); 48static void cp210x_break_ctl(struct tty_struct *, int);
50static int cp210x_startup(struct usb_serial *); 49static int cp210x_startup(struct usb_serial *);
51static void cp210x_dtr_rts(struct usb_serial_port *p, int on); 50static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
52static int cp210x_carrier_raised(struct usb_serial_port *p);
53 51
54static int debug; 52static int debug;
55 53
56static const struct usb_device_id id_table[] = { 54static const struct usb_device_id id_table[] = {
55 { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */
57 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ 56 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
58 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 57 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
59 { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 58 { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
@@ -86,7 +85,6 @@ static const struct usb_device_id id_table[] = {
86 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ 85 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
87 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 86 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
88 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ 87 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
89 { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */
90 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 88 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
91 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 89 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
92 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ 90 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
@@ -103,15 +101,21 @@ static const struct usb_device_id id_table[] = {
103 { USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */ 101 { USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */
104 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 102 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
105 { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ 103 { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */
106 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demostration module */ 104 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
107 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesys ETRX2USB */ 105 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
108 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ 106 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
109 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ 107 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
110 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ 108 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
111 { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ 109 { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */
110 { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */
112 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ 111 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
112 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
113 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ 113 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
114 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ 114 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
115 { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
116 { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
117 { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
118 { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
115 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 119 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
116 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 120 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
117 { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ 121 { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
@@ -132,6 +136,7 @@ static const struct usb_device_id id_table[] = {
132 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ 136 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
133 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ 137 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
134 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 138 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
139 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
135 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 140 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
136 { } /* Terminating Entry */ 141 { } /* Terminating Entry */
137}; 142};
@@ -163,8 +168,7 @@ static struct usb_serial_driver cp210x_device = {
163 .tiocmget = cp210x_tiocmget, 168 .tiocmget = cp210x_tiocmget,
164 .tiocmset = cp210x_tiocmset, 169 .tiocmset = cp210x_tiocmset,
165 .attach = cp210x_startup, 170 .attach = cp210x_startup,
166 .dtr_rts = cp210x_dtr_rts, 171 .dtr_rts = cp210x_dtr_rts
167 .carrier_raised = cp210x_carrier_raised
168}; 172};
169 173
170/* Config request types */ 174/* Config request types */
@@ -697,14 +701,14 @@ static void cp210x_set_termios(struct tty_struct *tty,
697 701
698} 702}
699 703
700static int cp210x_tiocmset (struct tty_struct *tty, struct file *file, 704static int cp210x_tiocmset (struct tty_struct *tty,
701 unsigned int set, unsigned int clear) 705 unsigned int set, unsigned int clear)
702{ 706{
703 struct usb_serial_port *port = tty->driver_data; 707 struct usb_serial_port *port = tty->driver_data;
704 return cp210x_tiocmset_port(port, file, set, clear); 708 return cp210x_tiocmset_port(port, set, clear);
705} 709}
706 710
707static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, 711static int cp210x_tiocmset_port(struct usb_serial_port *port,
708 unsigned int set, unsigned int clear) 712 unsigned int set, unsigned int clear)
709{ 713{
710 unsigned int control = 0; 714 unsigned int control = 0;
@@ -736,12 +740,12 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file,
736static void cp210x_dtr_rts(struct usb_serial_port *p, int on) 740static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
737{ 741{
738 if (on) 742 if (on)
739 cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); 743 cp210x_tiocmset_port(p, TIOCM_DTR|TIOCM_RTS, 0);
740 else 744 else
741 cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); 745 cp210x_tiocmset_port(p, 0, TIOCM_DTR|TIOCM_RTS);
742} 746}
743 747
744static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 748static int cp210x_tiocmget (struct tty_struct *tty)
745{ 749{
746 struct usb_serial_port *port = tty->driver_data; 750 struct usb_serial_port *port = tty->driver_data;
747 unsigned int control; 751 unsigned int control;
@@ -763,15 +767,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
763 return result; 767 return result;
764} 768}
765 769
766static int cp210x_carrier_raised(struct usb_serial_port *p)
767{
768 unsigned int control;
769 cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
770 if (control & CONTROL_DCD)
771 return 1;
772 return 0;
773}
774
775static void cp210x_break_ctl (struct tty_struct *tty, int break_state) 770static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
776{ 771{
777 struct usb_serial_port *port = tty->driver_data; 772 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index f5d06746cc3b..d9906eb9d16a 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -35,7 +35,7 @@
35 * 35 *
36 * Lonnie Mendez <dignome@gmail.com> 36 * Lonnie Mendez <dignome@gmail.com>
37 * 04-10-2004 37 * 04-10-2004
38 * Driver modified to support dynamic line settings. Various improvments 38 * Driver modified to support dynamic line settings. Various improvements
39 * and features. 39 * and features.
40 * 40 *
41 * Neil Whelchel 41 * Neil Whelchel
@@ -169,12 +169,12 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
169 const unsigned char *buf, int count); 169 const unsigned char *buf, int count);
170static void cypress_send(struct usb_serial_port *port); 170static void cypress_send(struct usb_serial_port *port);
171static int cypress_write_room(struct tty_struct *tty); 171static int cypress_write_room(struct tty_struct *tty);
172static int cypress_ioctl(struct tty_struct *tty, struct file *file, 172static int cypress_ioctl(struct tty_struct *tty,
173 unsigned int cmd, unsigned long arg); 173 unsigned int cmd, unsigned long arg);
174static void cypress_set_termios(struct tty_struct *tty, 174static void cypress_set_termios(struct tty_struct *tty,
175 struct usb_serial_port *port, struct ktermios *old); 175 struct usb_serial_port *port, struct ktermios *old);
176static int cypress_tiocmget(struct tty_struct *tty, struct file *file); 176static int cypress_tiocmget(struct tty_struct *tty);
177static int cypress_tiocmset(struct tty_struct *tty, struct file *file, 177static int cypress_tiocmset(struct tty_struct *tty,
178 unsigned int set, unsigned int clear); 178 unsigned int set, unsigned int clear);
179static int cypress_chars_in_buffer(struct tty_struct *tty); 179static int cypress_chars_in_buffer(struct tty_struct *tty);
180static void cypress_throttle(struct tty_struct *tty); 180static void cypress_throttle(struct tty_struct *tty);
@@ -864,7 +864,7 @@ static int cypress_write_room(struct tty_struct *tty)
864} 864}
865 865
866 866
867static int cypress_tiocmget(struct tty_struct *tty, struct file *file) 867static int cypress_tiocmget(struct tty_struct *tty)
868{ 868{
869 struct usb_serial_port *port = tty->driver_data; 869 struct usb_serial_port *port = tty->driver_data;
870 struct cypress_private *priv = usb_get_serial_port_data(port); 870 struct cypress_private *priv = usb_get_serial_port_data(port);
@@ -892,7 +892,7 @@ static int cypress_tiocmget(struct tty_struct *tty, struct file *file)
892} 892}
893 893
894 894
895static int cypress_tiocmset(struct tty_struct *tty, struct file *file, 895static int cypress_tiocmset(struct tty_struct *tty,
896 unsigned int set, unsigned int clear) 896 unsigned int set, unsigned int clear)
897{ 897{
898 struct usb_serial_port *port = tty->driver_data; 898 struct usb_serial_port *port = tty->driver_data;
@@ -917,7 +917,7 @@ static int cypress_tiocmset(struct tty_struct *tty, struct file *file,
917} 917}
918 918
919 919
920static int cypress_ioctl(struct tty_struct *tty, struct file *file, 920static int cypress_ioctl(struct tty_struct *tty,
921 unsigned int cmd, unsigned long arg) 921 unsigned int cmd, unsigned long arg)
922{ 922{
923 struct usb_serial_port *port = tty->driver_data; 923 struct usb_serial_port *port = tty->driver_data;
@@ -1320,8 +1320,6 @@ continue_read:
1320 cypress_set_dead(port); 1320 cypress_set_dead(port);
1321 } 1321 }
1322 } 1322 }
1323
1324 return;
1325} /* cypress_read_int_callback */ 1323} /* cypress_read_int_callback */
1326 1324
1327 1325
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index b92070c103cd..86fbba6336c9 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -445,17 +445,16 @@ static void digi_rx_unthrottle(struct tty_struct *tty);
445static void digi_set_termios(struct tty_struct *tty, 445static void digi_set_termios(struct tty_struct *tty,
446 struct usb_serial_port *port, struct ktermios *old_termios); 446 struct usb_serial_port *port, struct ktermios *old_termios);
447static void digi_break_ctl(struct tty_struct *tty, int break_state); 447static void digi_break_ctl(struct tty_struct *tty, int break_state);
448static int digi_tiocmget(struct tty_struct *tty, struct file *file); 448static int digi_tiocmget(struct tty_struct *tty);
449static int digi_tiocmset(struct tty_struct *tty, struct file *file, 449static int digi_tiocmset(struct tty_struct *tty, unsigned int set,
450 unsigned int set, unsigned int clear); 450 unsigned int clear);
451static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, 451static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
452 const unsigned char *buf, int count); 452 const unsigned char *buf, int count);
453static void digi_write_bulk_callback(struct urb *urb); 453static void digi_write_bulk_callback(struct urb *urb);
454static int digi_write_room(struct tty_struct *tty); 454static int digi_write_room(struct tty_struct *tty);
455static int digi_chars_in_buffer(struct tty_struct *tty); 455static int digi_chars_in_buffer(struct tty_struct *tty);
456static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); 456static int digi_open(struct tty_struct *tty, struct usb_serial_port *port);
457static void digi_close(struct usb_serial_port *port); 457static void digi_close(struct usb_serial_port *port);
458static int digi_carrier_raised(struct usb_serial_port *port);
459static void digi_dtr_rts(struct usb_serial_port *port, int on); 458static void digi_dtr_rts(struct usb_serial_port *port, int on);
460static int digi_startup_device(struct usb_serial *serial); 459static int digi_startup_device(struct usb_serial *serial);
461static int digi_startup(struct usb_serial *serial); 460static int digi_startup(struct usb_serial *serial);
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = {
511 .open = digi_open, 510 .open = digi_open,
512 .close = digi_close, 511 .close = digi_close,
513 .dtr_rts = digi_dtr_rts, 512 .dtr_rts = digi_dtr_rts,
514 .carrier_raised = digi_carrier_raised,
515 .write = digi_write, 513 .write = digi_write,
516 .write_room = digi_write_room, 514 .write_room = digi_write_room,
517 .write_bulk_callback = digi_write_bulk_callback, 515 .write_bulk_callback = digi_write_bulk_callback,
@@ -1120,7 +1118,7 @@ static void digi_break_ctl(struct tty_struct *tty, int break_state)
1120} 1118}
1121 1119
1122 1120
1123static int digi_tiocmget(struct tty_struct *tty, struct file *file) 1121static int digi_tiocmget(struct tty_struct *tty)
1124{ 1122{
1125 struct usb_serial_port *port = tty->driver_data; 1123 struct usb_serial_port *port = tty->driver_data;
1126 struct digi_port *priv = usb_get_serial_port_data(port); 1124 struct digi_port *priv = usb_get_serial_port_data(port);
@@ -1136,8 +1134,8 @@ static int digi_tiocmget(struct tty_struct *tty, struct file *file)
1136} 1134}
1137 1135
1138 1136
1139static int digi_tiocmset(struct tty_struct *tty, struct file *file, 1137static int digi_tiocmset(struct tty_struct *tty,
1140 unsigned int set, unsigned int clear) 1138 unsigned int set, unsigned int clear)
1141{ 1139{
1142 struct usb_serial_port *port = tty->driver_data; 1140 struct usb_serial_port *port = tty->driver_data;
1143 struct digi_port *priv = usb_get_serial_port_data(port); 1141 struct digi_port *priv = usb_get_serial_port_data(port);
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on)
1339 digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); 1337 digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1);
1340} 1338}
1341 1339
1342static int digi_carrier_raised(struct usb_serial_port *port)
1343{
1344 struct digi_port *priv = usb_get_serial_port_data(port);
1345 if (priv->dp_modem_signals & TIOCM_CD)
1346 return 1;
1347 return 0;
1348}
1349
1350static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) 1340static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
1351{ 1341{
1352 int ret; 1342 int ret;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 97cc87d654ce..2e06b90aa1f8 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -17,7 +17,7 @@
17 * See Documentation/usb/usb-serial.txt for more information on using this 17 * See Documentation/usb/usb-serial.txt for more information on using this
18 * driver 18 * driver
19 * 19 *
20 * See http://ftdi-usb-sio.sourceforge.net for upto date testing info 20 * See http://ftdi-usb-sio.sourceforge.net for up to date testing info
21 * and extra documentation 21 * and extra documentation
22 * 22 *
23 * Change entries from 2004 and earlier can be found in versions of this 23 * Change entries from 2004 and earlier can be found in versions of this
@@ -75,6 +75,7 @@ struct ftdi_private {
75 unsigned long last_dtr_rts; /* saved modem control outputs */ 75 unsigned long last_dtr_rts; /* saved modem control outputs */
76 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 76 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
77 char prev_status, diff_status; /* Used for TIOCMIWAIT */ 77 char prev_status, diff_status; /* Used for TIOCMIWAIT */
78 char transmit_empty; /* If transmitter is empty or not */
78 struct usb_serial_port *port; 79 struct usb_serial_port *port;
79 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface 80 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface
80 (0 for FT232/245) */ 81 (0 for FT232/245) */
@@ -99,6 +100,7 @@ struct ftdi_sio_quirk {
99static int ftdi_jtag_probe(struct usb_serial *serial); 100static int ftdi_jtag_probe(struct usb_serial *serial);
100static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); 101static int ftdi_mtxorb_hack_setup(struct usb_serial *serial);
101static int ftdi_NDI_device_setup(struct usb_serial *serial); 102static int ftdi_NDI_device_setup(struct usb_serial *serial);
103static int ftdi_stmclite_probe(struct usb_serial *serial);
102static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); 104static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
103static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); 105static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
104 106
@@ -122,6 +124,10 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
122 .port_probe = ftdi_HE_TIRA1_setup, 124 .port_probe = ftdi_HE_TIRA1_setup,
123}; 125};
124 126
127static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
128 .probe = ftdi_stmclite_probe,
129};
130
125/* 131/*
126 * The 8U232AM has the same API as the sio except for: 132 * The 8U232AM has the same API as the sio except for:
127 * - it can support MUCH higher baudrates; up to: 133 * - it can support MUCH higher baudrates; up to:
@@ -145,6 +151,8 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
145 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! 151 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report!
146 */ 152 */
147static struct usb_device_id id_table_combined [] = { 153static struct usb_device_id id_table_combined [] = {
154 { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) },
155 { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) },
148 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, 156 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
149 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, 157 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
150 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, 158 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
@@ -171,12 +179,14 @@ static struct usb_device_id id_table_combined [] = {
171 { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, 179 { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) },
172 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, 180 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
173 { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, 181 { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) },
182 { USB_DEVICE(FTDI_VID, FTDI_232H_PID) },
174 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, 183 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
175 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 184 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
176 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, 185 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
177 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, 186 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) },
178 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, 187 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
179 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, 188 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
180 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 190 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
181 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 191 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
182 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 192 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
@@ -200,6 +210,7 @@ static struct usb_device_id id_table_combined [] = {
200 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 210 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
201 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 211 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
202 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, 212 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) },
213 { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) },
203 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, 214 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) },
204 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, 215 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) },
205 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, 216 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) },
@@ -517,6 +528,7 @@ static struct usb_device_id id_table_combined [] = {
517 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 528 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) },
518 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, 529 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) },
519 { USB_DEVICE(OCT_VID, OCT_US101_PID) }, 530 { USB_DEVICE(OCT_VID, OCT_US101_PID) },
531 { USB_DEVICE(OCT_VID, OCT_DK201_PID) },
520 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), 532 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID),
521 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, 533 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk },
522 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), 534 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID),
@@ -555,6 +567,7 @@ static struct usb_device_id id_table_combined [] = {
555 { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) }, 567 { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) },
556 { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, 568 { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
557 { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, 569 { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
570 { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
558 /* 571 /*
559 * ELV devices: 572 * ELV devices:
560 */ 573 */
@@ -613,6 +626,7 @@ static struct usb_device_id id_table_combined [] = {
613 { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, 626 { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) },
614 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, 627 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
615 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 628 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
629 { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) },
616 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, 630 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
617 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 631 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
618 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 632 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
@@ -634,6 +648,7 @@ static struct usb_device_id id_table_combined [] = {
634 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 648 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
635 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, 649 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
636 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 650 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
651 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) },
637 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, 652 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) },
638 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, 653 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) },
639 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, 654 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) },
@@ -673,8 +688,17 @@ static struct usb_device_id id_table_combined [] = {
673 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 688 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
674 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, 689 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
675 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 690 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
676 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, 691 { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
677 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, 692 { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
693 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
694 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) },
695 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) },
696 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) },
697 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) },
698 { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) },
699 { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) },
700 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) },
701 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) },
678 { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, 702 { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
679 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, 703 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
680 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, 704 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
@@ -696,6 +720,7 @@ static struct usb_device_id id_table_combined [] = {
696 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 720 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
697 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 721 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
698 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, 722 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
723 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
699 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 724 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
700 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 725 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
701 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 726 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
@@ -703,6 +728,8 @@ static struct usb_device_id id_table_combined [] = {
703 { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, 728 { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
704 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), 729 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
705 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 730 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
731 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
732 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
706 { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), 733 { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
707 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 734 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
708 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), 735 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
@@ -715,8 +742,37 @@ static struct usb_device_id id_table_combined [] = {
715 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 742 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
716 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 743 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
717 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 744 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
745
746 /* Papouch devices based on FTDI chip */
747 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) },
748 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) },
749 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) },
750 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) },
751 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) },
752 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) },
753 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) },
754 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) },
755 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) },
756 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) },
757 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
758 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) },
759 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) },
760 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) },
718 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, 761 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
762 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) },
763 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) },
764 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) },
765 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) },
766 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) },
767 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) },
768 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) },
769 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) },
770 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) },
771 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) },
719 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, 772 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) },
773 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) },
774 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) },
775
720 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, 776 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
721 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, 777 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
722 { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, 778 { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
@@ -737,6 +793,8 @@ static struct usb_device_id id_table_combined [] = {
737 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 793 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
738 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 794 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
739 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 795 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
796 { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
797 { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
740 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, 798 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) },
741 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, 799 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) },
742 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, 800 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
@@ -751,6 +809,7 @@ static struct usb_device_id id_table_combined [] = {
751 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), 809 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
752 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 810 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
753 { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, 811 { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
812 { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) },
754 { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), 813 { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
755 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 814 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
756 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, 815 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) },
@@ -761,6 +820,14 @@ static struct usb_device_id id_table_combined [] = {
761 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, 820 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) },
762 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, 821 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) },
763 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, 822 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) },
823 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
824 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
825 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
826 { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
827 { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
828 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
829 { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
830 .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
764 { }, /* Optional parameter entry */ 831 { }, /* Optional parameter entry */
765 { } /* Terminating entry */ 832 { } /* Terminating entry */
766}; 833};
@@ -782,7 +849,8 @@ static const char *ftdi_chip_name[] = {
782 [FT2232C] = "FT2232C", 849 [FT2232C] = "FT2232C",
783 [FT232RL] = "FT232RL", 850 [FT232RL] = "FT232RL",
784 [FT2232H] = "FT2232H", 851 [FT2232H] = "FT2232H",
785 [FT4232H] = "FT4232H" 852 [FT4232H] = "FT4232H",
853 [FT232H] = "FT232H"
786}; 854};
787 855
788 856
@@ -807,10 +875,10 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port,
807 void *dest, size_t size); 875 void *dest, size_t size);
808static void ftdi_set_termios(struct tty_struct *tty, 876static void ftdi_set_termios(struct tty_struct *tty,
809 struct usb_serial_port *port, struct ktermios *old); 877 struct usb_serial_port *port, struct ktermios *old);
810static int ftdi_tiocmget(struct tty_struct *tty, struct file *file); 878static int ftdi_tiocmget(struct tty_struct *tty);
811static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, 879static int ftdi_tiocmset(struct tty_struct *tty,
812 unsigned int set, unsigned int clear); 880 unsigned int set, unsigned int clear);
813static int ftdi_ioctl(struct tty_struct *tty, struct file *file, 881static int ftdi_ioctl(struct tty_struct *tty,
814 unsigned int cmd, unsigned long arg); 882 unsigned int cmd, unsigned long arg);
815static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 883static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
816 884
@@ -916,7 +984,7 @@ static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base)
916 int divisor3; 984 int divisor3;
917 985
918 /* hi-speed baud rate is 10-bit sampling instead of 16-bit */ 986 /* hi-speed baud rate is 10-bit sampling instead of 16-bit */
919 divisor3 = (base / 10 / baud) * 8; 987 divisor3 = base * 8 / (baud * 10);
920 988
921 divisor = divisor3 >> 3; 989 divisor = divisor3 >> 3;
922 divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; 990 divisor |= (__u32)divfrac[divisor3 & 0x7] << 14;
@@ -1102,6 +1170,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1102 break; 1170 break;
1103 case FT2232H: /* FT2232H chip */ 1171 case FT2232H: /* FT2232H chip */
1104 case FT4232H: /* FT4232H chip */ 1172 case FT4232H: /* FT4232H chip */
1173 case FT232H: /* FT232H chip */
1105 if ((baud <= 12000000) & (baud >= 1200)) { 1174 if ((baud <= 12000000) & (baud >= 1200)) {
1106 div_value = ftdi_2232h_baud_to_divisor(baud); 1175 div_value = ftdi_2232h_baud_to_divisor(baud);
1107 } else if (baud < 1200) { 1176 } else if (baud < 1200) {
@@ -1285,6 +1354,23 @@ check_and_exit:
1285 return 0; 1354 return 0;
1286} 1355}
1287 1356
1357static int get_lsr_info(struct usb_serial_port *port,
1358 struct serial_struct __user *retinfo)
1359{
1360 struct ftdi_private *priv = usb_get_serial_port_data(port);
1361 unsigned int result = 0;
1362
1363 if (!retinfo)
1364 return -EFAULT;
1365
1366 if (priv->transmit_empty)
1367 result = TIOCSER_TEMT;
1368
1369 if (copy_to_user(retinfo, &result, sizeof(unsigned int)))
1370 return -EFAULT;
1371 return 0;
1372}
1373
1288 1374
1289/* Determine type of FTDI chip based on USB config and descriptor. */ 1375/* Determine type of FTDI chip based on USB config and descriptor. */
1290static void ftdi_determine_type(struct usb_serial_port *port) 1376static void ftdi_determine_type(struct usb_serial_port *port)
@@ -1346,9 +1432,12 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1346 } else if (version < 0x600) { 1432 } else if (version < 0x600) {
1347 /* Assume it's an FT232BM (or FT245BM) */ 1433 /* Assume it's an FT232BM (or FT245BM) */
1348 priv->chip_type = FT232BM; 1434 priv->chip_type = FT232BM;
1349 } else { 1435 } else if (version < 0x900) {
1350 /* Assume it's an FT232R */ 1436 /* Assume it's an FT232RL */
1351 priv->chip_type = FT232RL; 1437 priv->chip_type = FT232RL;
1438 } else {
1439 /* Assume it's an FT232H */
1440 priv->chip_type = FT232H;
1352 } 1441 }
1353 dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]); 1442 dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]);
1354} 1443}
@@ -1476,7 +1565,8 @@ static int create_sysfs_attrs(struct usb_serial_port *port)
1476 priv->chip_type == FT2232C || 1565 priv->chip_type == FT2232C ||
1477 priv->chip_type == FT232RL || 1566 priv->chip_type == FT232RL ||
1478 priv->chip_type == FT2232H || 1567 priv->chip_type == FT2232H ||
1479 priv->chip_type == FT4232H)) { 1568 priv->chip_type == FT4232H ||
1569 priv->chip_type == FT232H)) {
1480 retval = device_create_file(&port->dev, 1570 retval = device_create_file(&port->dev,
1481 &dev_attr_latency_timer); 1571 &dev_attr_latency_timer);
1482 } 1572 }
@@ -1497,7 +1587,8 @@ static void remove_sysfs_attrs(struct usb_serial_port *port)
1497 priv->chip_type == FT2232C || 1587 priv->chip_type == FT2232C ||
1498 priv->chip_type == FT232RL || 1588 priv->chip_type == FT232RL ||
1499 priv->chip_type == FT2232H || 1589 priv->chip_type == FT2232H ||
1500 priv->chip_type == FT4232H) { 1590 priv->chip_type == FT4232H ||
1591 priv->chip_type == FT232H) {
1501 device_remove_file(&port->dev, &dev_attr_latency_timer); 1592 device_remove_file(&port->dev, &dev_attr_latency_timer);
1502 } 1593 }
1503 } 1594 }
@@ -1559,6 +1650,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1559 ftdi_set_max_packet_size(port); 1650 ftdi_set_max_packet_size(port);
1560 if (read_latency_timer(port) < 0) 1651 if (read_latency_timer(port) < 0)
1561 priv->latency = 16; 1652 priv->latency = 16;
1653 write_latency_timer(port);
1562 create_sysfs_attrs(port); 1654 create_sysfs_attrs(port);
1563 return 0; 1655 return 0;
1564} 1656}
@@ -1642,6 +1734,25 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
1642} 1734}
1643 1735
1644/* 1736/*
1737 * First and second port on STMCLiteadaptors is reserved for JTAG interface
1738 * and the forth port for pio
1739 */
1740static int ftdi_stmclite_probe(struct usb_serial *serial)
1741{
1742 struct usb_device *udev = serial->dev;
1743 struct usb_interface *interface = serial->interface;
1744
1745 dbg("%s", __func__);
1746
1747 if (interface == udev->actconfig->interface[2])
1748 return 0;
1749
1750 dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
1751
1752 return -ENODEV;
1753}
1754
1755/*
1645 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. 1756 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
1646 * We have to correct it if we want to read from it. 1757 * We have to correct it if we want to read from it.
1647 */ 1758 */
@@ -1687,8 +1798,6 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1687 1798
1688 dbg("%s", __func__); 1799 dbg("%s", __func__);
1689 1800
1690 write_latency_timer(port);
1691
1692 /* No error checking for this (will get errors later anyway) */ 1801 /* No error checking for this (will get errors later anyway) */
1693 /* See ftdi_sio.h for description of what is reset */ 1802 /* See ftdi_sio.h for description of what is reset */
1694 usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1803 usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
@@ -1835,6 +1944,12 @@ static int ftdi_process_packet(struct tty_struct *tty,
1835 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 1944 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
1836 } 1945 }
1837 1946
1947 /* save if the transmitter is empty or not */
1948 if (packet[1] & FTDI_RS_TEMT)
1949 priv->transmit_empty = 1;
1950 else
1951 priv->transmit_empty = 0;
1952
1838 len -= 2; 1953 len -= 2;
1839 if (!len) 1954 if (!len)
1840 return 0; /* status only */ 1955 return 0; /* status only */
@@ -2028,8 +2143,6 @@ static void ftdi_set_termios(struct tty_struct *tty,
2028 "urb failed to set to rts/cts flow control\n"); 2143 "urb failed to set to rts/cts flow control\n");
2029 } 2144 }
2030 2145
2031 /* raise DTR/RTS */
2032 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2033 } else { 2146 } else {
2034 /* 2147 /*
2035 * Xon/Xoff code 2148 * Xon/Xoff code
@@ -2077,13 +2190,10 @@ static void ftdi_set_termios(struct tty_struct *tty,
2077 } 2190 }
2078 } 2191 }
2079 2192
2080 /* lower DTR/RTS */
2081 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2082 } 2193 }
2083 return;
2084} 2194}
2085 2195
2086static int ftdi_tiocmget(struct tty_struct *tty, struct file *file) 2196static int ftdi_tiocmget(struct tty_struct *tty)
2087{ 2197{
2088 struct usb_serial_port *port = tty->driver_data; 2198 struct usb_serial_port *port = tty->driver_data;
2089 struct ftdi_private *priv = usb_get_serial_port_data(port); 2199 struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -2110,6 +2220,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
2110 case FT232RL: 2220 case FT232RL:
2111 case FT2232H: 2221 case FT2232H:
2112 case FT4232H: 2222 case FT4232H:
2223 case FT232H:
2113 len = 2; 2224 len = 2;
2114 break; 2225 break;
2115 default: 2226 default:
@@ -2136,7 +2247,7 @@ out:
2136 return ret; 2247 return ret;
2137} 2248}
2138 2249
2139static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, 2250static int ftdi_tiocmset(struct tty_struct *tty,
2140 unsigned int set, unsigned int clear) 2251 unsigned int set, unsigned int clear)
2141{ 2252{
2142 struct usb_serial_port *port = tty->driver_data; 2253 struct usb_serial_port *port = tty->driver_data;
@@ -2144,7 +2255,7 @@ static int ftdi_tiocmset(struct tty_struct *tty, struct file *file,
2144 return update_mctrl(port, set, clear); 2255 return update_mctrl(port, set, clear);
2145} 2256}
2146 2257
2147static int ftdi_ioctl(struct tty_struct *tty, struct file *file, 2258static int ftdi_ioctl(struct tty_struct *tty,
2148 unsigned int cmd, unsigned long arg) 2259 unsigned int cmd, unsigned long arg)
2149{ 2260{
2150 struct usb_serial_port *port = tty->driver_data; 2261 struct usb_serial_port *port = tty->driver_data;
@@ -2168,6 +2279,7 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file *file,
2168 * - mask passed in arg for lines of interest 2279 * - mask passed in arg for lines of interest
2169 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 2280 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
2170 * Caller should use TIOCGICOUNT to see which one it was. 2281 * Caller should use TIOCGICOUNT to see which one it was.
2282 * (except that the driver doesn't support it !)
2171 * 2283 *
2172 * This code is borrowed from linux/drivers/char/serial.c 2284 * This code is borrowed from linux/drivers/char/serial.c
2173 */ 2285 */
@@ -2202,6 +2314,9 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file *file,
2202 } 2314 }
2203 } 2315 }
2204 return 0; 2316 return 0;
2317 case TIOCSERGETLSR:
2318 return get_lsr_info(port, (struct serial_struct __user *)arg);
2319 break;
2205 default: 2320 default:
2206 break; 2321 break;
2207 } 2322 }
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 213fe3d61282..19584faa86f9 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -156,7 +156,8 @@ enum ftdi_chip_type {
156 FT2232C = 4, 156 FT2232C = 4,
157 FT232RL = 5, 157 FT232RL = 5,
158 FT2232H = 6, 158 FT2232H = 6,
159 FT4232H = 7 159 FT4232H = 7,
160 FT232H = 8
160}; 161};
161 162
162enum ftdi_sio_baudrate { 163enum ftdi_sio_baudrate {
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 15a4583775ad..19156d1049fe 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -22,6 +22,7 @@
22#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ 22#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
23#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ 23#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
24#define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */ 24#define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
25#define FTDI_232H_PID 0x6014 /* Single channel hi-speed device */
25#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */ 26#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
26#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */ 27#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */
27 28
@@ -46,7 +47,7 @@
46#define FTDI_USINT_RS232_PID 0xb812 /* Navigator RS232 and CONFIG lines */ 47#define FTDI_USINT_RS232_PID 0xb812 /* Navigator RS232 and CONFIG lines */
47 48
48/* OOCDlink by Joern Kaipf <joernk@web.de> 49/* OOCDlink by Joern Kaipf <joernk@web.de>
49 * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */ 50 * (http://www.joernonline.de/) */
50#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ 51#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
51 52
52/* Luminary Micro Stellaris Boards, VID = FTDI_VID */ 53/* Luminary Micro Stellaris Boards, VID = FTDI_VID */
@@ -61,6 +62,7 @@
61#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9 62#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9
62#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA 63#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
63#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB 64#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
65#define FTDI_OPENDCC_GBM_PID 0xBFDC
64 66
65/* 67/*
66 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) 68 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
@@ -113,6 +115,9 @@
113/* Lenz LI-USB Computer Interface. */ 115/* Lenz LI-USB Computer Interface. */
114#define FTDI_LENZ_LIUSB_PID 0xD780 116#define FTDI_LENZ_LIUSB_PID 0xD780
115 117
118/* Vardaan Enterprises Serial Interface VEUSB422R3 */
119#define FTDI_VARDAAN_PID 0xF070
120
116/* 121/*
117 * Xsens Technologies BV products (http://www.xsens.com). 122 * Xsens Technologies BV products (http://www.xsens.com).
118 */ 123 */
@@ -296,6 +301,8 @@
296 * Hameg HO820 and HO870 interface (using VID 0x0403) 301 * Hameg HO820 and HO870 interface (using VID 0x0403)
297 */ 302 */
298#define HAMEG_HO820_PID 0xed74 303#define HAMEG_HO820_PID 0xed74
304#define HAMEG_HO730_PID 0xed73
305#define HAMEG_HO720_PID 0xed72
299#define HAMEG_HO870_PID 0xed71 306#define HAMEG_HO870_PID 0xed71
300 307
301/* 308/*
@@ -335,7 +342,7 @@
335#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */ 342#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
336 343
337/* ACT Solutions HomePro ZWave interface 344/* ACT Solutions HomePro ZWave interface
338 (http://www.act-solutions.com/HomePro.htm) */ 345 (http://www.act-solutions.com/HomePro-Product-Matrix.html) */
339#define FTDI_ACTZWAVE_PID 0xF2D0 346#define FTDI_ACTZWAVE_PID 0xF2D0
340 347
341/* 348/*
@@ -345,6 +352,7 @@
345 */ 352 */
346#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 353#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
347#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 354#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
355#define FTDI_4N_GALAXY_DE_3_PID 0xF3C2
348 356
349/* 357/*
350 * Linx Technologies product ids 358 * Linx Technologies product ids
@@ -366,7 +374,7 @@
366#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ 374#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */
367 375
368/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */ 376/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */
369/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ 377/* http://www.usbuirt.com/ */
370#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ 378#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */
371 379
372/* CCS Inc. ICDU/ICDU40 product ID - 380/* CCS Inc. ICDU/ICDU40 product ID -
@@ -395,7 +403,7 @@
395 */ 403 */
396#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */ 404#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */
397 405
398/* Inside Accesso contactless reader (http://www.insidefr.com) */ 406/* Inside Accesso contactless reader (http://www.insidecontactless.com/) */
399#define INSIDE_ACCESSO 0xFAD0 407#define INSIDE_ACCESSO 0xFAD0
400 408
401/* 409/*
@@ -485,6 +493,11 @@
485/* www.canusb.com Lawicel CANUSB device (FTDI_VID) */ 493/* www.canusb.com Lawicel CANUSB device (FTDI_VID) */
486#define FTDI_CANUSB_PID 0xFFA8 /* Product Id */ 494#define FTDI_CANUSB_PID 0xFFA8 /* Product Id */
487 495
496/*
497 * TavIR AVR product ids (FTDI_VID)
498 */
499#define FTDI_TAVIR_STK500_PID 0xFA33 /* STK500 AVR programmer */
500
488 501
489 502
490/********************************/ 503/********************************/
@@ -514,6 +527,12 @@
514#define RATOC_PRODUCT_ID_USB60F 0xb020 527#define RATOC_PRODUCT_ID_USB60F 0xb020
515 528
516/* 529/*
530 * Acton Research Corp.
531 */
532#define ACTON_VID 0x0647 /* Vendor ID */
533#define ACTON_SPECTRAPRO_PID 0x0100
534
535/*
517 * Contec products (http://www.contec.com) 536 * Contec products (http://www.contec.com)
518 * Submitted by Daniel Sangorrin 537 * Submitted by Daniel Sangorrin
519 */ 538 */
@@ -562,14 +581,27 @@
562/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ 581/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
563/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ 582/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
564/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ 583/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
584#define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */
565#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ 585#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
566 586
567/* 587/*
568 * Icom ID-1 digital transceiver 588 * Definitions for Icom Inc. devices
569 */ 589 */
570 590#define ICOM_VID 0x0C26 /* Icom vendor ID */
571#define ICOM_ID1_VID 0x0C26 591/* Note: ID-1 is a communications tranceiver for HAM-radio operators */
572#define ICOM_ID1_PID 0x0004 592#define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */
593/* Note: OPC is an Optional cable to connect an Icom Tranceiver */
594#define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */
595/* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */
596#define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */
597#define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */
598#define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/
599#define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */
600#define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */
601#define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */
602#define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */
603#define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */
604#define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */
573 605
574/* 606/*
575 * GN Otometrics (http://www.otometrics.com) 607 * GN Otometrics (http://www.otometrics.com)
@@ -634,14 +666,14 @@
634 666
635/* 667/*
636 * JETI SPECTROMETER SPECBOS 1201 668 * JETI SPECTROMETER SPECBOS 1201
637 * http://www.jeti.com/products/sys/scb/scb1201.php 669 * http://www.jeti.com/cms/index.php/instruments/other-instruments/specbos-2101
638 */ 670 */
639#define JETI_VID 0x0c6c 671#define JETI_VID 0x0c6c
640#define JETI_SPC1201_PID 0x04b2 672#define JETI_SPC1201_PID 0x04b2
641 673
642/* 674/*
643 * FTDI USB UART chips used in construction projects from the 675 * FTDI USB UART chips used in construction projects from the
644 * Elektor Electronics magazine (http://elektor-electronics.co.uk) 676 * Elektor Electronics magazine (http://www.elektor.com/)
645 */ 677 */
646#define ELEKTOR_VID 0x0C7D 678#define ELEKTOR_VID 0x0C7D
647#define ELEKTOR_FT323R_PID 0x0005 /* RFID-Reader, issue 09-2006 */ 679#define ELEKTOR_FT323R_PID 0x0005 /* RFID-Reader, issue 09-2006 */
@@ -708,6 +740,7 @@
708/* Olimex */ 740/* Olimex */
709#define OLIMEX_VID 0x15BA 741#define OLIMEX_VID 0x15BA
710#define OLIMEX_ARM_USB_OCD_PID 0x0003 742#define OLIMEX_ARM_USB_OCD_PID 0x0003
743#define OLIMEX_ARM_USB_OCD_H_PID 0x002b
711 744
712/* 745/*
713 * Telldus Technologies 746 * Telldus Technologies
@@ -720,6 +753,7 @@
720 */ 753 */
721#define RTSYSTEMS_VID 0x2100 /* Vendor ID */ 754#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
722#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ 755#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
756#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
723 757
724/* 758/*
725 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 759 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
@@ -1017,14 +1051,45 @@
1017#define WHT_PID 0x0004 /* Wireless Handheld Terminal */ 1051#define WHT_PID 0x0004 /* Wireless Handheld Terminal */
1018 1052
1019/* 1053/*
1054 * STMicroelectonics
1055 */
1056#define ST_VID 0x0483
1057#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */
1058
1059/*
1020 * Papouch products (http://www.papouch.com/) 1060 * Papouch products (http://www.papouch.com/)
1021 * Submitted by Folkert van Heusden 1061 * Submitted by Folkert van Heusden
1022 */ 1062 */
1023 1063
1024#define PAPOUCH_VID 0x5050 /* Vendor ID */ 1064#define PAPOUCH_VID 0x5050 /* Vendor ID */
1065#define PAPOUCH_SB485_PID 0x0100 /* Papouch SB485 USB-485/422 Converter */
1066#define PAPOUCH_AP485_PID 0x0101 /* AP485 USB-RS485 Converter */
1067#define PAPOUCH_SB422_PID 0x0102 /* Papouch SB422 USB-RS422 Converter */
1068#define PAPOUCH_SB485_2_PID 0x0103 /* Papouch SB485 USB-485/422 Converter */
1069#define PAPOUCH_AP485_2_PID 0x0104 /* AP485 USB-RS485 Converter */
1070#define PAPOUCH_SB422_2_PID 0x0105 /* Papouch SB422 USB-RS422 Converter */
1071#define PAPOUCH_SB485S_PID 0x0106 /* Papouch SB485S USB-485/422 Converter */
1072#define PAPOUCH_SB485C_PID 0x0107 /* Papouch SB485C USB-485/422 Converter */
1073#define PAPOUCH_LEC_PID 0x0300 /* LEC USB Converter */
1074#define PAPOUCH_SB232_PID 0x0301 /* Papouch SB232 USB-RS232 Converter */
1025#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ 1075#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
1026#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */ 1076#define PAPOUCH_IRAMP_PID 0x0500 /* Papouch IRAmp Duplex */
1077#define PAPOUCH_DRAK5_PID 0x0700 /* Papouch DRAK5 */
1078#define PAPOUCH_QUIDO8x8_PID 0x0800 /* Papouch Quido 8/8 Module */
1079#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Papouch Quido 4/4 Module */
1080#define PAPOUCH_QUIDO2x2_PID 0x0a00 /* Papouch Quido 2/2 Module */
1081#define PAPOUCH_QUIDO10x1_PID 0x0b00 /* Papouch Quido 10/1 Module */
1082#define PAPOUCH_QUIDO30x3_PID 0x0c00 /* Papouch Quido 30/3 Module */
1083#define PAPOUCH_QUIDO60x3_PID 0x0d00 /* Papouch Quido 60(100)/3 Module */
1084#define PAPOUCH_QUIDO2x16_PID 0x0e00 /* Papouch Quido 2/16 Module */
1085#define PAPOUCH_QUIDO3x32_PID 0x0f00 /* Papouch Quido 3/32 Module */
1086#define PAPOUCH_DRAK6_PID 0x1000 /* Papouch DRAK6 */
1087#define PAPOUCH_UPSUSB_PID 0x8000 /* Papouch UPS-USB adapter */
1088#define PAPOUCH_MU_PID 0x8001 /* MU controller */
1089#define PAPOUCH_SIMUKEY_PID 0x8002 /* Papouch SimuKey */
1027#define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */ 1090#define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */
1091#define PAPOUCH_GMUX_PID 0x8004 /* Papouch GOLIATH MUX */
1092#define PAPOUCH_GMSR_PID 0x8005 /* Papouch GOLIATH MSR */
1028 1093
1029/* 1094/*
1030 * Marvell SheevaPlug 1095 * Marvell SheevaPlug
@@ -1051,6 +1116,11 @@
1051#define MJSG_HD_RADIO_PID 0x937C 1116#define MJSG_HD_RADIO_PID 0x937C
1052 1117
1053/* 1118/*
1119 * D.O.Tec products (http://www.directout.eu)
1120 */
1121#define FTDI_DOTEC_PID 0x9868
1122
1123/*
1054 * Xverve Signalyzer tools (http://www.signalyzer.com/) 1124 * Xverve Signalyzer tools (http://www.signalyzer.com/)
1055 */ 1125 */
1056#define XVERVE_SIGNALYZER_ST_PID 0xBCA0 1126#define XVERVE_SIGNALYZER_ST_PID 0xBCA0
@@ -1063,3 +1133,30 @@
1063 * Submitted by John G. Rogers 1133 * Submitted by John G. Rogers
1064 */ 1134 */
1065#define SEGWAY_RMP200_PID 0xe729 1135#define SEGWAY_RMP200_PID 0xe729
1136
1137
1138/*
1139 * Accesio USB Data Acquisition products (http://www.accesio.com/)
1140 */
1141#define ACCESIO_COM4SM_PID 0xD578
1142
1143/* www.sciencescope.co.uk educational dataloggers */
1144#define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18
1145#define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C
1146#define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D
1147
1148/*
1149 * Milkymist One JTAG/Serial
1150 */
1151#define QIHARDWARE_VID 0x20B7
1152#define MILKYMISTONE_JTAGSERIAL_PID 0x0713
1153
1154/*
1155 * CTI GmbH RS485 Converter http://www.cti-lean.com/
1156 */
1157/* USB-485-Mini*/
1158#define FTDI_CTI_MINI_PID 0xF608
1159/* USB-Nano-485*/
1160#define FTDI_CTI_NANO_PID 0xF60B
1161
1162
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index a42b29a695b2..b0a7a9e909a4 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Garmin GPS driver 2 * Garmin GPS driver
3 * 3 *
4 * Copyright (C) 2006-2009 Hermann Kneissel herkne@users.sourceforge.net 4 * Copyright (C) 2006-2011 Hermann Kneissel herkne@gmx.de
5 * 5 *
6 * The latest version of the driver can be found at 6 * The latest version of the driver can be found at
7 * http://sourceforge.net/projects/garmin-gps/ 7 * http://sourceforge.net/projects/garmin-gps/
@@ -51,7 +51,7 @@ static int debug;
51 */ 51 */
52 52
53#define VERSION_MAJOR 0 53#define VERSION_MAJOR 0
54#define VERSION_MINOR 33 54#define VERSION_MINOR 36
55 55
56#define _STR(s) #s 56#define _STR(s) #s
57#define _DRIVER_VERSION(a, b) "v" _STR(a) "." _STR(b) 57#define _DRIVER_VERSION(a, b) "v" _STR(a) "." _STR(b)
@@ -410,6 +410,7 @@ static int gsp_send_ack(struct garmin_data *garmin_data_p, __u8 pkt_id)
410 */ 410 */
411static int gsp_rec_packet(struct garmin_data *garmin_data_p, int count) 411static int gsp_rec_packet(struct garmin_data *garmin_data_p, int count)
412{ 412{
413 unsigned long flags;
413 const __u8 *recpkt = garmin_data_p->inbuffer+GSP_INITIAL_OFFSET; 414 const __u8 *recpkt = garmin_data_p->inbuffer+GSP_INITIAL_OFFSET;
414 __le32 *usbdata = (__le32 *) garmin_data_p->inbuffer; 415 __le32 *usbdata = (__le32 *) garmin_data_p->inbuffer;
415 416
@@ -458,7 +459,9 @@ static int gsp_rec_packet(struct garmin_data *garmin_data_p, int count)
458 /* if this was an abort-transfer command, flush all 459 /* if this was an abort-transfer command, flush all
459 queued data. */ 460 queued data. */
460 if (isAbortTrfCmnd(garmin_data_p->inbuffer)) { 461 if (isAbortTrfCmnd(garmin_data_p->inbuffer)) {
462 spin_lock_irqsave(&garmin_data_p->lock, flags);
461 garmin_data_p->flags |= FLAGS_DROP_DATA; 463 garmin_data_p->flags |= FLAGS_DROP_DATA;
464 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
462 pkt_clear(garmin_data_p); 465 pkt_clear(garmin_data_p);
463 } 466 }
464 467
@@ -943,7 +946,7 @@ static int garmin_open(struct tty_struct *tty, struct usb_serial_port *port)
943 spin_lock_irqsave(&garmin_data_p->lock, flags); 946 spin_lock_irqsave(&garmin_data_p->lock, flags);
944 garmin_data_p->mode = initial_mode; 947 garmin_data_p->mode = initial_mode;
945 garmin_data_p->count = 0; 948 garmin_data_p->count = 0;
946 garmin_data_p->flags = 0; 949 garmin_data_p->flags &= FLAGS_SESSION_REPLY1_SEEN;
947 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 950 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
948 951
949 /* shutdown any bulk reads that might be going on */ 952 /* shutdown any bulk reads that might be going on */
@@ -1178,7 +1181,8 @@ static int garmin_write_room(struct tty_struct *tty)
1178 1181
1179 1182
1180static void garmin_read_process(struct garmin_data *garmin_data_p, 1183static void garmin_read_process(struct garmin_data *garmin_data_p,
1181 unsigned char *data, unsigned data_length) 1184 unsigned char *data, unsigned data_length,
1185 int bulk_data)
1182{ 1186{
1183 unsigned long flags; 1187 unsigned long flags;
1184 1188
@@ -1193,7 +1197,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
1193 send it directly to the tty port */ 1197 send it directly to the tty port */
1194 if (garmin_data_p->flags & FLAGS_QUEUING) { 1198 if (garmin_data_p->flags & FLAGS_QUEUING) {
1195 pkt_add(garmin_data_p, data, data_length); 1199 pkt_add(garmin_data_p, data, data_length);
1196 } else if (getLayerId(data) == GARMIN_LAYERID_APPL) { 1200 } else if (bulk_data ||
1201 getLayerId(data) == GARMIN_LAYERID_APPL) {
1197 1202
1198 spin_lock_irqsave(&garmin_data_p->lock, flags); 1203 spin_lock_irqsave(&garmin_data_p->lock, flags);
1199 garmin_data_p->flags |= APP_RESP_SEEN; 1204 garmin_data_p->flags |= APP_RESP_SEEN;
@@ -1237,7 +1242,7 @@ static void garmin_read_bulk_callback(struct urb *urb)
1237 usb_serial_debug_data(debug, &port->dev, 1242 usb_serial_debug_data(debug, &port->dev,
1238 __func__, urb->actual_length, data); 1243 __func__, urb->actual_length, data);
1239 1244
1240 garmin_read_process(garmin_data_p, data, urb->actual_length); 1245 garmin_read_process(garmin_data_p, data, urb->actual_length, 1);
1241 1246
1242 if (urb->actual_length == 0 && 1247 if (urb->actual_length == 0 &&
1243 0 != (garmin_data_p->flags & FLAGS_BULK_IN_RESTART)) { 1248 0 != (garmin_data_p->flags & FLAGS_BULK_IN_RESTART)) {
@@ -1264,7 +1269,6 @@ static void garmin_read_bulk_callback(struct urb *urb)
1264 garmin_data_p->flags &= ~FLAGS_BULK_IN_ACTIVE; 1269 garmin_data_p->flags &= ~FLAGS_BULK_IN_ACTIVE;
1265 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1270 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1266 } 1271 }
1267 return;
1268} 1272}
1269 1273
1270 1274
@@ -1347,7 +1351,7 @@ static void garmin_read_int_callback(struct urb *urb)
1347 __func__, garmin_data_p->serial_num); 1351 __func__, garmin_data_p->serial_num);
1348 } 1352 }
1349 1353
1350 garmin_read_process(garmin_data_p, data, urb->actual_length); 1354 garmin_read_process(garmin_data_p, data, urb->actual_length, 0);
1351 1355
1352 port->interrupt_in_urb->dev = port->serial->dev; 1356 port->interrupt_in_urb->dev = port->serial->dev;
1353 retval = usb_submit_urb(urb, GFP_ATOMIC); 1357 retval = usb_submit_urb(urb, GFP_ATOMIC);
@@ -1462,6 +1466,7 @@ static int garmin_attach(struct usb_serial *serial)
1462 garmin_data_p->timer.function = timeout_handler; 1466 garmin_data_p->timer.function = timeout_handler;
1463 garmin_data_p->port = port; 1467 garmin_data_p->port = port;
1464 garmin_data_p->state = 0; 1468 garmin_data_p->state = 0;
1469 garmin_data_p->flags = 0;
1465 garmin_data_p->count = 0; 1470 garmin_data_p->count = 0;
1466 usb_set_serial_port_data(port, garmin_data_p); 1471 usb_set_serial_port_data(port, garmin_data_p);
1467 1472
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index e6833e216fc9..e4db5ad2bc55 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port)
479} 479}
480EXPORT_SYMBOL_GPL(usb_serial_handle_break); 480EXPORT_SYMBOL_GPL(usb_serial_handle_break);
481 481
482/**
483 * usb_serial_handle_dcd_change - handle a change of carrier detect state
484 * @port: usb_serial_port structure for the open port
485 * @tty: tty_struct structure for the port
486 * @status: new carrier detect status, nonzero if active
487 */
488void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
489 struct tty_struct *tty, unsigned int status)
490{
491 struct tty_port *port = &usb_port->port;
492
493 dbg("%s - port %d, status %d", __func__, usb_port->number, status);
494
495 if (status)
496 wake_up_interruptible(&port->open_wait);
497 else if (tty && !C_CLOCAL(tty))
498 tty_hangup(tty);
499}
500EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change);
501
482int usb_serial_generic_resume(struct usb_serial *serial) 502int usb_serial_generic_resume(struct usb_serial *serial)
483{ 503{
484 struct usb_serial_port *port; 504 struct usb_serial_port *port;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 76e6fb3aab7a..abf095be5753 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -216,12 +216,14 @@ static void edge_unthrottle(struct tty_struct *tty);
216static void edge_set_termios(struct tty_struct *tty, 216static void edge_set_termios(struct tty_struct *tty,
217 struct usb_serial_port *port, 217 struct usb_serial_port *port,
218 struct ktermios *old_termios); 218 struct ktermios *old_termios);
219static int edge_ioctl(struct tty_struct *tty, struct file *file, 219static int edge_ioctl(struct tty_struct *tty,
220 unsigned int cmd, unsigned long arg); 220 unsigned int cmd, unsigned long arg);
221static void edge_break(struct tty_struct *tty, int break_state); 221static void edge_break(struct tty_struct *tty, int break_state);
222static int edge_tiocmget(struct tty_struct *tty, struct file *file); 222static int edge_tiocmget(struct tty_struct *tty);
223static int edge_tiocmset(struct tty_struct *tty, struct file *file, 223static int edge_tiocmset(struct tty_struct *tty,
224 unsigned int set, unsigned int clear); 224 unsigned int set, unsigned int clear);
225static int edge_get_icount(struct tty_struct *tty,
226 struct serial_icounter_struct *icount);
225static int edge_startup(struct usb_serial *serial); 227static int edge_startup(struct usb_serial *serial);
226static void edge_disconnect(struct usb_serial *serial); 228static void edge_disconnect(struct usb_serial *serial);
227static void edge_release(struct usb_serial *serial); 229static void edge_release(struct usb_serial *serial);
@@ -1465,8 +1467,6 @@ static void edge_throttle(struct tty_struct *tty)
1465 if (status != 0) 1467 if (status != 0)
1466 return; 1468 return;
1467 } 1469 }
1468
1469 return;
1470} 1470}
1471 1471
1472 1472
@@ -1568,7 +1568,7 @@ static int get_lsr_info(struct edgeport_port *edge_port,
1568 return 0; 1568 return 0;
1569} 1569}
1570 1570
1571static int edge_tiocmset(struct tty_struct *tty, struct file *file, 1571static int edge_tiocmset(struct tty_struct *tty,
1572 unsigned int set, unsigned int clear) 1572 unsigned int set, unsigned int clear)
1573{ 1573{
1574 struct usb_serial_port *port = tty->driver_data; 1574 struct usb_serial_port *port = tty->driver_data;
@@ -1599,7 +1599,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file,
1599 return 0; 1599 return 0;
1600} 1600}
1601 1601
1602static int edge_tiocmget(struct tty_struct *tty, struct file *file) 1602static int edge_tiocmget(struct tty_struct *tty)
1603{ 1603{
1604 struct usb_serial_port *port = tty->driver_data; 1604 struct usb_serial_port *port = tty->driver_data;
1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -1624,6 +1624,31 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file)
1624 return result; 1624 return result;
1625} 1625}
1626 1626
1627static int edge_get_icount(struct tty_struct *tty,
1628 struct serial_icounter_struct *icount)
1629{
1630 struct usb_serial_port *port = tty->driver_data;
1631 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1632 struct async_icount cnow;
1633 cnow = edge_port->icount;
1634
1635 icount->cts = cnow.cts;
1636 icount->dsr = cnow.dsr;
1637 icount->rng = cnow.rng;
1638 icount->dcd = cnow.dcd;
1639 icount->rx = cnow.rx;
1640 icount->tx = cnow.tx;
1641 icount->frame = cnow.frame;
1642 icount->overrun = cnow.overrun;
1643 icount->parity = cnow.parity;
1644 icount->brk = cnow.brk;
1645 icount->buf_overrun = cnow.buf_overrun;
1646
1647 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
1648 __func__, port->number, icount->rx, icount->tx);
1649 return 0;
1650}
1651
1627static int get_serial_info(struct edgeport_port *edge_port, 1652static int get_serial_info(struct edgeport_port *edge_port,
1628 struct serial_struct __user *retinfo) 1653 struct serial_struct __user *retinfo)
1629{ 1654{
@@ -1650,12 +1675,11 @@ static int get_serial_info(struct edgeport_port *edge_port,
1650} 1675}
1651 1676
1652 1677
1653
1654/***************************************************************************** 1678/*****************************************************************************
1655 * SerialIoctl 1679 * SerialIoctl
1656 * this function handles any ioctl calls to the driver 1680 * this function handles any ioctl calls to the driver
1657 *****************************************************************************/ 1681 *****************************************************************************/
1658static int edge_ioctl(struct tty_struct *tty, struct file *file, 1682static int edge_ioctl(struct tty_struct *tty,
1659 unsigned int cmd, unsigned long arg) 1683 unsigned int cmd, unsigned long arg)
1660{ 1684{
1661 struct usb_serial_port *port = tty->driver_data; 1685 struct usb_serial_port *port = tty->driver_data;
@@ -1663,7 +1687,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file,
1663 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1687 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1664 struct async_icount cnow; 1688 struct async_icount cnow;
1665 struct async_icount cprev; 1689 struct async_icount cprev;
1666 struct serial_icounter_struct icount;
1667 1690
1668 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); 1691 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
1669 1692
@@ -1702,26 +1725,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file,
1702 /* NOTREACHED */ 1725 /* NOTREACHED */
1703 break; 1726 break;
1704 1727
1705 case TIOCGICOUNT:
1706 cnow = edge_port->icount;
1707 memset(&icount, 0, sizeof(icount));
1708 icount.cts = cnow.cts;
1709 icount.dsr = cnow.dsr;
1710 icount.rng = cnow.rng;
1711 icount.dcd = cnow.dcd;
1712 icount.rx = cnow.rx;
1713 icount.tx = cnow.tx;
1714 icount.frame = cnow.frame;
1715 icount.overrun = cnow.overrun;
1716 icount.parity = cnow.parity;
1717 icount.brk = cnow.brk;
1718 icount.buf_overrun = cnow.buf_overrun;
1719
1720 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
1721 __func__, port->number, icount.rx, icount.tx);
1722 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
1723 return -EFAULT;
1724 return 0;
1725 } 1728 }
1726 return -ENOIOCTLCMD; 1729 return -ENOIOCTLCMD;
1727} 1730}
@@ -1770,8 +1773,6 @@ static void edge_break(struct tty_struct *tty, int break_state)
1770 dbg("%s - error sending break set/clear command.", 1773 dbg("%s - error sending break set/clear command.",
1771 __func__); 1774 __func__);
1772 } 1775 }
1773
1774 return;
1775} 1776}
1776 1777
1777 1778
@@ -1980,7 +1981,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
1980 if (code == IOSP_STATUS_OPEN_RSP) { 1981 if (code == IOSP_STATUS_OPEN_RSP) {
1981 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); 1982 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3);
1982 edge_port->maxTxCredits = edge_port->txCredits; 1983 edge_port->maxTxCredits = edge_port->txCredits;
1983 dbg("%s - Port %u Open Response Inital MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits); 1984 dbg("%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits);
1984 handle_new_msr(edge_port, byte2); 1985 handle_new_msr(edge_port, byte2);
1985 1986
1986 /* send the current line settings to the port so we are 1987 /* send the current line settings to the port so we are
@@ -2042,7 +2043,6 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2042 dbg("%s - Unrecognized IOSP status code %u", __func__, code); 2043 dbg("%s - Unrecognized IOSP status code %u", __func__, code);
2043 break; 2044 break;
2044 } 2045 }
2045 return;
2046} 2046}
2047 2047
2048 2048
@@ -2095,8 +2095,6 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr)
2095 2095
2096 /* Save the new modem status */ 2096 /* Save the new modem status */
2097 edge_port->shadowMSR = newMsr & 0xf0; 2097 edge_port->shadowMSR = newMsr & 0xf0;
2098
2099 return;
2100} 2098}
2101 2099
2102 2100
@@ -2143,8 +2141,6 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2143 icount->parity++; 2141 icount->parity++;
2144 if (newLsr & LSR_FRM_ERR) 2142 if (newLsr & LSR_FRM_ERR)
2145 icount->frame++; 2143 icount->frame++;
2146
2147 return;
2148} 2144}
2149 2145
2150 2146
@@ -2347,7 +2343,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
2347 usb_get_serial_data(edge_port->port->serial); 2343 usb_get_serial_data(edge_port->port->serial);
2348 int status = 0; 2344 int status = 0;
2349 struct urb *urb; 2345 struct urb *urb;
2350 int timeout;
2351 2346
2352 usb_serial_debug_data(debug, &edge_port->port->dev, 2347 usb_serial_debug_data(debug, &edge_port->port->dev,
2353 __func__, length, buffer); 2348 __func__, length, buffer);
@@ -2380,8 +2375,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
2380 return status; 2375 return status;
2381 } 2376 }
2382 2377
2383 /* wait for command to finish */
2384 timeout = COMMAND_TIMEOUT;
2385#if 0 2378#if 0
2386 wait_event(&edge_port->wait_command, !edge_port->commandPending); 2379 wait_event(&edge_port->wait_command, !edge_port->commandPending);
2387 2380
@@ -2720,7 +2713,6 @@ static void change_port_settings(struct tty_struct *tty,
2720 baud = tty_termios_baud_rate(old_termios); 2713 baud = tty_termios_baud_rate(old_termios);
2721 tty_encode_baud_rate(tty, baud, baud); 2714 tty_encode_baud_rate(tty, baud, baud);
2722 } 2715 }
2723 return;
2724} 2716}
2725 2717
2726 2718
@@ -2894,8 +2886,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2894 2886
2895 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); 2887 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build);
2896 2888
2897 edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; 2889 edge_serial->product_info.FirmwareMajorVersion = rec->data[0];
2898 edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; 2890 edge_serial->product_info.FirmwareMinorVersion = rec->data[1];
2899 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); 2891 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build);
2900 2892
2901 for (rec = ihex_next_binrec(rec); rec; 2893 for (rec = ihex_next_binrec(rec); rec;
@@ -2922,7 +2914,6 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2922 0x40, 0x4000, 0x0001, NULL, 0, 3000); 2914 0x40, 0x4000, 0x0001, NULL, 0, 3000);
2923 2915
2924 release_firmware(fw); 2916 release_firmware(fw);
2925 return;
2926} 2917}
2927 2918
2928 2919
diff --git a/drivers/usb/serial/io_edgeport.h b/drivers/usb/serial/io_edgeport.h
index dced7ec65470..ad9c1d47a619 100644
--- a/drivers/usb/serial/io_edgeport.h
+++ b/drivers/usb/serial/io_edgeport.h
@@ -68,7 +68,7 @@ struct comMapper {
68#define PROC_SET_COM_ENTRY 2 68#define PROC_SET_COM_ENTRY 2
69 69
70 70
71/* The following sturcture is passed to the write */ 71/* The following structure is passed to the write */
72struct procWrite { 72struct procWrite {
73 int Command; 73 int Command;
74 union { 74 union {
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index feb56a4ca799..178b22eb32b1 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -123,6 +123,7 @@ static struct usb_serial_driver edgeport_2port_device = {
123 .set_termios = edge_set_termios, 123 .set_termios = edge_set_termios,
124 .tiocmget = edge_tiocmget, 124 .tiocmget = edge_tiocmget,
125 .tiocmset = edge_tiocmset, 125 .tiocmset = edge_tiocmset,
126 .get_icount = edge_get_icount,
126 .write = edge_write, 127 .write = edge_write,
127 .write_room = edge_write_room, 128 .write_room = edge_write_room,
128 .chars_in_buffer = edge_chars_in_buffer, 129 .chars_in_buffer = edge_chars_in_buffer,
@@ -152,6 +153,7 @@ static struct usb_serial_driver edgeport_4port_device = {
152 .set_termios = edge_set_termios, 153 .set_termios = edge_set_termios,
153 .tiocmget = edge_tiocmget, 154 .tiocmget = edge_tiocmget,
154 .tiocmset = edge_tiocmset, 155 .tiocmset = edge_tiocmset,
156 .get_icount = edge_get_icount,
155 .write = edge_write, 157 .write = edge_write,
156 .write_room = edge_write_room, 158 .write_room = edge_write_room,
157 .chars_in_buffer = edge_chars_in_buffer, 159 .chars_in_buffer = edge_chars_in_buffer,
@@ -181,6 +183,7 @@ static struct usb_serial_driver edgeport_8port_device = {
181 .set_termios = edge_set_termios, 183 .set_termios = edge_set_termios,
182 .tiocmget = edge_tiocmget, 184 .tiocmget = edge_tiocmget,
183 .tiocmset = edge_tiocmset, 185 .tiocmset = edge_tiocmset,
186 .get_icount = edge_get_icount,
184 .write = edge_write, 187 .write = edge_write,
185 .write_room = edge_write_room, 188 .write_room = edge_write_room,
186 .chars_in_buffer = edge_chars_in_buffer, 189 .chars_in_buffer = edge_chars_in_buffer,
@@ -196,6 +199,7 @@ static struct usb_serial_driver epic_device = {
196 .name = "epic", 199 .name = "epic",
197 }, 200 },
198 .description = "EPiC device", 201 .description = "EPiC device",
202 .usb_driver = &io_driver,
199 .id_table = Epic_port_id_table, 203 .id_table = Epic_port_id_table,
200 .num_ports = 1, 204 .num_ports = 1,
201 .open = edge_open, 205 .open = edge_open,
@@ -209,6 +213,7 @@ static struct usb_serial_driver epic_device = {
209 .set_termios = edge_set_termios, 213 .set_termios = edge_set_termios,
210 .tiocmget = edge_tiocmget, 214 .tiocmget = edge_tiocmget,
211 .tiocmset = edge_tiocmset, 215 .tiocmset = edge_tiocmset,
216 .get_icount = edge_get_icount,
212 .write = edge_write, 217 .write = edge_write,
213 .write_room = edge_write_room, 218 .write_room = edge_write_room,
214 .chars_in_buffer = edge_chars_in_buffer, 219 .chars_in_buffer = edge_chars_in_buffer,
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index a7cfc5952937..0aac00afb5c8 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -433,7 +433,7 @@ static int write_i2c_mem(struct edgeport_serial *serial,
433 433
434 /* We can only send a maximum of 1 aligned byte page at a time */ 434 /* We can only send a maximum of 1 aligned byte page at a time */
435 435
436 /* calulate the number of bytes left in the first page */ 436 /* calculate the number of bytes left in the first page */
437 write_length = EPROM_PAGE_SIZE - 437 write_length = EPROM_PAGE_SIZE -
438 (start_address & (EPROM_PAGE_SIZE - 1)); 438 (start_address & (EPROM_PAGE_SIZE - 1));
439 439
@@ -1571,8 +1571,6 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr)
1571 } 1571 }
1572 } 1572 }
1573 tty_kref_put(tty); 1573 tty_kref_put(tty);
1574
1575 return;
1576} 1574}
1577 1575
1578static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, 1576static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
@@ -2424,7 +2422,6 @@ static void change_port_settings(struct tty_struct *tty,
2424 dbg("%s - error %d when trying to write config to device", 2422 dbg("%s - error %d when trying to write config to device",
2425 __func__, status); 2423 __func__, status);
2426 kfree(config); 2424 kfree(config);
2427 return;
2428} 2425}
2429 2426
2430static void edge_set_termios(struct tty_struct *tty, 2427static void edge_set_termios(struct tty_struct *tty,
@@ -2445,10 +2442,9 @@ static void edge_set_termios(struct tty_struct *tty,
2445 return; 2442 return;
2446 /* change the port settings to the new ones specified */ 2443 /* change the port settings to the new ones specified */
2447 change_port_settings(tty, edge_port, old_termios); 2444 change_port_settings(tty, edge_port, old_termios);
2448 return;
2449} 2445}
2450 2446
2451static int edge_tiocmset(struct tty_struct *tty, struct file *file, 2447static int edge_tiocmset(struct tty_struct *tty,
2452 unsigned int set, unsigned int clear) 2448 unsigned int set, unsigned int clear)
2453{ 2449{
2454 struct usb_serial_port *port = tty->driver_data; 2450 struct usb_serial_port *port = tty->driver_data;
@@ -2481,7 +2477,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file,
2481 return 0; 2477 return 0;
2482} 2478}
2483 2479
2484static int edge_tiocmget(struct tty_struct *tty, struct file *file) 2480static int edge_tiocmget(struct tty_struct *tty)
2485{ 2481{
2486 struct usb_serial_port *port = tty->driver_data; 2482 struct usb_serial_port *port = tty->driver_data;
2487 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2483 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -2510,6 +2506,27 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file)
2510 return result; 2506 return result;
2511} 2507}
2512 2508
2509static int edge_get_icount(struct tty_struct *tty,
2510 struct serial_icounter_struct *icount)
2511{
2512 struct usb_serial_port *port = tty->driver_data;
2513 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2514 struct async_icount *ic = &edge_port->icount;
2515
2516 icount->cts = ic->cts;
2517 icount->dsr = ic->dsr;
2518 icount->rng = ic->rng;
2519 icount->dcd = ic->dcd;
2520 icount->tx = ic->tx;
2521 icount->rx = ic->rx;
2522 icount->frame = ic->frame;
2523 icount->parity = ic->parity;
2524 icount->overrun = ic->overrun;
2525 icount->brk = ic->brk;
2526 icount->buf_overrun = ic->buf_overrun;
2527 return 0;
2528}
2529
2513static int get_serial_info(struct edgeport_port *edge_port, 2530static int get_serial_info(struct edgeport_port *edge_port,
2514 struct serial_struct __user *retinfo) 2531 struct serial_struct __user *retinfo)
2515{ 2532{
@@ -2535,7 +2552,7 @@ static int get_serial_info(struct edgeport_port *edge_port,
2535 return 0; 2552 return 0;
2536} 2553}
2537 2554
2538static int edge_ioctl(struct tty_struct *tty, struct file *file, 2555static int edge_ioctl(struct tty_struct *tty,
2539 unsigned int cmd, unsigned long arg) 2556 unsigned int cmd, unsigned long arg)
2540{ 2557{
2541 struct usb_serial_port *port = tty->driver_data; 2558 struct usb_serial_port *port = tty->driver_data;
@@ -2572,13 +2589,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file,
2572 } 2589 }
2573 /* not reached */ 2590 /* not reached */
2574 break; 2591 break;
2575 case TIOCGICOUNT:
2576 dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2577 port->number, edge_port->icount.rx, edge_port->icount.tx);
2578 if (copy_to_user((void __user *)arg, &edge_port->icount,
2579 sizeof(edge_port->icount)))
2580 return -EFAULT;
2581 return 0;
2582 } 2592 }
2583 return -ENOIOCTLCMD; 2593 return -ENOIOCTLCMD;
2584} 2594}
@@ -2758,6 +2768,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2758 .set_termios = edge_set_termios, 2768 .set_termios = edge_set_termios,
2759 .tiocmget = edge_tiocmget, 2769 .tiocmget = edge_tiocmget,
2760 .tiocmset = edge_tiocmset, 2770 .tiocmset = edge_tiocmset,
2771 .get_icount = edge_get_icount,
2761 .write = edge_write, 2772 .write = edge_write,
2762 .write_room = edge_write_room, 2773 .write_room = edge_write_room,
2763 .chars_in_buffer = edge_chars_in_buffer, 2774 .chars_in_buffer = edge_chars_in_buffer,
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index efc72113216b..6aca631a407a 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -150,7 +150,7 @@ static void iuu_release(struct usb_serial *serial)
150 } 150 }
151} 151}
152 152
153static int iuu_tiocmset(struct tty_struct *tty, struct file *file, 153static int iuu_tiocmset(struct tty_struct *tty,
154 unsigned int set, unsigned int clear) 154 unsigned int set, unsigned int clear)
155{ 155{
156 struct usb_serial_port *port = tty->driver_data; 156 struct usb_serial_port *port = tty->driver_data;
@@ -179,7 +179,7 @@ static int iuu_tiocmset(struct tty_struct *tty, struct file *file,
179 * When no card , the reader respond with TIOCM_CD 179 * When no card , the reader respond with TIOCM_CD
180 * This is known as CD autodetect mechanism 180 * This is known as CD autodetect mechanism
181 */ 181 */
182static int iuu_tiocmget(struct tty_struct *tty, struct file *file) 182static int iuu_tiocmget(struct tty_struct *tty)
183{ 183{
184 struct usb_serial_port *port = tty->driver_data; 184 struct usb_serial_port *port = tty->driver_data;
185 struct iuu_private *priv = usb_get_serial_port_data(port); 185 struct iuu_private *priv = usb_get_serial_port_data(port);
@@ -807,7 +807,6 @@ static void read_rxcmd_callback(struct urb *urb)
807 iuu_uart_read_callback, port); 807 iuu_uart_read_callback, port);
808 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 808 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
809 dbg("%s - submit result = %d", __func__, result); 809 dbg("%s - submit result = %d", __func__, result);
810 return;
811} 810}
812 811
813static int iuu_uart_on(struct usb_serial_port *port) 812static int iuu_uart_on(struct usb_serial_port *port)
@@ -1276,6 +1275,7 @@ static struct usb_serial_driver iuu_device = {
1276 .name = "iuu_phoenix", 1275 .name = "iuu_phoenix",
1277 }, 1276 },
1278 .id_table = id_table, 1277 .id_table = id_table,
1278 .usb_driver = &iuu_driver,
1279 .num_ports = 1, 1279 .num_ports = 1,
1280 .bulk_in_size = 512, 1280 .bulk_in_size = 512,
1281 .bulk_out_size = 512, 1281 .bulk_out_size = 512,
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 297163c3c610..a442352d7b61 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -9,7 +9,7 @@
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 See http://misc.nu/hugh/keyspan.html for more information. 12 See http://blemings.org/hugh/keyspan.html for more information.
13 13
14 Code in this driver inspired by and in a number of places taken 14 Code in this driver inspired by and in a number of places taken
15 from Brian Warner's original Keyspan-PDA driver. 15 from Brian Warner's original Keyspan-PDA driver.
@@ -301,7 +301,7 @@ static void keyspan_set_termios(struct tty_struct *tty,
301 keyspan_send_setup(port, 0); 301 keyspan_send_setup(port, 0);
302} 302}
303 303
304static int keyspan_tiocmget(struct tty_struct *tty, struct file *file) 304static int keyspan_tiocmget(struct tty_struct *tty)
305{ 305{
306 struct usb_serial_port *port = tty->driver_data; 306 struct usb_serial_port *port = tty->driver_data;
307 struct keyspan_port_private *p_priv = usb_get_serial_port_data(port); 307 struct keyspan_port_private *p_priv = usb_get_serial_port_data(port);
@@ -317,7 +317,7 @@ static int keyspan_tiocmget(struct tty_struct *tty, struct file *file)
317 return value; 317 return value;
318} 318}
319 319
320static int keyspan_tiocmset(struct tty_struct *tty, struct file *file, 320static int keyspan_tiocmset(struct tty_struct *tty,
321 unsigned int set, unsigned int clear) 321 unsigned int set, unsigned int clear)
322{ 322{
323 struct usb_serial_port *port = tty->driver_data; 323 struct usb_serial_port *port = tty->driver_data;
@@ -2121,16 +2121,16 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
2121 /* Work out which port within the device is being setup */ 2121 /* Work out which port within the device is being setup */
2122 device_port = port->number - port->serial->minor; 2122 device_port = port->number - port->serial->minor;
2123 2123
2124 dbg("%s - endpoint %d port %d (%d)", 2124 /* Make sure we have an urb then send the message */
2125 __func__, usb_pipeendpoint(this_urb->pipe),
2126 port->number, device_port);
2127
2128 /* Make sure we have an urb then send the message */
2129 if (this_urb == NULL) { 2125 if (this_urb == NULL) {
2130 dbg("%s - oops no urb for port %d.", __func__, port->number); 2126 dbg("%s - oops no urb for port %d.", __func__, port->number);
2131 return -1; 2127 return -1;
2132 } 2128 }
2133 2129
2130 dbg("%s - endpoint %d port %d (%d)",
2131 __func__, usb_pipeendpoint(this_urb->pipe),
2132 port->number, device_port);
2133
2134 /* Save reset port val for resend. 2134 /* Save reset port val for resend.
2135 Don't overwrite resend for open/close condition. */ 2135 Don't overwrite resend for open/close condition. */
2136 if ((reset_port + 1) > p_priv->resend_cont) 2136 if ((reset_port + 1) > p_priv->resend_cont)
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index bf3297ddd186..13fa1d1cc900 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -9,7 +9,7 @@
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 See http://misc.nu/hugh/keyspan.html for more information. 12 See http://blemings.org/hugh/keyspan.html for more information.
13 13
14 Code in this driver inspired by and in a number of places taken 14 Code in this driver inspired by and in a number of places taken
15 from Brian Warner's original Keyspan-PDA driver. 15 from Brian Warner's original Keyspan-PDA driver.
@@ -58,10 +58,9 @@ static void keyspan_set_termios (struct tty_struct *tty,
58 struct ktermios *old); 58 struct ktermios *old);
59static void keyspan_break_ctl (struct tty_struct *tty, 59static void keyspan_break_ctl (struct tty_struct *tty,
60 int break_state); 60 int break_state);
61static int keyspan_tiocmget (struct tty_struct *tty, 61static int keyspan_tiocmget (struct tty_struct *tty);
62 struct file *file);
63static int keyspan_tiocmset (struct tty_struct *tty, 62static int keyspan_tiocmset (struct tty_struct *tty,
64 struct file *file, unsigned int set, 63 unsigned int set,
65 unsigned int clear); 64 unsigned int clear);
66static int keyspan_fake_startup (struct usb_serial *serial); 65static int keyspan_fake_startup (struct usb_serial *serial);
67 66
@@ -546,6 +545,7 @@ static struct usb_serial_driver keyspan_pre_device = {
546 .name = "keyspan_no_firm", 545 .name = "keyspan_no_firm",
547 }, 546 },
548 .description = "Keyspan - (without firmware)", 547 .description = "Keyspan - (without firmware)",
548 .usb_driver = &keyspan_driver,
549 .id_table = keyspan_pre_ids, 549 .id_table = keyspan_pre_ids,
550 .num_ports = 1, 550 .num_ports = 1,
551 .attach = keyspan_fake_startup, 551 .attach = keyspan_fake_startup,
@@ -557,6 +557,7 @@ static struct usb_serial_driver keyspan_1port_device = {
557 .name = "keyspan_1", 557 .name = "keyspan_1",
558 }, 558 },
559 .description = "Keyspan 1 port adapter", 559 .description = "Keyspan 1 port adapter",
560 .usb_driver = &keyspan_driver,
560 .id_table = keyspan_1port_ids, 561 .id_table = keyspan_1port_ids,
561 .num_ports = 1, 562 .num_ports = 1,
562 .open = keyspan_open, 563 .open = keyspan_open,
@@ -579,6 +580,7 @@ static struct usb_serial_driver keyspan_2port_device = {
579 .name = "keyspan_2", 580 .name = "keyspan_2",
580 }, 581 },
581 .description = "Keyspan 2 port adapter", 582 .description = "Keyspan 2 port adapter",
583 .usb_driver = &keyspan_driver,
582 .id_table = keyspan_2port_ids, 584 .id_table = keyspan_2port_ids,
583 .num_ports = 2, 585 .num_ports = 2,
584 .open = keyspan_open, 586 .open = keyspan_open,
@@ -601,6 +603,7 @@ static struct usb_serial_driver keyspan_4port_device = {
601 .name = "keyspan_4", 603 .name = "keyspan_4",
602 }, 604 },
603 .description = "Keyspan 4 port adapter", 605 .description = "Keyspan 4 port adapter",
606 .usb_driver = &keyspan_driver,
604 .id_table = keyspan_4port_ids, 607 .id_table = keyspan_4port_ids,
605 .num_ports = 4, 608 .num_ports = 4,
606 .open = keyspan_open, 609 .open = keyspan_open,
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 185fe9a7d4e0..d5c0c6ab4966 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -173,7 +173,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
173 container_of(work, struct keyspan_pda_private, wakeup_work); 173 container_of(work, struct keyspan_pda_private, wakeup_work);
174 struct usb_serial_port *port = priv->port; 174 struct usb_serial_port *port = priv->port;
175 struct tty_struct *tty = tty_port_tty_get(&port->port); 175 struct tty_struct *tty = tty_port_tty_get(&port->port);
176 tty_wakeup(tty); 176 if (tty)
177 tty_wakeup(tty);
177 tty_kref_put(tty); 178 tty_kref_put(tty);
178} 179}
179 180
@@ -206,7 +207,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
206static void keyspan_pda_rx_interrupt(struct urb *urb) 207static void keyspan_pda_rx_interrupt(struct urb *urb)
207{ 208{
208 struct usb_serial_port *port = urb->context; 209 struct usb_serial_port *port = urb->context;
209 struct tty_struct *tty = tty_port_tty_get(&port->port); 210 struct tty_struct *tty;
210 unsigned char *data = urb->transfer_buffer; 211 unsigned char *data = urb->transfer_buffer;
211 int retval; 212 int retval;
212 int status = urb->status; 213 int status = urb->status;
@@ -223,7 +224,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
223 /* this urb is terminated, clean up */ 224 /* this urb is terminated, clean up */
224 dbg("%s - urb shutting down with status: %d", 225 dbg("%s - urb shutting down with status: %d",
225 __func__, status); 226 __func__, status);
226 goto out; 227 return;
227 default: 228 default:
228 dbg("%s - nonzero urb status received: %d", 229 dbg("%s - nonzero urb status received: %d",
229 __func__, status); 230 __func__, status);
@@ -233,12 +234,14 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
233 /* see if the message is data or a status interrupt */ 234 /* see if the message is data or a status interrupt */
234 switch (data[0]) { 235 switch (data[0]) {
235 case 0: 236 case 0:
236 /* rest of message is rx data */ 237 tty = tty_port_tty_get(&port->port);
237 if (urb->actual_length) { 238 /* rest of message is rx data */
239 if (tty && urb->actual_length) {
238 tty_insert_flip_string(tty, data + 1, 240 tty_insert_flip_string(tty, data + 1,
239 urb->actual_length - 1); 241 urb->actual_length - 1);
240 tty_flip_buffer_push(tty); 242 tty_flip_buffer_push(tty);
241 } 243 }
244 tty_kref_put(tty);
242 break; 245 break;
243 case 1: 246 case 1:
244 /* status interrupt */ 247 /* status interrupt */
@@ -265,8 +268,6 @@ exit:
265 dev_err(&port->dev, 268 dev_err(&port->dev,
266 "%s - usb_submit_urb failed with result %d", 269 "%s - usb_submit_urb failed with result %d",
267 __func__, retval); 270 __func__, retval);
268out:
269 tty_kref_put(tty);
270} 271}
271 272
272 273
@@ -292,7 +293,6 @@ static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
292 port->interrupt_in_urb->dev = port->serial->dev; 293 port->interrupt_in_urb->dev = port->serial->dev;
293 if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) 294 if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
294 dbg(" usb_submit_urb(read urb) failed"); 295 dbg(" usb_submit_urb(read urb) failed");
295 return;
296} 296}
297 297
298 298
@@ -458,7 +458,7 @@ static int keyspan_pda_set_modem_info(struct usb_serial *serial,
458 return rc; 458 return rc;
459} 459}
460 460
461static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) 461static int keyspan_pda_tiocmget(struct tty_struct *tty)
462{ 462{
463 struct usb_serial_port *port = tty->driver_data; 463 struct usb_serial_port *port = tty->driver_data;
464 struct usb_serial *serial = port->serial; 464 struct usb_serial *serial = port->serial;
@@ -479,7 +479,7 @@ static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file)
479 return value; 479 return value;
480} 480}
481 481
482static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file, 482static int keyspan_pda_tiocmset(struct tty_struct *tty,
483 unsigned int set, unsigned int clear) 483 unsigned int set, unsigned int clear)
484{ 484{
485 struct usb_serial_port *port = tty->driver_data; 485 struct usb_serial_port *port = tty->driver_data;
@@ -680,22 +680,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on)
680 } 680 }
681} 681}
682 682
683static int keyspan_pda_carrier_raised(struct usb_serial_port *port)
684{
685 struct usb_serial *serial = port->serial;
686 unsigned char modembits;
687
688 /* If we can read the modem status and the DCD is low then
689 carrier is not raised yet */
690 if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) {
691 if (!(modembits & (1>>6)))
692 return 0;
693 }
694 /* Carrier raised, or we failed (eg disconnected) so
695 progress accordingly */
696 return 1;
697}
698
699 683
700static int keyspan_pda_open(struct tty_struct *tty, 684static int keyspan_pda_open(struct tty_struct *tty,
701 struct usb_serial_port *port) 685 struct usb_serial_port *port)
@@ -882,7 +866,6 @@ static struct usb_serial_driver keyspan_pda_device = {
882 .id_table = id_table_std, 866 .id_table = id_table_std,
883 .num_ports = 1, 867 .num_ports = 1,
884 .dtr_rts = keyspan_pda_dtr_rts, 868 .dtr_rts = keyspan_pda_dtr_rts,
885 .carrier_raised = keyspan_pda_carrier_raised,
886 .open = keyspan_pda_open, 869 .open = keyspan_pda_open,
887 .close = keyspan_pda_close, 870 .close = keyspan_pda_close,
888 .write = keyspan_pda_write, 871 .write = keyspan_pda_write,
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index e8a65ce45a2f..19373cb7c5bf 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -68,8 +68,8 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port);
68static void klsi_105_close(struct usb_serial_port *port); 68static void klsi_105_close(struct usb_serial_port *port);
69static void klsi_105_set_termios(struct tty_struct *tty, 69static void klsi_105_set_termios(struct tty_struct *tty,
70 struct usb_serial_port *port, struct ktermios *old); 70 struct usb_serial_port *port, struct ktermios *old);
71static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file); 71static int klsi_105_tiocmget(struct tty_struct *tty);
72static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, 72static int klsi_105_tiocmset(struct tty_struct *tty,
73 unsigned int set, unsigned int clear); 73 unsigned int set, unsigned int clear);
74static void klsi_105_process_read_urb(struct urb *urb); 74static void klsi_105_process_read_urb(struct urb *urb);
75static int klsi_105_prepare_write_buffer(struct usb_serial_port *port, 75static int klsi_105_prepare_write_buffer(struct usb_serial_port *port,
@@ -637,7 +637,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
637} 637}
638#endif 638#endif
639 639
640static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file) 640static int klsi_105_tiocmget(struct tty_struct *tty)
641{ 641{
642 struct usb_serial_port *port = tty->driver_data; 642 struct usb_serial_port *port = tty->driver_data;
643 struct klsi_105_private *priv = usb_get_serial_port_data(port); 643 struct klsi_105_private *priv = usb_get_serial_port_data(port);
@@ -661,7 +661,7 @@ static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file)
661 return (int)line_state; 661 return (int)line_state;
662} 662}
663 663
664static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, 664static int klsi_105_tiocmset(struct tty_struct *tty,
665 unsigned int set, unsigned int clear) 665 unsigned int set, unsigned int clear)
666{ 666{
667 int retval = -EINVAL; 667 int retval = -EINVAL;
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index bd5bd8589e04..ddd146300ddb 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -75,10 +75,10 @@ static void kobil_close(struct usb_serial_port *port);
75static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, 75static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
76 const unsigned char *buf, int count); 76 const unsigned char *buf, int count);
77static int kobil_write_room(struct tty_struct *tty); 77static int kobil_write_room(struct tty_struct *tty);
78static int kobil_ioctl(struct tty_struct *tty, struct file *file, 78static int kobil_ioctl(struct tty_struct *tty,
79 unsigned int cmd, unsigned long arg); 79 unsigned int cmd, unsigned long arg);
80static int kobil_tiocmget(struct tty_struct *tty, struct file *file); 80static int kobil_tiocmget(struct tty_struct *tty);
81static int kobil_tiocmset(struct tty_struct *tty, struct file *file, 81static int kobil_tiocmset(struct tty_struct *tty,
82 unsigned int set, unsigned int clear); 82 unsigned int set, unsigned int clear);
83static void kobil_read_int_callback(struct urb *urb); 83static void kobil_read_int_callback(struct urb *urb);
84static void kobil_write_callback(struct urb *purb); 84static void kobil_write_callback(struct urb *purb);
@@ -372,7 +372,7 @@ static void kobil_read_int_callback(struct urb *urb)
372 } 372 }
373 373
374 tty = tty_port_tty_get(&port->port); 374 tty = tty_port_tty_get(&port->port);
375 if (urb->actual_length) { 375 if (tty && urb->actual_length) {
376 376
377 /* BEGIN DEBUG */ 377 /* BEGIN DEBUG */
378 /* 378 /*
@@ -504,7 +504,7 @@ static int kobil_write_room(struct tty_struct *tty)
504} 504}
505 505
506 506
507static int kobil_tiocmget(struct tty_struct *tty, struct file *file) 507static int kobil_tiocmget(struct tty_struct *tty)
508{ 508{
509 struct usb_serial_port *port = tty->driver_data; 509 struct usb_serial_port *port = tty->driver_data;
510 struct kobil_private *priv; 510 struct kobil_private *priv;
@@ -544,7 +544,7 @@ static int kobil_tiocmget(struct tty_struct *tty, struct file *file)
544 return result; 544 return result;
545} 545}
546 546
547static int kobil_tiocmset(struct tty_struct *tty, struct file *file, 547static int kobil_tiocmset(struct tty_struct *tty,
548 unsigned int set, unsigned int clear) 548 unsigned int set, unsigned int clear)
549{ 549{
550 struct usb_serial_port *port = tty->driver_data; 550 struct usb_serial_port *port = tty->driver_data;
@@ -668,7 +668,7 @@ static void kobil_set_termios(struct tty_struct *tty,
668 ); 668 );
669} 669}
670 670
671static int kobil_ioctl(struct tty_struct *tty, struct file *file, 671static int kobil_ioctl(struct tty_struct *tty,
672 unsigned int cmd, unsigned long arg) 672 unsigned int cmd, unsigned long arg)
673{ 673{
674 struct usb_serial_port *port = tty->driver_data; 674 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 7aa01b95b1d4..ba0d28727ccb 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -78,6 +78,8 @@
78#include <asm/unaligned.h> 78#include <asm/unaligned.h>
79#include <linux/usb.h> 79#include <linux/usb.h>
80#include <linux/usb/serial.h> 80#include <linux/usb/serial.h>
81#include <linux/serial.h>
82#include <linux/ioctl.h>
81#include "mct_u232.h" 83#include "mct_u232.h"
82 84
83/* 85/*
@@ -101,9 +103,13 @@ static void mct_u232_read_int_callback(struct urb *urb);
101static void mct_u232_set_termios(struct tty_struct *tty, 103static void mct_u232_set_termios(struct tty_struct *tty,
102 struct usb_serial_port *port, struct ktermios *old); 104 struct usb_serial_port *port, struct ktermios *old);
103static void mct_u232_break_ctl(struct tty_struct *tty, int break_state); 105static void mct_u232_break_ctl(struct tty_struct *tty, int break_state);
104static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file); 106static int mct_u232_tiocmget(struct tty_struct *tty);
105static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, 107static int mct_u232_tiocmset(struct tty_struct *tty,
106 unsigned int set, unsigned int clear); 108 unsigned int set, unsigned int clear);
109static int mct_u232_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg);
111static int mct_u232_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount);
107static void mct_u232_throttle(struct tty_struct *tty); 113static void mct_u232_throttle(struct tty_struct *tty);
108static void mct_u232_unthrottle(struct tty_struct *tty); 114static void mct_u232_unthrottle(struct tty_struct *tty);
109 115
@@ -150,9 +156,10 @@ static struct usb_serial_driver mct_u232_device = {
150 .tiocmset = mct_u232_tiocmset, 156 .tiocmset = mct_u232_tiocmset,
151 .attach = mct_u232_startup, 157 .attach = mct_u232_startup,
152 .release = mct_u232_release, 158 .release = mct_u232_release,
159 .ioctl = mct_u232_ioctl,
160 .get_icount = mct_u232_get_icount,
153}; 161};
154 162
155
156struct mct_u232_private { 163struct mct_u232_private {
157 spinlock_t lock; 164 spinlock_t lock;
158 unsigned int control_state; /* Modem Line Setting (TIOCM) */ 165 unsigned int control_state; /* Modem Line Setting (TIOCM) */
@@ -160,6 +167,9 @@ struct mct_u232_private {
160 unsigned char last_lsr; /* Line Status Register */ 167 unsigned char last_lsr; /* Line Status Register */
161 unsigned char last_msr; /* Modem Status Register */ 168 unsigned char last_msr; /* Modem Status Register */
162 unsigned int rx_flags; /* Throttling flags */ 169 unsigned int rx_flags; /* Throttling flags */
170 struct async_icount icount;
171 wait_queue_head_t msr_wait; /* for handling sleeping while waiting
172 for msr change to happen */
163}; 173};
164 174
165#define THROTTLED 0x01 175#define THROTTLED 0x01
@@ -386,6 +396,20 @@ static int mct_u232_get_modem_stat(struct usb_serial *serial,
386 return rc; 396 return rc;
387} /* mct_u232_get_modem_stat */ 397} /* mct_u232_get_modem_stat */
388 398
399static void mct_u232_msr_to_icount(struct async_icount *icount,
400 unsigned char msr)
401{
402 /* Translate Control Line states */
403 if (msr & MCT_U232_MSR_DDSR)
404 icount->dsr++;
405 if (msr & MCT_U232_MSR_DCTS)
406 icount->cts++;
407 if (msr & MCT_U232_MSR_DRI)
408 icount->rng++;
409 if (msr & MCT_U232_MSR_DCD)
410 icount->dcd++;
411} /* mct_u232_msr_to_icount */
412
389static void mct_u232_msr_to_state(unsigned int *control_state, 413static void mct_u232_msr_to_state(unsigned int *control_state,
390 unsigned char msr) 414 unsigned char msr)
391{ 415{
@@ -422,6 +446,7 @@ static int mct_u232_startup(struct usb_serial *serial)
422 if (!priv) 446 if (!priv)
423 return -ENOMEM; 447 return -ENOMEM;
424 spin_lock_init(&priv->lock); 448 spin_lock_init(&priv->lock);
449 init_waitqueue_head(&priv->msr_wait);
425 usb_set_serial_port_data(serial->port[0], priv); 450 usb_set_serial_port_data(serial->port[0], priv);
426 451
427 init_waitqueue_head(&serial->port[0]->write_wait); 452 init_waitqueue_head(&serial->port[0]->write_wait);
@@ -549,9 +574,12 @@ static void mct_u232_close(struct usb_serial_port *port)
549{ 574{
550 dbg("%s port %d", __func__, port->number); 575 dbg("%s port %d", __func__, port->number);
551 576
552 usb_serial_generic_close(port); 577 if (port->serial->dev) {
553 if (port->serial->dev) 578 /* shutdown our urbs */
579 usb_kill_urb(port->write_urb);
580 usb_kill_urb(port->read_urb);
554 usb_kill_urb(port->interrupt_in_urb); 581 usb_kill_urb(port->interrupt_in_urb);
582 }
555} /* mct_u232_close */ 583} /* mct_u232_close */
556 584
557 585
@@ -618,6 +646,8 @@ static void mct_u232_read_int_callback(struct urb *urb)
618 /* Record Control Line states */ 646 /* Record Control Line states */
619 mct_u232_msr_to_state(&priv->control_state, priv->last_msr); 647 mct_u232_msr_to_state(&priv->control_state, priv->last_msr);
620 648
649 mct_u232_msr_to_icount(&priv->icount, priv->last_msr);
650
621#if 0 651#if 0
622 /* Not yet handled. See belkin_sa.c for further information */ 652 /* Not yet handled. See belkin_sa.c for further information */
623 /* Now to report any errors */ 653 /* Now to report any errors */
@@ -644,6 +674,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
644 tty_kref_put(tty); 674 tty_kref_put(tty);
645 } 675 }
646#endif 676#endif
677 wake_up_interruptible(&priv->msr_wait);
647 spin_unlock_irqrestore(&priv->lock, flags); 678 spin_unlock_irqrestore(&priv->lock, flags);
648exit: 679exit:
649 retval = usb_submit_urb(urb, GFP_ATOMIC); 680 retval = usb_submit_urb(urb, GFP_ATOMIC);
@@ -759,7 +790,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
759} /* mct_u232_break_ctl */ 790} /* mct_u232_break_ctl */
760 791
761 792
762static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file) 793static int mct_u232_tiocmget(struct tty_struct *tty)
763{ 794{
764 struct usb_serial_port *port = tty->driver_data; 795 struct usb_serial_port *port = tty->driver_data;
765 struct mct_u232_private *priv = usb_get_serial_port_data(port); 796 struct mct_u232_private *priv = usb_get_serial_port_data(port);
@@ -775,7 +806,7 @@ static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file)
775 return control_state; 806 return control_state;
776} 807}
777 808
778static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, 809static int mct_u232_tiocmset(struct tty_struct *tty,
779 unsigned int set, unsigned int clear) 810 unsigned int set, unsigned int clear)
780{ 811{
781 struct usb_serial_port *port = tty->driver_data; 812 struct usb_serial_port *port = tty->driver_data;
@@ -823,7 +854,6 @@ static void mct_u232_throttle(struct tty_struct *tty)
823 } 854 }
824} 855}
825 856
826
827static void mct_u232_unthrottle(struct tty_struct *tty) 857static void mct_u232_unthrottle(struct tty_struct *tty)
828{ 858{
829 struct usb_serial_port *port = tty->driver_data; 859 struct usb_serial_port *port = tty->driver_data;
@@ -844,6 +874,82 @@ static void mct_u232_unthrottle(struct tty_struct *tty)
844 } 874 }
845} 875}
846 876
877static int mct_u232_ioctl(struct tty_struct *tty,
878 unsigned int cmd, unsigned long arg)
879{
880 DEFINE_WAIT(wait);
881 struct usb_serial_port *port = tty->driver_data;
882 struct mct_u232_private *mct_u232_port = usb_get_serial_port_data(port);
883 struct async_icount cnow, cprev;
884 unsigned long flags;
885
886 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
887
888 switch (cmd) {
889
890 case TIOCMIWAIT:
891
892 dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
893
894 spin_lock_irqsave(&mct_u232_port->lock, flags);
895 cprev = mct_u232_port->icount;
896 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
897 for ( ; ; ) {
898 prepare_to_wait(&mct_u232_port->msr_wait,
899 &wait, TASK_INTERRUPTIBLE);
900 schedule();
901 finish_wait(&mct_u232_port->msr_wait, &wait);
902 /* see if a signal did it */
903 if (signal_pending(current))
904 return -ERESTARTSYS;
905 spin_lock_irqsave(&mct_u232_port->lock, flags);
906 cnow = mct_u232_port->icount;
907 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
908 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
909 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
910 return -EIO; /* no change => error */
911 if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
912 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
913 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
914 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
915 return 0;
916 }
917 cprev = cnow;
918 }
919
920 }
921 return -ENOIOCTLCMD;
922}
923
924static int mct_u232_get_icount(struct tty_struct *tty,
925 struct serial_icounter_struct *icount)
926{
927 struct usb_serial_port *port = tty->driver_data;
928 struct mct_u232_private *mct_u232_port = usb_get_serial_port_data(port);
929 struct async_icount *ic = &mct_u232_port->icount;
930 unsigned long flags;
931
932 spin_lock_irqsave(&mct_u232_port->lock, flags);
933
934 icount->cts = ic->cts;
935 icount->dsr = ic->dsr;
936 icount->rng = ic->rng;
937 icount->dcd = ic->dcd;
938 icount->rx = ic->rx;
939 icount->tx = ic->tx;
940 icount->frame = ic->frame;
941 icount->overrun = ic->overrun;
942 icount->parity = ic->parity;
943 icount->brk = ic->brk;
944 icount->buf_overrun = ic->buf_overrun;
945
946 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
947
948 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
949 __func__, port->number, icount->rx, icount->tx);
950 return 0;
951}
952
847static int __init mct_u232_init(void) 953static int __init mct_u232_init(void)
848{ 954{
849 int retval; 955 int retval;
diff --git a/drivers/usb/serial/mct_u232.h b/drivers/usb/serial/mct_u232.h
index 3a3f5e6b8f96..d325bb8cb583 100644
--- a/drivers/usb/serial/mct_u232.h
+++ b/drivers/usb/serial/mct_u232.h
@@ -10,10 +10,9 @@
10 * 10 *
11 * This driver is for the device MCT USB-RS232 Converter (25 pin, Model No. 11 * This driver is for the device MCT USB-RS232 Converter (25 pin, Model No.
12 * U232-P25) from Magic Control Technology Corp. (there is also a 9 pin 12 * U232-P25) from Magic Control Technology Corp. (there is also a 9 pin
13 * Model No. U232-P9). See http://www.mct.com.tw/p_u232.html for further 13 * Model No. U232-P9). See http://www.mct.com.tw/products/product_us232.html
14 * information. The properties of this device are listed at the end of this 14 * for further information. The properties of this device are listed at the end
15 * file. This device is available from various distributors. I know Hana, 15 * of this file. This device was used in the Dlink DSB-S25.
16 * http://www.hana.de and D-Link, http://www.dlink.com/products/usb/dsbs25.
17 * 16 *
18 * All of the information about the device was acquired by using SniffUSB 17 * All of the information about the device was acquired by using SniffUSB
19 * on Windows98. The technical details of the reverse engineering are 18 * on Windows98. The technical details of the reverse engineering are
@@ -458,7 +457,7 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial,
458 * embedded UART. Exhaustive documentation for these is available at: 457 * embedded UART. Exhaustive documentation for these is available at:
459 * 458 *
460 * http://www.semiconductors.philips.com/pip/p87c52ubaa 459 * http://www.semiconductors.philips.com/pip/p87c52ubaa
461 * http://www.semiconductors.philips.com/pip/pdiusbd12 460 * http://www.nxp.com/acrobat_download/various/PDIUSBD12_PROGRAMMING_GUIDE.pdf
462 * 461 *
463 * Thanks to Julian Highfield for the pointer to the Philips database. 462 * Thanks to Julian Highfield for the pointer to the Philips database.
464 * 463 *
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index aa665817a272..40abedbc5943 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -827,7 +827,6 @@ exit:
827 dev_err(&urb->dev->dev, 827 dev_err(&urb->dev->dev,
828 "%s - Error %d submitting control urb\n", 828 "%s - Error %d submitting control urb\n",
829 __func__, result); 829 __func__, result);
830 return;
831} 830}
832 831
833/* 832/*
@@ -907,7 +906,6 @@ exit:
907 dev_err(&urb->dev->dev, 906 dev_err(&urb->dev->dev,
908 "%s - Error %d submitting control urb\n", 907 "%s - Error %d submitting control urb\n",
909 __func__, result); 908 __func__, result);
910 return;
911} 909}
912 910
913/* 911/*
@@ -1227,8 +1225,6 @@ static void mos7720_break(struct tty_struct *tty, int break_state)
1227 mos7720_port->shadowLCR = data; 1225 mos7720_port->shadowLCR = data;
1228 write_mos_reg(serial, port->number - port->serial->minor, 1226 write_mos_reg(serial, port->number - port->serial->minor,
1229 LCR, mos7720_port->shadowLCR); 1227 LCR, mos7720_port->shadowLCR);
1230
1231 return;
1232} 1228}
1233 1229
1234/* 1230/*
@@ -1746,7 +1742,6 @@ static void change_port_settings(struct tty_struct *tty,
1746 dbg("usb_submit_urb(read bulk) failed, status = %d", 1742 dbg("usb_submit_urb(read bulk) failed, status = %d",
1747 status); 1743 status);
1748 } 1744 }
1749 return;
1750} 1745}
1751 1746
1752/* 1747/*
@@ -1803,7 +1798,6 @@ static void mos7720_set_termios(struct tty_struct *tty,
1803 dbg("usb_submit_urb(read bulk) failed, status = %d", 1798 dbg("usb_submit_urb(read bulk) failed, status = %d",
1804 status); 1799 status);
1805 } 1800 }
1806 return;
1807} 1801}
1808 1802
1809/* 1803/*
@@ -1839,7 +1833,7 @@ static int get_lsr_info(struct tty_struct *tty,
1839 return 0; 1833 return 0;
1840} 1834}
1841 1835
1842static int mos7720_tiocmget(struct tty_struct *tty, struct file *file) 1836static int mos7720_tiocmget(struct tty_struct *tty)
1843{ 1837{
1844 struct usb_serial_port *port = tty->driver_data; 1838 struct usb_serial_port *port = tty->driver_data;
1845 struct moschip_port *mos7720_port = usb_get_serial_port_data(port); 1839 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
@@ -1864,14 +1858,14 @@ static int mos7720_tiocmget(struct tty_struct *tty, struct file *file)
1864 return result; 1858 return result;
1865} 1859}
1866 1860
1867static int mos7720_tiocmset(struct tty_struct *tty, struct file *file, 1861static int mos7720_tiocmset(struct tty_struct *tty,
1868 unsigned int set, unsigned int clear) 1862 unsigned int set, unsigned int clear)
1869{ 1863{
1870 struct usb_serial_port *port = tty->driver_data; 1864 struct usb_serial_port *port = tty->driver_data;
1871 struct moschip_port *mos7720_port = usb_get_serial_port_data(port); 1865 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
1872 unsigned int mcr ; 1866 unsigned int mcr ;
1873 dbg("%s - port %d", __func__, port->number); 1867 dbg("%s - port %d", __func__, port->number);
1874 dbg("he was at tiocmget"); 1868 dbg("he was at tiocmset");
1875 1869
1876 mcr = mos7720_port->shadowMCR; 1870 mcr = mos7720_port->shadowMCR;
1877 1871
@@ -1896,10 +1890,37 @@ static int mos7720_tiocmset(struct tty_struct *tty, struct file *file,
1896 return 0; 1890 return 0;
1897} 1891}
1898 1892
1893static int mos7720_get_icount(struct tty_struct *tty,
1894 struct serial_icounter_struct *icount)
1895{
1896 struct usb_serial_port *port = tty->driver_data;
1897 struct moschip_port *mos7720_port;
1898 struct async_icount cnow;
1899
1900 mos7720_port = usb_get_serial_port_data(port);
1901 cnow = mos7720_port->icount;
1902
1903 icount->cts = cnow.cts;
1904 icount->dsr = cnow.dsr;
1905 icount->rng = cnow.rng;
1906 icount->dcd = cnow.dcd;
1907 icount->rx = cnow.rx;
1908 icount->tx = cnow.tx;
1909 icount->frame = cnow.frame;
1910 icount->overrun = cnow.overrun;
1911 icount->parity = cnow.parity;
1912 icount->brk = cnow.brk;
1913 icount->buf_overrun = cnow.buf_overrun;
1914
1915 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
1916 port->number, icount->rx, icount->tx);
1917 return 0;
1918}
1919
1899static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, 1920static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1900 unsigned int __user *value) 1921 unsigned int __user *value)
1901{ 1922{
1902 unsigned int mcr ; 1923 unsigned int mcr;
1903 unsigned int arg; 1924 unsigned int arg;
1904 1925
1905 struct usb_serial_port *port; 1926 struct usb_serial_port *port;
@@ -1966,14 +1987,13 @@ static int get_serial_info(struct moschip_port *mos7720_port,
1966 return 0; 1987 return 0;
1967} 1988}
1968 1989
1969static int mos7720_ioctl(struct tty_struct *tty, struct file *file, 1990static int mos7720_ioctl(struct tty_struct *tty,
1970 unsigned int cmd, unsigned long arg) 1991 unsigned int cmd, unsigned long arg)
1971{ 1992{
1972 struct usb_serial_port *port = tty->driver_data; 1993 struct usb_serial_port *port = tty->driver_data;
1973 struct moschip_port *mos7720_port; 1994 struct moschip_port *mos7720_port;
1974 struct async_icount cnow; 1995 struct async_icount cnow;
1975 struct async_icount cprev; 1996 struct async_icount cprev;
1976 struct serial_icounter_struct icount;
1977 1997
1978 mos7720_port = usb_get_serial_port_data(port); 1998 mos7720_port = usb_get_serial_port_data(port);
1979 if (mos7720_port == NULL) 1999 if (mos7720_port == NULL)
@@ -2021,29 +2041,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
2021 } 2041 }
2022 /* NOTREACHED */ 2042 /* NOTREACHED */
2023 break; 2043 break;
2024
2025 case TIOCGICOUNT:
2026 cnow = mos7720_port->icount;
2027
2028 memset(&icount, 0, sizeof(struct serial_icounter_struct));
2029
2030 icount.cts = cnow.cts;
2031 icount.dsr = cnow.dsr;
2032 icount.rng = cnow.rng;
2033 icount.dcd = cnow.dcd;
2034 icount.rx = cnow.rx;
2035 icount.tx = cnow.tx;
2036 icount.frame = cnow.frame;
2037 icount.overrun = cnow.overrun;
2038 icount.parity = cnow.parity;
2039 icount.brk = cnow.brk;
2040 icount.buf_overrun = cnow.buf_overrun;
2041
2042 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2043 port->number, icount.rx, icount.tx);
2044 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
2045 return -EFAULT;
2046 return 0;
2047 } 2044 }
2048 2045
2049 return -ENOIOCTLCMD; 2046 return -ENOIOCTLCMD;
@@ -2055,7 +2052,7 @@ static int mos7720_startup(struct usb_serial *serial)
2055 struct usb_device *dev; 2052 struct usb_device *dev;
2056 int i; 2053 int i;
2057 char data; 2054 char data;
2058 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); 2055 u16 product;
2059 int ret_val; 2056 int ret_val;
2060 2057
2061 dbg("%s: Entering ..........", __func__); 2058 dbg("%s: Entering ..........", __func__);
@@ -2065,6 +2062,7 @@ static int mos7720_startup(struct usb_serial *serial)
2065 return -ENODEV; 2062 return -ENODEV;
2066 } 2063 }
2067 2064
2065 product = le16_to_cpu(serial->dev->descriptor.idProduct);
2068 dev = serial->dev; 2066 dev = serial->dev;
2069 2067
2070 /* 2068 /*
@@ -2212,6 +2210,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
2212 .ioctl = mos7720_ioctl, 2210 .ioctl = mos7720_ioctl,
2213 .tiocmget = mos7720_tiocmget, 2211 .tiocmget = mos7720_tiocmget,
2214 .tiocmset = mos7720_tiocmset, 2212 .tiocmset = mos7720_tiocmset,
2213 .get_icount = mos7720_get_icount,
2215 .set_termios = mos7720_set_termios, 2214 .set_termios = mos7720_set_termios,
2216 .write = mos7720_write, 2215 .write = mos7720_write,
2217 .write_room = mos7720_write_room, 2216 .write_room = mos7720_write_room,
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 1a42bc213799..7b50aa122752 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1367,8 +1367,6 @@ static void mos7840_break(struct tty_struct *tty, int break_state)
1367 mos7840_port->shadowLCR); 1367 mos7840_port->shadowLCR);
1368 mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, 1368 mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER,
1369 mos7840_port->shadowLCR); 1369 mos7840_port->shadowLCR);
1370
1371 return;
1372} 1370}
1373 1371
1374/***************************************************************************** 1372/*****************************************************************************
@@ -1599,8 +1597,6 @@ static void mos7840_throttle(struct tty_struct *tty)
1599 if (status < 0) 1597 if (status < 0)
1600 return; 1598 return;
1601 } 1599 }
1602
1603 return;
1604} 1600}
1605 1601
1606/***************************************************************************** 1602/*****************************************************************************
@@ -1648,7 +1644,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
1648 } 1644 }
1649} 1645}
1650 1646
1651static int mos7840_tiocmget(struct tty_struct *tty, struct file *file) 1647static int mos7840_tiocmget(struct tty_struct *tty)
1652{ 1648{
1653 struct usb_serial_port *port = tty->driver_data; 1649 struct usb_serial_port *port = tty->driver_data;
1654 struct moschip_port *mos7840_port; 1650 struct moschip_port *mos7840_port;
@@ -1678,7 +1674,7 @@ static int mos7840_tiocmget(struct tty_struct *tty, struct file *file)
1678 return result; 1674 return result;
1679} 1675}
1680 1676
1681static int mos7840_tiocmset(struct tty_struct *tty, struct file *file, 1677static int mos7840_tiocmset(struct tty_struct *tty,
1682 unsigned int set, unsigned int clear) 1678 unsigned int set, unsigned int clear)
1683{ 1679{
1684 struct usb_serial_port *port = tty->driver_data; 1680 struct usb_serial_port *port = tty->driver_data;
@@ -2075,8 +2071,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
2075 mos7840_port->delta_msr_cond = 1; 2071 mos7840_port->delta_msr_cond = 1;
2076 dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x", 2072 dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x",
2077 mos7840_port->shadowLCR); 2073 mos7840_port->shadowLCR);
2078
2079 return;
2080} 2074}
2081 2075
2082/***************************************************************************** 2076/*****************************************************************************
@@ -2145,7 +2139,6 @@ static void mos7840_set_termios(struct tty_struct *tty,
2145 mos7840_port->read_urb_busy = false; 2139 mos7840_port->read_urb_busy = false;
2146 } 2140 }
2147 } 2141 }
2148 return;
2149} 2142}
2150 2143
2151/***************************************************************************** 2144/*****************************************************************************
@@ -2209,12 +2202,40 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port,
2209 return 0; 2202 return 0;
2210} 2203}
2211 2204
2205static int mos7840_get_icount(struct tty_struct *tty,
2206 struct serial_icounter_struct *icount)
2207{
2208 struct usb_serial_port *port = tty->driver_data;
2209 struct moschip_port *mos7840_port;
2210 struct async_icount cnow;
2211
2212 mos7840_port = mos7840_get_port_private(port);
2213 cnow = mos7840_port->icount;
2214
2215 smp_rmb();
2216 icount->cts = cnow.cts;
2217 icount->dsr = cnow.dsr;
2218 icount->rng = cnow.rng;
2219 icount->dcd = cnow.dcd;
2220 icount->rx = cnow.rx;
2221 icount->tx = cnow.tx;
2222 icount->frame = cnow.frame;
2223 icount->overrun = cnow.overrun;
2224 icount->parity = cnow.parity;
2225 icount->brk = cnow.brk;
2226 icount->buf_overrun = cnow.buf_overrun;
2227
2228 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2229 port->number, icount->rx, icount->tx);
2230 return 0;
2231}
2232
2212/***************************************************************************** 2233/*****************************************************************************
2213 * SerialIoctl 2234 * SerialIoctl
2214 * this function handles any ioctl calls to the driver 2235 * this function handles any ioctl calls to the driver
2215 *****************************************************************************/ 2236 *****************************************************************************/
2216 2237
2217static int mos7840_ioctl(struct tty_struct *tty, struct file *file, 2238static int mos7840_ioctl(struct tty_struct *tty,
2218 unsigned int cmd, unsigned long arg) 2239 unsigned int cmd, unsigned long arg)
2219{ 2240{
2220 struct usb_serial_port *port = tty->driver_data; 2241 struct usb_serial_port *port = tty->driver_data;
@@ -2223,7 +2244,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2223 2244
2224 struct async_icount cnow; 2245 struct async_icount cnow;
2225 struct async_icount cprev; 2246 struct async_icount cprev;
2226 struct serial_icounter_struct icount;
2227 2247
2228 if (mos7840_port_paranoia_check(port, __func__)) { 2248 if (mos7840_port_paranoia_check(port, __func__)) {
2229 dbg("%s", "Invalid port"); 2249 dbg("%s", "Invalid port");
@@ -2282,29 +2302,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2282 /* NOTREACHED */ 2302 /* NOTREACHED */
2283 break; 2303 break;
2284 2304
2285 case TIOCGICOUNT:
2286 cnow = mos7840_port->icount;
2287 smp_rmb();
2288
2289 memset(&icount, 0, sizeof(struct serial_icounter_struct));
2290
2291 icount.cts = cnow.cts;
2292 icount.dsr = cnow.dsr;
2293 icount.rng = cnow.rng;
2294 icount.dcd = cnow.dcd;
2295 icount.rx = cnow.rx;
2296 icount.tx = cnow.tx;
2297 icount.frame = cnow.frame;
2298 icount.overrun = cnow.overrun;
2299 icount.parity = cnow.parity;
2300 icount.brk = cnow.brk;
2301 icount.buf_overrun = cnow.buf_overrun;
2302
2303 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2304 port->number, icount.rx, icount.tx);
2305 if (copy_to_user(argp, &icount, sizeof(icount)))
2306 return -EFAULT;
2307 return 0;
2308 default: 2305 default:
2309 break; 2306 break;
2310 } 2307 }
@@ -2674,6 +2671,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
2674 .break_ctl = mos7840_break, 2671 .break_ctl = mos7840_break,
2675 .tiocmget = mos7840_tiocmget, 2672 .tiocmget = mos7840_tiocmget,
2676 .tiocmset = mos7840_tiocmset, 2673 .tiocmset = mos7840_tiocmset,
2674 .get_icount = mos7840_get_icount,
2677 .attach = mos7840_startup, 2675 .attach = mos7840_startup,
2678 .disconnect = mos7840_disconnect, 2676 .disconnect = mos7840_disconnect,
2679 .release = mos7840_release, 2677 .release = mos7840_release,
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c
index cf1718394e18..e2bfecc46402 100644
--- a/drivers/usb/serial/moto_modem.c
+++ b/drivers/usb/serial/moto_modem.c
@@ -25,6 +25,7 @@ static const struct usb_device_id id_table[] = {
25 { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */ 25 { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */
26 { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */ 26 { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */
27 { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */ 27 { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */
28 { USB_DEVICE(0x22b8, 0x2c84) }, /* Motorola VE240 phone */
28 { USB_DEVICE(0x22b8, 0x2c64) }, /* Motorola V950 phone */ 29 { USB_DEVICE(0x22b8, 0x2c64) }, /* Motorola V950 phone */
29 { }, 30 { },
30}; 31};
@@ -44,6 +45,7 @@ static struct usb_serial_driver moto_device = {
44 .name = "moto-modem", 45 .name = "moto-modem",
45 }, 46 },
46 .id_table = id_table, 47 .id_table = id_table,
48 .usb_driver = &moto_driver,
47 .num_ports = 1, 49 .num_ports = 1,
48}; 50};
49 51
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 89c724c0ac0a..60f38d5e64fc 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -246,8 +246,6 @@ static void omninet_read_bulk_callback(struct urb *urb)
246 dev_err(&port->dev, 246 dev_err(&port->dev,
247 "%s - failed resubmitting read urb, error %d\n", 247 "%s - failed resubmitting read urb, error %d\n",
248 __func__, result); 248 __func__, result);
249
250 return;
251} 249}
252 250
253static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, 251static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index ed01f3b2de8c..96423f3c8ef3 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * Opticon USB barcode to serial driver 2 * Opticon USB barcode to serial driver
3 * 3 *
4 * Copyright (C) 2011 Martin Jansen <martin.jansen@opticon.com>
4 * Copyright (C) 2008 - 2009 Greg Kroah-Hartman <gregkh@suse.de> 5 * Copyright (C) 2008 - 2009 Greg Kroah-Hartman <gregkh@suse.de>
5 * Copyright (C) 2008 - 2009 Novell Inc. 6 * Copyright (C) 2008 - 2009 Novell Inc.
6 * 7 *
@@ -21,6 +22,16 @@
21#include <linux/usb/serial.h> 22#include <linux/usb/serial.h>
22#include <linux/uaccess.h> 23#include <linux/uaccess.h>
23 24
25#define CONTROL_RTS 0x02
26#define RESEND_CTS_STATE 0x03
27
28/* max number of write urbs in flight */
29#define URB_UPPER_LIMIT 8
30
31/* This driver works for the Opticon 1D barcode reader
32 * an examples of 1D barcode types are EAN, UPC, Code39, IATA etc.. */
33#define DRIVER_DESC "Opticon USB barcode to serial driver (1D)"
34
24static int debug; 35static int debug;
25 36
26static const struct usb_device_id id_table[] = { 37static const struct usb_device_id id_table[] = {
@@ -42,13 +53,13 @@ struct opticon_private {
42 bool throttled; 53 bool throttled;
43 bool actually_throttled; 54 bool actually_throttled;
44 bool rts; 55 bool rts;
56 bool cts;
45 int outstanding_urbs; 57 int outstanding_urbs;
46}; 58};
47 59
48/* max number of write urbs in flight */
49#define URB_UPPER_LIMIT 4
50 60
51static void opticon_bulk_callback(struct urb *urb) 61
62static void opticon_read_bulk_callback(struct urb *urb)
52{ 63{
53 struct opticon_private *priv = urb->context; 64 struct opticon_private *priv = urb->context;
54 unsigned char *data = urb->transfer_buffer; 65 unsigned char *data = urb->transfer_buffer;
@@ -57,6 +68,7 @@ static void opticon_bulk_callback(struct urb *urb)
57 struct tty_struct *tty; 68 struct tty_struct *tty;
58 int result; 69 int result;
59 int data_length; 70 int data_length;
71 unsigned long flags;
60 72
61 dbg("%s - port %d", __func__, port->number); 73 dbg("%s - port %d", __func__, port->number);
62 74
@@ -87,31 +99,34 @@ static void opticon_bulk_callback(struct urb *urb)
87 * Data from the device comes with a 2 byte header: 99 * Data from the device comes with a 2 byte header:
88 * 100 *
89 * <0x00><0x00>data... 101 * <0x00><0x00>data...
90 * This is real data to be sent to the tty layer 102 * This is real data to be sent to the tty layer
91 * <0x00><0x01)level 103 * <0x00><0x01)level
92 * This is a RTS level change, the third byte is the RTS 104 * This is a CTS level change, the third byte is the CTS
93 * value (0 for low, 1 for high). 105 * value (0 for low, 1 for high).
94 */ 106 */
95 if ((data[0] == 0x00) && (data[1] == 0x00)) { 107 if ((data[0] == 0x00) && (data[1] == 0x00)) {
96 /* real data, send it to the tty layer */ 108 /* real data, send it to the tty layer */
97 tty = tty_port_tty_get(&port->port); 109 tty = tty_port_tty_get(&port->port);
98 if (tty) { 110 if (tty) {
99 tty_insert_flip_string(tty, data, 111 tty_insert_flip_string(tty, data + 2,
100 data_length); 112 data_length);
101 tty_flip_buffer_push(tty); 113 tty_flip_buffer_push(tty);
102 tty_kref_put(tty); 114 tty_kref_put(tty);
103 } 115 }
104 } else { 116 } else {
105 if ((data[0] == 0x00) && (data[1] == 0x01)) { 117 if ((data[0] == 0x00) && (data[1] == 0x01)) {
118 spin_lock_irqsave(&priv->lock, flags);
119 /* CTS status information package */
106 if (data[2] == 0x00) 120 if (data[2] == 0x00)
107 priv->rts = false; 121 priv->cts = false;
108 else 122 else
109 priv->rts = true; 123 priv->cts = true;
124 spin_unlock_irqrestore(&priv->lock, flags);
110 } else { 125 } else {
111 dev_dbg(&priv->udev->dev, 126 dev_dbg(&priv->udev->dev,
112 "Unknown data packet received from the device:" 127 "Unknown data packet received from the device:"
113 " %2x %2x\n", 128 " %2x %2x\n",
114 data[0], data[1]); 129 data[0], data[1]);
115 } 130 }
116 } 131 }
117 } else { 132 } else {
@@ -129,8 +144,8 @@ exit:
129 usb_rcvbulkpipe(priv->udev, 144 usb_rcvbulkpipe(priv->udev,
130 priv->bulk_address), 145 priv->bulk_address),
131 priv->bulk_in_buffer, priv->buffer_size, 146 priv->bulk_in_buffer, priv->buffer_size,
132 opticon_bulk_callback, priv); 147 opticon_read_bulk_callback, priv);
133 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 148 result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC);
134 if (result) 149 if (result)
135 dev_err(&port->dev, 150 dev_err(&port->dev,
136 "%s - failed resubmitting read urb, error %d\n", 151 "%s - failed resubmitting read urb, error %d\n",
@@ -140,6 +155,24 @@ exit:
140 spin_unlock(&priv->lock); 155 spin_unlock(&priv->lock);
141} 156}
142 157
158static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
159 u8 val)
160{
161 struct usb_serial *serial = port->serial;
162 int retval;
163 u8 buffer[2];
164
165 buffer[0] = val;
166 /* Send the message to the vendor control endpoint
167 * of the connected device */
168 retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
169 requesttype,
170 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
171 0, 0, buffer, 1, 0);
172
173 return retval;
174}
175
143static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port) 176static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
144{ 177{
145 struct opticon_private *priv = usb_get_serial_data(port->serial); 178 struct opticon_private *priv = usb_get_serial_data(port->serial);
@@ -152,19 +185,30 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
152 priv->throttled = false; 185 priv->throttled = false;
153 priv->actually_throttled = false; 186 priv->actually_throttled = false;
154 priv->port = port; 187 priv->port = port;
188 priv->rts = false;
155 spin_unlock_irqrestore(&priv->lock, flags); 189 spin_unlock_irqrestore(&priv->lock, flags);
156 190
157 /* Start reading from the device */ 191 /* Clear RTS line */
192 send_control_msg(port, CONTROL_RTS, 0);
193
194 /* Setup the read URB and start reading from the device */
158 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev, 195 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
159 usb_rcvbulkpipe(priv->udev, 196 usb_rcvbulkpipe(priv->udev,
160 priv->bulk_address), 197 priv->bulk_address),
161 priv->bulk_in_buffer, priv->buffer_size, 198 priv->bulk_in_buffer, priv->buffer_size,
162 opticon_bulk_callback, priv); 199 opticon_read_bulk_callback, priv);
200
201 /* clear the halt status of the enpoint */
202 usb_clear_halt(priv->udev, priv->bulk_read_urb->pipe);
203
163 result = usb_submit_urb(priv->bulk_read_urb, GFP_KERNEL); 204 result = usb_submit_urb(priv->bulk_read_urb, GFP_KERNEL);
164 if (result) 205 if (result)
165 dev_err(&port->dev, 206 dev_err(&port->dev,
166 "%s - failed resubmitting read urb, error %d\n", 207 "%s - failed resubmitting read urb, error %d\n",
167 __func__, result); 208 __func__, result);
209 /* Request CTS line state, sometimes during opening the current
210 * CTS state can be missed. */
211 send_control_msg(port, RESEND_CTS_STATE, 1);
168 return result; 212 return result;
169} 213}
170 214
@@ -178,7 +222,7 @@ static void opticon_close(struct usb_serial_port *port)
178 usb_kill_urb(priv->bulk_read_urb); 222 usb_kill_urb(priv->bulk_read_urb);
179} 223}
180 224
181static void opticon_write_bulk_callback(struct urb *urb) 225static void opticon_write_control_callback(struct urb *urb)
182{ 226{
183 struct opticon_private *priv = urb->context; 227 struct opticon_private *priv = urb->context;
184 int status = urb->status; 228 int status = urb->status;
@@ -187,6 +231,9 @@ static void opticon_write_bulk_callback(struct urb *urb)
187 /* free up the transfer buffer, as usb_free_urb() does not do this */ 231 /* free up the transfer buffer, as usb_free_urb() does not do this */
188 kfree(urb->transfer_buffer); 232 kfree(urb->transfer_buffer);
189 233
234 /* setup packet may be set if we're using it for writing */
235 kfree(urb->setup_packet);
236
190 if (status) 237 if (status)
191 dbg("%s - nonzero write bulk status received: %d", 238 dbg("%s - nonzero write bulk status received: %d",
192 __func__, status); 239 __func__, status);
@@ -207,6 +254,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
207 unsigned char *buffer; 254 unsigned char *buffer;
208 unsigned long flags; 255 unsigned long flags;
209 int status; 256 int status;
257 struct usb_ctrlrequest *dr;
210 258
211 dbg("%s - port %d", __func__, port->number); 259 dbg("%s - port %d", __func__, port->number);
212 260
@@ -223,6 +271,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
223 if (!buffer) { 271 if (!buffer) {
224 dev_err(&port->dev, "out of memory\n"); 272 dev_err(&port->dev, "out of memory\n");
225 count = -ENOMEM; 273 count = -ENOMEM;
274
226 goto error_no_buffer; 275 goto error_no_buffer;
227 } 276 }
228 277
@@ -237,16 +286,31 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
237 286
238 usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); 287 usb_serial_debug_data(debug, &port->dev, __func__, count, buffer);
239 288
240 usb_fill_bulk_urb(urb, serial->dev, 289 /* The conncected devices do not have a bulk write endpoint,
241 usb_sndbulkpipe(serial->dev, 290 * to transmit data to de barcode device the control endpoint is used */
242 port->bulk_out_endpointAddress), 291 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
243 buffer, count, opticon_write_bulk_callback, priv); 292 if (!dr) {
293 dev_err(&port->dev, "out of memory\n");
294 count = -ENOMEM;
295 goto error;
296 }
297
298 dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
299 dr->bRequest = 0x01;
300 dr->wValue = 0;
301 dr->wIndex = 0;
302 dr->wLength = cpu_to_le16(count);
303
304 usb_fill_control_urb(urb, serial->dev,
305 usb_sndctrlpipe(serial->dev, 0),
306 (unsigned char *)dr, buffer, count,
307 opticon_write_control_callback, priv);
244 308
245 /* send it down the pipe */ 309 /* send it down the pipe */
246 status = usb_submit_urb(urb, GFP_ATOMIC); 310 status = usb_submit_urb(urb, GFP_ATOMIC);
247 if (status) { 311 if (status) {
248 dev_err(&port->dev, 312 dev_err(&port->dev,
249 "%s - usb_submit_urb(write bulk) failed with status = %d\n", 313 "%s - usb_submit_urb(write endpoint) failed status = %d\n",
250 __func__, status); 314 __func__, status);
251 count = status; 315 count = status;
252 goto error; 316 goto error;
@@ -330,7 +394,7 @@ static void opticon_unthrottle(struct tty_struct *tty)
330 } 394 }
331} 395}
332 396
333static int opticon_tiocmget(struct tty_struct *tty, struct file *file) 397static int opticon_tiocmget(struct tty_struct *tty)
334{ 398{
335 struct usb_serial_port *port = tty->driver_data; 399 struct usb_serial_port *port = tty->driver_data;
336 struct opticon_private *priv = usb_get_serial_data(port->serial); 400 struct opticon_private *priv = usb_get_serial_data(port->serial);
@@ -338,16 +402,49 @@ static int opticon_tiocmget(struct tty_struct *tty, struct file *file)
338 int result = 0; 402 int result = 0;
339 403
340 dbg("%s - port %d", __func__, port->number); 404 dbg("%s - port %d", __func__, port->number);
405 if (!usb_get_intfdata(port->serial->interface))
406 return -ENODEV;
341 407
342 spin_lock_irqsave(&priv->lock, flags); 408 spin_lock_irqsave(&priv->lock, flags);
343 if (priv->rts) 409 if (priv->rts)
344 result = TIOCM_RTS; 410 result |= TIOCM_RTS;
411 if (priv->cts)
412 result |= TIOCM_CTS;
345 spin_unlock_irqrestore(&priv->lock, flags); 413 spin_unlock_irqrestore(&priv->lock, flags);
346 414
347 dbg("%s - %x", __func__, result); 415 dbg("%s - %x", __func__, result);
348 return result; 416 return result;
349} 417}
350 418
419static int opticon_tiocmset(struct tty_struct *tty,
420 unsigned int set, unsigned int clear)
421{
422 struct usb_serial_port *port = tty->driver_data;
423 struct opticon_private *priv = usb_get_serial_data(port->serial);
424 unsigned long flags;
425 bool rts;
426 bool changed = false;
427
428 if (!usb_get_intfdata(port->serial->interface))
429 return -ENODEV;
430 /* We only support RTS so we only handle that */
431 spin_lock_irqsave(&priv->lock, flags);
432
433 rts = priv->rts;
434 if (set & TIOCM_RTS)
435 priv->rts = true;
436 if (clear & TIOCM_RTS)
437 priv->rts = false;
438 changed = rts ^ priv->rts;
439 spin_unlock_irqrestore(&priv->lock, flags);
440
441 if (!changed)
442 return 0;
443
444 /* Send the new RTS state to the connected device */
445 return send_control_msg(port, CONTROL_RTS, !rts);
446}
447
351static int get_serial_info(struct opticon_private *priv, 448static int get_serial_info(struct opticon_private *priv,
352 struct serial_struct __user *serial) 449 struct serial_struct __user *serial)
353{ 450{
@@ -374,7 +471,7 @@ static int get_serial_info(struct opticon_private *priv,
374 return 0; 471 return 0;
375} 472}
376 473
377static int opticon_ioctl(struct tty_struct *tty, struct file *file, 474static int opticon_ioctl(struct tty_struct *tty,
378 unsigned int cmd, unsigned long arg) 475 unsigned int cmd, unsigned long arg)
379{ 476{
380 struct usb_serial_port *port = tty->driver_data; 477 struct usb_serial_port *port = tty->driver_data;
@@ -409,6 +506,7 @@ static int opticon_startup(struct usb_serial *serial)
409 priv->serial = serial; 506 priv->serial = serial;
410 priv->port = serial->port[0]; 507 priv->port = serial->port[0];
411 priv->udev = serial->dev; 508 priv->udev = serial->dev;
509 priv->outstanding_urbs = 0; /* Init the outstanding urbs */
412 510
413 /* find our bulk endpoint */ 511 /* find our bulk endpoint */
414 intf = serial->interface->altsetting; 512 intf = serial->interface->altsetting;
@@ -434,13 +532,6 @@ static int opticon_startup(struct usb_serial *serial)
434 532
435 priv->bulk_address = endpoint->bEndpointAddress; 533 priv->bulk_address = endpoint->bEndpointAddress;
436 534
437 /* set up our bulk urb */
438 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
439 usb_rcvbulkpipe(priv->udev,
440 endpoint->bEndpointAddress),
441 priv->bulk_in_buffer, priv->buffer_size,
442 opticon_bulk_callback, priv);
443
444 bulk_in_found = true; 535 bulk_in_found = true;
445 break; 536 break;
446 } 537 }
@@ -536,6 +627,7 @@ static struct usb_serial_driver opticon_device = {
536 .unthrottle = opticon_unthrottle, 627 .unthrottle = opticon_unthrottle,
537 .ioctl = opticon_ioctl, 628 .ioctl = opticon_ioctl,
538 .tiocmget = opticon_tiocmget, 629 .tiocmget = opticon_tiocmget,
630 .tiocmset = opticon_tiocmset,
539}; 631};
540 632
541static int __init opticon_init(void) 633static int __init opticon_init(void)
@@ -559,6 +651,7 @@ static void __exit opticon_exit(void)
559 651
560module_init(opticon_init); 652module_init(opticon_init);
561module_exit(opticon_exit); 653module_exit(opticon_exit);
654MODULE_DESCRIPTION(DRIVER_DESC);
562MODULE_LICENSE("GPL"); 655MODULE_LICENSE("GPL");
563 656
564module_param(debug, bool, S_IRUGO | S_IWUSR); 657module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index c46911af282f..60b25d8ea0e2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -149,6 +149,7 @@ static void option_instat_callback(struct urb *urb);
149#define HUAWEI_PRODUCT_K3765 0x1465 149#define HUAWEI_PRODUCT_K3765 0x1465
150#define HUAWEI_PRODUCT_E14AC 0x14AC 150#define HUAWEI_PRODUCT_E14AC 0x14AC
151#define HUAWEI_PRODUCT_ETS1220 0x1803 151#define HUAWEI_PRODUCT_ETS1220 0x1803
152#define HUAWEI_PRODUCT_E353 0x1506
152 153
153#define QUANTA_VENDOR_ID 0x0408 154#define QUANTA_VENDOR_ID 0x0408
154#define QUANTA_PRODUCT_Q101 0xEA02 155#define QUANTA_PRODUCT_Q101 0xEA02
@@ -310,10 +311,6 @@ static void option_instat_callback(struct urb *urb);
310#define ZTE_PRODUCT_AC2726 0xfff5 311#define ZTE_PRODUCT_AC2726 0xfff5
311#define ZTE_PRODUCT_AC8710T 0xffff 312#define ZTE_PRODUCT_AC8710T 0xffff
312 313
313/* ZTE PRODUCTS -- alternate vendor ID */
314#define ZTE_VENDOR_ID2 0x1d6b
315#define ZTE_PRODUCT_MF_330 0x0002
316
317#define BENQ_VENDOR_ID 0x04a5 314#define BENQ_VENDOR_ID 0x04a5
318#define BENQ_PRODUCT_H10 0x4068 315#define BENQ_PRODUCT_H10 0x4068
319 316
@@ -339,11 +336,12 @@ static void option_instat_callback(struct urb *urb);
339#define TOSHIBA_PRODUCT_G450 0x0d45 336#define TOSHIBA_PRODUCT_G450 0x0d45
340 337
341#define ALINK_VENDOR_ID 0x1e0e 338#define ALINK_VENDOR_ID 0x1e0e
339#define ALINK_PRODUCT_PH300 0x9100
342#define ALINK_PRODUCT_3GU 0x9200 340#define ALINK_PRODUCT_3GU 0x9200
343 341
344/* ALCATEL PRODUCTS */ 342/* ALCATEL PRODUCTS */
345#define ALCATEL_VENDOR_ID 0x1bbb 343#define ALCATEL_VENDOR_ID 0x1bbb
346#define ALCATEL_PRODUCT_X060S 0x0000 344#define ALCATEL_PRODUCT_X060S_X200 0x0000
347 345
348#define PIRELLI_VENDOR_ID 0x1266 346#define PIRELLI_VENDOR_ID 0x1266
349#define PIRELLI_PRODUCT_C100_1 0x1002 347#define PIRELLI_PRODUCT_C100_1 0x1002
@@ -378,11 +376,23 @@ static void option_instat_callback(struct urb *urb);
378 * It seems to contain a Qualcomm QSC6240/6290 chipset */ 376 * It seems to contain a Qualcomm QSC6240/6290 chipset */
379#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 377#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
380 378
379/* Zoom */
380#define ZOOM_PRODUCT_4597 0x9607
381
381/* Haier products */ 382/* Haier products */
382#define HAIER_VENDOR_ID 0x201e 383#define HAIER_VENDOR_ID 0x201e
383#define HAIER_PRODUCT_CE100 0x2009 384#define HAIER_PRODUCT_CE100 0x2009
384 385
385#define CINTERION_VENDOR_ID 0x0681 386/* Cinterion (formerly Siemens) products */
387#define SIEMENS_VENDOR_ID 0x0681
388#define CINTERION_VENDOR_ID 0x1e2d
389#define CINTERION_PRODUCT_HC25_MDM 0x0047
390#define CINTERION_PRODUCT_HC25_MDMNET 0x0040
391#define CINTERION_PRODUCT_HC28_MDM 0x004C
392#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */
393#define CINTERION_PRODUCT_EU3_E 0x0051
394#define CINTERION_PRODUCT_EU3_P 0x0052
395#define CINTERION_PRODUCT_PH8 0x0053
386 396
387/* Olivetti products */ 397/* Olivetti products */
388#define OLIVETTI_VENDOR_ID 0x0b3c 398#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -392,6 +402,16 @@ static void option_instat_callback(struct urb *urb);
392#define CELOT_VENDOR_ID 0x211f 402#define CELOT_VENDOR_ID 0x211f
393#define CELOT_PRODUCT_CT680M 0x6801 403#define CELOT_PRODUCT_CT680M 0x6801
394 404
405/* ONDA Communication vendor id */
406#define ONDA_VENDOR_ID 0x1ee8
407
408/* ONDA MT825UP HSDPA 14.2 modem */
409#define ONDA_MT825UP 0x000b
410
411/* Samsung products */
412#define SAMSUNG_VENDOR_ID 0x04e8
413#define SAMSUNG_PRODUCT_GT_B3730 0x6889
414
395/* some devices interfaces need special handling due to a number of reasons */ 415/* some devices interfaces need special handling due to a number of reasons */
396enum option_blacklist_reason { 416enum option_blacklist_reason {
397 OPTION_BLACKLIST_NONE = 0, 417 OPTION_BLACKLIST_NONE = 0,
@@ -412,6 +432,20 @@ static const struct option_blacklist_info four_g_w14_blacklist = {
412 .reason = OPTION_BLACKLIST_SENDSETUP 432 .reason = OPTION_BLACKLIST_SENDSETUP
413}; 433};
414 434
435static const u8 alcatel_x200_no_sendsetup[] = { 0, 1 };
436static const struct option_blacklist_info alcatel_x200_blacklist = {
437 .infolen = ARRAY_SIZE(alcatel_x200_no_sendsetup),
438 .ifaceinfo = alcatel_x200_no_sendsetup,
439 .reason = OPTION_BLACKLIST_SENDSETUP
440};
441
442static const u8 zte_k3765_z_no_sendsetup[] = { 0, 1, 2 };
443static const struct option_blacklist_info zte_k3765_z_blacklist = {
444 .infolen = ARRAY_SIZE(zte_k3765_z_no_sendsetup),
445 .ifaceinfo = zte_k3765_z_no_sendsetup,
446 .reason = OPTION_BLACKLIST_SENDSETUP
447};
448
415static const struct usb_device_id option_ids[] = { 449static const struct usb_device_id option_ids[] = {
416 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 450 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
417 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 451 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -512,7 +546,8 @@ static const struct usb_device_id option_ids[] = {
512 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, 546 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) },
513 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, 547 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) },
514 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, 548 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
515 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, 549 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },
550 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) },
516 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, 551 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
517 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, 552 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
518 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, 553 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
@@ -609,7 +644,6 @@ static const struct usb_device_id option_ids[] = {
609 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0004, 0xff, 0xff, 0xff) }, 644 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0004, 0xff, 0xff, 0xff) },
610 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0005, 0xff, 0xff, 0xff) }, 645 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0005, 0xff, 0xff, 0xff) },
611 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0006, 0xff, 0xff, 0xff) }, 646 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0006, 0xff, 0xff, 0xff) },
612 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0007, 0xff, 0xff, 0xff) },
613 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0008, 0xff, 0xff, 0xff) }, 647 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0008, 0xff, 0xff, 0xff) },
614 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0009, 0xff, 0xff, 0xff) }, 648 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0009, 0xff, 0xff, 0xff) },
615 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x000a, 0xff, 0xff, 0xff) }, 649 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x000a, 0xff, 0xff, 0xff) },
@@ -622,6 +656,7 @@ static const struct usb_device_id option_ids[] = {
622 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, 656 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) },
623 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, 657 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) },
624 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, 658 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
659 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) },
625 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, 660 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
626 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, 661 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
627 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) }, 662 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) },
@@ -633,38 +668,53 @@ static const struct usb_device_id option_ids[] = {
633 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, 668 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) },
634 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, 669 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
635 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, 670 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) },
636 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, 671 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */
637 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, 672 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
638 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, 673 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
639 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, 674 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
640 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) }, 675 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff,
676 0xff, 0xff), .driver_info = (kernel_ulong_t)&four_g_w14_blacklist },
641 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, 677 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) },
642 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, 678 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) },
679 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) },
643 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, 680 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) },
681 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) },
644 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, 682 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) },
683 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) },
645 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, 684 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) },
646 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, 685 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) },
686 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) },
647 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, 687 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) },
648 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, 688 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) },
689 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) },
649 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, 690 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
650 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, 691 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) },
692 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */
651 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, 693 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
652 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, 694 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) },
695 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) },
653 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, 696 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
654 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, 697 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) },
698 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
655 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, 699 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
656 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, 700 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
657 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, 701 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) },
658 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, 702 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) },
703 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) },
659 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, 704 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
705 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) },
660 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, 706 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) },
707 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
661 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, 708 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) },
709 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) },
662 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, 710 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) },
711 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0079, 0xff, 0xff, 0xff) },
663 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) }, 712 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) },
713 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) },
664 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, 714 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
665 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, 715 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) },
666 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
667 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, 716 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) },
717 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
668 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, 718 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
669 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, 719 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
670 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) }, 720 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
@@ -880,11 +930,13 @@ static const struct usb_device_id option_ids[] = {
880 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 930 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, 931 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
882 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, 932 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
933 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
934 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
935 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 936 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
884 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 937 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 938 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, 939 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
887 { USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) },
888 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, 940 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
889 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, 941 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
890 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ 942 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
@@ -897,13 +949,17 @@ static const struct usb_device_id option_ids[] = {
897 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, 949 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
898 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ 950 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
899 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, 951 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
952 { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) },
900 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, 953 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
901 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, 954 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
955 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
956 },
902 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 957 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
903 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, 958 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
904 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), 959 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
905 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist 960 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
906 }, 961 },
962 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
907 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, 963 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
908 /* Pirelli */ 964 /* Pirelli */
909 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)}, 965 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)},
@@ -922,9 +978,21 @@ static const struct usb_device_id option_ids[] = {
922 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, 978 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
923 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, 979 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
924 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, 980 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
925 { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, 981 /* Cinterion */
982 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
983 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
984 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
985 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
986 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
987 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
988 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
989 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
990 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
991
926 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, 992 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
927 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ 993 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
994 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
995 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
928 { } /* Terminating entry */ 996 { } /* Terminating entry */
929}; 997};
930MODULE_DEVICE_TABLE(usb, option_ids); 998MODULE_DEVICE_TABLE(usb, option_ids);
@@ -965,6 +1033,7 @@ static struct usb_serial_driver option_1port_device = {
965 .set_termios = usb_wwan_set_termios, 1033 .set_termios = usb_wwan_set_termios,
966 .tiocmget = usb_wwan_tiocmget, 1034 .tiocmget = usb_wwan_tiocmget,
967 .tiocmset = usb_wwan_tiocmset, 1035 .tiocmset = usb_wwan_tiocmset,
1036 .ioctl = usb_wwan_ioctl,
968 .attach = usb_wwan_startup, 1037 .attach = usb_wwan_startup,
969 .disconnect = usb_wwan_disconnect, 1038 .disconnect = usb_wwan_disconnect,
970 .release = usb_wwan_release, 1039 .release = usb_wwan_release,
@@ -1060,6 +1129,12 @@ static int option_probe(struct usb_serial *serial,
1060 serial->interface->cur_altsetting->desc.bInterfaceNumber == 1) 1129 serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
1061 return -ENODEV; 1130 return -ENODEV;
1062 1131
1132 /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */
1133 if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID &&
1134 serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
1135 serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA)
1136 return -ENODEV;
1137
1063 data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); 1138 data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
1064 1139
1065 if (!data) 1140 if (!data)
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index e199b0f4f99c..4c29e6c2bda7 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -135,7 +135,7 @@ static void oti6858_close(struct usb_serial_port *port);
135static void oti6858_set_termios(struct tty_struct *tty, 135static void oti6858_set_termios(struct tty_struct *tty,
136 struct usb_serial_port *port, struct ktermios *old); 136 struct usb_serial_port *port, struct ktermios *old);
137static void oti6858_init_termios(struct tty_struct *tty); 137static void oti6858_init_termios(struct tty_struct *tty);
138static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 138static int oti6858_ioctl(struct tty_struct *tty,
139 unsigned int cmd, unsigned long arg); 139 unsigned int cmd, unsigned long arg);
140static void oti6858_read_int_callback(struct urb *urb); 140static void oti6858_read_int_callback(struct urb *urb);
141static void oti6858_read_bulk_callback(struct urb *urb); 141static void oti6858_read_bulk_callback(struct urb *urb);
@@ -144,8 +144,8 @@ static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
144 const unsigned char *buf, int count); 144 const unsigned char *buf, int count);
145static int oti6858_write_room(struct tty_struct *tty); 145static int oti6858_write_room(struct tty_struct *tty);
146static int oti6858_chars_in_buffer(struct tty_struct *tty); 146static int oti6858_chars_in_buffer(struct tty_struct *tty);
147static int oti6858_tiocmget(struct tty_struct *tty, struct file *file); 147static int oti6858_tiocmget(struct tty_struct *tty);
148static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, 148static int oti6858_tiocmset(struct tty_struct *tty,
149 unsigned int set, unsigned int clear); 149 unsigned int set, unsigned int clear);
150static int oti6858_startup(struct usb_serial *serial); 150static int oti6858_startup(struct usb_serial *serial);
151static void oti6858_release(struct usb_serial *serial); 151static void oti6858_release(struct usb_serial *serial);
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = {
157 .name = "oti6858", 157 .name = "oti6858",
158 }, 158 },
159 .id_table = id_table, 159 .id_table = id_table,
160 .usb_driver = &oti6858_driver,
160 .num_ports = 1, 161 .num_ports = 1,
161 .open = oti6858_open, 162 .open = oti6858_open,
162 .close = oti6858_close, 163 .close = oti6858_close,
@@ -613,9 +614,8 @@ static void oti6858_close(struct usb_serial_port *port)
613 dbg("%s(): after buf_clear()", __func__); 614 dbg("%s(): after buf_clear()", __func__);
614 615
615 /* cancel scheduled setup */ 616 /* cancel scheduled setup */
616 cancel_delayed_work(&priv->delayed_setup_work); 617 cancel_delayed_work_sync(&priv->delayed_setup_work);
617 cancel_delayed_work(&priv->delayed_write_work); 618 cancel_delayed_work_sync(&priv->delayed_write_work);
618 flush_scheduled_work();
619 619
620 /* shutdown our urbs */ 620 /* shutdown our urbs */
621 dbg("%s(): shutting down urbs", __func__); 621 dbg("%s(): shutting down urbs", __func__);
@@ -624,7 +624,7 @@ static void oti6858_close(struct usb_serial_port *port)
624 usb_kill_urb(port->interrupt_in_urb); 624 usb_kill_urb(port->interrupt_in_urb);
625} 625}
626 626
627static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, 627static int oti6858_tiocmset(struct tty_struct *tty,
628 unsigned int set, unsigned int clear) 628 unsigned int set, unsigned int clear)
629{ 629{
630 struct usb_serial_port *port = tty->driver_data; 630 struct usb_serial_port *port = tty->driver_data;
@@ -657,7 +657,7 @@ static int oti6858_tiocmset(struct tty_struct *tty, struct file *file,
657 return 0; 657 return 0;
658} 658}
659 659
660static int oti6858_tiocmget(struct tty_struct *tty, struct file *file) 660static int oti6858_tiocmget(struct tty_struct *tty)
661{ 661{
662 struct usb_serial_port *port = tty->driver_data; 662 struct usb_serial_port *port = tty->driver_data;
663 struct oti6858_private *priv = usb_get_serial_port_data(port); 663 struct oti6858_private *priv = usb_get_serial_port_data(port);
@@ -728,7 +728,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
728 return 0; 728 return 0;
729} 729}
730 730
731static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 731static int oti6858_ioctl(struct tty_struct *tty,
732 unsigned int cmd, unsigned long arg) 732 unsigned int cmd, unsigned long arg)
733{ 733{
734 struct usb_serial_port *port = tty->driver_data; 734 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 8ae4c6cbc38a..30461fcc2206 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = {
50 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, 50 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
51 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, 51 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
52 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, 52 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
53 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) },
53 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 54 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
54 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 55 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
55 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 56 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
@@ -504,7 +505,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
504 return 0; 505 return 0;
505} 506}
506 507
507static int pl2303_tiocmset(struct tty_struct *tty, struct file *file, 508static int pl2303_tiocmset(struct tty_struct *tty,
508 unsigned int set, unsigned int clear) 509 unsigned int set, unsigned int clear)
509{ 510{
510 struct usb_serial_port *port = tty->driver_data; 511 struct usb_serial_port *port = tty->driver_data;
@@ -530,7 +531,7 @@ static int pl2303_tiocmset(struct tty_struct *tty, struct file *file,
530 return set_control_lines(port->serial->dev, control); 531 return set_control_lines(port->serial->dev, control);
531} 532}
532 533
533static int pl2303_tiocmget(struct tty_struct *tty, struct file *file) 534static int pl2303_tiocmget(struct tty_struct *tty)
534{ 535{
535 struct usb_serial_port *port = tty->driver_data; 536 struct usb_serial_port *port = tty->driver_data;
536 struct pl2303_private *priv = usb_get_serial_port_data(port); 537 struct pl2303_private *priv = usb_get_serial_port_data(port);
@@ -605,7 +606,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
605 return 0; 606 return 0;
606} 607}
607 608
608static int pl2303_ioctl(struct tty_struct *tty, struct file *file, 609static int pl2303_ioctl(struct tty_struct *tty,
609 unsigned int cmd, unsigned long arg) 610 unsigned int cmd, unsigned long arg)
610{ 611{
611 struct serial_struct ser; 612 struct serial_struct ser;
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
677{ 678{
678 679
679 struct pl2303_private *priv = usb_get_serial_port_data(port); 680 struct pl2303_private *priv = usb_get_serial_port_data(port);
681 struct tty_struct *tty;
680 unsigned long flags; 682 unsigned long flags;
681 u8 status_idx = UART_STATE; 683 u8 status_idx = UART_STATE;
682 u8 length = UART_STATE + 1; 684 u8 length = UART_STATE + 1;
685 u8 prev_line_status;
683 u16 idv, idp; 686 u16 idv, idp;
684 687
685 idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); 688 idv = le16_to_cpu(port->serial->dev->descriptor.idVendor);
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
701 704
702 /* Save off the uart status for others to look at */ 705 /* Save off the uart status for others to look at */
703 spin_lock_irqsave(&priv->lock, flags); 706 spin_lock_irqsave(&priv->lock, flags);
707 prev_line_status = priv->line_status;
704 priv->line_status = data[status_idx]; 708 priv->line_status = data[status_idx];
705 spin_unlock_irqrestore(&priv->lock, flags); 709 spin_unlock_irqrestore(&priv->lock, flags);
706 if (priv->line_status & UART_BREAK_ERROR) 710 if (priv->line_status & UART_BREAK_ERROR)
707 usb_serial_handle_break(port); 711 usb_serial_handle_break(port);
708 wake_up_interruptible(&priv->delta_msr_wait); 712 wake_up_interruptible(&priv->delta_msr_wait);
713
714 tty = tty_port_tty_get(&port->port);
715 if (!tty)
716 return;
717 if ((priv->line_status ^ prev_line_status) & UART_DCD)
718 usb_serial_handle_dcd_change(port, tty,
719 priv->line_status & UART_DCD);
720 tty_kref_put(tty);
709} 721}
710 722
711static void pl2303_read_int_callback(struct urb *urb) 723static void pl2303_read_int_callback(struct urb *urb)
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 43eb9bdad422..1b025f75dafd 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -21,6 +21,7 @@
21#define PL2303_PRODUCT_ID_MMX 0x0612 21#define PL2303_PRODUCT_ID_MMX 0x0612
22#define PL2303_PRODUCT_ID_GPRS 0x0609 22#define PL2303_PRODUCT_ID_GPRS 0x0609
23#define PL2303_PRODUCT_ID_HCR331 0x331a 23#define PL2303_PRODUCT_ID_HCR331 0x331a
24#define PL2303_PRODUCT_ID_MOTOROLA 0x0307
24 25
25#define ATEN_VENDOR_ID 0x0557 26#define ATEN_VENDOR_ID 0x0557
26#define ATEN_VENDOR_ID2 0x0547 27#define ATEN_VENDOR_ID2 0x0547
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index 214a3e504292..30b73e68a904 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -36,6 +36,7 @@
36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712 36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712
37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714 37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714
38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715
39#define PANTECH_PRODUCT_UML290_VZW 0x3718
39 40
40/* CMOTECH devices */ 41/* CMOTECH devices */
41#define CMOTECH_VENDOR_ID 0x16d8 42#define CMOTECH_VENDOR_ID 0x16d8
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = {
66 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, 67 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
67 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, 68 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
68 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, 69 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
70 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) },
69 { }, 71 { },
70}; 72};
71MODULE_DEVICE_TABLE(usb, id_table); 73MODULE_DEVICE_TABLE(usb, id_table);
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = {
84 .name = "qcaux", 86 .name = "qcaux",
85 }, 87 },
86 .id_table = id_table, 88 .id_table = id_table,
89 .usb_driver = &qcaux_driver,
87 .num_ports = 1, 90 .num_ports = 1,
88}; 91};
89 92
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index cde67cacb2c3..54a9dab1f33b 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -111,13 +111,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
111 ifnum = intf->desc.bInterfaceNumber; 111 ifnum = intf->desc.bInterfaceNumber;
112 dbg("This Interface = %d", ifnum); 112 dbg("This Interface = %d", ifnum);
113 113
114 data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), 114 data = kzalloc(sizeof(struct usb_wwan_intf_private),
115 GFP_KERNEL); 115 GFP_KERNEL);
116 if (!data) 116 if (!data)
117 return -ENOMEM; 117 return -ENOMEM;
118 118
119 spin_lock_init(&data->susp_lock); 119 spin_lock_init(&data->susp_lock);
120 120
121 usb_enable_autosuspend(serial->dev);
122
121 switch (nintf) { 123 switch (nintf) {
122 case 1: 124 case 1:
123 /* QDL mode */ 125 /* QDL mode */
@@ -132,8 +134,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
132 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { 134 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
133 dbg("QDL port found"); 135 dbg("QDL port found");
134 136
135 if (serial->interface->num_altsetting == 1) 137 if (serial->interface->num_altsetting == 1) {
136 return 0; 138 retval = 0; /* Success */
139 break;
140 }
137 141
138 retval = usb_set_interface(serial->dev, ifnum, 1); 142 retval = usb_set_interface(serial->dev, ifnum, 1);
139 if (retval < 0) { 143 if (retval < 0) {
@@ -143,14 +147,29 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
143 retval = -ENODEV; 147 retval = -ENODEV;
144 kfree(data); 148 kfree(data);
145 } 149 }
146 return retval;
147 } 150 }
148 break; 151 break;
149 152
150 case 3: 153 case 3:
151 case 4: 154 case 4:
152 /* Composite mode */ 155 /* Composite mode */
153 if (ifnum == 2) { 156 /* ifnum == 0 is a broadband network adapter */
157 if (ifnum == 1) {
158 /*
159 * Diagnostics Monitor (serial line 9600 8N1)
160 * Qualcomm DM protocol
161 * use "libqcdm" (ModemManager) for communication
162 */
163 dbg("Diagnostics Monitor found");
164 retval = usb_set_interface(serial->dev, ifnum, 0);
165 if (retval < 0) {
166 dev_err(&serial->dev->dev,
167 "Could not set interface, error %d\n",
168 retval);
169 retval = -ENODEV;
170 kfree(data);
171 }
172 } else if (ifnum == 2) {
154 dbg("Modem port found"); 173 dbg("Modem port found");
155 retval = usb_set_interface(serial->dev, ifnum, 0); 174 retval = usb_set_interface(serial->dev, ifnum, 0);
156 if (retval < 0) { 175 if (retval < 0) {
@@ -160,7 +179,21 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
160 retval = -ENODEV; 179 retval = -ENODEV;
161 kfree(data); 180 kfree(data);
162 } 181 }
163 return retval; 182 } else if (ifnum==3) {
183 /*
184 * NMEA (serial line 9600 8N1)
185 * # echo "\$GPS_START" > /dev/ttyUSBx
186 * # echo "\$GPS_STOP" > /dev/ttyUSBx
187 */
188 dbg("NMEA GPS interface found");
189 retval = usb_set_interface(serial->dev, ifnum, 0);
190 if (retval < 0) {
191 dev_err(&serial->dev->dev,
192 "Could not set interface, error %d\n",
193 retval);
194 retval = -ENODEV;
195 kfree(data);
196 }
164 } 197 }
165 break; 198 break;
166 199
@@ -168,12 +201,27 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
168 dev_err(&serial->dev->dev, 201 dev_err(&serial->dev->dev,
169 "unknown number of interfaces: %d\n", nintf); 202 "unknown number of interfaces: %d\n", nintf);
170 kfree(data); 203 kfree(data);
171 return -ENODEV; 204 retval = -ENODEV;
172 } 205 }
173 206
207 /* Set serial->private if not returning -ENODEV */
208 if (retval != -ENODEV)
209 usb_set_serial_data(serial, data);
174 return retval; 210 return retval;
175} 211}
176 212
213static void qc_release(struct usb_serial *serial)
214{
215 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
216
217 dbg("%s", __func__);
218
219 /* Call usb_wwan release & free the private data allocated in qcprobe */
220 usb_wwan_release(serial);
221 usb_set_serial_data(serial, NULL);
222 kfree(priv);
223}
224
177static struct usb_serial_driver qcdevice = { 225static struct usb_serial_driver qcdevice = {
178 .driver = { 226 .driver = {
179 .owner = THIS_MODULE, 227 .owner = THIS_MODULE,
@@ -191,7 +239,7 @@ static struct usb_serial_driver qcdevice = {
191 .chars_in_buffer = usb_wwan_chars_in_buffer, 239 .chars_in_buffer = usb_wwan_chars_in_buffer,
192 .attach = usb_wwan_startup, 240 .attach = usb_wwan_startup,
193 .disconnect = usb_wwan_disconnect, 241 .disconnect = usb_wwan_disconnect,
194 .release = usb_wwan_release, 242 .release = qc_release,
195#ifdef CONFIG_PM 243#ifdef CONFIG_PM
196 .suspend = usb_wwan_suspend, 244 .suspend = usb_wwan_suspend,
197 .resume = usb_wwan_resume, 245 .resume = usb_wwan_resume,
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c
index cb8195cabfde..74cd4ccdb3fc 100644
--- a/drivers/usb/serial/siemens_mpi.c
+++ b/drivers/usb/serial/siemens_mpi.c
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = {
42 .name = "siemens_mpi", 42 .name = "siemens_mpi",
43 }, 43 },
44 .id_table = id_table, 44 .id_table = id_table,
45 .usb_driver = &siemens_usb_mpi_driver,
45 .num_ports = 1, 46 .num_ports = 1,
46}; 47};
47 48
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d47b56e9e8ce..d5d136a53b61 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -301,6 +301,9 @@ static const struct usb_device_id id_table[] = {
301 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ 301 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
302 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist 302 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
303 }, 303 },
304 { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */
305 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
306 },
304 { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ 307 { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */
305 308
306 { } 309 { }
@@ -373,7 +376,10 @@ static int sierra_send_setup(struct usb_serial_port *port)
373 if (!do_send) 376 if (!do_send)
374 return 0; 377 return 0;
375 378
376 usb_autopm_get_interface(serial->interface); 379 retval = usb_autopm_get_interface(serial->interface);
380 if (retval < 0)
381 return retval;
382
377 retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 383 retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
378 0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT); 384 0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT);
379 usb_autopm_put_interface(serial->interface); 385 usb_autopm_put_interface(serial->interface);
@@ -389,7 +395,7 @@ static void sierra_set_termios(struct tty_struct *tty,
389 sierra_send_setup(port); 395 sierra_send_setup(port);
390} 396}
391 397
392static int sierra_tiocmget(struct tty_struct *tty, struct file *file) 398static int sierra_tiocmget(struct tty_struct *tty)
393{ 399{
394 struct usb_serial_port *port = tty->driver_data; 400 struct usb_serial_port *port = tty->driver_data;
395 unsigned int value; 401 unsigned int value;
@@ -408,7 +414,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file)
408 return value; 414 return value;
409} 415}
410 416
411static int sierra_tiocmset(struct tty_struct *tty, struct file *file, 417static int sierra_tiocmset(struct tty_struct *tty,
412 unsigned int set, unsigned int clear) 418 unsigned int set, unsigned int clear)
413{ 419{
414 struct usb_serial_port *port = tty->driver_data; 420 struct usb_serial_port *port = tty->driver_data;
@@ -620,8 +626,6 @@ static void sierra_indat_callback(struct urb *urb)
620 dev_err(&port->dev, "resubmit read urb failed." 626 dev_err(&port->dev, "resubmit read urb failed."
621 "(%d)\n", err); 627 "(%d)\n", err);
622 } 628 }
623
624 return;
625} 629}
626 630
627static void sierra_instat_callback(struct urb *urb) 631static void sierra_instat_callback(struct urb *urb)
@@ -810,8 +814,12 @@ static void sierra_close(struct usb_serial_port *port)
810 mutex_lock(&serial->disc_mutex); 814 mutex_lock(&serial->disc_mutex);
811 if (!serial->disconnected) { 815 if (!serial->disconnected) {
812 serial->interface->needs_remote_wakeup = 0; 816 serial->interface->needs_remote_wakeup = 0;
813 usb_autopm_get_interface(serial->interface); 817 /* odd error handling due to pm counters */
814 sierra_send_setup(port); 818 if (!usb_autopm_get_interface(serial->interface))
819 sierra_send_setup(port);
820 else
821 usb_autopm_get_interface_no_resume(serial->interface);
822
815 } 823 }
816 mutex_unlock(&serial->disc_mutex); 824 mutex_unlock(&serial->disc_mutex);
817 spin_lock_irq(&intfdata->susp_lock); 825 spin_lock_irq(&intfdata->susp_lock);
@@ -864,7 +872,8 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port)
864 /* get rid of everything as in close */ 872 /* get rid of everything as in close */
865 sierra_close(port); 873 sierra_close(port);
866 /* restore balance for autopm */ 874 /* restore balance for autopm */
867 usb_autopm_put_interface(serial->interface); 875 if (!serial->disconnected)
876 usb_autopm_put_interface(serial->interface);
868 return err; 877 return err;
869 } 878 }
870 sierra_send_setup(port); 879 sierra_send_setup(port);
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 329d311a35d9..180ea6c7911c 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg {
133 133
134/* how come ??? */ 134/* how come ??? */
135#define UART_STATE 0x08 135#define UART_STATE 0x08
136#define UART_STATE_TRANSIENT_MASK 0x74 136#define UART_STATE_TRANSIENT_MASK 0x75
137#define UART_DCD 0x01 137#define UART_DCD 0x01
138#define UART_DSR 0x02 138#define UART_DSR 0x02
139#define UART_BREAK_ERROR 0x04 139#define UART_BREAK_ERROR 0x04
@@ -441,7 +441,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
441 spcp8x5_set_workMode(serial->dev, 0x000a, 441 spcp8x5_set_workMode(serial->dev, 0x000a,
442 SET_WORKING_MODE_U2C, priv->type); 442 SET_WORKING_MODE_U2C, priv->type);
443 } 443 }
444 return;
445} 444}
446 445
447/* open the serial port. do some usb system call. set termios and get the line 446/* open the serial port. do some usb system call. set termios and get the line
@@ -526,6 +525,10 @@ static void spcp8x5_process_read_urb(struct urb *urb)
526 /* overrun is special, not associated with a char */ 525 /* overrun is special, not associated with a char */
527 if (status & UART_OVERRUN_ERROR) 526 if (status & UART_OVERRUN_ERROR)
528 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 527 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
528
529 if (status & UART_DCD)
530 usb_serial_handle_dcd_change(port, tty,
531 priv->line_status & MSR_STATUS_LINE_DCD);
529 } 532 }
530 533
531 tty_insert_flip_string_fixed_flag(tty, data, tty_flag, 534 tty_insert_flip_string_fixed_flag(tty, data, tty_flag,
@@ -573,7 +576,7 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port,
573 return 0; 576 return 0;
574} 577}
575 578
576static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file, 579static int spcp8x5_ioctl(struct tty_struct *tty,
577 unsigned int cmd, unsigned long arg) 580 unsigned int cmd, unsigned long arg)
578{ 581{
579 struct usb_serial_port *port = tty->driver_data; 582 struct usb_serial_port *port = tty->driver_data;
@@ -592,7 +595,7 @@ static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file,
592 return -ENOIOCTLCMD; 595 return -ENOIOCTLCMD;
593} 596}
594 597
595static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file, 598static int spcp8x5_tiocmset(struct tty_struct *tty,
596 unsigned int set, unsigned int clear) 599 unsigned int set, unsigned int clear)
597{ 600{
598 struct usb_serial_port *port = tty->driver_data; 601 struct usb_serial_port *port = tty->driver_data;
@@ -615,7 +618,7 @@ static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file,
615 return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type); 618 return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type);
616} 619}
617 620
618static int spcp8x5_tiocmget(struct tty_struct *tty, struct file *file) 621static int spcp8x5_tiocmget(struct tty_struct *tty)
619{ 622{
620 struct usb_serial_port *port = tty->driver_data; 623 struct usb_serial_port *port = tty->driver_data;
621 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 624 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
@@ -646,6 +649,7 @@ static struct usb_serial_driver spcp8x5_device = {
646 .name = "SPCP8x5", 649 .name = "SPCP8x5",
647 }, 650 },
648 .id_table = id_table, 651 .id_table = id_table,
652 .usb_driver = &spcp8x5_driver,
649 .num_ports = 1, 653 .num_ports = 1,
650 .open = spcp8x5_open, 654 .open = spcp8x5_open,
651 .dtr_rts = spcp8x5_dtr_rts, 655 .dtr_rts = spcp8x5_dtr_rts,
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index e986002b3844..87362e48796e 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -79,7 +79,6 @@ struct ssu100_port_private {
79 u8 shadowLSR; 79 u8 shadowLSR;
80 u8 shadowMSR; 80 u8 shadowMSR;
81 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 81 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
82 unsigned short max_packet_size;
83 struct async_icount icount; 82 struct async_icount icount;
84}; 83};
85 84
@@ -416,12 +415,34 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
416 return 0; 415 return 0;
417} 416}
418 417
419static int ssu100_ioctl(struct tty_struct *tty, struct file *file, 418static int ssu100_get_icount(struct tty_struct *tty,
420 unsigned int cmd, unsigned long arg) 419 struct serial_icounter_struct *icount)
421{ 420{
422 struct usb_serial_port *port = tty->driver_data; 421 struct usb_serial_port *port = tty->driver_data;
423 struct ssu100_port_private *priv = usb_get_serial_port_data(port); 422 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
424 void __user *user_arg = (void __user *)arg; 423 struct async_icount cnow = priv->icount;
424
425 icount->cts = cnow.cts;
426 icount->dsr = cnow.dsr;
427 icount->rng = cnow.rng;
428 icount->dcd = cnow.dcd;
429 icount->rx = cnow.rx;
430 icount->tx = cnow.tx;
431 icount->frame = cnow.frame;
432 icount->overrun = cnow.overrun;
433 icount->parity = cnow.parity;
434 icount->brk = cnow.brk;
435 icount->buf_overrun = cnow.buf_overrun;
436
437 return 0;
438}
439
440
441
442static int ssu100_ioctl(struct tty_struct *tty,
443 unsigned int cmd, unsigned long arg)
444{
445 struct usb_serial_port *port = tty->driver_data;
425 446
426 dbg("%s cmd 0x%04x", __func__, cmd); 447 dbg("%s cmd 0x%04x", __func__, cmd);
427 448
@@ -433,27 +454,6 @@ static int ssu100_ioctl(struct tty_struct *tty, struct file *file,
433 case TIOCMIWAIT: 454 case TIOCMIWAIT:
434 return wait_modem_info(port, arg); 455 return wait_modem_info(port, arg);
435 456
436 case TIOCGICOUNT:
437 {
438 struct serial_icounter_struct icount;
439 struct async_icount cnow = priv->icount;
440 memset(&icount, 0, sizeof(icount));
441 icount.cts = cnow.cts;
442 icount.dsr = cnow.dsr;
443 icount.rng = cnow.rng;
444 icount.dcd = cnow.dcd;
445 icount.rx = cnow.rx;
446 icount.tx = cnow.tx;
447 icount.frame = cnow.frame;
448 icount.overrun = cnow.overrun;
449 icount.parity = cnow.parity;
450 icount.brk = cnow.brk;
451 icount.buf_overrun = cnow.buf_overrun;
452 if (copy_to_user(user_arg, &icount, sizeof(icount)))
453 return -EFAULT;
454 return 0;
455 }
456
457 default: 457 default:
458 break; 458 break;
459 } 459 }
@@ -463,36 +463,6 @@ static int ssu100_ioctl(struct tty_struct *tty, struct file *file,
463 return -ENOIOCTLCMD; 463 return -ENOIOCTLCMD;
464} 464}
465 465
466static void ssu100_set_max_packet_size(struct usb_serial_port *port)
467{
468 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
469 struct usb_serial *serial = port->serial;
470 struct usb_device *udev = serial->dev;
471
472 struct usb_interface *interface = serial->interface;
473 struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc;
474
475 unsigned num_endpoints;
476 int i;
477 unsigned long flags;
478
479 num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
480 dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
481
482 for (i = 0; i < num_endpoints; i++) {
483 dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1,
484 interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
485 ep_desc = &interface->cur_altsetting->endpoint[i].desc;
486 }
487
488 /* set max packet size based on descriptor */
489 spin_lock_irqsave(&priv->status_lock, flags);
490 priv->max_packet_size = ep_desc->wMaxPacketSize;
491 spin_unlock_irqrestore(&priv->status_lock, flags);
492
493 dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
494}
495
496static int ssu100_attach(struct usb_serial *serial) 466static int ssu100_attach(struct usb_serial *serial)
497{ 467{
498 struct ssu100_port_private *priv; 468 struct ssu100_port_private *priv;
@@ -510,12 +480,11 @@ static int ssu100_attach(struct usb_serial *serial)
510 spin_lock_init(&priv->status_lock); 480 spin_lock_init(&priv->status_lock);
511 init_waitqueue_head(&priv->delta_msr_wait); 481 init_waitqueue_head(&priv->delta_msr_wait);
512 usb_set_serial_port_data(port, priv); 482 usb_set_serial_port_data(port, priv);
513 ssu100_set_max_packet_size(port);
514 483
515 return ssu100_initdevice(serial->dev); 484 return ssu100_initdevice(serial->dev);
516} 485}
517 486
518static int ssu100_tiocmget(struct tty_struct *tty, struct file *file) 487static int ssu100_tiocmget(struct tty_struct *tty)
519{ 488{
520 struct usb_serial_port *port = tty->driver_data; 489 struct usb_serial_port *port = tty->driver_data;
521 struct usb_device *dev = port->serial->dev; 490 struct usb_device *dev = port->serial->dev;
@@ -548,7 +517,7 @@ mget_out:
548 return r; 517 return r;
549} 518}
550 519
551static int ssu100_tiocmset(struct tty_struct *tty, struct file *file, 520static int ssu100_tiocmset(struct tty_struct *tty,
552 unsigned int set, unsigned int clear) 521 unsigned int set, unsigned int clear)
553{ 522{
554 struct usb_serial_port *port = tty->driver_data; 523 struct usb_serial_port *port = tty->driver_data;
@@ -640,13 +609,14 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
640 609
641} 610}
642 611
643static int ssu100_process_packet(struct tty_struct *tty, 612static int ssu100_process_packet(struct urb *urb,
644 struct usb_serial_port *port, 613 struct tty_struct *tty)
645 struct ssu100_port_private *priv,
646 char *packet, int len)
647{ 614{
648 int i; 615 struct usb_serial_port *port = urb->context;
616 char *packet = (char *)urb->transfer_buffer;
649 char flag = TTY_NORMAL; 617 char flag = TTY_NORMAL;
618 u32 len = urb->actual_length;
619 int i;
650 char *ch; 620 char *ch;
651 621
652 dbg("%s - port %d", __func__, port->number); 622 dbg("%s - port %d", __func__, port->number);
@@ -684,12 +654,8 @@ static int ssu100_process_packet(struct tty_struct *tty,
684static void ssu100_process_read_urb(struct urb *urb) 654static void ssu100_process_read_urb(struct urb *urb)
685{ 655{
686 struct usb_serial_port *port = urb->context; 656 struct usb_serial_port *port = urb->context;
687 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
688 char *data = (char *)urb->transfer_buffer;
689 struct tty_struct *tty; 657 struct tty_struct *tty;
690 int count = 0; 658 int count;
691 int i;
692 int len;
693 659
694 dbg("%s", __func__); 660 dbg("%s", __func__);
695 661
@@ -697,10 +663,7 @@ static void ssu100_process_read_urb(struct urb *urb)
697 if (!tty) 663 if (!tty)
698 return; 664 return;
699 665
700 for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { 666 count = ssu100_process_packet(urb, tty);
701 len = min_t(int, urb->actual_length - i, priv->max_packet_size);
702 count += ssu100_process_packet(tty, port, priv, &data[i], len);
703 }
704 667
705 if (count) 668 if (count)
706 tty_flip_buffer_push(tty); 669 tty_flip_buffer_push(tty);
@@ -716,8 +679,6 @@ static struct usb_serial_driver ssu100_device = {
716 .id_table = id_table, 679 .id_table = id_table,
717 .usb_driver = &ssu100_driver, 680 .usb_driver = &ssu100_driver,
718 .num_ports = 1, 681 .num_ports = 1,
719 .bulk_in_size = 256,
720 .bulk_out_size = 256,
721 .open = ssu100_open, 682 .open = ssu100_open,
722 .close = ssu100_close, 683 .close = ssu100_close,
723 .attach = ssu100_attach, 684 .attach = ssu100_attach,
@@ -726,6 +687,7 @@ static struct usb_serial_driver ssu100_device = {
726 .process_read_urb = ssu100_process_read_urb, 687 .process_read_urb = ssu100_process_read_urb,
727 .tiocmget = ssu100_tiocmget, 688 .tiocmget = ssu100_tiocmget,
728 .tiocmset = ssu100_tiocmset, 689 .tiocmset = ssu100_tiocmset,
690 .get_icount = ssu100_get_icount,
729 .ioctl = ssu100_ioctl, 691 .ioctl = ssu100_ioctl,
730 .set_termios = ssu100_set_termios, 692 .set_termios = ssu100_set_termios,
731 .disconnect = usb_serial_generic_disconnect, 693 .disconnect = usb_serial_generic_disconnect,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 90979a1f5311..ea8445689c85 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -106,12 +106,14 @@ static int ti_write_room(struct tty_struct *tty);
106static int ti_chars_in_buffer(struct tty_struct *tty); 106static int ti_chars_in_buffer(struct tty_struct *tty);
107static void ti_throttle(struct tty_struct *tty); 107static void ti_throttle(struct tty_struct *tty);
108static void ti_unthrottle(struct tty_struct *tty); 108static void ti_unthrottle(struct tty_struct *tty);
109static int ti_ioctl(struct tty_struct *tty, struct file *file, 109static int ti_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
111static int ti_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount);
111static void ti_set_termios(struct tty_struct *tty, 113static void ti_set_termios(struct tty_struct *tty,
112 struct usb_serial_port *port, struct ktermios *old_termios); 114 struct usb_serial_port *port, struct ktermios *old_termios);
113static int ti_tiocmget(struct tty_struct *tty, struct file *file); 115static int ti_tiocmget(struct tty_struct *tty);
114static int ti_tiocmset(struct tty_struct *tty, struct file *file, 116static int ti_tiocmset(struct tty_struct *tty,
115 unsigned int set, unsigned int clear); 117 unsigned int set, unsigned int clear);
116static void ti_break(struct tty_struct *tty, int break_state); 118static void ti_break(struct tty_struct *tty, int break_state);
117static void ti_interrupt_callback(struct urb *urb); 119static void ti_interrupt_callback(struct urb *urb);
@@ -237,6 +239,7 @@ static struct usb_serial_driver ti_1port_device = {
237 .set_termios = ti_set_termios, 239 .set_termios = ti_set_termios,
238 .tiocmget = ti_tiocmget, 240 .tiocmget = ti_tiocmget,
239 .tiocmset = ti_tiocmset, 241 .tiocmset = ti_tiocmset,
242 .get_icount = ti_get_icount,
240 .break_ctl = ti_break, 243 .break_ctl = ti_break,
241 .read_int_callback = ti_interrupt_callback, 244 .read_int_callback = ti_interrupt_callback,
242 .read_bulk_callback = ti_bulk_in_callback, 245 .read_bulk_callback = ti_bulk_in_callback,
@@ -265,6 +268,7 @@ static struct usb_serial_driver ti_2port_device = {
265 .set_termios = ti_set_termios, 268 .set_termios = ti_set_termios,
266 .tiocmget = ti_tiocmget, 269 .tiocmget = ti_tiocmget,
267 .tiocmset = ti_tiocmset, 270 .tiocmset = ti_tiocmset,
271 .get_icount = ti_get_icount,
268 .break_ctl = ti_break, 272 .break_ctl = ti_break,
269 .read_int_callback = ti_interrupt_callback, 273 .read_int_callback = ti_interrupt_callback,
270 .read_bulk_callback = ti_bulk_in_callback, 274 .read_bulk_callback = ti_bulk_in_callback,
@@ -365,9 +369,9 @@ failed_1port:
365 369
366static void __exit ti_exit(void) 370static void __exit ti_exit(void)
367{ 371{
372 usb_deregister(&ti_usb_driver);
368 usb_serial_deregister(&ti_1port_device); 373 usb_serial_deregister(&ti_1port_device);
369 usb_serial_deregister(&ti_2port_device); 374 usb_serial_deregister(&ti_2port_device);
370 usb_deregister(&ti_usb_driver);
371} 375}
372 376
373 377
@@ -788,8 +792,33 @@ static void ti_unthrottle(struct tty_struct *tty)
788 } 792 }
789} 793}
790 794
795static int ti_get_icount(struct tty_struct *tty,
796 struct serial_icounter_struct *icount)
797{
798 struct usb_serial_port *port = tty->driver_data;
799 struct ti_port *tport = usb_get_serial_port_data(port);
800 struct async_icount cnow = tport->tp_icount;
801
802 dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d",
803 __func__, port->number,
804 cnow.rx, cnow.tx);
805
806 icount->cts = cnow.cts;
807 icount->dsr = cnow.dsr;
808 icount->rng = cnow.rng;
809 icount->dcd = cnow.dcd;
810 icount->rx = cnow.rx;
811 icount->tx = cnow.tx;
812 icount->frame = cnow.frame;
813 icount->overrun = cnow.overrun;
814 icount->parity = cnow.parity;
815 icount->brk = cnow.brk;
816 icount->buf_overrun = cnow.buf_overrun;
791 817
792static int ti_ioctl(struct tty_struct *tty, struct file *file, 818 return 0;
819}
820
821static int ti_ioctl(struct tty_struct *tty,
793 unsigned int cmd, unsigned long arg) 822 unsigned int cmd, unsigned long arg)
794{ 823{
795 struct usb_serial_port *port = tty->driver_data; 824 struct usb_serial_port *port = tty->driver_data;
@@ -830,14 +859,6 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file,
830 cprev = cnow; 859 cprev = cnow;
831 } 860 }
832 break; 861 break;
833 case TIOCGICOUNT:
834 dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d",
835 __func__, port->number,
836 tport->tp_icount.rx, tport->tp_icount.tx);
837 if (copy_to_user((void __user *)arg, &tport->tp_icount,
838 sizeof(tport->tp_icount)))
839 return -EFAULT;
840 return 0;
841 } 862 }
842 return -ENOIOCTLCMD; 863 return -ENOIOCTLCMD;
843} 864}
@@ -979,7 +1000,7 @@ static void ti_set_termios(struct tty_struct *tty,
979} 1000}
980 1001
981 1002
982static int ti_tiocmget(struct tty_struct *tty, struct file *file) 1003static int ti_tiocmget(struct tty_struct *tty)
983{ 1004{
984 struct usb_serial_port *port = tty->driver_data; 1005 struct usb_serial_port *port = tty->driver_data;
985 struct ti_port *tport = usb_get_serial_port_data(port); 1006 struct ti_port *tport = usb_get_serial_port_data(port);
@@ -1012,8 +1033,8 @@ static int ti_tiocmget(struct tty_struct *tty, struct file *file)
1012} 1033}
1013 1034
1014 1035
1015static int ti_tiocmset(struct tty_struct *tty, struct file *file, 1036static int ti_tiocmset(struct tty_struct *tty,
1016 unsigned int set, unsigned int clear) 1037 unsigned int set, unsigned int clear)
1017{ 1038{
1018 struct usb_serial_port *port = tty->driver_data; 1039 struct usb_serial_port *port = tty->driver_data;
1019 struct ti_port *tport = usb_get_serial_port_data(port); 1040 struct ti_port *tport = usb_get_serial_port_data(port);
@@ -1724,6 +1745,7 @@ static int ti_download_firmware(struct ti_device *tdev)
1724 } 1745 }
1725 if (fw_p->size > TI_FIRMWARE_BUF_SIZE) { 1746 if (fw_p->size > TI_FIRMWARE_BUF_SIZE) {
1726 dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size); 1747 dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size);
1748 release_firmware(fw_p);
1727 return -ENOENT; 1749 return -ENOENT;
1728 } 1750 }
1729 1751
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 7a2177c79bde..1c031309ab25 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -21,7 +21,6 @@
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/smp_lock.h>
25#include <linux/tty.h> 24#include <linux/tty.h>
26#include <linux/tty_driver.h> 25#include <linux/tty_driver.h>
27#include <linux/tty_flip.h> 26#include <linux/tty_flip.h>
@@ -52,6 +51,7 @@ static struct usb_driver usb_serial_driver = {
52 .suspend = usb_serial_suspend, 51 .suspend = usb_serial_suspend,
53 .resume = usb_serial_resume, 52 .resume = usb_serial_resume,
54 .no_dynamic_id = 1, 53 .no_dynamic_id = 1,
54 .supports_autosuspend = 1,
55}; 55};
56 56
57/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead 57/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead
@@ -406,7 +406,7 @@ static void serial_unthrottle(struct tty_struct *tty)
406 port->serial->type->unthrottle(tty); 406 port->serial->type->unthrottle(tty);
407} 407}
408 408
409static int serial_ioctl(struct tty_struct *tty, struct file *file, 409static int serial_ioctl(struct tty_struct *tty,
410 unsigned int cmd, unsigned long arg) 410 unsigned int cmd, unsigned long arg)
411{ 411{
412 struct usb_serial_port *port = tty->driver_data; 412 struct usb_serial_port *port = tty->driver_data;
@@ -417,7 +417,7 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file,
417 /* pass on to the driver specific version of this function 417 /* pass on to the driver specific version of this function
418 if it is available */ 418 if it is available */
419 if (port->serial->type->ioctl) { 419 if (port->serial->type->ioctl) {
420 retval = port->serial->type->ioctl(tty, file, cmd, arg); 420 retval = port->serial->type->ioctl(tty, cmd, arg);
421 } else 421 } else
422 retval = -ENOIOCTLCMD; 422 retval = -ENOIOCTLCMD;
423 return retval; 423 return retval;
@@ -496,18 +496,18 @@ static const struct file_operations serial_proc_fops = {
496 .release = single_release, 496 .release = single_release,
497}; 497};
498 498
499static int serial_tiocmget(struct tty_struct *tty, struct file *file) 499static int serial_tiocmget(struct tty_struct *tty)
500{ 500{
501 struct usb_serial_port *port = tty->driver_data; 501 struct usb_serial_port *port = tty->driver_data;
502 502
503 dbg("%s - port %d", __func__, port->number); 503 dbg("%s - port %d", __func__, port->number);
504 504
505 if (port->serial->type->tiocmget) 505 if (port->serial->type->tiocmget)
506 return port->serial->type->tiocmget(tty, file); 506 return port->serial->type->tiocmget(tty);
507 return -EINVAL; 507 return -EINVAL;
508} 508}
509 509
510static int serial_tiocmset(struct tty_struct *tty, struct file *file, 510static int serial_tiocmset(struct tty_struct *tty,
511 unsigned int set, unsigned int clear) 511 unsigned int set, unsigned int clear)
512{ 512{
513 struct usb_serial_port *port = tty->driver_data; 513 struct usb_serial_port *port = tty->driver_data;
@@ -515,7 +515,19 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file,
515 dbg("%s - port %d", __func__, port->number); 515 dbg("%s - port %d", __func__, port->number);
516 516
517 if (port->serial->type->tiocmset) 517 if (port->serial->type->tiocmset)
518 return port->serial->type->tiocmset(tty, file, set, clear); 518 return port->serial->type->tiocmset(tty, set, clear);
519 return -EINVAL;
520}
521
522static int serial_get_icount(struct tty_struct *tty,
523 struct serial_icounter_struct *icount)
524{
525 struct usb_serial_port *port = tty->driver_data;
526
527 dbg("%s - port %d", __func__, port->number);
528
529 if (port->serial->type->get_icount)
530 return port->serial->type->get_icount(tty, icount);
519 return -EINVAL; 531 return -EINVAL;
520} 532}
521 533
@@ -899,9 +911,8 @@ int usb_serial_probe(struct usb_interface *interface,
899 dev_err(&interface->dev, "No free urbs available\n"); 911 dev_err(&interface->dev, "No free urbs available\n");
900 goto probe_error; 912 goto probe_error;
901 } 913 }
902 buffer_size = serial->type->bulk_in_size; 914 buffer_size = max_t(int, serial->type->bulk_in_size,
903 if (!buffer_size) 915 le16_to_cpu(endpoint->wMaxPacketSize));
904 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
905 port->bulk_in_size = buffer_size; 916 port->bulk_in_size = buffer_size;
906 port->bulk_in_endpointAddress = endpoint->bEndpointAddress; 917 port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
907 port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); 918 port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
@@ -1195,6 +1206,7 @@ static const struct tty_operations serial_ops = {
1195 .chars_in_buffer = serial_chars_in_buffer, 1206 .chars_in_buffer = serial_chars_in_buffer,
1196 .tiocmget = serial_tiocmget, 1207 .tiocmget = serial_tiocmget,
1197 .tiocmset = serial_tiocmset, 1208 .tiocmset = serial_tiocmset,
1209 .get_icount = serial_get_icount,
1198 .cleanup = serial_cleanup, 1210 .cleanup = serial_cleanup,
1199 .install = serial_install, 1211 .install = serial_install,
1200 .proc_fops = &serial_proc_fops, 1212 .proc_fops = &serial_proc_fops,
@@ -1334,6 +1346,12 @@ int usb_serial_register(struct usb_serial_driver *driver)
1334 1346
1335 if (!driver->description) 1347 if (!driver->description)
1336 driver->description = driver->driver.name; 1348 driver->description = driver->driver.name;
1349 if (!driver->usb_driver) {
1350 WARN(1, "Serial driver %s has no usb_driver\n",
1351 driver->description);
1352 return -EINVAL;
1353 }
1354 driver->usb_driver->supports_autosuspend = 1;
1337 1355
1338 /* Add this device to our list of devices */ 1356 /* Add this device to our list of devices */
1339 mutex_lock(&table_lock); 1357 mutex_lock(&table_lock);
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index 2be298a1305b..c47b6ec03063 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -15,9 +15,11 @@ extern int usb_wwan_write_room(struct tty_struct *tty);
15extern void usb_wwan_set_termios(struct tty_struct *tty, 15extern void usb_wwan_set_termios(struct tty_struct *tty,
16 struct usb_serial_port *port, 16 struct usb_serial_port *port,
17 struct ktermios *old); 17 struct ktermios *old);
18extern int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file); 18extern int usb_wwan_tiocmget(struct tty_struct *tty);
19extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, 19extern int usb_wwan_tiocmset(struct tty_struct *tty,
20 unsigned int set, unsigned int clear); 20 unsigned int set, unsigned int clear);
21extern int usb_wwan_ioctl(struct tty_struct *tty,
22 unsigned int cmd, unsigned long arg);
21extern int usb_wwan_send_setup(struct usb_serial_port *port); 23extern int usb_wwan_send_setup(struct usb_serial_port *port);
22extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, 24extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
23 const unsigned char *buf, int count); 25 const unsigned char *buf, int count);
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index f2ed6a31be77..95a82148ee81 100644
--- a/drivers/usb/serial/usb_debug.c
+++ b/drivers/usb/serial/usb_debug.c
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = {
75 .name = "debug", 75 .name = "debug",
76 }, 76 },
77 .id_table = id_table, 77 .id_table = id_table,
78 .usb_driver = &debug_driver,
78 .num_ports = 1, 79 .num_ports = 1,
79 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, 80 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE,
80 .break_ctl = usb_debug_break_ctl, 81 .break_ctl = usb_debug_break_ctl,
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 0c70b4a621bb..e4fad5e643d7 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -31,8 +31,10 @@
31#include <linux/tty_flip.h> 31#include <linux/tty_flip.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/bitops.h> 33#include <linux/bitops.h>
34#include <linux/uaccess.h>
34#include <linux/usb.h> 35#include <linux/usb.h>
35#include <linux/usb/serial.h> 36#include <linux/usb/serial.h>
37#include <linux/serial.h>
36#include "usb-wwan.h" 38#include "usb-wwan.h"
37 39
38static int debug; 40static int debug;
@@ -77,7 +79,7 @@ void usb_wwan_set_termios(struct tty_struct *tty,
77} 79}
78EXPORT_SYMBOL(usb_wwan_set_termios); 80EXPORT_SYMBOL(usb_wwan_set_termios);
79 81
80int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file) 82int usb_wwan_tiocmget(struct tty_struct *tty)
81{ 83{
82 struct usb_serial_port *port = tty->driver_data; 84 struct usb_serial_port *port = tty->driver_data;
83 unsigned int value; 85 unsigned int value;
@@ -96,7 +98,7 @@ int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file)
96} 98}
97EXPORT_SYMBOL(usb_wwan_tiocmget); 99EXPORT_SYMBOL(usb_wwan_tiocmget);
98 100
99int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, 101int usb_wwan_tiocmset(struct tty_struct *tty,
100 unsigned int set, unsigned int clear) 102 unsigned int set, unsigned int clear)
101{ 103{
102 struct usb_serial_port *port = tty->driver_data; 104 struct usb_serial_port *port = tty->driver_data;
@@ -123,6 +125,83 @@ int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file,
123} 125}
124EXPORT_SYMBOL(usb_wwan_tiocmset); 126EXPORT_SYMBOL(usb_wwan_tiocmset);
125 127
128static int get_serial_info(struct usb_serial_port *port,
129 struct serial_struct __user *retinfo)
130{
131 struct serial_struct tmp;
132
133 if (!retinfo)
134 return -EFAULT;
135
136 memset(&tmp, 0, sizeof(tmp));
137 tmp.line = port->serial->minor;
138 tmp.port = port->number;
139 tmp.baud_base = tty_get_baud_rate(port->port.tty);
140 tmp.close_delay = port->port.close_delay / 10;
141 tmp.closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
142 ASYNC_CLOSING_WAIT_NONE :
143 port->port.closing_wait / 10;
144
145 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
146 return -EFAULT;
147 return 0;
148}
149
150static int set_serial_info(struct usb_serial_port *port,
151 struct serial_struct __user *newinfo)
152{
153 struct serial_struct new_serial;
154 unsigned int closing_wait, close_delay;
155 int retval = 0;
156
157 if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
158 return -EFAULT;
159
160 close_delay = new_serial.close_delay * 10;
161 closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
162 ASYNC_CLOSING_WAIT_NONE : new_serial.closing_wait * 10;
163
164 mutex_lock(&port->port.mutex);
165
166 if (!capable(CAP_SYS_ADMIN)) {
167 if ((close_delay != port->port.close_delay) ||
168 (closing_wait != port->port.closing_wait))
169 retval = -EPERM;
170 else
171 retval = -EOPNOTSUPP;
172 } else {
173 port->port.close_delay = close_delay;
174 port->port.closing_wait = closing_wait;
175 }
176
177 mutex_unlock(&port->port.mutex);
178 return retval;
179}
180
181int usb_wwan_ioctl(struct tty_struct *tty,
182 unsigned int cmd, unsigned long arg)
183{
184 struct usb_serial_port *port = tty->driver_data;
185
186 dbg("%s cmd 0x%04x", __func__, cmd);
187
188 switch (cmd) {
189 case TIOCGSERIAL:
190 return get_serial_info(port,
191 (struct serial_struct __user *) arg);
192 case TIOCSSERIAL:
193 return set_serial_info(port,
194 (struct serial_struct __user *) arg);
195 default:
196 break;
197 }
198
199 dbg("%s arg not supported", __func__);
200
201 return -ENOIOCTLCMD;
202}
203EXPORT_SYMBOL(usb_wwan_ioctl);
204
126/* Write */ 205/* Write */
127int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, 206int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
128 const unsigned char *buf, int count) 207 const unsigned char *buf, int count)
@@ -182,7 +261,8 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
182 intfdata->in_flight--; 261 intfdata->in_flight--;
183 spin_unlock_irqrestore(&intfdata->susp_lock, 262 spin_unlock_irqrestore(&intfdata->susp_lock,
184 flags); 263 flags);
185 continue; 264 usb_autopm_put_interface_async(port->serial->interface);
265 break;
186 } 266 }
187 } 267 }
188 268
@@ -216,25 +296,32 @@ static void usb_wwan_indat_callback(struct urb *urb)
216 __func__, status, endpoint); 296 __func__, status, endpoint);
217 } else { 297 } else {
218 tty = tty_port_tty_get(&port->port); 298 tty = tty_port_tty_get(&port->port);
219 if (urb->actual_length) { 299 if (tty) {
220 tty_insert_flip_string(tty, data, urb->actual_length); 300 if (urb->actual_length) {
221 tty_flip_buffer_push(tty); 301 tty_insert_flip_string(tty, data,
222 } else 302 urb->actual_length);
223 dbg("%s: empty read urb received", __func__); 303 tty_flip_buffer_push(tty);
224 tty_kref_put(tty); 304 } else
305 dbg("%s: empty read urb received", __func__);
306 tty_kref_put(tty);
307 }
225 308
226 /* Resubmit urb so we continue receiving */ 309 /* Resubmit urb so we continue receiving */
227 if (status != -ESHUTDOWN) { 310 if (status != -ESHUTDOWN) {
228 err = usb_submit_urb(urb, GFP_ATOMIC); 311 err = usb_submit_urb(urb, GFP_ATOMIC);
229 if (err && err != -EPERM) 312 if (err) {
230 printk(KERN_ERR "%s: resubmit read urb failed. " 313 if (err != -EPERM) {
231 "(%d)", __func__, err); 314 printk(KERN_ERR "%s: resubmit read urb failed. "
232 else 315 "(%d)", __func__, err);
316 /* busy also in error unless we are killed */
317 usb_mark_last_busy(port->serial->dev);
318 }
319 } else {
233 usb_mark_last_busy(port->serial->dev); 320 usb_mark_last_busy(port->serial->dev);
321 }
234 } 322 }
235 323
236 } 324 }
237 return;
238} 325}
239 326
240static void usb_wwan_outdat_callback(struct urb *urb) 327static void usb_wwan_outdat_callback(struct urb *urb)
@@ -340,6 +427,7 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port)
340 spin_lock_irq(&intfdata->susp_lock); 427 spin_lock_irq(&intfdata->susp_lock);
341 portdata->opened = 1; 428 portdata->opened = 1;
342 spin_unlock_irq(&intfdata->susp_lock); 429 spin_unlock_irq(&intfdata->susp_lock);
430 /* this balances a get in the generic USB serial code */
343 usb_autopm_put_interface(serial->interface); 431 usb_autopm_put_interface(serial->interface);
344 432
345 return 0; 433 return 0;
@@ -366,7 +454,8 @@ void usb_wwan_close(struct usb_serial_port *port)
366 usb_kill_urb(portdata->in_urbs[i]); 454 usb_kill_urb(portdata->in_urbs[i]);
367 for (i = 0; i < N_OUT_URB; i++) 455 for (i = 0; i < N_OUT_URB; i++)
368 usb_kill_urb(portdata->out_urbs[i]); 456 usb_kill_urb(portdata->out_urbs[i]);
369 usb_autopm_get_interface(serial->interface); 457 /* balancing - important as an error cannot be handled*/
458 usb_autopm_get_interface_no_resume(serial->interface);
370 serial->interface->needs_remote_wakeup = 0; 459 serial->interface->needs_remote_wakeup = 0;
371 } 460 }
372} 461}
@@ -580,6 +669,18 @@ int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message)
580} 669}
581EXPORT_SYMBOL(usb_wwan_suspend); 670EXPORT_SYMBOL(usb_wwan_suspend);
582 671
672static void unbusy_queued_urb(struct urb *urb, struct usb_wwan_port_private *portdata)
673{
674 int i;
675
676 for (i = 0; i < N_OUT_URB; i++) {
677 if (urb == portdata->out_urbs[i]) {
678 clear_bit(i, &portdata->out_busy);
679 break;
680 }
681 }
682}
683
583static void play_delayed(struct usb_serial_port *port) 684static void play_delayed(struct usb_serial_port *port)
584{ 685{
585 struct usb_wwan_intf_private *data; 686 struct usb_wwan_intf_private *data;
@@ -591,8 +692,16 @@ static void play_delayed(struct usb_serial_port *port)
591 data = port->serial->private; 692 data = port->serial->private;
592 while ((urb = usb_get_from_anchor(&portdata->delayed))) { 693 while ((urb = usb_get_from_anchor(&portdata->delayed))) {
593 err = usb_submit_urb(urb, GFP_ATOMIC); 694 err = usb_submit_urb(urb, GFP_ATOMIC);
594 if (!err) 695 if (!err) {
595 data->in_flight++; 696 data->in_flight++;
697 } else {
698 /* we have to throw away the rest */
699 do {
700 unbusy_queued_urb(urb, portdata);
701 usb_autopm_put_interface_no_suspend(port->serial->interface);
702 } while ((urb = usb_get_from_anchor(&portdata->delayed)));
703 break;
704 }
596 } 705 }
597} 706}
598 707
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index eb76aaef4268..1c11959a7d58 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -27,6 +27,7 @@
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/usb/serial.h> 29#include <linux/usb/serial.h>
30#include <linux/usb/cdc.h>
30#include "visor.h" 31#include "visor.h"
31 32
32/* 33/*
@@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial,
479 480
480 dbg("%s", __func__); 481 dbg("%s", __func__);
481 482
483 /*
484 * some Samsung Android phones in modem mode have the same ID
485 * as SPH-I500, but they are ACM devices, so dont bind to them
486 */
487 if (id->idVendor == SAMSUNG_VENDOR_ID &&
488 id->idProduct == SAMSUNG_SPH_I500_ID &&
489 serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM &&
490 serial->dev->descriptor.bDeviceSubClass ==
491 USB_CDC_SUBCLASS_ACM)
492 return -ENODEV;
493
482 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 494 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
483 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", 495 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
484 serial->dev->actconfig->desc.bConfigurationValue); 496 serial->dev->actconfig->desc.bConfigurationValue);
@@ -606,6 +618,10 @@ static int treo_attach(struct usb_serial *serial)
606 618
607static int clie_5_attach(struct usb_serial *serial) 619static int clie_5_attach(struct usb_serial *serial)
608{ 620{
621 struct usb_serial_port *port;
622 unsigned int pipe;
623 int j;
624
609 dbg("%s", __func__); 625 dbg("%s", __func__);
610 626
611 /* TH55 registers 2 ports. 627 /* TH55 registers 2 ports.
@@ -621,9 +637,14 @@ static int clie_5_attach(struct usb_serial *serial)
621 return -1; 637 return -1;
622 638
623 /* port 0 now uses the modified endpoint Address */ 639 /* port 0 now uses the modified endpoint Address */
624 serial->port[0]->bulk_out_endpointAddress = 640 port = serial->port[0];
641 port->bulk_out_endpointAddress =
625 serial->port[1]->bulk_out_endpointAddress; 642 serial->port[1]->bulk_out_endpointAddress;
626 643
644 pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress);
645 for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j)
646 port->write_urbs[j]->pipe = pipe;
647
627 return 0; 648 return 0;
628} 649}
629 650
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 12ed8209ca72..5b073bcc807b 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -152,12 +152,12 @@ static int whiteheat_write(struct tty_struct *tty,
152 struct usb_serial_port *port, 152 struct usb_serial_port *port,
153 const unsigned char *buf, int count); 153 const unsigned char *buf, int count);
154static int whiteheat_write_room(struct tty_struct *tty); 154static int whiteheat_write_room(struct tty_struct *tty);
155static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, 155static int whiteheat_ioctl(struct tty_struct *tty,
156 unsigned int cmd, unsigned long arg); 156 unsigned int cmd, unsigned long arg);
157static void whiteheat_set_termios(struct tty_struct *tty, 157static void whiteheat_set_termios(struct tty_struct *tty,
158 struct usb_serial_port *port, struct ktermios *old); 158 struct usb_serial_port *port, struct ktermios *old);
159static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file); 159static int whiteheat_tiocmget(struct tty_struct *tty);
160static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, 160static int whiteheat_tiocmset(struct tty_struct *tty,
161 unsigned int set, unsigned int clear); 161 unsigned int set, unsigned int clear);
162static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); 162static void whiteheat_break_ctl(struct tty_struct *tty, int break_state);
163static int whiteheat_chars_in_buffer(struct tty_struct *tty); 163static int whiteheat_chars_in_buffer(struct tty_struct *tty);
@@ -655,8 +655,6 @@ static void whiteheat_release(struct usb_serial *serial)
655 } 655 }
656 kfree(info); 656 kfree(info);
657 } 657 }
658
659 return;
660} 658}
661 659
662static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) 660static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port)
@@ -835,7 +833,7 @@ static int whiteheat_write_room(struct tty_struct *tty)
835 return (room); 833 return (room);
836} 834}
837 835
838static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file) 836static int whiteheat_tiocmget(struct tty_struct *tty)
839{ 837{
840 struct usb_serial_port *port = tty->driver_data; 838 struct usb_serial_port *port = tty->driver_data;
841 struct whiteheat_private *info = usb_get_serial_port_data(port); 839 struct whiteheat_private *info = usb_get_serial_port_data(port);
@@ -852,7 +850,7 @@ static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file)
852 return modem_signals; 850 return modem_signals;
853} 851}
854 852
855static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, 853static int whiteheat_tiocmset(struct tty_struct *tty,
856 unsigned int set, unsigned int clear) 854 unsigned int set, unsigned int clear)
857{ 855{
858 struct usb_serial_port *port = tty->driver_data; 856 struct usb_serial_port *port = tty->driver_data;
@@ -876,7 +874,7 @@ static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file,
876} 874}
877 875
878 876
879static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, 877static int whiteheat_ioctl(struct tty_struct *tty,
880 unsigned int cmd, unsigned long arg) 878 unsigned int cmd, unsigned long arg)
881{ 879{
882 struct usb_serial_port *port = tty->driver_data; 880 struct usb_serial_port *port = tty->driver_data;
@@ -955,8 +953,6 @@ static void whiteheat_throttle(struct tty_struct *tty)
955 spin_lock_irq(&info->lock); 953 spin_lock_irq(&info->lock);
956 info->flags |= THROTTLED; 954 info->flags |= THROTTLED;
957 spin_unlock_irq(&info->lock); 955 spin_unlock_irq(&info->lock);
958
959 return;
960} 956}
961 957
962 958
@@ -975,8 +971,6 @@ static void whiteheat_unthrottle(struct tty_struct *tty)
975 971
976 if (actually_throttled) 972 if (actually_throttled)
977 rx_data_softint(&info->rx_work); 973 rx_data_softint(&info->rx_work);
978
979 return;
980} 974}
981 975
982 976