drivers/usb/serial/iuu_phoenix.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/iuu_phoenix.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/iuu_phoenix.c- Extension
.c- Size
- 30055 bytes
- Lines
- 1208
- 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/kernel.hlinux/errno.hlinux/slab.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/serial.hlinux/module.hlinux/moduleparam.hlinux/spinlock.hlinux/uaccess.hlinux/usb.hlinux/usb/serial.hiuu_phoenix.hlinux/random.h
Detected Declarations
struct iuu_privatefunction iuu_port_probefunction iuu_port_removefunction iuu_tiocmsetfunction iuu_tiocmgetfunction iuu_rxcmdfunction iuu_resetfunction iuu_update_status_callbackfunction iuu_status_callbackfunction iuu_statusfunction bulk_immediatefunction read_immediatefunction iuu_ledfunction iuu_rgbf_fill_bufferfunction iuu_led_activity_onfunction iuu_led_activity_offfunction iuu_clkfunction iuu_uart_flushfunction read_buf_callbackfunction iuu_bulk_writefunction iuu_read_buffunction iuu_uart_read_callbackfunction iuu_uart_writefunction read_rxcmd_callbackfunction iuu_uart_onfunction iuu_uart_offfunction iuu_uart_baudfunction iuu_set_termiosfunction iuu_closefunction iuu_init_termiosfunction iuu_openfunction iuu_vcc_setfunction vcc_mode_showfunction vcc_mode_storefunction iuu_create_sysfs_attrsfunction iuu_remove_sysfs_attrs
Annotated Snippet
struct iuu_private {
spinlock_t lock; /* store irq state */
u8 line_status;
int tiostatus; /* store IUART SIGNAL for tiocmget call */
u8 reset; /* if 1 reset is needed */
int poll; /* number of poll */
u8 *writebuf; /* buffer for writing to device */
int writelen; /* num of byte to write to device */
u8 *buf; /* used for initialize speed */
u8 len;
int vcc; /* vcc (either 3 or 5 V) */
u32 boost;
u32 clk;
};
static int iuu_port_probe(struct usb_serial_port *port)
{
struct iuu_private *priv;
int ret;
priv = kzalloc_obj(struct iuu_private);
if (!priv)
return -ENOMEM;
priv->buf = kzalloc(256, GFP_KERNEL);
if (!priv->buf) {
kfree(priv);
return -ENOMEM;
}
priv->writebuf = kzalloc(256, GFP_KERNEL);
if (!priv->writebuf) {
kfree(priv->buf);
kfree(priv);
return -ENOMEM;
}
priv->vcc = vcc_default;
spin_lock_init(&priv->lock);
usb_set_serial_port_data(port, priv);
ret = iuu_create_sysfs_attrs(port);
if (ret) {
kfree(priv->writebuf);
kfree(priv->buf);
kfree(priv);
return ret;
}
return 0;
}
static void iuu_port_remove(struct usb_serial_port *port)
{
struct iuu_private *priv = usb_get_serial_port_data(port);
iuu_remove_sysfs_attrs(port);
kfree(priv->writebuf);
kfree(priv->buf);
kfree(priv);
}
static int iuu_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear)
{
struct usb_serial_port *port = tty->driver_data;
struct iuu_private *priv = usb_get_serial_port_data(port);
unsigned long flags;
/* FIXME: locking on tiomstatus */
dev_dbg(&port->dev, "%s msg : SET = 0x%04x, CLEAR = 0x%04x\n",
__func__, set, clear);
spin_lock_irqsave(&priv->lock, flags);
if ((set & TIOCM_RTS) && !(priv->tiostatus == TIOCM_RTS)) {
dev_dbg(&port->dev, "%s TIOCMSET RESET called !!!\n", __func__);
priv->reset = 1;
}
if (set & TIOCM_RTS)
priv->tiostatus = TIOCM_RTS;
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
/* This is used to provide a carrier detect mechanism
* When a card is present, the response is 0x00
* When no card , the reader respond with TIOCM_CD
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/serial.h`, `linux/module.h`.
- Detected declarations: `struct iuu_private`, `function iuu_port_probe`, `function iuu_port_remove`, `function iuu_tiocmset`, `function iuu_tiocmget`, `function iuu_rxcmd`, `function iuu_reset`, `function iuu_update_status_callback`, `function iuu_status_callback`, `function iuu_status`.
- 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.