From 159595e37cdd1c6e901126b8db74b5afc77bcdfe Mon Sep 17 00:00:00 2001 From: Gerben Jan Dijkman Date: Fri, 21 Jan 2022 20:13:18 +0100 Subject: [PATCH] Added battery patch --- .../files/.gitlab-ci.yml | 16 ---- ...18-battery-Report-charging-status-ba.patch | 92 +++++++++++++++++++ .../pinephone-pro-sources-5.16.0.ebuild | 2 +- .../pinephone-pro-sources-5.16.1.ebuild | 2 +- .../pinephone-pro-sources-5.16.2.ebuild | 3 +- 5 files changed, 96 insertions(+), 19 deletions(-) delete mode 100644 sys-kernel/pinephone-pro-sources/files/.gitlab-ci.yml create mode 100644 sys-kernel/pinephone-pro-sources/files/0059-power-supply-rk818-battery-Report-charging-status-ba.patch diff --git a/sys-kernel/pinephone-pro-sources/files/.gitlab-ci.yml b/sys-kernel/pinephone-pro-sources/files/.gitlab-ci.yml deleted file mode 100644 index 0a10378..0000000 --- a/sys-kernel/pinephone-pro-sources/files/.gitlab-ci.yml +++ /dev/null @@ -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 - diff --git a/sys-kernel/pinephone-pro-sources/files/0059-power-supply-rk818-battery-Report-charging-status-ba.patch b/sys-kernel/pinephone-pro-sources/files/0059-power-supply-rk818-battery-Report-charging-status-ba.patch new file mode 100644 index 0000000..31124d3 --- /dev/null +++ b/sys-kernel/pinephone-pro-sources/files/0059-power-supply-rk818-battery-Report-charging-status-ba.patch @@ -0,0 +1,92 @@ +From bc3fbe6818d83e3522670bd30c86b71a60eef562 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +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 +--- + 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 diff --git a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.0.ebuild b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.0.ebuild index d08db03..547f8ba 100644 --- a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.0.ebuild +++ b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.0.ebuild @@ -16,7 +16,7 @@ KEYWORDS="~arm64" DEPEND="${RDEPEND} >=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}" diff --git a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.1.ebuild b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.1.ebuild index 6b5a3e1..148d8d8 100644 --- a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.1.ebuild +++ b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.1.ebuild @@ -16,7 +16,7 @@ KEYWORDS="~arm64" DEPEND="${RDEPEND} >=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}" diff --git a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.2.ebuild b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.2.ebuild index 9f9f702..df5635c 100644 --- a/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.2.ebuild +++ b/sys-kernel/pinephone-pro-sources/pinephone-pro-sources-5.16.2.ebuild @@ -16,7 +16,7 @@ KEYWORDS="~arm64" DEPEND="${RDEPEND} >=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}" @@ -80,6 +80,7 @@ PATCHES=( "${FILESDIR}"/0056-arm64-dts-rk3399-pinephone-pro-add-modem-RI-pin.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}"/0059-power-supply-rk818-battery-Report-charging-status-ba.patch # Pinephone Keyboard "${FILESDIR}"/pp-keyboard.patch "${FILESDIR}"/ppp-keyboard.patch