When we set or clear a pmic_bus bit, we do a read-modify-write

operation. We waste some time however, by writing back the exact same
value that was already set in the chip. Let us thus only configure the
chip if the data is different.
lime2
Merlijn Wajer 6 years ago
parent 93cb6142c1
commit 1a82933368
  1. 6
      arch/arm/mach-sunxi/pmic_bus.c

@ -102,6 +102,9 @@ int pmic_bus_setbits(u8 reg, u8 bits)
if (ret)
return ret;
if (val & bits)
return 0;
val |= bits;
return pmic_bus_write(reg, val);
}
@ -115,6 +118,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);
}

Loading…
Cancel
Save