1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 20d456194SMatthew Garrett /* 30d456194SMatthew Garrett * Definitions for USB serial mobile broadband cards 40d456194SMatthew Garrett */ 50d456194SMatthew Garrett 60d456194SMatthew Garrett #ifndef __LINUX_USB_USB_WWAN 70d456194SMatthew Garrett #define __LINUX_USB_USB_WWAN 80d456194SMatthew Garrett 90d456194SMatthew Garrett extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); 100d456194SMatthew Garrett extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); 110d456194SMatthew Garrett extern void usb_wwan_close(struct usb_serial_port *port); 12b8f0e820SJohan Hovold extern int usb_wwan_port_probe(struct usb_serial_port *port); 13c5d1448fSUwe Kleine-König extern void usb_wwan_port_remove(struct usb_serial_port *port); 1494cc7aeaSJiri Slaby extern unsigned int usb_wwan_write_room(struct tty_struct *tty); 1560b33c13SAlan Cox extern int usb_wwan_tiocmget(struct tty_struct *tty); 1620b9d177SAlan Cox extern int usb_wwan_tiocmset(struct tty_struct *tty, 170d456194SMatthew Garrett unsigned int set, unsigned int clear); 180d456194SMatthew Garrett extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, 190d456194SMatthew Garrett const unsigned char *buf, int count); 20*155591d3SJiri Slaby extern unsigned int usb_wwan_chars_in_buffer(struct tty_struct *tty); 210d456194SMatthew Garrett #ifdef CONFIG_PM 220d456194SMatthew Garrett extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message); 230d456194SMatthew Garrett extern int usb_wwan_resume(struct usb_serial *serial); 240d456194SMatthew Garrett #endif 250d456194SMatthew Garrett 260d456194SMatthew Garrett /* per port private data */ 270d456194SMatthew Garrett 280d456194SMatthew Garrett #define N_IN_URB 4 290d456194SMatthew Garrett #define N_OUT_URB 4 300d456194SMatthew Garrett #define IN_BUFLEN 4096 310d456194SMatthew Garrett #define OUT_BUFLEN 4096 320d456194SMatthew Garrett 330d456194SMatthew Garrett struct usb_wwan_intf_private { 340d456194SMatthew Garrett spinlock_t susp_lock; 350d456194SMatthew Garrett unsigned int suspended:1; 36669e729fSDavid Ward unsigned int use_send_setup:1; 372438c3a1SDaniele Palmas unsigned int use_zlp:1; 380d456194SMatthew Garrett int in_flight; 39c1c01803SJohan Hovold unsigned int open_ports; 400d456194SMatthew Garrett void *private; 410d456194SMatthew Garrett }; 420d456194SMatthew Garrett 430d456194SMatthew Garrett struct usb_wwan_port_private { 440d456194SMatthew Garrett /* Input endpoints and buffer for this port */ 450d456194SMatthew Garrett struct urb *in_urbs[N_IN_URB]; 460d456194SMatthew Garrett u8 *in_buffer[N_IN_URB]; 470d456194SMatthew Garrett /* Output endpoints and buffer for this port */ 480d456194SMatthew Garrett struct urb *out_urbs[N_OUT_URB]; 490d456194SMatthew Garrett u8 *out_buffer[N_OUT_URB]; 500d456194SMatthew Garrett unsigned long out_busy; /* Bit vector of URBs in use */ 510d456194SMatthew Garrett struct usb_anchor delayed; 520d456194SMatthew Garrett 530d456194SMatthew Garrett /* Settings for the port */ 540d456194SMatthew Garrett int rts_state; /* Handshaking pins (outputs) */ 550d456194SMatthew Garrett int dtr_state; 560d456194SMatthew Garrett int cts_state; /* Handshaking pins (inputs) */ 570d456194SMatthew Garrett int dsr_state; 580d456194SMatthew Garrett int dcd_state; 590d456194SMatthew Garrett int ri_state; 600d456194SMatthew Garrett 610d456194SMatthew Garrett unsigned long tx_start_time[N_OUT_URB]; 620d456194SMatthew Garrett }; 630d456194SMatthew Garrett 640d456194SMatthew Garrett #endif /* __LINUX_USB_USB_WWAN */ 65