drivers/input/rmi4/rmi_f34.c
Source file repositories/reference/linux-study-clean/drivers/input/rmi4/rmi_f34.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/rmi4/rmi_f34.c- Extension
.c- Size
- 15115 bytes
- Lines
- 617
- Domain
- Driver Families
- Bucket
- drivers/input
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/device.hlinux/kernel.hlinux/rmi.hlinux/firmware.hlinux/unaligned.hlinux/bitops.hrmi_driver.hrmi_f34.h
Detected Declarations
function Copyrightfunction rmi_f34_commandfunction rmi_f34_attentionfunction rmi_f34_write_blocksfunction rmi_f34_write_firmwarefunction rmi_f34_write_configfunction rmi_f34_enable_flashfunction rmi_f34_flash_firmwarefunction rmi_f34_update_firmwarefunction rmi_driver_bootloader_id_showfunction rmi_driver_configuration_id_showfunction rmi_firmware_updatefunction rmi_driver_update_fw_storefunction rmi_driver_update_fw_status_showfunction rmi_f34v5_probefunction rmi_f34_probefunction rmi_f34_create_sysfsfunction rmi_f34_remove_sysfs
Annotated Snippet
msecs_to_jiffies(timeout))) {
ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status);
if (ret) {
dev_err(&f34->fn->dev,
"%s: cmd %#02x timed out: %d\n",
__func__, command, ret);
return ret;
}
if (f34->v5.status & 0x7f) {
dev_err(&f34->fn->dev,
"%s: cmd %#02x timed out, status: %#02x\n",
__func__, command, f34->v5.status);
return -ETIMEDOUT;
}
}
return 0;
}
static irqreturn_t rmi_f34_attention(int irq, void *ctx)
{
struct rmi_function *fn = ctx;
struct f34_data *f34 = dev_get_drvdata(&fn->dev);
int ret;
u8 status;
if (f34->bl_version == 5) {
ret = rmi_read(f34->fn->rmi_dev, f34->v5.ctrl_address,
&status);
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: status: %#02x, ret: %d\n",
__func__, status, ret);
if (!ret && !(status & 0x7f))
complete(&f34->v5.cmd_done);
} else {
ret = rmi_read_block(f34->fn->rmi_dev,
f34->fn->fd.data_base_addr +
V7_COMMAND_OFFSET,
&status, sizeof(status));
rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: cmd: %#02x, ret: %d\n",
__func__, status, ret);
if (!ret && status == CMD_V7_IDLE)
complete(&f34->v7.cmd_done);
}
return IRQ_HANDLED;
}
static int rmi_f34_write_blocks(struct f34_data *f34, const void *data,
int block_count, u8 command)
{
struct rmi_function *fn = f34->fn;
struct rmi_device *rmi_dev = fn->rmi_dev;
u16 address = fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET;
u8 start_address[] = { 0, 0 };
int i;
int ret;
ret = rmi_write_block(rmi_dev, fn->fd.data_base_addr,
start_address, sizeof(start_address));
if (ret) {
dev_err(&fn->dev, "Failed to write initial zeros: %d\n", ret);
return ret;
}
for (i = 0; i < block_count; i++) {
ret = rmi_write_block(rmi_dev, address,
data, f34->v5.block_size);
if (ret) {
dev_err(&fn->dev,
"failed to write block #%d: %d\n", i, ret);
return ret;
}
ret = rmi_f34_command(f34, command, F34_IDLE_WAIT_MS, false);
if (ret) {
dev_err(&fn->dev,
"Failed to write command for block #%d: %d\n",
i, ret);
return ret;
}
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "wrote block %d of %d\n",
i + 1, block_count);
data += f34->v5.block_size;
f34->update_progress += f34->v5.block_size;
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `linux/rmi.h`, `linux/firmware.h`, `linux/unaligned.h`, `linux/bitops.h`, `rmi_driver.h`, `rmi_f34.h`.
- Detected declarations: `function Copyright`, `function rmi_f34_command`, `function rmi_f34_attention`, `function rmi_f34_write_blocks`, `function rmi_f34_write_firmware`, `function rmi_f34_write_config`, `function rmi_f34_enable_flash`, `function rmi_f34_flash_firmware`, `function rmi_f34_update_firmware`, `function rmi_driver_bootloader_id_show`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.