Thread (15 messages) 15 messages, 4 authors, 2012-03-17

Re: [PATCH] ili210x: Add support for Ilitek ILI210x based touchscreens

From: Olivier Sobrie <hidden>
Date: 2012-03-06 13:58:57

On Tue, Mar 06, 2012 at 02:42:52PM +0100, Henrik Rydberg wrote:
quoted
I propose to change the handling of the interrupt by the code below.

#define POLL_PERIOD	msecs_to_jiffies(1)

static void ili210x_work(struct work_struct *work)
{
	struct ili210x *priv = container_of(work, struct ili210x,
					    dwork.work);
	struct input_dev *input = priv->input;
	struct i2c_client *client = priv->client;
	struct device *dev = &client->dev;
	struct touchdata touchdata;
	int rc;

	rc = ili210x_read_reg(client, REG_TOUCHDATA, &touchdata,
			      sizeof(touchdata));
	if (rc < 0) {
		dev_err(dev, "Unable to get touchdata, err = %d\n",
			rc);
		return;
	}

	ili210x_report_events(input, &touchdata);

	if ((touchdata.status & 0xf3) || get_pendown_state(priv))
		schedule_delayed_work(&priv->dwork, POLL_PERIOD);
}

static irqreturn_t ili210x_irq(int irq, void *irq_data)
{
	struct ili210x *priv = irq_data;

	schedule_delayed_work(&priv->dwork, 0);

	return IRQ_HANDLED;
}

It removes the timer and handle the case of level triggered and edge
triggered interrupts.
What do you think about that ?
Looks a lot nicer, thank you!
Ok thanks I'll send a new version of the patch including that and the
changes for the remarks you made before.

-- 
Olivier Sobrie
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help