Lines Matching +full:touchscreen +full:- +full:inverted +full:- +full:x

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic DT helper functions for touchscreen devices
11 #include <linux/input/touchscreen.h>
38 if (!test_bit(axis, dev->absbit)) { in touchscreen_set_params()
39 dev_warn(&dev->dev, in touchscreen_set_params()
45 absinfo = &dev->absinfo[axis]; in touchscreen_set_params()
46 absinfo->minimum = min; in touchscreen_set_params()
47 absinfo->maximum = max; in touchscreen_set_params()
48 absinfo->fuzz = fuzz; in touchscreen_set_params()
52 * touchscreen_parse_properties - parse common touchscreen DT properties
55 * single-touch or multi-touch axes
67 struct device *dev = input->dev.parent; in touchscreen_parse_properties()
74 if (!input->absinfo) in touchscreen_parse_properties()
80 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", in touchscreen_parse_properties()
83 touchscreen_get_prop_u32(dev, "touchscreen-size-x", in touchscreen_parse_properties()
87 touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", in touchscreen_parse_properties()
91 touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz); in touchscreen_parse_properties()
93 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y", in touchscreen_parse_properties()
96 touchscreen_get_prop_u32(dev, "touchscreen-size-y", in touchscreen_parse_properties()
100 touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", in touchscreen_parse_properties()
104 touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz); in touchscreen_parse_properties()
108 "touchscreen-max-pressure", in touchscreen_parse_properties()
112 "touchscreen-fuzz-pressure", in touchscreen_parse_properties()
121 prop->max_x = input_abs_get_max(input, axis_x); in touchscreen_parse_properties()
122 prop->max_y = input_abs_get_max(input, axis_y); in touchscreen_parse_properties()
124 prop->invert_x = in touchscreen_parse_properties()
125 device_property_read_bool(dev, "touchscreen-inverted-x"); in touchscreen_parse_properties()
126 if (prop->invert_x) { in touchscreen_parse_properties()
127 absinfo = &input->absinfo[axis_x]; in touchscreen_parse_properties()
128 absinfo->maximum -= absinfo->minimum; in touchscreen_parse_properties()
129 absinfo->minimum = 0; in touchscreen_parse_properties()
132 prop->invert_y = in touchscreen_parse_properties()
133 device_property_read_bool(dev, "touchscreen-inverted-y"); in touchscreen_parse_properties()
134 if (prop->invert_y) { in touchscreen_parse_properties()
135 absinfo = &input->absinfo[axis_y]; in touchscreen_parse_properties()
136 absinfo->maximum -= absinfo->minimum; in touchscreen_parse_properties()
137 absinfo->minimum = 0; in touchscreen_parse_properties()
140 prop->swap_x_y = in touchscreen_parse_properties()
141 device_property_read_bool(dev, "touchscreen-swapped-x-y"); in touchscreen_parse_properties()
142 if (prop->swap_x_y) in touchscreen_parse_properties()
143 swap(input->absinfo[axis_x], input->absinfo[axis_y]); in touchscreen_parse_properties()
149 unsigned int *x, unsigned int *y) in touchscreen_apply_prop_to_x_y() argument
151 if (prop->invert_x) in touchscreen_apply_prop_to_x_y()
152 *x = prop->max_x - *x; in touchscreen_apply_prop_to_x_y()
154 if (prop->invert_y) in touchscreen_apply_prop_to_x_y()
155 *y = prop->max_y - *y; in touchscreen_apply_prop_to_x_y()
157 if (prop->swap_x_y) in touchscreen_apply_prop_to_x_y()
158 swap(*x, *y); in touchscreen_apply_prop_to_x_y()
162 * touchscreen_set_mt_pos - Set input_mt_pos coordinates
165 * @x: X coordinate to store in pos
168 * Adjust the passed in x and y values applying any axis inversion and
174 unsigned int x, unsigned int y) in touchscreen_set_mt_pos() argument
176 touchscreen_apply_prop_to_x_y(prop, &x, &y); in touchscreen_set_mt_pos()
177 pos->x = x; in touchscreen_set_mt_pos()
178 pos->y = y; in touchscreen_set_mt_pos()
183 * touchscreen_report_pos - Report touchscreen coordinates
186 * @x: X coordinate to report
188 * @multitouch: Report coordinates on single-touch or multi-touch axes
190 * Adjust the passed in x and y values applying any axis inversion and
192 * report the resulting coordinates on the input_dev's x and y axis.
196 unsigned int x, unsigned int y, in touchscreen_report_pos() argument
199 touchscreen_apply_prop_to_x_y(prop, &x, &y); in touchscreen_report_pos()
200 input_report_abs(input, multitouch ? ABS_MT_POSITION_X : ABS_X, x); in touchscreen_report_pos()
206 MODULE_DESCRIPTION("Device-tree helpers functions for touchscreen devices");