Added battery patch

This commit is contained in:
Gerben Jan Dijkman 2022-01-21 20:13:18 +01:00
parent da65d020a7
commit 159595e37c
5 changed files with 96 additions and 19 deletions

View File

@ -1,16 +0,0 @@
build-package:
tags:
- bigbuilds
- aarch64
- fosshost
- xlarge
script:
- export PKG=${PWD##*/}
- cd ..
- sudo chrootbuild -b arm-unstable -cp $PKG
- mv -v ./*.pkg.tar.* $PKG
artifacts:
paths:
- ./*.pkg.tar.*
expire_in: 1 week

View File

@ -0,0 +1,92 @@
From bc3fbe6818d83e3522670bd30c86b71a60eef562 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Fri, 21 Jan 2022 11:38:00 +0100
Subject: [PATCH] power: supply: rk818-battery: Report charging status based on
charging current
If the current is positive, battery is charging, if negative the battery
is discharging. Duh?!
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/power/supply/rk818_battery.c | 63 +---------------------------
1 file changed, 1 insertion(+), 62 deletions(-)
diff --git a/drivers/power/supply/rk818_battery.c b/drivers/power/supply/rk818_battery.c
index 665f043377c6..741195e77da6 100644
--- a/drivers/power/supply/rk818_battery.c
+++ b/drivers/power/supply/rk818_battery.c
@@ -893,70 +893,9 @@ static enum power_supply_property rk818_bat_props[] = {
POWER_SUPPLY_PROP_CURRENT_MAX,
};
-static int rk818_bat_get_usb_psy(struct device *dev, void *data)
-{
- struct rk818_battery *di = data;
- struct power_supply *psy = dev_get_drvdata(dev);
-
- if (psy->desc->type == POWER_SUPPLY_TYPE_USB) {
- di->usb_psy = psy;
- return 1;
- }
-
- return 0;
-}
-
-static int rk818_bat_get_ac_psy(struct device *dev, void *data)
-{
- struct rk818_battery *di = data;
- struct power_supply *psy = dev_get_drvdata(dev);
-
- if (psy->desc->type == POWER_SUPPLY_TYPE_MAINS) {
- di->ac_psy = psy;
- return 1;
- }
-
- return 0;
-}
-
-static void rk818_bat_get_chrg_psy(struct rk818_battery *di)
-{
- if (!di->usb_psy)
- class_for_each_device(power_supply_class, NULL, (void *)di,
- rk818_bat_get_usb_psy);
- if (!di->ac_psy)
- class_for_each_device(power_supply_class, NULL, (void *)di,
- rk818_bat_get_ac_psy);
-}
-
static int rk818_bat_get_charge_state(struct rk818_battery *di)
{
- union power_supply_propval val;
- int ret;
-
- if (!di->usb_psy || !di->ac_psy)
- rk818_bat_get_chrg_psy(di);
-
- if (di->usb_psy) {
- ret = di->usb_psy->desc->get_property(di->usb_psy,
- POWER_SUPPLY_PROP_ONLINE,
- &val);
- if (!ret)
- di->usb_in = val.intval;
- }
-
- if (di->ac_psy) {
- ret = di->ac_psy->desc->get_property(di->ac_psy,
- POWER_SUPPLY_PROP_ONLINE,
- &val);
- if (!ret)
- di->ac_in = val.intval;
- }
-
- DBG("%s: ac_online=%d, usb_online=%d\n",
- __func__, di->ac_in, di->usb_in);
-
- return (di->usb_in || di->ac_in);
+ return di->current_avg > 0;
}
static int rk818_battery_get_property(struct power_supply *psy,
--
2.34.1

View File

@ -16,7 +16,7 @@ KEYWORDS="~arm64"
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
>=sys-devel/patch-2.7.5" >=sys-devel/patch-2.7.5"
DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with megi's patch for the PinePhone Pro" DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with Mobian patches for the PinePhone Pro"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}" SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"

View File

@ -16,7 +16,7 @@ KEYWORDS="~arm64"
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
>=sys-devel/patch-2.7.5" >=sys-devel/patch-2.7.5"
DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with megi'/s patch for the PinePhone Pro" DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with Mobian patches for the PinePhone Pro"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}" SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"

View File

@ -16,7 +16,7 @@ KEYWORDS="~arm64"
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
>=sys-devel/patch-2.7.5" >=sys-devel/patch-2.7.5"
DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with megi'/s patch for the PinePhone Pro" DESCRIPTION="Full sources for the Linux kernel with gentoo patchset and with Mobian patches for the PinePhone Pro"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}" SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
@ -80,6 +80,7 @@ PATCHES=(
"${FILESDIR}"/0056-arm64-dts-rk3399-pinephone-pro-add-modem-RI-pin.patch "${FILESDIR}"/0056-arm64-dts-rk3399-pinephone-pro-add-modem-RI-pin.patch
"${FILESDIR}"/0057-arm64-dts-rk3399-pinephone-pro-improve-sound-device.patch "${FILESDIR}"/0057-arm64-dts-rk3399-pinephone-pro-improve-sound-device.patch
"${FILESDIR}"/0058-arm64-dts-rk3399-pinephone-pro-remove-front-camera-n.patch "${FILESDIR}"/0058-arm64-dts-rk3399-pinephone-pro-remove-front-camera-n.patch
"${FILESDIR}"/0059-power-supply-rk818-battery-Report-charging-status-ba.patch
# Pinephone Keyboard # Pinephone Keyboard
"${FILESDIR}"/pp-keyboard.patch "${FILESDIR}"/pp-keyboard.patch
"${FILESDIR}"/ppp-keyboard.patch "${FILESDIR}"/ppp-keyboard.patch