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!
Henrik