When we clear a pmic_bus bit, we do a read-modify-write operation.
We waste some time however, by writing back the exact samea value
that was already set in the chip. Let us thus only do the write
in case data was changed.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
if (ret)
return ret;
+ if ((val & bits) == bits)
+ return 0;
+
val |= bits;
return pmic_bus_write(reg, val);
}
if (ret)
return ret;
+ if (!(val & bits))
+ return 0;
+
val &= ~bits;
return pmic_bus_write(reg, val);
}