* nongnu/packages/linux.scm (linux-pinenote): New variable. * nongnu/configs/pinenote_config: New file. * nongnu/configs/pinenote_defconfig: New file. * nongnu/configs/quartz64_defconfig: New file. * nongnu/configs/quartz64b_defconfig: New file. * nongnu/packages/patches/0001-Rudimentary-attempt-to-keep-PMIC-usable-after-suspen.patch: New file. * nongnu/packages/patches/battery-level.patch: New file. * nongnu/packages/patches/pinenote-battery-level.patch: New file. * nongnu/packages/patches/pinenote-rockchip-ebc-patches-mw.patch: New file. * nongnu/packages/patches/pinenote-touchscreen-1.patch: New file. * nongnu/packages/patches/pinenote-touchscreen-2.patch: New file. * nongnu/packages/patches/pinenote_defconfig.patch: New file. * nongnu/packages/patches/rk3566-pinenote_dtsi.patch: New file. * nongnu/packages/patches/rockchip_ebc_addition_extract_fbs.patch: New file. * nongnu/packages/patches/rockchip_ebc_mw_20220624.patch: New file. * nongnu/packages/patches/rockchip_ebc_patches_mw_20220712.patch: New file. * nongnu/packages/patches/rockchip_ebc_patches_mw_20220730.patch: New file. * nongnu/packages/patches/rockchip_ebc_patches_mw_20220804.patch: New file. * nongnu/packages/patches/rockchip_ebc_patches_mw_20220808.patch: New file. * nongnu/packages/patches/sdbus-cpp-remove-systemd.patch: New file. * nongnu/packages/patches/touchscreen-driver-01.patch: New file. * nongnu/packages/patches/touchscreen-driver-02.patch: New file. * nongnu/packages/patches/wusb3801_patches_samsapti_20220725.patch: New file.
63 lines
1.9 KiB
Diff
63 lines
1.9 KiB
Diff
From 822294664906499682b55264ae0553ee05caa352 Mon Sep 17 00:00:00 2001
|
|
From: Dorian Rudolph <mail@dorianrudolph.com>
|
|
Date: Sat, 14 May 2022 14:28:37 +0200
|
|
Subject: [PATCH] fix power_supply_temp2resist_simple and
|
|
power_supply_ocv2cap_simple
|
|
|
|
---
|
|
drivers/power/supply/power_supply_core.c | 24 ++++++++++++------------
|
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
|
|
index ec838c9bcc0a5e..3828ba9d0eab90 100644
|
|
--- a/drivers/power/supply/power_supply_core.c
|
|
+++ b/drivers/power/supply/power_supply_core.c
|
|
@@ -801,17 +801,17 @@ int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *t
|
|
{
|
|
int i, high, low;
|
|
|
|
- /* Break loop at table_len - 1 because that is the highest index */
|
|
- for (i = 0; i < table_len - 1; i++)
|
|
+ for (i = 0; i < table_len; i++)
|
|
if (temp > table[i].temp)
|
|
break;
|
|
|
|
/* The library function will deal with high == low */
|
|
- if ((i == 0) || (i == (table_len - 1)))
|
|
- high = i;
|
|
+ if (i == 0)
|
|
+ high = low = i;
|
|
+ else if (i == table_len)
|
|
+ high = low = i - 1;
|
|
else
|
|
- high = i - 1;
|
|
- low = i;
|
|
+ high = (low = i) - 1;
|
|
|
|
return fixp_linear_interpolate(table[low].temp,
|
|
table[low].resistance,
|
|
@@ -838,17 +838,17 @@ int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
|
|
{
|
|
int i, high, low;
|
|
|
|
- /* Break loop at table_len - 1 because that is the highest index */
|
|
- for (i = 0; i < table_len - 1; i++)
|
|
+ for (i = 0; i < table_len; i++)
|
|
if (ocv > table[i].ocv)
|
|
break;
|
|
|
|
/* The library function will deal with high == low */
|
|
- if ((i == 0) || (i == (table_len - 1)))
|
|
- high = i - 1;
|
|
+ if (i == 0)
|
|
+ high = low = i;
|
|
+ else if (i == table_len)
|
|
+ high = low = i - 1;
|
|
else
|
|
- high = i; /* i.e. i == 0 */
|
|
- low = i;
|
|
+ high = (low = i) - 1;
|
|
|
|
return fixp_linear_interpolate(table[low].ocv,
|
|
table[low].capacity,
|