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

1 // SPDX-License-Identifier: GPL-2.0
3 * ADC generic resistive touchscreen (GRTS)
13 #include <linux/input/touchscreen.h>
21 #define DRIVER_NAME "resistive-adc-touch"
26 * grts_state - generic resistive touch screen information struct
32 * @prop: touchscreen properties struct
47 unsigned int x, y, press = 0x0; in grts_cb() local
50 x = touch_info[0]; in grts_cb()
52 if (st->pressure) in grts_cb()
55 if ((!x && !y) || (st->pressure && (press < st->pressure_min))) { in grts_cb()
57 input_report_key(st->input, BTN_TOUCH, 0); in grts_cb()
58 input_sync(st->input); in grts_cb()
63 touchscreen_report_pos(st->input, &st->prop, x, y, false); in grts_cb()
64 if (st->pressure) in grts_cb()
65 input_report_abs(st->input, ABS_PRESSURE, press); in grts_cb()
66 input_report_key(st->input, BTN_TOUCH, 1); in grts_cb()
67 input_sync(st->input); in grts_cb()
77 error = iio_channel_start_all_cb(st->iio_cb); in grts_open()
79 dev_err(dev->dev.parent, "failed to start callback buffer.\n"); in grts_open()
89 iio_channel_stop_all_cb(st->iio_cb); in grts_close()
101 struct device *dev = &pdev->dev; in grts_probe()
107 return -ENOMEM; in grts_probe()
110 st->iio_chans = devm_iio_channel_get_all(dev); in grts_probe()
111 if (IS_ERR(st->iio_chans)) { in grts_probe()
112 error = PTR_ERR(st->iio_chans); in grts_probe()
113 if (error != -EPROBE_DEFER) in grts_probe()
118 chan = &st->iio_chans[0]; in grts_probe()
119 st->pressure = false; in grts_probe()
120 while (chan && chan->indio_dev) { in grts_probe()
121 if (!strcmp(chan->channel->datasheet_name, "pressure")) in grts_probe()
122 st->pressure = true; in grts_probe()
126 if (st->pressure) { in grts_probe()
128 "touchscreen-min-pressure", in grts_probe()
129 &st->pressure_min); in grts_probe()
131 dev_dbg(dev, "can't get touchscreen-min-pressure property.\n"); in grts_probe()
132 st->pressure_min = GRTS_DEFAULT_PRESSURE_MIN; in grts_probe()
139 return -ENOMEM; in grts_probe()
142 input->name = DRIVER_NAME; in grts_probe()
143 input->id.bustype = BUS_HOST; in grts_probe()
144 input->open = grts_open; in grts_probe()
145 input->close = grts_close; in grts_probe()
147 input_set_abs_params(input, ABS_X, 0, GRTS_MAX_POS_MASK - 1, 0, 0); in grts_probe()
148 input_set_abs_params(input, ABS_Y, 0, GRTS_MAX_POS_MASK - 1, 0, 0); in grts_probe()
149 if (st->pressure) in grts_probe()
150 input_set_abs_params(input, ABS_PRESSURE, st->pressure_min, in grts_probe()
156 touchscreen_parse_properties(input, false, &st->prop); in grts_probe()
158 st->input = input; in grts_probe()
167 st->iio_cb = iio_channel_get_all_cb(dev, grts_cb, st); in grts_probe()
168 if (IS_ERR(st->iio_cb)) { in grts_probe()
170 return PTR_ERR(st->iio_cb); in grts_probe()
173 error = devm_add_action_or_reset(dev, grts_disable, st->iio_cb); in grts_probe()
184 .compatible = "resistive-adc-touch",