lkml.org 
[lkml]   [2008]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/6] Driver for WM97xx touchscreens in streaming mode on Mainstone
On Tue, 26 Feb 2008 13:40:17 +0000 Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> +#ifdef CONFIG_PXA27x
> +static void wm97xx_acc_pen_up(struct wm97xx *wm)
> +{
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(1);
> +
> + while (MISR & (1 << 2))
> + MODR;
> +}
> +#else
> +static void wm97xx_acc_pen_up(struct wm97xx *wm)
> +{
> + int count = 16;
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(1);
> +
> + while (count < 16) {
> + MODR;
> + count--;
> + }
> +}
> +#endif

Can use schedule_timeout_interruptible() here.

If the calling process happens to have a signal pending then the
schedule_timeout() becomes a no-op. Will the driver still function
correctly?

> +static int wm97xx_acc_pen_down(struct wm97xx *wm)
> +{
> + u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
> + int reads = 0;
> +
> + /* data is never immediately available after pen down irq */
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(1);

dittoes.

> + if (tries > 5) {
> + tries = 0;
> + return RC_PENUP;
> + }
> +
> + x = MODR;
> + if (x == last) {
> + tries++;
> + return RC_AGAIN;
> + }
> + last = x;
> + do {
> + if (reads)
> + x = MODR;
> + y = MODR;
> + if (pressure)
> + p = MODR;
> +
> + /* are samples valid */
> + if ((x & 0x7000) != WM97XX_ADCSEL_X ||
> + (y & 0x7000) != WM97XX_ADCSEL_Y ||
> + (p & 0x7000) != WM97XX_ADCSEL_PRES)
> + goto up;
> +
> + /* coordinate is good */
> + tries = 0;
> + input_report_abs(wm->input_dev, ABS_X, x & 0xfff);
> + input_report_abs(wm->input_dev, ABS_Y, y & 0xfff);
> + input_report_abs(wm->input_dev, ABS_PRESSURE, p & 0xfff);
> + input_sync(wm->input_dev);
> + reads++;
> + } while (reads < cinfo[sp_idx].reads);
> +up:
> + return RC_PENDOWN | RC_AGAIN;
> +}
> +



\
 
 \ /
  Last update: 2008-02-28 08:15    [W:0.040 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site