Lines Matching full:ts
89 bool tsc2007_is_pen_down(struct tsc2007 *ts) in tsc2007_is_pen_down() argument
105 if (!ts->get_pendown_state) in tsc2007_is_pen_down()
108 return ts->get_pendown_state(&ts->client->dev); in tsc2007_is_pen_down()
113 struct tsc2007 *ts = handle; in tsc2007_soft_irq() local
114 struct input_dev *input = ts->input; in tsc2007_soft_irq()
118 while (!ts->stopped && tsc2007_is_pen_down(ts)) { in tsc2007_soft_irq()
122 mutex_lock(&ts->mlock); in tsc2007_soft_irq()
123 tsc2007_read_values(ts, &tc); in tsc2007_soft_irq()
124 mutex_unlock(&ts->mlock); in tsc2007_soft_irq()
126 rt = tsc2007_calculate_resistance(ts, &tc); in tsc2007_soft_irq()
128 if (!rt && !ts->get_pendown_state) { in tsc2007_soft_irq()
137 if (rt <= ts->max_rt) { in tsc2007_soft_irq()
138 dev_dbg(&ts->client->dev, in tsc2007_soft_irq()
142 rt = ts->max_rt - rt; in tsc2007_soft_irq()
145 touchscreen_report_pos(input, &ts->prop, tc.x, tc.y, false); in tsc2007_soft_irq()
156 dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); in tsc2007_soft_irq()
159 wait_event_timeout(ts->wait, ts->stopped, ts->poll_period); in tsc2007_soft_irq()
162 dev_dbg(&ts->client->dev, "UP\n"); in tsc2007_soft_irq()
168 if (ts->clear_penirq) in tsc2007_soft_irq()
169 ts->clear_penirq(); in tsc2007_soft_irq()
174 static void tsc2007_stop(struct tsc2007 *ts) in tsc2007_stop() argument
176 ts->stopped = true; in tsc2007_stop()
178 wake_up(&ts->wait); in tsc2007_stop()
180 disable_irq(ts->irq); in tsc2007_stop()
185 struct tsc2007 *ts = input_get_drvdata(input_dev); in tsc2007_open() local
188 ts->stopped = false; in tsc2007_open()
191 enable_irq(ts->irq); in tsc2007_open()
194 err = tsc2007_xfer(ts, PWRDOWN); in tsc2007_open()
196 tsc2007_stop(ts); in tsc2007_open()
205 struct tsc2007 *ts = input_get_drvdata(input_dev); in tsc2007_close() local
207 tsc2007_stop(ts); in tsc2007_close()
213 struct tsc2007 *ts = i2c_get_clientdata(client); in tsc2007_get_pendown_state_gpio() local
215 return gpiod_get_value_cansleep(ts->gpiod); in tsc2007_get_pendown_state_gpio()
218 static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts) in tsc2007_probe_properties() argument
224 ts->max_rt = val32; in tsc2007_probe_properties()
226 ts->max_rt = MAX_12BIT; in tsc2007_probe_properties()
229 ts->fuzzx = val32; in tsc2007_probe_properties()
232 ts->fuzzy = val32; in tsc2007_probe_properties()
235 ts->fuzzz = val32; in tsc2007_probe_properties()
238 ts->poll_period = msecs_to_jiffies(val64); in tsc2007_probe_properties()
240 ts->poll_period = msecs_to_jiffies(1); in tsc2007_probe_properties()
243 ts->x_plate_ohms = val32; in tsc2007_probe_properties()
249 ts->gpiod = devm_gpiod_get_optional(dev, NULL, GPIOD_IN); in tsc2007_probe_properties()
250 if (IS_ERR(ts->gpiod)) in tsc2007_probe_properties()
251 return PTR_ERR(ts->gpiod); in tsc2007_probe_properties()
253 if (ts->gpiod) in tsc2007_probe_properties()
254 ts->get_pendown_state = tsc2007_get_pendown_state_gpio; in tsc2007_probe_properties()
261 static int tsc2007_probe_pdev(struct device *dev, struct tsc2007 *ts, in tsc2007_probe_pdev() argument
265 ts->model = pdata->model; in tsc2007_probe_pdev()
266 ts->x_plate_ohms = pdata->x_plate_ohms; in tsc2007_probe_pdev()
267 ts->max_rt = pdata->max_rt ? : MAX_12BIT; in tsc2007_probe_pdev()
268 ts->poll_period = msecs_to_jiffies(pdata->poll_period ? : 1); in tsc2007_probe_pdev()
269 ts->get_pendown_state = pdata->get_pendown_state; in tsc2007_probe_pdev()
270 ts->clear_penirq = pdata->clear_penirq; in tsc2007_probe_pdev()
271 ts->fuzzx = pdata->fuzzx; in tsc2007_probe_pdev()
272 ts->fuzzy = pdata->fuzzy; in tsc2007_probe_pdev()
273 ts->fuzzz = pdata->fuzzz; in tsc2007_probe_pdev()
296 struct tsc2007 *ts; in tsc2007_probe() local
304 ts = devm_kzalloc(&client->dev, sizeof(struct tsc2007), GFP_KERNEL); in tsc2007_probe()
305 if (!ts) in tsc2007_probe()
309 err = tsc2007_probe_pdev(&client->dev, ts, pdata, id); in tsc2007_probe()
311 err = tsc2007_probe_properties(&client->dev, ts); in tsc2007_probe()
319 i2c_set_clientdata(client, ts); in tsc2007_probe()
321 ts->client = client; in tsc2007_probe()
322 ts->irq = client->irq; in tsc2007_probe()
323 ts->input = input_dev; in tsc2007_probe()
325 init_waitqueue_head(&ts->wait); in tsc2007_probe()
326 mutex_init(&ts->mlock); in tsc2007_probe()
328 snprintf(ts->phys, sizeof(ts->phys), in tsc2007_probe()
332 input_dev->phys = ts->phys; in tsc2007_probe()
338 input_set_drvdata(input_dev, ts); in tsc2007_probe()
341 input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, ts->fuzzx, 0); in tsc2007_probe()
342 input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, ts->fuzzy, 0); in tsc2007_probe()
343 touchscreen_parse_properties(input_dev, false, &ts->prop); in tsc2007_probe()
345 ts->fuzzz, 0); in tsc2007_probe()
364 err = devm_request_threaded_irq(&client->dev, ts->irq, in tsc2007_probe()
367 client->dev.driver->name, ts); in tsc2007_probe()
370 ts->irq, err); in tsc2007_probe()
374 tsc2007_stop(ts); in tsc2007_probe()
377 err = tsc2007_xfer(ts, PWRDOWN); in tsc2007_probe()
391 err = tsc2007_iio_configure(ts); in tsc2007_probe()