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