Lines Matching refs:ts
54 static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y) in ucb1x00_ts_evt_add() argument
56 struct input_dev *idev = ts->idev; in ucb1x00_ts_evt_add()
65 static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts) in ucb1x00_ts_event_release() argument
67 struct input_dev *idev = ts->idev; in ucb1x00_ts_event_release()
77 static inline void ucb1x00_ts_mode_int(struct ucb1x00_ts *ts) in ucb1x00_ts_mode_int() argument
79 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_mode_int()
89 static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) in ucb1x00_ts_read_pressure() argument
92 ucb1x00_io_write(ts->ucb, COLLIE_TC35143_GPIO_TBL_CHK, 0); in ucb1x00_ts_read_pressure()
93 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_pressure()
99 return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_AD2, ts->adcsync); in ucb1x00_ts_read_pressure()
101 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_pressure()
106 return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); in ucb1x00_ts_read_pressure()
116 static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) in ucb1x00_ts_read_xpos() argument
119 ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); in ucb1x00_ts_read_xpos()
121 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_xpos()
124 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_xpos()
128 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_xpos()
134 return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); in ucb1x00_ts_read_xpos()
143 static inline unsigned int ucb1x00_ts_read_ypos(struct ucb1x00_ts *ts) in ucb1x00_ts_read_ypos() argument
146 ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); in ucb1x00_ts_read_ypos()
148 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_ypos()
151 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_ypos()
156 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_ypos()
162 return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPX, ts->adcsync); in ucb1x00_ts_read_ypos()
169 static inline unsigned int ucb1x00_ts_read_xres(struct ucb1x00_ts *ts) in ucb1x00_ts_read_xres() argument
171 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_xres()
174 return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync); in ucb1x00_ts_read_xres()
181 static inline unsigned int ucb1x00_ts_read_yres(struct ucb1x00_ts *ts) in ucb1x00_ts_read_yres() argument
183 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, in ucb1x00_ts_read_yres()
186 return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync); in ucb1x00_ts_read_yres()
189 static inline int ucb1x00_ts_pen_down(struct ucb1x00_ts *ts) in ucb1x00_ts_pen_down() argument
191 unsigned int val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR); in ucb1x00_ts_pen_down()
206 struct ucb1x00_ts *ts = _ts; in ucb1x00_thread() local
212 add_wait_queue(&ts->irq_wait, &wait); in ucb1x00_thread()
220 ucb1x00_adc_enable(ts->ucb); in ucb1x00_thread()
222 x = ucb1x00_ts_read_xpos(ts); in ucb1x00_thread()
223 y = ucb1x00_ts_read_ypos(ts); in ucb1x00_thread()
224 p = ucb1x00_ts_read_pressure(ts); in ucb1x00_thread()
229 ucb1x00_ts_mode_int(ts); in ucb1x00_thread()
230 ucb1x00_adc_disable(ts->ucb); in ucb1x00_thread()
234 ucb1x00_enable(ts->ucb); in ucb1x00_thread()
237 if (ucb1x00_ts_pen_down(ts)) { in ucb1x00_thread()
240 spin_lock_irq(&ts->irq_lock); in ucb1x00_thread()
241 if (ts->irq_disabled) { in ucb1x00_thread()
242 ts->irq_disabled = 0; in ucb1x00_thread()
243 enable_irq(ts->ucb->irq_base + UCB_IRQ_TSPX); in ucb1x00_thread()
245 spin_unlock_irq(&ts->irq_lock); in ucb1x00_thread()
246 ucb1x00_disable(ts->ucb); in ucb1x00_thread()
253 ucb1x00_ts_event_release(ts); in ucb1x00_thread()
259 ucb1x00_disable(ts->ucb); in ucb1x00_thread()
267 ucb1x00_ts_evt_add(ts, p, x, y); in ucb1x00_thread()
278 remove_wait_queue(&ts->irq_wait, &wait); in ucb1x00_thread()
280 ts->rtask = NULL; in ucb1x00_thread()
290 struct ucb1x00_ts *ts = id; in ucb1x00_ts_irq() local
292 spin_lock(&ts->irq_lock); in ucb1x00_ts_irq()
293 ts->irq_disabled = 1; in ucb1x00_ts_irq()
294 disable_irq_nosync(ts->ucb->irq_base + UCB_IRQ_TSPX); in ucb1x00_ts_irq()
295 spin_unlock(&ts->irq_lock); in ucb1x00_ts_irq()
296 wake_up(&ts->irq_wait); in ucb1x00_ts_irq()
303 struct ucb1x00_ts *ts = input_get_drvdata(idev); in ucb1x00_ts_open() local
307 BUG_ON(ts->rtask); in ucb1x00_ts_open()
314 ts->irq_disabled = 0; in ucb1x00_ts_open()
316 init_waitqueue_head(&ts->irq_wait); in ucb1x00_ts_open()
317 ret = request_irq(ts->ucb->irq_base + UCB_IRQ_TSPX, ucb1x00_ts_irq, in ucb1x00_ts_open()
318 flags, "ucb1x00-ts", ts); in ucb1x00_ts_open()
326 ucb1x00_adc_enable(ts->ucb); in ucb1x00_ts_open()
327 ts->x_res = ucb1x00_ts_read_xres(ts); in ucb1x00_ts_open()
328 ts->y_res = ucb1x00_ts_read_yres(ts); in ucb1x00_ts_open()
329 ucb1x00_adc_disable(ts->ucb); in ucb1x00_ts_open()
331 ts->rtask = kthread_run(ucb1x00_thread, ts, "ktsd"); in ucb1x00_ts_open()
332 if (!IS_ERR(ts->rtask)) { in ucb1x00_ts_open()
335 free_irq(ts->ucb->irq_base + UCB_IRQ_TSPX, ts); in ucb1x00_ts_open()
336 ts->rtask = NULL; in ucb1x00_ts_open()
349 struct ucb1x00_ts *ts = input_get_drvdata(idev); in ucb1x00_ts_close() local
351 if (ts->rtask) in ucb1x00_ts_close()
352 kthread_stop(ts->rtask); in ucb1x00_ts_close()
354 ucb1x00_enable(ts->ucb); in ucb1x00_ts_close()
355 free_irq(ts->ucb->irq_base + UCB_IRQ_TSPX, ts); in ucb1x00_ts_close()
356 ucb1x00_reg_write(ts->ucb, UCB_TS_CR, 0); in ucb1x00_ts_close()
357 ucb1x00_disable(ts->ucb); in ucb1x00_ts_close()
366 struct ucb1x00_ts *ts; in ucb1x00_ts_add() local
370 ts = kzalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL); in ucb1x00_ts_add()
372 if (!ts || !idev) { in ucb1x00_ts_add()
377 ts->ucb = dev->ucb; in ucb1x00_ts_add()
378 ts->idev = idev; in ucb1x00_ts_add()
379 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; in ucb1x00_ts_add()
380 spin_lock_init(&ts->irq_lock); in ucb1x00_ts_add()
383 idev->id.product = ts->ucb->id; in ucb1x00_ts_add()
386 idev->dev.parent = &ts->ucb->dev; in ucb1x00_ts_add()
391 input_set_drvdata(idev, ts); in ucb1x00_ts_add()
393 ucb1x00_adc_enable(ts->ucb); in ucb1x00_ts_add()
394 ts->x_res = ucb1x00_ts_read_xres(ts); in ucb1x00_ts_add()
395 ts->y_res = ucb1x00_ts_read_yres(ts); in ucb1x00_ts_add()
396 ucb1x00_adc_disable(ts->ucb); in ucb1x00_ts_add()
398 input_set_abs_params(idev, ABS_X, 0, ts->x_res, 0, 0); in ucb1x00_ts_add()
399 input_set_abs_params(idev, ABS_Y, 0, ts->y_res, 0, 0); in ucb1x00_ts_add()
406 dev->priv = ts; in ucb1x00_ts_add()
412 kfree(ts); in ucb1x00_ts_add()
418 struct ucb1x00_ts *ts = dev->priv; in ucb1x00_ts_remove() local
420 input_unregister_device(ts->idev); in ucb1x00_ts_remove()
421 kfree(ts); in ucb1x00_ts_remove()