]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86: x86-android-tablets: Add ovc-capacity-table info
authorHans de Goede <hansg@kernel.org>
Mon, 9 Jun 2025 10:46:20 +0000 (12:46 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 30 Jun 2025 10:05:15 +0000 (13:05 +0300)
Add ovc-capacity-table info to the generic battery nodes.

The values come from the ug3105 driver which currently hardcodes these
values. The ug3105 driver will be modified to stop hardcoding this and
instead get the values from device-properties.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20250609104620.25896-2-hansg@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/x86-android-tablets/shared-psy-info.c

index 55da574771534ea8a640329cc5148e76dfa76b01..fe34cedb6257b38f43a2a57ff481250ca75c1080 100644 (file)
@@ -39,6 +39,58 @@ const struct software_node fg_bq25890_supply_node = {
        .properties = fg_bq25890_supply_props,
 };
 
+static const u32 generic_lipo_battery_ovc_cap_celcius[] = { 25 };
+
+static const u32 generic_lipo_4v2_battery_ovc_cap_table0[] = {
+       4200000, 100,
+       4150000, 95,
+       4110000, 90,
+       4075000, 85,
+       4020000, 80,
+       3982500, 75,
+       3945000, 70,
+       3907500, 65,
+       3870000, 60,
+       3853333, 55,
+       3836667, 50,
+       3820000, 45,
+       3803333, 40,
+       3786667, 35,
+       3770000, 30,
+       3750000, 25,
+       3730000, 20,
+       3710000, 15,
+       3690000, 10,
+       3610000, 5,
+       3350000, 0
+};
+
+static const u32 generic_lipo_hv_4v35_battery_ovc_cap_table0[] = {
+       4300000, 100,
+       4250000, 96,
+       4200000, 91,
+       4150000, 86,
+       4110000, 82,
+       4075000, 77,
+       4020000, 73,
+       3982500, 68,
+       3945000, 64,
+       3907500, 59,
+       3870000, 55,
+       3853333, 50,
+       3836667, 45,
+       3820000, 41,
+       3803333, 36,
+       3786667, 32,
+       3770000, 27,
+       3750000, 23,
+       3730000, 18,
+       3710000, 14,
+       3690000, 9,
+       3610000, 5,
+       3350000, 0
+};
+
 /* Standard LiPo (max 4.2V) settings used by most devs with a LiPo battery */
 static const struct property_entry generic_lipo_4v2_battery_props[] = {
        PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
@@ -48,6 +100,10 @@ static const struct property_entry generic_lipo_4v2_battery_props[] = {
        PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 2048000),
        PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4208000),
        PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
+       PROPERTY_ENTRY_U32_ARRAY("ocv-capacity-celsius",
+                                generic_lipo_battery_ovc_cap_celcius),
+       PROPERTY_ENTRY_U32_ARRAY("ocv-capacity-table-0",
+                                generic_lipo_4v2_battery_ovc_cap_table0),
        { }
 };
 
@@ -64,6 +120,10 @@ static const struct property_entry generic_lipo_hv_4v35_battery_props[] = {
        PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 1856000),
        PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4352000),
        PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
+       PROPERTY_ENTRY_U32_ARRAY("ocv-capacity-celsius",
+                                generic_lipo_battery_ovc_cap_celcius),
+       PROPERTY_ENTRY_U32_ARRAY("ocv-capacity-table-0",
+                                generic_lipo_hv_4v35_battery_ovc_cap_table0),
        { }
 };