Skip to content

Commit 0d45619

Browse files
Matthew Garrettgregkh
authored andcommitted
usb serial: Add generic USB wwan support
The generic USB serial code is ill-suited for high-speed USB wwan devices, resulting in the option driver. However, other non-option devices may also gain similar benefits from not using the generic code. Factorise out the non-option specific code from the option driver and make it available to other users. Signed-off-by: Matthew Garrett <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a903098 commit 0d45619

File tree

4 files changed

+736
-0
lines changed

4 files changed

+736
-0
lines changed

drivers/usb/serial/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,9 @@ config USB_SERIAL_XIRCOM
576576
To compile this driver as a module, choose M here: the
577577
module will be called keyspan_pda.
578578

579+
config USB_SERIAL_WWAN
580+
tristate
581+
579582
config USB_SERIAL_OPTION
580583
tristate "USB driver for GSM and CDMA modems"
581584
help

drivers/usb/serial/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI) += siemens_mpi.o
5252
obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o
5353
obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o
5454
obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o
55+
obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o
5556
obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o
5657
obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
5758
obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o

drivers/usb/serial/usb-wwan.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Definitions for USB serial mobile broadband cards
3+
*/
4+
5+
#ifndef __LINUX_USB_USB_WWAN
6+
#define __LINUX_USB_USB_WWAN
7+
8+
extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
9+
extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
10+
extern void usb_wwan_close(struct usb_serial_port *port);
11+
extern int usb_wwan_startup(struct usb_serial *serial);
12+
extern void usb_wwan_disconnect(struct usb_serial *serial);
13+
extern void usb_wwan_release(struct usb_serial *serial);
14+
extern int usb_wwan_write_room(struct tty_struct *tty);
15+
extern void usb_wwan_set_termios(struct tty_struct *tty,
16+
struct usb_serial_port *port,
17+
struct ktermios *old);
18+
extern int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file);
19+
extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file,
20+
unsigned int set, unsigned int clear);
21+
extern int usb_wwan_send_setup(struct usb_serial_port *port);
22+
extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
23+
const unsigned char *buf, int count);
24+
extern int usb_wwan_chars_in_buffer(struct tty_struct *tty);
25+
#ifdef CONFIG_PM
26+
extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
27+
extern int usb_wwan_resume(struct usb_serial *serial);
28+
#endif
29+
30+
/* per port private data */
31+
32+
#define N_IN_URB 4
33+
#define N_OUT_URB 4
34+
#define IN_BUFLEN 4096
35+
#define OUT_BUFLEN 4096
36+
37+
struct usb_wwan_intf_private {
38+
spinlock_t susp_lock;
39+
unsigned int suspended:1;
40+
int in_flight;
41+
int (*send_setup) (struct usb_serial_port *port);
42+
void *private;
43+
};
44+
45+
struct usb_wwan_port_private {
46+
/* Input endpoints and buffer for this port */
47+
struct urb *in_urbs[N_IN_URB];
48+
u8 *in_buffer[N_IN_URB];
49+
/* Output endpoints and buffer for this port */
50+
struct urb *out_urbs[N_OUT_URB];
51+
u8 *out_buffer[N_OUT_URB];
52+
unsigned long out_busy; /* Bit vector of URBs in use */
53+
int opened;
54+
struct usb_anchor delayed;
55+
56+
/* Settings for the port */
57+
int rts_state; /* Handshaking pins (outputs) */
58+
int dtr_state;
59+
int cts_state; /* Handshaking pins (inputs) */
60+
int dsr_state;
61+
int dcd_state;
62+
int ri_state;
63+
64+
unsigned long tx_start_time[N_OUT_URB];
65+
};
66+
67+
#endif /* __LINUX_USB_USB_WWAN */

0 commit comments

Comments
 (0)