lkml.org 
[lkml]   [2008]   [Feb]   [28]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateWed, 27 Feb 2008 23:09:41 -0800
FromAndrew Morton <>
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;
> +}
> +

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-02-28 07:15    [W:0.211 / U:0.180 seconds]
©2003-2008 Jasper Spaans