Lines Matching +full:x +full:- +full:axis
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic helper functions for touchscreens and other two-dimensional
34 unsigned long axis, in touchscreen_set_params() argument
39 if (!test_bit(axis, dev->absbit)) { in touchscreen_set_params()
40 dev_warn(&dev->dev, in touchscreen_set_params()
41 "Parameters are specified but the axis %lu is not set up\n", in touchscreen_set_params()
42 axis); in touchscreen_set_params()
46 absinfo = &dev->absinfo[axis]; in touchscreen_set_params()
47 absinfo->minimum = min; in touchscreen_set_params()
48 absinfo->maximum = max; in touchscreen_set_params()
49 absinfo->fuzz = fuzz; in touchscreen_set_params()
53 * touchscreen_parse_properties - parse common touchscreen properties
56 * single-touch or multi-touch axes
58 * axis swap and invert info for use with touchscreen_report_x_y();
68 struct device *dev = input->dev.parent; in touchscreen_parse_properties()
70 unsigned int axis, axis_x, axis_y; in touchscreen_parse_properties() local
75 if (!input->absinfo) in touchscreen_parse_properties()
81 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", in touchscreen_parse_properties()
84 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-x", in touchscreen_parse_properties()
88 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", in touchscreen_parse_properties()
92 touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz); in touchscreen_parse_properties()
94 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y", in touchscreen_parse_properties()
97 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-y", in touchscreen_parse_properties()
101 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", in touchscreen_parse_properties()
105 touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz); in touchscreen_parse_properties()
107 axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE; in touchscreen_parse_properties()
109 "touchscreen-max-pressure", in touchscreen_parse_properties()
110 input_abs_get_max(input, axis), in touchscreen_parse_properties()
113 "touchscreen-fuzz-pressure", in touchscreen_parse_properties()
114 input_abs_get_fuzz(input, axis), in touchscreen_parse_properties()
117 touchscreen_set_params(input, axis, 0, maximum, fuzz); in touchscreen_parse_properties()
122 prop->max_x = input_abs_get_max(input, axis_x); in touchscreen_parse_properties()
123 prop->max_y = input_abs_get_max(input, axis_y); in touchscreen_parse_properties()
125 prop->invert_x = in touchscreen_parse_properties()
126 device_property_read_bool(dev, "touchscreen-inverted-x"); in touchscreen_parse_properties()
127 if (prop->invert_x) { in touchscreen_parse_properties()
128 absinfo = &input->absinfo[axis_x]; in touchscreen_parse_properties()
129 absinfo->maximum -= absinfo->minimum; in touchscreen_parse_properties()
130 absinfo->minimum = 0; in touchscreen_parse_properties()
133 prop->invert_y = in touchscreen_parse_properties()
134 device_property_read_bool(dev, "touchscreen-inverted-y"); in touchscreen_parse_properties()
135 if (prop->invert_y) { in touchscreen_parse_properties()
136 absinfo = &input->absinfo[axis_y]; in touchscreen_parse_properties()
137 absinfo->maximum -= absinfo->minimum; in touchscreen_parse_properties()
138 absinfo->minimum = 0; in touchscreen_parse_properties()
141 prop->swap_x_y = in touchscreen_parse_properties()
142 device_property_read_bool(dev, "touchscreen-swapped-x-y"); in touchscreen_parse_properties()
143 if (prop->swap_x_y) in touchscreen_parse_properties()
144 swap(input->absinfo[axis_x], input->absinfo[axis_y]); in touchscreen_parse_properties()
150 unsigned int *x, unsigned int *y) in touchscreen_apply_prop_to_x_y() argument
152 if (prop->invert_x) in touchscreen_apply_prop_to_x_y()
153 *x = prop->max_x - *x; in touchscreen_apply_prop_to_x_y()
155 if (prop->invert_y) in touchscreen_apply_prop_to_x_y()
156 *y = prop->max_y - *y; in touchscreen_apply_prop_to_x_y()
158 if (prop->swap_x_y) in touchscreen_apply_prop_to_x_y()
159 swap(*x, *y); in touchscreen_apply_prop_to_x_y()
163 * touchscreen_set_mt_pos - Set input_mt_pos coordinates
166 * @x: X coordinate to store in pos
169 * Adjust the passed in x and y values applying any axis inversion and
175 unsigned int x, unsigned int y) in touchscreen_set_mt_pos() argument
177 touchscreen_apply_prop_to_x_y(prop, &x, &y); in touchscreen_set_mt_pos()
178 pos->x = x; in touchscreen_set_mt_pos()
179 pos->y = y; in touchscreen_set_mt_pos()
184 * touchscreen_report_pos - Report touchscreen coordinates
187 * @x: X coordinate to report
189 * @multitouch: Report coordinates on single-touch or multi-touch axes
191 * Adjust the passed in x and y values applying any axis inversion and
193 * report the resulting coordinates on the input_dev's x and y axis.
197 unsigned int x, unsigned int y, in touchscreen_report_pos() argument
200 touchscreen_apply_prop_to_x_y(prop, &x, &y); in touchscreen_report_pos()
201 input_report_abs(input, multitouch ? ABS_MT_POSITION_X : ABS_X, x); in touchscreen_report_pos()