Lines Matching +full:input +full:- +full:value
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic helper functions for touchscreens and other two-dimensional
10 #include <linux/input.h>
11 #include <linux/input/mt.h>
12 #include <linux/input/touchscreen.h>
18 unsigned int *value) in touchscreen_get_prop_u32() argument
25 *value = default_value; in touchscreen_get_prop_u32()
29 *value = val; in touchscreen_get_prop_u32()
39 if (!test_bit(axis, dev->absbit)) { in touchscreen_set_params()
40 dev_warn(&dev->dev, 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
54 * @input: input device that should be parsed
56 * single-touch or multi-touch axes
62 * input device accordingly. The function keeps previously set up default
63 * values if no value is specified.
65 void touchscreen_parse_properties(struct input_dev *input, bool multitouch, in touchscreen_parse_properties() argument
68 struct device *dev = input->dev.parent; in touchscreen_parse_properties()
74 input_alloc_absinfo(input); in touchscreen_parse_properties()
75 if (!input->absinfo) in touchscreen_parse_properties()
81 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", in touchscreen_parse_properties()
82 input_abs_get_min(input, axis_x), in touchscreen_parse_properties()
84 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-x", in touchscreen_parse_properties()
85 input_abs_get_max(input, in touchscreen_parse_properties()
88 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", in touchscreen_parse_properties()
89 input_abs_get_fuzz(input, axis_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()
95 input_abs_get_min(input, axis_y), in touchscreen_parse_properties()
97 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-y", in touchscreen_parse_properties()
98 input_abs_get_max(input, in touchscreen_parse_properties()
101 data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", in touchscreen_parse_properties()
102 input_abs_get_fuzz(input, axis_y), in touchscreen_parse_properties()
105 touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz); 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()
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()
163 * touchscreen_set_mt_pos - Set input_mt_pos coordinates
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
185 * @input: input_device to report coordinates for
189 * @multitouch: Report coordinates on single-touch or multi-touch axes
195 void touchscreen_report_pos(struct input_dev *input, in touchscreen_report_pos() argument
201 input_report_abs(input, multitouch ? ABS_MT_POSITION_X : ABS_X, x); in touchscreen_report_pos()
202 input_report_abs(input, multitouch ? ABS_MT_POSITION_Y : ABS_Y, y); in touchscreen_report_pos()