Re: [PATCH 0/4][RFC] regmap: add force write option

From: Kuninori Morimoto
Date: Thu Jul 02 2015 - 04:58:33 EST



Hi Lars

> > Current _regmap_update_bits() writes data to register if current value and
> > write value was different. This means it doesn't write data if the value was
> > same as current value.
> > But, some device needs to write data even though it was same value.
>
> Can you go into more detail about the exact usecase with a specific example?

Some of our device registers need to be written data even though it was same as current value.
Otherwise, it doesn't work correctly.
Now, its device driver is using regmap. If my understanding was correct, regmap write
function will try to read current data. then it writes data if current data and
write data were not same. this behavior can reduce process, but we had trouble.

pseudo code of current regmap is

xxx regmap_xx_write(reg, new)
{
old = xx_read(reg);

if (old != new)
xxx_write(reg, new);
}

We would like to have "force" write feature

xxx regmap_xx_write(reg, new, force)
{
old = xx_read(reg);

/*
* we would like to write data
* even though old == new here
*/

if (force || (old != new))
xxx_write(reg, new);
}


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