Lines Matching full:ts

88 bool tsc2007_is_pen_down(struct tsc2007 *ts)  in tsc2007_is_pen_down()  argument
104 if (!ts->get_pendown_state) in tsc2007_is_pen_down()
107 return ts->get_pendown_state(&ts->client->dev); in tsc2007_is_pen_down()
112 struct tsc2007 *ts = handle; in tsc2007_soft_irq() local
113 struct input_dev *input = ts->input; in tsc2007_soft_irq()
117 while (!ts->stopped && tsc2007_is_pen_down(ts)) { in tsc2007_soft_irq()
121 mutex_lock(&ts->mlock); in tsc2007_soft_irq()
122 tsc2007_read_values(ts, &tc); in tsc2007_soft_irq()
123 mutex_unlock(&ts->mlock); in tsc2007_soft_irq()
125 rt = tsc2007_calculate_resistance(ts, &tc); in tsc2007_soft_irq()
127 if (!rt && !ts->get_pendown_state) { in tsc2007_soft_irq()
136 if (rt <= ts->max_rt) { in tsc2007_soft_irq()
137 dev_dbg(&ts->client->dev, in tsc2007_soft_irq()
141 rt = ts->max_rt - rt; 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()
176 struct tsc2007 *ts = handle; in tsc2007_hard_irq() local
178 if (tsc2007_is_pen_down(ts)) in tsc2007_hard_irq()
181 if (ts->clear_penirq) in tsc2007_hard_irq()
182 ts->clear_penirq(); in tsc2007_hard_irq()
187 static void tsc2007_stop(struct tsc2007 *ts) in tsc2007_stop() argument
189 ts->stopped = true; in tsc2007_stop()
191 wake_up(&ts->wait); in tsc2007_stop()
193 disable_irq(ts->irq); in tsc2007_stop()
198 struct tsc2007 *ts = input_get_drvdata(input_dev); in tsc2007_open() local
201 ts->stopped = false; in tsc2007_open()
204 enable_irq(ts->irq); in tsc2007_open()
207 err = tsc2007_xfer(ts, PWRDOWN); in tsc2007_open()
209 tsc2007_stop(ts); in tsc2007_open()
218 struct tsc2007 *ts = input_get_drvdata(input_dev); in tsc2007_close() local
220 tsc2007_stop(ts); in tsc2007_close()
227 struct tsc2007 *ts = i2c_get_clientdata(client); in tsc2007_get_pendown_state_gpio() local
229 return !gpio_get_value(ts->gpio); in tsc2007_get_pendown_state_gpio()
232 static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) in tsc2007_probe_dt() argument
244 ts->max_rt = val32; in tsc2007_probe_dt()
246 ts->max_rt = MAX_12BIT; in tsc2007_probe_dt()
249 ts->fuzzx = val32; in tsc2007_probe_dt()
252 ts->fuzzy = val32; in tsc2007_probe_dt()
255 ts->fuzzz = val32; in tsc2007_probe_dt()
258 ts->poll_period = msecs_to_jiffies(val64); in tsc2007_probe_dt()
260 ts->poll_period = msecs_to_jiffies(1); in tsc2007_probe_dt()
263 ts->x_plate_ohms = val32; in tsc2007_probe_dt()
269 ts->gpio = of_get_gpio(np, 0); in tsc2007_probe_dt()
270 if (gpio_is_valid(ts->gpio)) in tsc2007_probe_dt()
271 ts->get_pendown_state = tsc2007_get_pendown_state_gpio; in tsc2007_probe_dt()
275 ts->gpio); in tsc2007_probe_dt()
280 static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) in tsc2007_probe_dt() argument
287 static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts, in tsc2007_probe_pdev() argument
291 ts->model = pdata->model; in tsc2007_probe_pdev()
292 ts->x_plate_ohms = pdata->x_plate_ohms; in tsc2007_probe_pdev()
293 ts->max_rt = pdata->max_rt ? : MAX_12BIT; in tsc2007_probe_pdev()
294 ts->poll_period = msecs_to_jiffies(pdata->poll_period ? : 1); in tsc2007_probe_pdev()
295 ts->get_pendown_state = pdata->get_pendown_state; in tsc2007_probe_pdev()
296 ts->clear_penirq = pdata->clear_penirq; in tsc2007_probe_pdev()
297 ts->fuzzx = pdata->fuzzx; in tsc2007_probe_pdev()
298 ts->fuzzy = pdata->fuzzy; in tsc2007_probe_pdev()
299 ts->fuzzz = pdata->fuzzz; in tsc2007_probe_pdev()
322 struct tsc2007 *ts; in tsc2007_probe() local
330 ts = devm_kzalloc(&client->dev, sizeof(struct tsc2007), GFP_KERNEL); in tsc2007_probe()
331 if (!ts) in tsc2007_probe()
335 err = tsc2007_probe_pdev(client, ts, pdata, id); in tsc2007_probe()
337 err = tsc2007_probe_dt(client, ts); in tsc2007_probe()
345 i2c_set_clientdata(client, ts); in tsc2007_probe()
347 ts->client = client; in tsc2007_probe()
348 ts->irq = client->irq; in tsc2007_probe()
349 ts->input = input_dev; in tsc2007_probe()
351 init_waitqueue_head(&ts->wait); in tsc2007_probe()
352 mutex_init(&ts->mlock); in tsc2007_probe()
354 snprintf(ts->phys, sizeof(ts->phys), in tsc2007_probe()
358 input_dev->phys = ts->phys; in tsc2007_probe()
364 input_set_drvdata(input_dev, ts); in tsc2007_probe()
368 input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, ts->fuzzx, 0); in tsc2007_probe()
369 input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, ts->fuzzy, 0); in tsc2007_probe()
371 ts->fuzzz, 0); in tsc2007_probe()
390 err = devm_request_threaded_irq(&client->dev, ts->irq, in tsc2007_probe()
393 client->dev.driver->name, ts); in tsc2007_probe()
396 ts->irq, err); in tsc2007_probe()
400 tsc2007_stop(ts); in tsc2007_probe()
403 err = tsc2007_xfer(ts, PWRDOWN); in tsc2007_probe()
417 err = tsc2007_iio_configure(ts); in tsc2007_probe()