• Home
  • Raw
  • Download

Lines Matching refs:ucb

38 static void ucb1400_ts_mode_int(struct ucb1400_ts *ucb)  in ucb1400_ts_mode_int()  argument
40 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_mode_int()
50 static unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) in ucb1400_ts_read_pressure() argument
52 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_pressure()
59 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); in ucb1400_ts_read_pressure()
68 static unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) in ucb1400_ts_read_xpos() argument
70 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_xpos()
73 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_xpos()
76 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_xpos()
82 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); in ucb1400_ts_read_xpos()
91 static int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) in ucb1400_ts_read_ypos() argument
93 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_ypos()
96 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_ypos()
99 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_ypos()
105 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPX, adcsync); in ucb1400_ts_read_ypos()
112 static unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) in ucb1400_ts_read_xres() argument
114 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_xres()
117 return ucb1400_adc_read(ucb->ac97, 0, adcsync); in ucb1400_ts_read_xres()
124 static unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) in ucb1400_ts_read_yres() argument
126 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, in ucb1400_ts_read_yres()
129 return ucb1400_adc_read(ucb->ac97, 0, adcsync); in ucb1400_ts_read_yres()
132 static int ucb1400_ts_pen_up(struct ucb1400_ts *ucb) in ucb1400_ts_pen_up() argument
134 unsigned short val = ucb1400_reg_read(ucb->ac97, UCB_TS_CR); in ucb1400_ts_pen_up()
139 static void ucb1400_ts_irq_enable(struct ucb1400_ts *ucb) in ucb1400_ts_irq_enable() argument
141 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, UCB_IE_TSPX); in ucb1400_ts_irq_enable()
142 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); in ucb1400_ts_irq_enable()
143 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, UCB_IE_TSPX); in ucb1400_ts_irq_enable()
146 static void ucb1400_ts_irq_disable(struct ucb1400_ts *ucb) in ucb1400_ts_irq_disable() argument
148 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, 0); in ucb1400_ts_irq_disable()
167 static void ucb1400_clear_pending_irq(struct ucb1400_ts *ucb) in ucb1400_clear_pending_irq() argument
171 isr = ucb1400_reg_read(ucb->ac97, UCB_IE_STATUS); in ucb1400_clear_pending_irq()
172 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr); in ucb1400_clear_pending_irq()
173 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); in ucb1400_clear_pending_irq()
176 ucb1400_ts_irq_disable(ucb); in ucb1400_clear_pending_irq()
178 dev_dbg(&ucb->ts_idev->dev, in ucb1400_clear_pending_irq()
191 struct ucb1400_ts *ucb = devid; in ucb1400_irq() local
195 if (unlikely(irqnr != ucb->irq)) in ucb1400_irq()
198 ucb1400_clear_pending_irq(ucb); in ucb1400_irq()
203 while (!ucb->stopped && !(penup = ucb1400_ts_pen_up(ucb))) { in ucb1400_irq()
205 ucb1400_adc_enable(ucb->ac97); in ucb1400_irq()
206 x = ucb1400_ts_read_xpos(ucb); in ucb1400_irq()
207 y = ucb1400_ts_read_ypos(ucb); in ucb1400_irq()
208 p = ucb1400_ts_read_pressure(ucb); in ucb1400_irq()
209 ucb1400_adc_disable(ucb->ac97); in ucb1400_irq()
211 ucb1400_ts_report_event(ucb->ts_idev, p, x, y); in ucb1400_irq()
213 wait_event_timeout(ucb->ts_wait, ucb->stopped, in ucb1400_irq()
217 ucb1400_ts_event_release(ucb->ts_idev); in ucb1400_irq()
219 if (!ucb->stopped) { in ucb1400_irq()
221 ucb1400_ts_mode_int(ucb); in ucb1400_irq()
222 ucb1400_ts_irq_enable(ucb); in ucb1400_irq()
228 static void ucb1400_ts_stop(struct ucb1400_ts *ucb) in ucb1400_ts_stop() argument
231 ucb->stopped = true; in ucb1400_ts_stop()
233 wake_up(&ucb->ts_wait); in ucb1400_ts_stop()
234 disable_irq(ucb->irq); in ucb1400_ts_stop()
236 ucb1400_ts_irq_disable(ucb); in ucb1400_ts_stop()
237 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0); in ucb1400_ts_stop()
241 static void ucb1400_ts_start(struct ucb1400_ts *ucb) in ucb1400_ts_start() argument
244 ucb->stopped = false; in ucb1400_ts_start()
247 ucb1400_ts_mode_int(ucb); in ucb1400_ts_start()
248 ucb1400_ts_irq_enable(ucb); in ucb1400_ts_start()
250 enable_irq(ucb->irq); in ucb1400_ts_start()
255 struct ucb1400_ts *ucb = input_get_drvdata(idev); in ucb1400_ts_open() local
257 ucb1400_ts_start(ucb); in ucb1400_ts_open()
264 struct ucb1400_ts *ucb = input_get_drvdata(idev); in ucb1400_ts_close() local
266 ucb1400_ts_stop(ucb); in ucb1400_ts_close()
277 static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, in ucb1400_ts_detect_irq() argument
285 ucb1400_reg_write(ucb->ac97, UCB_IE_RIS, UCB_IE_ADC); in ucb1400_ts_detect_irq()
286 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, UCB_IE_ADC); in ucb1400_ts_detect_irq()
287 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0xffff); in ucb1400_ts_detect_irq()
288 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); in ucb1400_ts_detect_irq()
291 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, UCB_ADC_ENA); in ucb1400_ts_detect_irq()
292 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, UCB_ADC_ENA | UCB_ADC_START); in ucb1400_ts_detect_irq()
296 while (!(ucb1400_reg_read(ucb->ac97, UCB_ADC_DATA) & in ucb1400_ts_detect_irq()
305 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, 0); in ucb1400_ts_detect_irq()
308 ucb1400_reg_write(ucb->ac97, UCB_IE_RIS, 0); in ucb1400_ts_detect_irq()
309 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, 0); in ucb1400_ts_detect_irq()
310 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0xffff); in ucb1400_ts_detect_irq()
311 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); in ucb1400_ts_detect_irq()
314 ucb->irq = probe_irq_off(mask); in ucb1400_ts_detect_irq()
315 if (ucb->irq < 0 || ucb->irq == NO_IRQ) in ucb1400_ts_detect_irq()
323 struct ucb1400_ts *ucb = pdev->dev.platform_data; in ucb1400_ts_probe() local
327 ucb->ts_idev = input_allocate_device(); in ucb1400_ts_probe()
328 if (!ucb->ts_idev) { in ucb1400_ts_probe()
334 if (ucb->irq < 0) { in ucb1400_ts_probe()
335 error = ucb1400_ts_detect_irq(ucb, pdev); in ucb1400_ts_probe()
341 dev_dbg(&pdev->dev, "found IRQ %d\n", ucb->irq); in ucb1400_ts_probe()
343 init_waitqueue_head(&ucb->ts_wait); in ucb1400_ts_probe()
345 input_set_drvdata(ucb->ts_idev, ucb); in ucb1400_ts_probe()
347 ucb->ts_idev->dev.parent = &pdev->dev; in ucb1400_ts_probe()
348 ucb->ts_idev->name = "UCB1400 touchscreen interface"; in ucb1400_ts_probe()
349 ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97, in ucb1400_ts_probe()
351 ucb->ts_idev->id.product = ucb->id; in ucb1400_ts_probe()
352 ucb->ts_idev->open = ucb1400_ts_open; in ucb1400_ts_probe()
353 ucb->ts_idev->close = ucb1400_ts_close; in ucb1400_ts_probe()
354 ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); in ucb1400_ts_probe()
355 ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); in ucb1400_ts_probe()
362 fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR); in ucb1400_ts_probe()
363 ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE); in ucb1400_ts_probe()
365 ucb1400_adc_enable(ucb->ac97); in ucb1400_ts_probe()
366 x_res = ucb1400_ts_read_xres(ucb); in ucb1400_ts_probe()
367 y_res = ucb1400_ts_read_yres(ucb); in ucb1400_ts_probe()
368 ucb1400_adc_disable(ucb->ac97); in ucb1400_ts_probe()
371 input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0); in ucb1400_ts_probe()
372 input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0); in ucb1400_ts_probe()
373 input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0); in ucb1400_ts_probe()
375 ucb1400_ts_stop(ucb); in ucb1400_ts_probe()
377 error = request_threaded_irq(ucb->irq, NULL, ucb1400_irq, in ucb1400_ts_probe()
379 "UCB1400", ucb); in ucb1400_ts_probe()
382 "unable to grab irq%d: %d\n", ucb->irq, error); in ucb1400_ts_probe()
386 error = input_register_device(ucb->ts_idev); in ucb1400_ts_probe()
393 free_irq(ucb->irq, ucb); in ucb1400_ts_probe()
395 input_free_device(ucb->ts_idev); in ucb1400_ts_probe()
402 struct ucb1400_ts *ucb = pdev->dev.platform_data; in ucb1400_ts_remove() local
404 free_irq(ucb->irq, ucb); in ucb1400_ts_remove()
405 input_unregister_device(ucb->ts_idev); in ucb1400_ts_remove()
413 struct ucb1400_ts *ucb = dev->platform_data; in ucb1400_ts_suspend() local
414 struct input_dev *idev = ucb->ts_idev; in ucb1400_ts_suspend()
419 ucb1400_ts_start(ucb); in ucb1400_ts_suspend()
427 struct ucb1400_ts *ucb = dev->platform_data; in ucb1400_ts_resume() local
428 struct input_dev *idev = ucb->ts_idev; in ucb1400_ts_resume()
433 ucb1400_ts_stop(ucb); in ucb1400_ts_resume()