usb-wwan.h 2.0 KB

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