drivers/usb/serial/keyspan.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/keyspan.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/keyspan.c- Extension
.c- Size
- 86160 bytes
- Lines
- 3108
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/jiffies.hlinux/errno.hlinux/slab.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/module.hlinux/spinlock.hlinux/uaccess.hlinux/usb.hlinux/usb/serial.hlinux/usb/ezusb.hkeyspan_usa26msg.hkeyspan_usa28msg.hkeyspan_usa49msg.hkeyspan_usa90msg.hkeyspan_usa67msg.h
Detected Declarations
struct keyspan_device_detailsstruct keyspan_serial_privatestruct keyspan_port_privatefunction keyspan_break_ctlfunction keyspan_set_termiosfunction keyspan_tiocmgetfunction keyspan_tiocmsetfunction usa90function usa26_indat_callbackfunction usa2x_outdat_callbackfunction usa26_inack_callbackfunction usa26_instat_callbackfunction usa26_glocont_callbackfunction usa28_inack_callbackfunction usa28_instat_callbackfunction usa28_glocont_callbackfunction usa49_instat_callbackfunction usa49_inack_callbackfunction usa49wg_indat_callbackfunction usa49_outcont_callbackfunction usa90_instat_callbackfunction usa90_outcont_callbackfunction usa67_instat_callbackfunction usa67_glocont_callbackfunction keyspan_write_roomfunction keyspan_openfunction keyspan_dtr_rtsfunction keyspan_closefunction keyspan_fake_startupfunction voidfunction keyspan_setup_urbsfunction keyspan_usa19_calc_baudfunction keyspan_usa19hs_calc_baudfunction keyspan_usa19w_calc_baudfunction keyspan_usa28_calc_baudfunction keyspan_usa26_send_setupfunction keyspan_usa28_send_setupfunction keyspan_usa49_send_setupfunction keyspan_usa90_send_setupfunction keyspan_usa67_send_setupfunction keyspan_send_setupfunction keyspan_startupfunction keyspan_disconnectfunction keyspan_releasefunction keyspan_port_probefunction keyspan_port_remove
Annotated Snippet
struct keyspan_device_details {
/* product ID value */
int product_id;
enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format;
/* Number of physical ports */
int num_ports;
/* 1 if endpoint flipping used on input, 0 if not */
int indat_endp_flip;
/* 1 if endpoint flipping used on output, 0 if not */
int outdat_endp_flip;
/*
* Table mapping input data endpoint IDs to physical port
* number and flip if used
*/
int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
/* Same for output endpoints */
int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
/* Input acknowledge endpoints */
int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
/* Output control endpoints */
int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
/* Endpoint used for input status */
int instat_endpoint;
/* Endpoint used for input data 49WG only */
int indat_endpoint;
/* Endpoint used for global control functions */
int glocont_endpoint;
int (*calculate_baud_rate)(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *prescaler,
int portnum);
u32 baudclk;
};
/*
* Now for each device type we setup the device detail structure with the
* appropriate information (provided in Keyspan's documentation)
*/
static const struct keyspan_device_details usa18x_device_details = {
.product_id = keyspan_usa18x_product_id,
.msg_format = msg_usa26,
.num_ports = 1,
.indat_endp_flip = 0,
.outdat_endp_flip = 1,
.indat_endpoints = {0x81},
.outdat_endpoints = {0x01},
.inack_endpoints = {0x85},
.outcont_endpoints = {0x05},
.instat_endpoint = 0x87,
.indat_endpoint = -1,
.glocont_endpoint = 0x07,
.calculate_baud_rate = keyspan_usa19w_calc_baud,
.baudclk = KEYSPAN_USA18X_BAUDCLK,
};
static const struct keyspan_device_details usa19_device_details = {
.product_id = keyspan_usa19_product_id,
.msg_format = msg_usa28,
.num_ports = 1,
.indat_endp_flip = 1,
.outdat_endp_flip = 1,
.indat_endpoints = {0x81},
.outdat_endpoints = {0x01},
.inack_endpoints = {0x83},
.outcont_endpoints = {0x03},
.instat_endpoint = 0x84,
.indat_endpoint = -1,
.glocont_endpoint = -1,
.calculate_baud_rate = keyspan_usa19_calc_baud,
.baudclk = KEYSPAN_USA19_BAUDCLK,
};
static const struct keyspan_device_details usa19qi_device_details = {
.product_id = keyspan_usa19qi_product_id,
.msg_format = msg_usa28,
.num_ports = 1,
.indat_endp_flip = 1,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/jiffies.h`, `linux/errno.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/module.h`.
- Detected declarations: `struct keyspan_device_details`, `struct keyspan_serial_private`, `struct keyspan_port_private`, `function keyspan_break_ctl`, `function keyspan_set_termios`, `function keyspan_tiocmget`, `function keyspan_tiocmset`, `function usa90`, `function usa26_indat_callback`, `function usa2x_outdat_callback`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.