From f7f49b34160e2b9ea5b2c9763f5dda363059fd62 Mon Sep 17 00:00:00 2001 From: "Sicelo A. Mhlongo" <absicsz@gmail.com> Date: Wed, 27 Nov 2024 13:16:25 +0200 Subject: [PATCH] linux-postmarketos-omap: n900: bq27xxx: generate events in changes to status flags (MR 5857) bq27xxx_battery has a check for status flags in order to detect changes and report to userspace. However, the cached flags are updated before checking for changes, hence no flag-related events are ever sent. This patch fixes this behavior, and has been sent upstream. [ci:skip-build]: already built successfully in CI --- ...7xxx_battery-do-not-update-cached-fl.patch | 33 +++++++++++++++++++ .../linux-postmarketos-omap/APKBUILD | 4 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 device/community/linux-postmarketos-omap/0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch diff --git a/device/community/linux-postmarketos-omap/0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch b/device/community/linux-postmarketos-omap/0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch new file mode 100644 index 00000000000..192802873a0 --- /dev/null +++ b/device/community/linux-postmarketos-omap/0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch @@ -0,0 +1,33 @@ +From f9c5d5284a554ed3e2f3a60e05d3538e0653a3a7 Mon Sep 17 00:00:00 2001 +From: "Sicelo A. Mhlongo" <absicsz@gmail.com> +Date: Sun, 27 Oct 2024 21:47:48 +0200 +Subject: [PATCH] power: supply: bq27xxx_battery: do not update cached flags + prematurely + +Commit 243f8ffc883a1 ("power: supply: bq27xxx_battery: Notify also about +status changes") intended to notify userspace when the status changes, +based on the flags register. However, the cached state is updated too +early, before the flags are tested for any changes. Remove the premature +update. + +Fixes: 243f8ffc883a1 ("power: supply: bq27xxx_battery: Notify also about status changes") +Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com> +--- + drivers/power/supply/bq27xxx_battery.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c +index 40c5ac7a1118..b2c65fe43d5c 100644 +--- a/drivers/power/supply/bq27xxx_battery.c ++++ b/drivers/power/supply/bq27xxx_battery.c +@@ -1913,7 +1913,6 @@ static void bq27xxx_battery_update_unlocked(struct bq27xxx_device_info *di) + cache.flags = -1; /* read error */ + if (cache.flags >= 0) { + cache.capacity = bq27xxx_battery_read_soc(di); +- di->cache.flags = cache.flags; + + /* + * On gauges with signed current reporting the current must be +-- +2.45.2 + diff --git a/device/community/linux-postmarketos-omap/APKBUILD b/device/community/linux-postmarketos-omap/APKBUILD index b3a6ca3fcf5..93ef9981290 100644 --- a/device/community/linux-postmarketos-omap/APKBUILD +++ b/device/community/linux-postmarketos-omap/APKBUILD @@ -4,7 +4,7 @@ pkgname=linux-postmarketos-omap pkgver=6.12.1 -pkgrel=0 +pkgrel=1 pkgdesc="Mainline kernel fork for OMAP devices" arch="armv7" url="https://kernel.org/" @@ -41,6 +41,7 @@ source=" 0007-hsi-ssi_port-force-pio-path.patch 0008-n900-dts-volume-keys.patch 0009-ARM-dts-disable-twl-off-idle-configuration-for-N900.patch + 0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch " builddir="$srcdir/linux-$_kernver" replaces="linux-samsung-espresso3g linux-nokia-n900" @@ -81,4 +82,5 @@ f7d1a87088c65278a114125e732d5bebebb560a6245afb34e003083d808ef3f8c5f49ff231319535 c3af9715b3559c2d593f4fcfa078730722c7deeec132c5b83e085ff4d9815d85ef349384097c580efe1bbc37c60f42e18ef559f0abccfe236080670e4403fa77 0007-hsi-ssi_port-force-pio-path.patch b98ce806b3d5a0122086e4c9670639174470ff6d29851c60258cc5d699ce9a479dbf4996b24299fc075d25e9fe8f6b1250fafdff742deea0ddeaf53d342a9d72 0008-n900-dts-volume-keys.patch 66abb5548910ad369608b08200f5835d5a8526c04cc3617221ef546f3e3d22cd944db91dc6727a5c26a102b24d8ef1306ea01254c9c382759afced91b31747ef 0009-ARM-dts-disable-twl-off-idle-configuration-for-N900.patch +efdf7f4f718faac8b753f8aacb5f845ccab75952c53310fe1f17efb7211d0d300ca7242a0c56dcb033962ca6505341730469645f2e774559eee469211411685f 0010-power-supply-bq27xxx_battery-do-not-update-cached-fl.patch " -- GitLab