xref: /openbmc/linux/drivers/usb/serial/usb-wwan.h (revision 02303f73373aa1da19dbec510ec5a4e2576f9610)
10d456194SMatthew Garrett /*
20d456194SMatthew Garrett  * Definitions for USB serial mobile broadband cards
30d456194SMatthew Garrett  */
40d456194SMatthew Garrett 
50d456194SMatthew Garrett #ifndef __LINUX_USB_USB_WWAN
60d456194SMatthew Garrett #define __LINUX_USB_USB_WWAN
70d456194SMatthew Garrett 
80d456194SMatthew Garrett extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
90d456194SMatthew Garrett extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
100d456194SMatthew Garrett extern void usb_wwan_close(struct usb_serial_port *port);
110d456194SMatthew Garrett extern int usb_wwan_startup(struct usb_serial *serial);
120d456194SMatthew Garrett extern void usb_wwan_disconnect(struct usb_serial *serial);
130d456194SMatthew Garrett extern void usb_wwan_release(struct usb_serial *serial);
140d456194SMatthew Garrett extern int usb_wwan_write_room(struct tty_struct *tty);
150d456194SMatthew Garrett extern void usb_wwan_set_termios(struct tty_struct *tty,
160d456194SMatthew Garrett 				 struct usb_serial_port *port,
170d456194SMatthew Garrett 				 struct ktermios *old);
180d456194SMatthew Garrett extern int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file);
190d456194SMatthew Garrett extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file,
200d456194SMatthew Garrett 			     unsigned int set, unsigned int clear);
21*02303f73SDan Williams extern int usb_wwan_ioctl(struct tty_struct *tty, struct file *file,
22*02303f73SDan Williams 			  unsigned int cmd, unsigned long arg);
230d456194SMatthew Garrett extern int usb_wwan_send_setup(struct usb_serial_port *port);
240d456194SMatthew Garrett extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
250d456194SMatthew Garrett 			  const unsigned char *buf, int count);
260d456194SMatthew Garrett extern int usb_wwan_chars_in_buffer(struct tty_struct *tty);
270d456194SMatthew Garrett #ifdef CONFIG_PM
280d456194SMatthew Garrett extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
290d456194SMatthew Garrett extern int usb_wwan_resume(struct usb_serial *serial);
300d456194SMatthew Garrett #endif
310d456194SMatthew Garrett 
320d456194SMatthew Garrett /* per port private data */
330d456194SMatthew Garrett 
340d456194SMatthew Garrett #define N_IN_URB 4
350d456194SMatthew Garrett #define N_OUT_URB 4
360d456194SMatthew Garrett #define IN_BUFLEN 4096
370d456194SMatthew Garrett #define OUT_BUFLEN 4096
380d456194SMatthew Garrett 
390d456194SMatthew Garrett struct usb_wwan_intf_private {
400d456194SMatthew Garrett 	spinlock_t susp_lock;
410d456194SMatthew Garrett 	unsigned int suspended:1;
420d456194SMatthew Garrett 	int in_flight;
430d456194SMatthew Garrett 	int (*send_setup) (struct usb_serial_port *port);
440d456194SMatthew Garrett 	void *private;
450d456194SMatthew Garrett };
460d456194SMatthew Garrett 
470d456194SMatthew Garrett struct usb_wwan_port_private {
480d456194SMatthew Garrett 	/* Input endpoints and buffer for this port */
490d456194SMatthew Garrett 	struct urb *in_urbs[N_IN_URB];
500d456194SMatthew Garrett 	u8 *in_buffer[N_IN_URB];
510d456194SMatthew Garrett 	/* Output endpoints and buffer for this port */
520d456194SMatthew Garrett 	struct urb *out_urbs[N_OUT_URB];
530d456194SMatthew Garrett 	u8 *out_buffer[N_OUT_URB];
540d456194SMatthew Garrett 	unsigned long out_busy;	/* Bit vector of URBs in use */
550d456194SMatthew Garrett 	int opened;
560d456194SMatthew Garrett 	struct usb_anchor delayed;
570d456194SMatthew Garrett 
580d456194SMatthew Garrett 	/* Settings for the port */
590d456194SMatthew Garrett 	int rts_state;		/* Handshaking pins (outputs) */
600d456194SMatthew Garrett 	int dtr_state;
610d456194SMatthew Garrett 	int cts_state;		/* Handshaking pins (inputs) */
620d456194SMatthew Garrett 	int dsr_state;
630d456194SMatthew Garrett 	int dcd_state;
640d456194SMatthew Garrett 	int ri_state;
650d456194SMatthew Garrett 
660d456194SMatthew Garrett 	unsigned long tx_start_time[N_OUT_URB];
670d456194SMatthew Garrett };
680d456194SMatthew Garrett 
690d456194SMatthew Garrett #endif /* __LINUX_USB_USB_WWAN */
70