blob: 9879773fb39ea9afa54ecf66e9dde36b9ada513b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Matthew Garrett0d456192010-04-01 12:31:07 -04002/*
3 * Definitions for USB serial mobile broadband cards
4 */
5
6#ifndef __LINUX_USB_USB_WWAN
7#define __LINUX_USB_USB_WWAN
8
9extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
10extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
11extern void usb_wwan_close(struct usb_serial_port *port);
Johan Hovoldb8f0e822012-10-25 10:29:16 +020012extern int usb_wwan_port_probe(struct usb_serial_port *port);
Bjørn Morka1028f02012-07-27 01:11:41 +020013extern int usb_wwan_port_remove(struct usb_serial_port *port);
Matthew Garrett0d456192010-04-01 12:31:07 -040014extern int usb_wwan_write_room(struct tty_struct *tty);
Alan Cox60b33c12011-02-14 16:26:14 +000015extern int usb_wwan_tiocmget(struct tty_struct *tty);
Alan Cox20b9d172011-02-14 16:26:50 +000016extern int usb_wwan_tiocmset(struct tty_struct *tty,
Matthew Garrett0d456192010-04-01 12:31:07 -040017 unsigned int set, unsigned int clear);
Alan Cox00a0d0d2011-02-14 16:27:06 +000018extern int usb_wwan_ioctl(struct tty_struct *tty,
Dan Williams02303f72010-11-19 16:04:00 -060019 unsigned int cmd, unsigned long arg);
Matthew Garrett0d456192010-04-01 12:31:07 -040020extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
21 const unsigned char *buf, int count);
22extern int usb_wwan_chars_in_buffer(struct tty_struct *tty);
23#ifdef CONFIG_PM
24extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
25extern int usb_wwan_resume(struct usb_serial *serial);
26#endif
27
28/* per port private data */
29
30#define N_IN_URB 4
31#define N_OUT_URB 4
32#define IN_BUFLEN 4096
33#define OUT_BUFLEN 4096
34
35struct usb_wwan_intf_private {
36 spinlock_t susp_lock;
37 unsigned int suspended:1;
David Ward669e7292015-09-16 12:27:57 -040038 unsigned int use_send_setup:1;
Daniele Palmas3a56fda2019-12-19 11:07:07 +010039 unsigned int use_zlp:1;
Matthew Garrett0d456192010-04-01 12:31:07 -040040 int in_flight;
Johan Hovoldc1c01802014-05-26 19:23:20 +020041 unsigned int open_ports;
Matthew Garrett0d456192010-04-01 12:31:07 -040042 void *private;
43};
44
45struct 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 */
Matthew Garrett0d456192010-04-01 12:31:07 -040053 struct usb_anchor delayed;
54
55 /* Settings for the port */
56 int rts_state; /* Handshaking pins (outputs) */
57 int dtr_state;
58 int cts_state; /* Handshaking pins (inputs) */
59 int dsr_state;
60 int dcd_state;
61 int ri_state;
62
63 unsigned long tx_start_time[N_OUT_URB];
64};
65
66#endif /* __LINUX_USB_USB_WWAN */