power: supply: axp288_fuel_gauge: Take the P-Unit semaphore only once during probe()
authorHans de Goede <hdegoede@redhat.com>
Sun, 1 Aug 2021 13:31:05 +0000 (15:31 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 5 Aug 2021 16:54:52 +0000 (18:54 +0200)
commit213e19d659f9bb891387f105281a63700594a3dd
tree6d4f7335584aeb24c38d97bc6d398768faa196a4
parent964b3e9b02bd89a17fdd108a2ecb053beba2b43f
power: supply: axp288_fuel_gauge: Take the P-Unit semaphore only once during probe()

The I2C-bus to the XPower AXP288 is shared between the Linux kernel and
the SoCs P-Unit. The P-Unit has a semaphore which the kernel must "lock"
before it may use the bus. If not explicitly taken by the I2C-driver,
then this semaphore is automatically taken by the I2C-bus-driver for
each I2C-transfer and this is a quite expensive operation.

Explicitly take the semaphore in probe() around the register-accesses
done during probe, so that this only needs to be done once, rather then
once per register-access.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/axp288_fuel_gauge.c