Lines Matching refs:st

61 	struct grts_state *st = private;
64 x = touch_info[st->ch_map[GRTS_CH_X]];
65 y = touch_info[st->ch_map[GRTS_CH_Y]];
67 if (st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS) {
68 press = touch_info[st->ch_map[GRTS_CH_PRESSURE]];
69 } else if (st->ch_map[GRTS_CH_Z1] < GRTS_MAX_CHANNELS) {
70 unsigned int z1 = touch_info[st->ch_map[GRTS_CH_Z1]];
71 unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]];
77 Rt *= st->x_plate_ohms;
92 if ((!x && !y) || (st->pressure && (press < st->pressure_min))) {
94 input_report_key(st->input, BTN_TOUCH, 0);
95 input_sync(st->input);
100 touchscreen_report_pos(st->input, &st->prop, x, y, false);
101 if (st->pressure)
102 input_report_abs(st->input, ABS_PRESSURE, press);
103 input_report_key(st->input, BTN_TOUCH, 1);
104 input_sync(st->input);
112 struct grts_state *st = input_get_drvdata(dev);
114 error = iio_channel_start_all_cb(st->iio_cb);
124 struct grts_state *st = input_get_drvdata(dev);
126 iio_channel_stop_all_cb(st->iio_cb);
134 static int grts_map_channel(struct grts_state *st, struct device *dev,
149 st->ch_map[type] = idx;
153 static int grts_get_properties(struct grts_state *st, struct device *dev)
157 error = grts_map_channel(st, dev, GRTS_CH_X, "x", false);
161 error = grts_map_channel(st, dev, GRTS_CH_Y, "y", false);
166 error = grts_map_channel(st, dev, GRTS_CH_PRESSURE, "pressure", true);
170 if (st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS) {
171 st->pressure = true;
176 error = grts_map_channel(st, dev, GRTS_CH_Z1, "z1", true);
180 if (st->ch_map[GRTS_CH_Z1] >= GRTS_MAX_CHANNELS)
184 error = grts_map_channel(st, dev, GRTS_CH_Z2, "z2", true);
190 &st->x_plate_ohms);
196 st->pressure = true;
202 struct grts_state *st;
207 st = devm_kzalloc(dev, sizeof(struct grts_state), GFP_KERNEL);
208 if (!st)
212 st->iio_chans = devm_iio_channel_get_all(dev);
213 if (IS_ERR(st->iio_chans))
214 return dev_err_probe(dev, PTR_ERR(st->iio_chans), "can't get iio channels\n");
219 error = grts_get_properties(st, dev);
225 if (st->pressure) {
228 &st->pressure_min);
231 st->pressure_min = GRTS_DEFAULT_PRESSURE_MIN;
248 if (st->pressure)
249 input_set_abs_params(input, ABS_PRESSURE, st->pressure_min,
255 touchscreen_parse_properties(input, false, &st->prop);
257 st->input = input;
258 input_set_drvdata(input, st);
266 st->iio_cb = iio_channel_get_all_cb(dev, grts_cb, st);
267 if (IS_ERR(st->iio_cb)) {
269 return PTR_ERR(st->iio_cb);
272 error = devm_add_action_or_reset(dev, grts_disable, st->iio_cb);