drivers/usb/serial/upd78f0730.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/upd78f0730.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/upd78f0730.c- Extension
.c- Size
- 11268 bytes
- Lines
- 435
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/slab.hlinux/tty.hlinux/usb.hlinux/usb/serial.h
Detected Declarations
struct upd78f0730_port_privatestruct upd78f0730_line_controlstruct upd78f0730_set_dtr_rtsstruct upd78f0730_set_xon_xoff_chrstruct upd78f0730_open_closestruct upd78f0730_set_err_chrfunction upd78f0730_send_ctlfunction upd78f0730_port_probefunction upd78f0730_port_removefunction upd78f0730_tiocmgetfunction upd78f0730_tiocmsetfunction upd78f0730_break_ctlfunction upd78f0730_dtr_rtsfunction upd78f0730_get_baud_ratefunction upd78f0730_set_termiosfunction upd78f0730_openfunction upd78f0730_close
Annotated Snippet
struct upd78f0730_port_private {
struct mutex lock; /* mutex to protect line_signals */
u8 line_signals;
};
/* Op-codes of control commands */
#define UPD78F0730_CMD_LINE_CONTROL 0x00
#define UPD78F0730_CMD_SET_DTR_RTS 0x01
#define UPD78F0730_CMD_SET_XON_XOFF_CHR 0x02
#define UPD78F0730_CMD_OPEN_CLOSE 0x03
#define UPD78F0730_CMD_SET_ERR_CHR 0x04
/* Data sizes in UPD78F0730_CMD_LINE_CONTROL command */
#define UPD78F0730_DATA_SIZE_7_BITS 0x00
#define UPD78F0730_DATA_SIZE_8_BITS 0x01
#define UPD78F0730_DATA_SIZE_MASK 0x01
/* Stop-bit modes in UPD78F0730_CMD_LINE_CONTROL command */
#define UPD78F0730_STOP_BIT_1_BIT 0x00
#define UPD78F0730_STOP_BIT_2_BIT 0x02
#define UPD78F0730_STOP_BIT_MASK 0x02
/* Parity modes in UPD78F0730_CMD_LINE_CONTROL command */
#define UPD78F0730_PARITY_NONE 0x00
#define UPD78F0730_PARITY_EVEN 0x04
#define UPD78F0730_PARITY_ODD 0x08
#define UPD78F0730_PARITY_MASK 0x0C
/* Flow control modes in UPD78F0730_CMD_LINE_CONTROL command */
#define UPD78F0730_FLOW_CONTROL_NONE 0x00
#define UPD78F0730_FLOW_CONTROL_HW 0x10
#define UPD78F0730_FLOW_CONTROL_SW 0x20
#define UPD78F0730_FLOW_CONTROL_MASK 0x30
/* Control signal bits in UPD78F0730_CMD_SET_DTR_RTS command */
#define UPD78F0730_RTS 0x01
#define UPD78F0730_DTR 0x02
#define UPD78F0730_BREAK 0x04
/* Port modes in UPD78F0730_CMD_OPEN_CLOSE command */
#define UPD78F0730_PORT_CLOSE 0x00
#define UPD78F0730_PORT_OPEN 0x01
/* Error character substitution modes in UPD78F0730_CMD_SET_ERR_CHR command */
#define UPD78F0730_ERR_CHR_DISABLED 0x00
#define UPD78F0730_ERR_CHR_ENABLED 0x01
/*
* Declaration of command structures
*/
/* UPD78F0730_CMD_LINE_CONTROL command */
struct upd78f0730_line_control {
u8 opcode;
__le32 baud_rate;
u8 params;
} __packed;
/* UPD78F0730_CMD_SET_DTR_RTS command */
struct upd78f0730_set_dtr_rts {
u8 opcode;
u8 params;
};
/* UPD78F0730_CMD_SET_XON_OFF_CHR command */
struct upd78f0730_set_xon_xoff_chr {
u8 opcode;
u8 xon;
u8 xoff;
};
/* UPD78F0730_CMD_OPEN_CLOSE command */
struct upd78f0730_open_close {
u8 opcode;
u8 state;
};
/* UPD78F0730_CMD_SET_ERR_CHR command */
struct upd78f0730_set_err_chr {
u8 opcode;
u8 state;
u8 err_char;
};
static int upd78f0730_send_ctl(struct usb_serial_port *port,
const void *data, int size)
{
struct usb_device *usbdev = port->serial->dev;
void *buf;
int res;
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/tty.h`, `linux/usb.h`, `linux/usb/serial.h`.
- Detected declarations: `struct upd78f0730_port_private`, `struct upd78f0730_line_control`, `struct upd78f0730_set_dtr_rts`, `struct upd78f0730_set_xon_xoff_chr`, `struct upd78f0730_open_close`, `struct upd78f0730_set_err_chr`, `function upd78f0730_send_ctl`, `function upd78f0730_port_probe`, `function upd78f0730_port_remove`, `function upd78f0730_tiocmget`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.