drivers/usb/misc/usb-ljca.c
Source file repositories/reference/linux-study-clean/drivers/usb/misc/usb-ljca.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/misc/usb-ljca.c- Extension
.c- Size
- 21266 bytes
- Lines
- 905
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/acpi.hlinux/auxiliary_bus.hlinux/dev_printk.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/mutex.hlinux/slab.hlinux/spinlock.hlinux/types.hlinux/usb.hlinux/usb/ljca.hlinux/unaligned.h
Detected Declarations
struct ljca_msgstruct ljca_i2c_ctr_infostruct ljca_i2c_descriptorstruct ljca_spi_ctr_infostruct ljca_spi_descriptorstruct ljca_bank_descriptorstruct ljca_gpio_descriptorstruct ljca_adapterstruct ljca_match_ids_walk_dataenum ljca_client_typeenum ljca_mng_cmdenum ljca_client_acpi_adrfunction ljca_handle_eventfunction list_for_each_entryfunction ljca_handle_cmd_ackfunction ljca_recvfunction ljca_sendfunction ljca_transferfunction ljca_transfer_noackfunction ljca_register_event_cbfunction ljca_unregister_event_cbfunction ljca_match_device_idsfunction ljca_auxdev_acpi_bindfunction ljca_auxdev_releasefunction ljca_new_client_devicefunction ljca_enumerate_gpiofunction ljca_enumerate_i2cfunction ljca_enumerate_spifunction ljca_reset_handshakefunction ljca_enumerate_clientsfunction list_for_each_entry_safe_reversefunction ljca_probefunction ljca_disconnectfunction list_for_each_entry_safe_reversefunction ljca_suspendfunction ljca_resume
Annotated Snippet
struct ljca_msg {
u8 type;
u8 cmd;
u8 flags;
u8 len;
u8 data[] __counted_by(len);
} __packed;
struct ljca_i2c_ctr_info {
u8 id;
u8 capacity;
u8 intr_pin;
} __packed;
struct ljca_i2c_descriptor {
u8 num;
struct ljca_i2c_ctr_info info[] __counted_by(num);
} __packed;
struct ljca_spi_ctr_info {
u8 id;
u8 capacity;
u8 intr_pin;
} __packed;
struct ljca_spi_descriptor {
u8 num;
struct ljca_spi_ctr_info info[] __counted_by(num);
} __packed;
struct ljca_bank_descriptor {
u8 bank_id;
u8 pin_num;
/* 1 bit for each gpio, 1 means valid */
__le32 valid_pins;
} __packed;
struct ljca_gpio_descriptor {
u8 pins_per_bank;
u8 bank_num;
struct ljca_bank_descriptor bank_desc[] __counted_by(bank_num);
} __packed;
/**
* struct ljca_adapter - represent a ljca adapter
*
* @intf: the usb interface for this ljca adapter
* @usb_dev: the usb device for this ljca adapter
* @dev: the specific device info of the usb interface
* @rx_pipe: bulk in pipe for receive data from firmware
* @tx_pipe: bulk out pipe for send data to firmware
* @rx_urb: urb used for the bulk in pipe
* @rx_buf: buffer used to receive command response and event
* @rx_len: length of rx buffer
* @ex_buf: external buffer to save command response
* @ex_buf_len: length of external buffer
* @actual_length: actual length of data copied to external buffer
* @tx_buf: buffer used to download command to firmware
* @tx_buf_len: length of tx buffer
* @lock: spinlock to protect tx_buf and ex_buf
* @cmd_completion: completion object as the command receives ack
* @mutex: mutex to avoid command download concurrently
* @client_list: client device list
* @disconnect: usb disconnect ongoing or not
* @reset_id: used to reset firmware
*/
struct ljca_adapter {
struct usb_interface *intf;
struct usb_device *usb_dev;
struct device *dev;
unsigned int rx_pipe;
unsigned int tx_pipe;
struct urb *rx_urb;
void *rx_buf;
unsigned int rx_len;
u8 *ex_buf;
u8 ex_buf_len;
u8 actual_length;
void *tx_buf;
u8 tx_buf_len;
spinlock_t lock;
struct completion cmd_completion;
struct mutex mutex;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/auxiliary_bus.h`, `linux/dev_printk.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`.
- Detected declarations: `struct ljca_msg`, `struct ljca_i2c_ctr_info`, `struct ljca_i2c_descriptor`, `struct ljca_spi_ctr_info`, `struct ljca_spi_descriptor`, `struct ljca_bank_descriptor`, `struct ljca_gpio_descriptor`, `struct ljca_adapter`, `struct ljca_match_ids_walk_data`, `enum ljca_client_type`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration 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.