提交 c970e895 编写于 作者: O Olliver Schinagl 提交者: Jagan Teki

sunxi: pmic_bus: Decrease boot time by not writing duplicate data

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: NOlliver Schinagl <oliver@schinagl.nl>
Signed-off-by: NPriit Laes <plaes@plaes.org>
Acked-by: NMaxime Ripard <maxime.ripard@bootlin.com>
上级 a8011eb8
......@@ -101,6 +101,9 @@ int pmic_bus_setbits(u8 reg, u8 bits)
if (ret)
return ret;
if ((val & bits) == bits)
return 0;
val |= bits;
return pmic_bus_write(reg, val);
}
......@@ -114,6 +117,9 @@ int pmic_bus_clrbits(u8 reg, u8 bits)
if (ret)
return ret;
if (!(val & bits))
return 0;
val &= ~bits;
return pmic_bus_write(reg, val);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册