Skip to contentSkip to conversation

PROBLEM: module i2c_pca_isa PC9564, interrupt problem

DISCUSSION alain meirhaeghe 1 participant 1 message May 21, 2007

lore
Share & tools
lore
#0 lore raw

Hello,
I think there is a bug in i2c_pca_isa driver. Problem is interrupt running on arm720 system linux-2.6.20.1.

Description of the problem:
When driver write to pc9564 an infinite loop interrupt appear (bloquing the system).

J think it is because the acknowledge of interrupt is not do correctly. Acknowledge of interrupt is done outside interrupt .
J think it is dangerous if latency time of interrupt is short (as in ARM processor).

See existing code below:
static int pca_isa_waitforinterrupt(struct i2c_algo_pca_data *adap) {
int ret = 0;
if (irq > -1)
{
ret = wait_event_interruptible(pca_wait,pca_isa_readbyte(adap,
I2C_PCA_CON) & I2C_PCA_CON_SI);

} else

   {
       while ((pca_isa_readbyte(adap, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
           udelay(100);

}
return ret;
}

static irqreturn_t pca_handler(int this_irq, void *dev_id) {

wake_up_interruptible(&pca_wait);
return IRQ_HANDLED;
}

Isa_wait is never waked because pca_handler is always call, because j think it is necessary to acknowledge the interrupt in the interrupt handler as usual. My temporary solution is:
static irqreturn_t pca_handler(int this_irq, void *dev_id) {
disable_irq(irq); // !!!!!!!!!!!!!!!!!!! temporary patch
wake_up_interruptible(&pca_wait);
return IRQ_HANDLED;
}

How can we correct this ?

Thank to all
Alain Meirhaeghe