]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86: x86-android-tablets: Add generic_lipo_4v2_battery info
authorHans de Goede <hansg@kernel.org>
Mon, 9 Jun 2025 10:46:19 +0000 (12:46 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 30 Jun 2025 10:05:12 +0000 (13:05 +0300)
Move the asus_tf103c_battery_node to shared-psy-info.c and rename it to
generic_lipo_4v2_battery_node.

This is a preparation patch for adding ovc-capacity-table info to
the battery nodes.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20250609104620.25896-1-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/asus.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.h

index 7dde63b9943f122f4ef737ab68a1384a9795585e..97cd14c1fd23c74b9bc7f3da2329b1500f4951a1 100644 (file)
@@ -206,24 +206,9 @@ static const struct software_node asus_tf103c_touchscreen_node = {
        .properties = asus_tf103c_touchscreen_props,
 };
 
-static const struct property_entry asus_tf103c_battery_props[] = {
-       PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
-       PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion-polymer"),
-       PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
-       PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
-       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),
-       { }
-};
-
-static const struct software_node asus_tf103c_battery_node = {
-       .properties = asus_tf103c_battery_props,
-};
-
 static const struct property_entry asus_tf103c_bq24190_props[] = {
        PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", tusb1211_chg_det_psy, 1),
-       PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node),
+       PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
        PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
        PROPERTY_ENTRY_BOOL("omit-battery-class"),
        PROPERTY_ENTRY_BOOL("disable-reset"),
@@ -236,7 +221,7 @@ static const struct software_node asus_tf103c_bq24190_node = {
 
 static const struct property_entry asus_tf103c_ug3105_props[] = {
        PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy, 1),
-       PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node),
+       PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
        PROPERTY_ENTRY_U32("upisemi,rsns-microohm", 5000),
        { }
 };
@@ -321,6 +306,6 @@ const struct x86_dev_info asus_tf103c_info __initconst = {
        .gpio_button = &asus_me176c_tf103c_lid,
        .gpio_button_count = 1,
        .gpiod_lookup_tables = asus_tf103c_gpios,
-       .bat_swnode = &asus_tf103c_battery_node,
+       .bat_swnode = &generic_lipo_4v2_battery_node,
        .modules = bq24190_modules,
 };
index a46fa15acfb14e4b030af4dc0e9cb2c05d538fc6..55da574771534ea8a640329cc5148e76dfa76b01 100644 (file)
@@ -39,6 +39,22 @@ const struct software_node fg_bq25890_supply_node = {
        .properties = fg_bq25890_supply_props,
 };
 
+/* 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"),
+       PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion-polymer"),
+       PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
+       PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
+       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),
+       { }
+};
+
+const struct software_node generic_lipo_4v2_battery_node = {
+       .properties = generic_lipo_4v2_battery_props,
+};
+
 /* LiPo HighVoltage (max 4.35V) settings used by most devs with a HV battery */
 static const struct property_entry generic_lipo_hv_4v35_battery_props[] = {
        PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
index c2d2968cddc2d1acff8eb13b75104f4fb0a3e88a..bcf9845ad275c091501f7fd20cd58b89de97ec55 100644 (file)
@@ -21,6 +21,7 @@ extern const char * const bq25890_psy[];
 
 extern const struct software_node fg_bq24190_supply_node;
 extern const struct software_node fg_bq25890_supply_node;
+extern const struct software_node generic_lipo_4v2_battery_node;
 extern const struct software_node generic_lipo_hv_4v35_battery_node;
 
 extern struct bq24190_platform_data bq24190_pdata;