summaryrefslogtreecommitdiff
path: root/drivers/input/tests/touchscreen_test.c
AgeCommit message (Collapse)Author
7 daysInput: touchscreen - parse touchscreen-x-mm and touchscreen-y-mmDmitry Torokhov
The touchscreen device tree bindings define common touchscreen-x-mm and touchscreen-y-mm properties specifying the physical dimensions of the touchscreen in millimeters. However, touchscreen_parse_properties() does not parse these properties, forcing individual drivers to parse them manually or fall back to arbitrary resolution values. Parse touchscreen-x-mm and touchscreen-y-mm in touchscreen_parse_properties() and calculate axis resolution in units per millimeter as the coordinate count (maximum - minimum + 1) divided by the physical dimension, rounded to the nearest integer. Guard against zero physical size or invalid axis ranges, and preserve pre-existing resolution settings when the properties are omitted. Apply resolution before early exit so callers passing a NULL properties pointer still get axes configured and so coordinate inversion and axis swapping continue to work seamlessly. Also add KUnit test coverage for resolution calculation. Link: https://patch.msgid.link/20261103044708.2461481-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>