Lines Matching +full:usb +full:- +full:to +full:- +full:serial

1 // SPDX-License-Identifier: GPL-2.0
3 * USB Serial Converter stuff
5 * Copyright (C) 1999 - 2012
6 * Greg Kroah-Hartman (greg@kroah.com)
14 #include <linux/serial.h>
20 /* USB serial flags */
26 * @serial: pointer back to the struct usb_serial owner of this port.
27 * @port: pointer to the corresponding tty_port for this port.
28 * @lock: spinlock to grab when updating portions of this structure.
31 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
32 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
35 * @interrupt_out_buffer: pointer to the interrupt out buffer for this port.
37 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
40 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
42 * @read_urb: pointer to the bulk in struct urb for this port.
45 * @bulk_in_buffers: pointers to the bulk in buffers for this port
46 * @read_urbs: pointers to the bulk in urbs for this port
48 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
50 * @write_urb: pointer to the bulk out struct urb for this port.
51 * @write_fifo: kfifo used to buffer outgoing data
52 * @bulk_out_buffers: pointers to the bulk out buffers for this port
53 * @write_urbs: pointers to the bulk out urbs for this port
59 * @flags: usb serial port flags
61 * @dev: pointer to the serial device
63 * This structure is used by the usb-serial core and drivers for the specific
67 struct usb_serial *serial; member
114 return dev_get_drvdata(&port->dev); in usb_get_serial_port_data()
120 dev_set_drvdata(&port->dev, data); in usb_set_serial_port_data()
124 * usb_serial - structure used by the usb-serial core for a device
125 * @dev: pointer to the struct usb_device for this device
126 * @type: pointer to the struct usb_serial_driver for this device
127 * @interface: pointer to the struct usb_interface for this device
128 * @sibling: pointer to the struct usb_interface of any sibling interface
136 * @private: place to put any driver specific information that is needed. The
137 * usb-serial driver is required to manage this data, the usb-serial core
139 * usb_set_serial_data() to access this.
163 /* get and set the serial private data pointer helper functions */
164 static inline void *usb_get_serial_data(struct usb_serial *serial) in usb_get_serial_data() argument
166 return serial->private; in usb_get_serial_data()
169 static inline void usb_set_serial_data(struct usb_serial *serial, void *data) in usb_set_serial_data() argument
171 serial->private = data; in usb_set_serial_data()
186 * usb_serial_driver - describes a usb serial driver
187 * @description: pointer to a string that describes this driver. This string
189 * @id_table: pointer to a list of usb_device_id structures that define all
192 * @num_bulk_in: minimum number of bulk-in endpoints
193 * @num_bulk_out: minimum number of bulk-out endpoints
194 * @num_interrupt_in: minimum number of interrupt-in endpoints
195 * @num_interrupt_out: minimum number of interrupt-out endpoints
196 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
197 * (0 = end-point size)
198 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
199 * @calc_num_ports: pointer to a function to determine how many ports this
200 * device has dynamically. It can also be used to verify the number of
201 * endpoints or to modify the port-endpoint mapping. It will be called
203 * @probe: pointer to the driver's probe function.
206 * subsystem. Use this function to download any firmware to the device,
208 * Return 0 to continue on with the initialization sequence. Anything
210 * @attach: pointer to the driver's attach function.
214 * @disconnect: pointer to the driver's disconnect function. This will be
216 * @release: pointer to the driver's release function. This will be called
217 * when the usb_serial data structure is about to be destroyed.
218 * @usb_driver: pointer to the struct usb_driver that controls this
219 * device. This is necessary to allow dynamic ids to be added to
222 * This structure is defines a USB Serial driver. It provides all of
223 * the information that the USB serial core code needs. If the function
224 * pointers are defined, then the USB serial core code will call them when
226 * called, the generic serial function will be used instead.
228 * The driver.owner field should be set to the module owner of this driver.
229 * The driver.name field should be set to the name of this driver (remember
230 * it will show up in sysfs, so it needs to be short and to the point.
252 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
253 int (*attach)(struct usb_serial *serial);
254 int (*calc_num_ports)(struct usb_serial *serial,
257 void (*disconnect)(struct usb_serial *serial);
258 void (*release)(struct usb_serial *serial);
263 int (*suspend)(struct usb_serial *serial, pm_message_t message);
264 int (*resume)(struct usb_serial *serial);
265 int (*reset_resume)(struct usb_serial *serial);
267 /* serial function calls */
297 /* Called by the usb serial hooks to allow the user to rework the
300 /* USB events */
325 /* USB Serial console functions */
329 void usb_serial_console_disconnect(struct usb_serial *serial);
333 static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} in usb_serial_console_disconnect() argument
338 void usb_serial_put(struct usb_serial *serial);
340 int usb_serial_claim_interface(struct usb_serial *serial, struct usb_interface *intf);
347 int usb_serial_generic_resume(struct usb_serial *serial);
391 dev_dbg(dev, "%s - length = %d, data = %*ph\n", in usb_serial_debug_data()
396 * Macro for reporting errors in write path to avoid infinite loop
404 if (!__port->port.console || !__print_once) { \
406 dev_err(&__port->dev, fmt, ##__VA_ARGS__); \
411 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
412 * @__serial_drivers: list of usb_serial drivers to register
413 * @__ids: all device ids that @__serial_drivers bind to
415 * Helper macro for USB serial drivers which do not do anything special