Re: [PATCH v2] regmap: irq: clear status when disable irq

From: Mark Brown
Date: Thu Oct 17 2013 - 20:11:34 EST


On Tue, Oct 15, 2013 at 08:23:30PM +0800, Yi Zhang wrote:

I'm still not sure this is doing the right thing.

> + for (j = 0; j < bits_length; j++) {
> + if (!(d->mask_buf[i] & (0x1 << j))) {

This is checking to see if the bit is masked...

> + ret = regmap_update_bits(d->map, reg,
> + (0x1 << j), 0);

...then writing a zero to that bit. For most chips with a write 1 to
clear acknowledge this will result in all set bits in the register being
acked except the currently masked one (though if there are two masked
bits all will be acked).

It would be much quicker to just write mask_buf[i] back to the device to
acknoweldge all masked bits at once rather than try to do it
individually and the result should be the same unless the chip requires
us to set zero (which probably ought to be a quirk).

Attachment: signature.asc
Description: Digital signature