drivers/input/rmi4/rmi_2d_sensor.c
Source file repositories/reference/linux-study-clean/drivers/input/rmi4/rmi_2d_sensor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/rmi4/rmi_2d_sensor.c- Extension
.c- Size
- 8641 bytes
- Lines
- 332
- Domain
- Driver Families
- Bucket
- drivers/input
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/kernel.hlinux/device.hlinux/of.hlinux/input.hlinux/input/mt.hlinux/rmi.hrmi_driver.hrmi_2d_sensor.h
Detected Declarations
function Copyrightfunction rmi_2d_sensor_abs_reportfunction rmi_2d_sensor_rel_reportfunction rmi_2d_sensor_set_input_paramsfunction rmi_2d_sensor_configure_inputfunction rmi_2d_sensor_of_probefunction rmi_2d_sensor_of_probeexport rmi_2d_sensor_abs_processexport rmi_2d_sensor_abs_reportexport rmi_2d_sensor_rel_reportexport rmi_2d_sensor_configure_inputexport rmi_2d_sensor_of_probe
Annotated Snippet
if (obj->type == RMI_2D_OBJECT_STYLUS) {
major = max(1, major);
minor = max(1, minor);
}
input_event(sensor->input, EV_ABS, ABS_MT_POSITION_X, obj->x);
input_event(sensor->input, EV_ABS, ABS_MT_POSITION_Y, obj->y);
input_event(sensor->input, EV_ABS, ABS_MT_ORIENTATION, wide);
input_event(sensor->input, EV_ABS, ABS_MT_PRESSURE, obj->z);
input_event(sensor->input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
input_event(sensor->input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
rmi_dbg(RMI_DEBUG_2D_SENSOR, &sensor->input->dev,
"%s: obj[%d]: type: 0x%02x X: %d Y: %d Z: %d WX: %d WY: %d\n",
__func__, slot, obj->type, obj->x, obj->y, obj->z,
obj->wx, obj->wy);
}
}
EXPORT_SYMBOL_GPL(rmi_2d_sensor_abs_report);
void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y)
{
struct rmi_2d_axis_alignment *axis_align = &sensor->axis_align;
x = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)x));
y = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)y));
if (axis_align->flip_x)
x = min(RMI_2D_REL_POS_MAX, -x);
if (axis_align->flip_y)
y = min(RMI_2D_REL_POS_MAX, -y);
if (axis_align->swap_axes)
swap(x, y);
if (x || y) {
input_report_rel(sensor->input, REL_X, x);
input_report_rel(sensor->input, REL_Y, y);
}
}
EXPORT_SYMBOL_GPL(rmi_2d_sensor_rel_report);
static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
{
struct input_dev *input = sensor->input;
int res_x;
int res_y;
int max_x, max_y;
int input_flags = 0;
if (sensor->report_abs) {
sensor->min_x = sensor->axis_align.clip_x_low;
if (sensor->axis_align.clip_x_high)
sensor->max_x = min(sensor->max_x,
sensor->axis_align.clip_x_high);
sensor->min_y = sensor->axis_align.clip_y_low;
if (sensor->axis_align.clip_y_high)
sensor->max_y = min(sensor->max_y,
sensor->axis_align.clip_y_high);
set_bit(EV_ABS, input->evbit);
max_x = sensor->max_x;
max_y = sensor->max_y;
if (sensor->axis_align.swap_axes)
swap(max_x, max_y);
input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_x, 0, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
if (sensor->x_mm && sensor->y_mm) {
res_x = (sensor->max_x - sensor->min_x) / sensor->x_mm;
res_y = (sensor->max_y - sensor->min_y) / sensor->y_mm;
if (sensor->axis_align.swap_axes)
swap(res_x, res_y);
input_abs_set_res(input, ABS_X, res_x);
input_abs_set_res(input, ABS_Y, res_y);
input_abs_set_res(input, ABS_MT_POSITION_X, res_x);
input_abs_set_res(input, ABS_MT_POSITION_Y, res_y);
if (!sensor->dmax)
sensor->dmax = DMAX * res_x;
}
input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xff, 0, 0);
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 0x0f, 0, 0);
input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 0x0f, 0, 0);
Annotation
- Immediate include surface: `linux/export.h`, `linux/kernel.h`, `linux/device.h`, `linux/of.h`, `linux/input.h`, `linux/input/mt.h`, `linux/rmi.h`, `rmi_driver.h`.
- Detected declarations: `function Copyright`, `function rmi_2d_sensor_abs_report`, `function rmi_2d_sensor_rel_report`, `function rmi_2d_sensor_set_input_params`, `function rmi_2d_sensor_configure_input`, `function rmi_2d_sensor_of_probe`, `function rmi_2d_sensor_of_probe`, `export rmi_2d_sensor_abs_process`, `export rmi_2d_sensor_abs_report`, `export rmi_2d_sensor_rel_report`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: integration implementation candidate.
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.