mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
![Johan Hovold](/assets/img/avatar_default.png)
TIOCSSERIAL is a horrid, underspecified, legacy interface which for most serial devices is only useful for setting the close_delay and closing_wait parameters. The closing_wait parameter determines how long to wait for the transfer buffers to drain during close and the default timeout of 30 seconds may not be sufficient at low line speeds. In other cases, when for example flow is stopped, the default timeout may instead be too long. Add generic support for TIOCSSERIAL and TIOCGSERIAL with handling of the three common parameters close_delay, closing_wait and line for the benefit of all USB serial drivers while still allowing drivers to implement further functionality through the existing callbacks. This currently includes a few drivers that report their base baud clock rate even if that is really only of interest when setting custom divisors through the deprecated ASYNC_SPD_CUST interface; an interface which only the FTDI driver actually implements. Some drivers have also been reporting back a fake UART type, something which should no longer be needed and will be dropped by a follow-on patch. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Definitions for USB serial mobile broadband cards
|
|
*/
|
|
|
|
#ifndef __LINUX_USB_USB_WWAN
|
|
#define __LINUX_USB_USB_WWAN
|
|
|
|
extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
|
|
extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
|
|
extern void usb_wwan_close(struct usb_serial_port *port);
|
|
extern int usb_wwan_port_probe(struct usb_serial_port *port);
|
|
extern void usb_wwan_port_remove(struct usb_serial_port *port);
|
|
extern int usb_wwan_write_room(struct tty_struct *tty);
|
|
extern int usb_wwan_tiocmget(struct tty_struct *tty);
|
|
extern int usb_wwan_tiocmset(struct tty_struct *tty,
|
|
unsigned int set, unsigned int clear);
|
|
extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
|
|
const unsigned char *buf, int count);
|
|
extern int usb_wwan_chars_in_buffer(struct tty_struct *tty);
|
|
#ifdef CONFIG_PM
|
|
extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
|
|
extern int usb_wwan_resume(struct usb_serial *serial);
|
|
#endif
|
|
|
|
/* per port private data */
|
|
|
|
#define N_IN_URB 4
|
|
#define N_OUT_URB 4
|
|
#define IN_BUFLEN 4096
|
|
#define OUT_BUFLEN 4096
|
|
|
|
struct usb_wwan_intf_private {
|
|
spinlock_t susp_lock;
|
|
unsigned int suspended:1;
|
|
unsigned int use_send_setup:1;
|
|
unsigned int use_zlp:1;
|
|
int in_flight;
|
|
unsigned int open_ports;
|
|
void *private;
|
|
};
|
|
|
|
struct usb_wwan_port_private {
|
|
/* Input endpoints and buffer for this port */
|
|
struct urb *in_urbs[N_IN_URB];
|
|
u8 *in_buffer[N_IN_URB];
|
|
/* Output endpoints and buffer for this port */
|
|
struct urb *out_urbs[N_OUT_URB];
|
|
u8 *out_buffer[N_OUT_URB];
|
|
unsigned long out_busy; /* Bit vector of URBs in use */
|
|
struct usb_anchor delayed;
|
|
|
|
/* Settings for the port */
|
|
int rts_state; /* Handshaking pins (outputs) */
|
|
int dtr_state;
|
|
int cts_state; /* Handshaking pins (inputs) */
|
|
int dsr_state;
|
|
int dcd_state;
|
|
int ri_state;
|
|
|
|
unsigned long tx_start_time[N_OUT_URB];
|
|
};
|
|
|
|
#endif /* __LINUX_USB_USB_WWAN */
|