drivers/input/rmi4/rmi_f54.c
Source file repositories/reference/linux-study-clean/drivers/input/rmi4/rmi_f54.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/rmi4/rmi_f54.c- Extension
.c- Size
- 18352 bytes
- Lines
- 756
- 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.
- 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/rmi.hlinux/input.hlinux/slab.hlinux/delay.hlinux/i2c.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/videobuf2-v4l2.hmedia/videobuf2-vmalloc.hrmi_driver.h
Detected Declarations
struct f54_dataenum rmi_f54_report_typefunction is_f54_report_type_validfunction rmi_f54_get_reptypefunction rmi_f54_create_input_mapfunction rmi_f54_request_reportfunction rmi_f54_get_report_sizefunction rmi_f54_get_pixel_fmtfunction rmi_f54_queue_setupfunction rmi_f54_buffer_queuefunction rmi_f54_stop_streamingfunction rmi_f54_vidioc_querycapfunction rmi_f54_vidioc_enum_inputfunction rmi_f54_set_inputfunction rmi_f54_vidioc_s_inputfunction rmi_f54_vidioc_g_inputfunction rmi_f54_vidioc_fmtfunction rmi_f54_vidioc_enum_fmtfunction rmi_f54_vidioc_g_parmfunction rmi_f54_workfunction rmi_f54_configfunction rmi_f54_detectfunction rmi_f54_probefunction rmi_f54_remove
Annotated Snippet
struct f54_data {
struct rmi_function *fn;
u8 num_rx_electrodes;
u8 num_tx_electrodes;
u8 capabilities;
u16 clock_rate;
u8 family;
enum rmi_f54_report_type report_type;
u8 *report_data;
int report_size;
bool is_busy;
struct mutex status_mutex;
struct mutex data_mutex;
struct workqueue_struct *workqueue;
struct delayed_work work;
unsigned long timeout;
struct completion cmd_done;
/* V4L2 support */
struct v4l2_device v4l2;
struct v4l2_pix_format format;
struct video_device vdev;
struct vb2_queue queue;
struct mutex lock;
u32 sequence;
int input;
enum rmi_f54_report_type inputs[F54_MAX_REPORT_TYPE];
};
/*
* Basic checks on report_type to ensure we write a valid type
* to the sensor.
*/
static bool is_f54_report_type_valid(struct f54_data *f54,
enum rmi_f54_report_type reptype)
{
switch (reptype) {
case F54_8BIT_IMAGE:
return f54->capabilities & F54_CAP_IMAGE8;
case F54_16BIT_IMAGE:
case F54_RAW_16BIT_IMAGE:
return f54->capabilities & F54_CAP_IMAGE16;
case F54_TRUE_BASELINE:
return f54->capabilities & F54_CAP_IMAGE16;
case F54_FULL_RAW_CAP:
case F54_FULL_RAW_CAP_RX_OFFSET_REMOVED:
return true;
default:
return false;
}
}
static enum rmi_f54_report_type rmi_f54_get_reptype(struct f54_data *f54,
unsigned int i)
{
if (i >= F54_MAX_REPORT_TYPE)
return F54_REPORT_NONE;
return f54->inputs[i];
}
static void rmi_f54_create_input_map(struct f54_data *f54)
{
int i = 0;
enum rmi_f54_report_type reptype;
for (reptype = 1; reptype < F54_MAX_REPORT_TYPE; reptype++) {
if (!is_f54_report_type_valid(f54, reptype))
continue;
f54->inputs[i++] = reptype;
}
/* Remaining values are zero via kzalloc */
}
static int rmi_f54_request_report(struct rmi_function *fn, u8 report_type)
{
struct f54_data *f54 = dev_get_drvdata(&fn->dev);
struct rmi_device *rmi_dev = fn->rmi_dev;
int error;
/* Write Report Type into F54_AD_Data0 */
if (f54->report_type != report_type) {
error = rmi_write(rmi_dev, f54->fn->fd.data_base_addr,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/rmi.h`, `linux/input.h`, `linux/slab.h`, `linux/delay.h`, `linux/i2c.h`, `media/v4l2-device.h`, `media/v4l2-ioctl.h`.
- Detected declarations: `struct f54_data`, `enum rmi_f54_report_type`, `function is_f54_report_type_valid`, `function rmi_f54_get_reptype`, `function rmi_f54_create_input_map`, `function rmi_f54_request_report`, `function rmi_f54_get_report_size`, `function rmi_f54_get_pixel_fmt`, `function rmi_f54_queue_setup`, `function rmi_f54_buffer_queue`.
- Atlas domain: Driver Families / drivers/input.
- 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.