linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] power: supply: axp288_fuel_gauge: Reduce number of register accesses + cleanups
@ 2021-07-17 16:44 Hans de Goede
  2021-07-17 16:44 ` [PATCH 01/10] power: supply: axp288_fuel_gauge: Fix define alignment Hans de Goede
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Hans de Goede @ 2021-07-17 16:44 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: Hans de Goede, Andrejus Basovas, linux-pm

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 and while the kernel holds the semaphore the CPU
and GPU power-states must not be changed otherwise the system will freeze.
This is a complex process, which is quite expensive.

To ensure that no unguarded I2C-bus accesses happen, the semaphore is
taken by the I2C-bus-driver for every I2C transfer. When upower refreshes
its battery stats it reads all the power-supply properties at once,
leading to the semaphore getting hammered which sometimes causes the
system to hang.

Andrejus maintains a large "fleet" of affected Cherry Trail tablets
and was seeing these hangs semi regularly. After discussing this with
me Andrejus wrote the caching patch in this series which greatly reduces
the number of semaphore accesses and since then there have been no
reports of hangs in the fleet of devices which he maintains.

I've cleaned up Andrejus work a bit before submitting it upstream and
while working on this I found a slew of other issues in this driver
which bugged me enough to write a bunch of cleanup patches. I've also
added some extra patches to also reduce the semaphore use during driver
probe.

Regards,

Hans


Andrejus Basovas (1):
  power: supply: axp288_fuel_gauge: Refresh all registers in one go

Hans de Goede (9):
  power: supply: axp288_fuel_gauge: Fix define alignment
  power: supply: axp288_fuel_gauge: Remove debugfs support
  power: supply: axp288_fuel_gauge: Silence the chatty IRQ mapping code
  power: supply: axp288_fuel_gauge: Report register-address on readb /
    writeb errors
  power: supply: axp288_fuel_gauge: Drop retry logic from
    fuel_gauge_reg_readb()
  power: supply: axp288_fuel_gauge: Store struct device pointer in
    axp288_fg_info
  power: supply: axp288_fuel_gauge: Only read PWR_OP_MODE,
    FG_LOW_CAP_REG regs once
  power: supply: axp288_fuel_gauge: Move the AXP20X_CC_CTRL check
    together with the other checks
  power: supply: axp288_fuel_gauge: Take the P-Unit semaphore only once
    during probe()

 drivers/power/supply/axp288_fuel_gauge.c | 489 +++++++++--------------
 1 file changed, 186 insertions(+), 303 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-30  8:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-17 16:44 [PATCH 00/10] power: supply: axp288_fuel_gauge: Reduce number of register accesses + cleanups Hans de Goede
2021-07-17 16:44 ` [PATCH 01/10] power: supply: axp288_fuel_gauge: Fix define alignment Hans de Goede
2021-07-17 16:44 ` [PATCH 02/10] power: supply: axp288_fuel_gauge: Remove debugfs support Hans de Goede
2021-07-17 16:44 ` [PATCH 03/10] power: supply: axp288_fuel_gauge: Silence the chatty IRQ mapping code Hans de Goede
2021-07-17 16:44 ` [PATCH 04/10] power: supply: axp288_fuel_gauge: Report register-address on readb / writeb errors Hans de Goede
2021-07-17 16:44 ` [PATCH 05/10] power: supply: axp288_fuel_gauge: Drop retry logic from fuel_gauge_reg_readb() Hans de Goede
2021-07-17 16:44 ` [PATCH 06/10] power: supply: axp288_fuel_gauge: Store struct device pointer in axp288_fg_info Hans de Goede
2021-07-17 16:44 ` [PATCH 07/10] power: supply: axp288_fuel_gauge: Only read PWR_OP_MODE, FG_LOW_CAP_REG regs once Hans de Goede
2021-07-17 16:44 ` [PATCH 08/10] power: supply: axp288_fuel_gauge: Refresh all registers in one go Hans de Goede
2021-07-18 19:52   ` kernel test robot
2021-07-30  8:48     ` Hans de Goede
2021-07-17 16:44 ` [PATCH 09/10] power: supply: axp288_fuel_gauge: Move the AXP20X_CC_CTRL check together with the other checks Hans de Goede
2021-07-17 16:44 ` [PATCH 10/10] power: supply: axp288_fuel_gauge: Take the P-Unit semaphore only once during probe() Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).