]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86: x86-android-tablets: replace bat_swnode with swnode_group
authorHans de Goede <hansg@kernel.org>
Sat, 20 Sep 2025 20:07:05 +0000 (22:07 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 26 Sep 2025 11:26:31 +0000 (14:26 +0300)
Now that we are using software-nodes are used in more places it is
useful to have a more generic mechanism to have the core code register
software-nodes.

Replace the bat_swnode registration mechanism with a more generic
swnode_group registration mechanism.

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://patch.msgid.link/20250920200713.20193-13-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/core.c
drivers/platform/x86/x86-android-tablets/lenovo.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.h
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h

index 91245f1bfd8739000887a7df1011d6f98f7a02a3..39eb2f9dc031ccadbfb758d38a0533eb0dcc7048 100644 (file)
@@ -190,7 +190,7 @@ const struct x86_dev_info asus_me176c_info __initconst = {
        .serdev_info = asus_me176c_serdevs,
        .serdev_count = ARRAY_SIZE(asus_me176c_serdevs),
        .gpio_button_swnodes = asus_me176c_tf103c_lid_swnodes,
-       .bat_swnode = &generic_lipo_hv_4v35_battery_node,
+       .swnode_group = generic_lipo_hv_4v35_battery_swnodes,
        .modules = bq24190_modules,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 };
@@ -313,7 +313,7 @@ const struct x86_dev_info asus_tf103c_info __initconst = {
        .pdev_info = asus_me176c_tf103c_pdevs,
        .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
        .gpio_button_swnodes = asus_me176c_tf103c_lid_swnodes,
-       .bat_swnode = &generic_lipo_4v2_battery_node,
+       .swnode_group = generic_lipo_4v2_battery_swnodes,
        .modules = bq24190_modules,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 };
index 955a2c83a9bf05f93c5ff679e5a8eb998af8f765..5675e888d84f87047d9a654763f2d071d48f9556 100644 (file)
@@ -153,7 +153,7 @@ static struct spi_device **spi_devs;
 static struct platform_device **pdevs;
 static struct serdev_device **serdevs;
 static const struct software_node **gpio_button_swnodes;
-static const struct software_node *bat_swnode;
+static const struct software_node **swnode_group;
 static const struct software_node **gpiochip_node_group;
 static void (*exit_handler)(void);
 
@@ -390,8 +390,8 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
        if (gpio_button_swnodes)
                software_node_unregister_node_group(gpio_button_swnodes);
 
-       if (bat_swnode)
-               software_node_unregister(bat_swnode);
+       if (swnode_group)
+               software_node_unregister_node_group(swnode_group);
 
        if (gpiochip_node_group)
                software_node_unregister_node_group(gpiochip_node_group);
@@ -436,13 +436,13 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       if (dev_info->bat_swnode) {
-               ret = software_node_register(dev_info->bat_swnode);
+       if (dev_info->swnode_group) {
+               ret = software_node_register_node_group(dev_info->swnode_group);
                if (ret) {
                        x86_android_tablet_remove(pdev);
                        return ret;
                }
-               bat_swnode = dev_info->bat_swnode;
+               swnode_group = dev_info->swnode_group;
        }
 
        if (dev_info->init) {
index 9a28216642c316470e2d225afedc2ab5c9c8e1f3..66617f6ff13e53459703d0a5680164055ae364c3 100644 (file)
@@ -448,7 +448,7 @@ const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
        .pdev_info = lenovo_yoga_tab2_830_1050_pdevs,
        .pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_pdevs),
        .gpio_button_swnodes = lenovo_yoga_tab2_830_1050_lid_swnodes,
-       .bat_swnode = &generic_lipo_hv_4v35_battery_node,
+       .swnode_group = generic_lipo_hv_4v35_battery_swnodes,
        .modules = bq24190_modules,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
        .init = lenovo_yoga_tab2_830_1050_init,
@@ -812,7 +812,7 @@ const struct x86_dev_info lenovo_yoga_tab2_1380_info __initconst = {
        .pdev_info = lenovo_yoga_tab2_1380_pdevs,
        .pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_pdevs),
        .gpio_button_swnodes = lenovo_yoga_tab2_830_1050_lid_swnodes,
-       .bat_swnode = &generic_lipo_hv_4v35_battery_node,
+       .swnode_group = generic_lipo_hv_4v35_battery_swnodes,
        .modules = lenovo_yoga_tab2_1380_modules,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
        .init = lenovo_yoga_tab2_1380_init,
index 6ebe282bda6e905a68b0261d647bc6eaa3228a00..62f41c14e6ba01ce261573349c80a2fd8681ca73 100644 (file)
@@ -113,6 +113,11 @@ const struct software_node generic_lipo_4v2_battery_node = {
        .properties = generic_lipo_4v2_battery_props,
 };
 
+const struct software_node *generic_lipo_4v2_battery_swnodes[] = {
+       &generic_lipo_4v2_battery_node,
+       NULL
+};
+
 /* 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"),
@@ -133,6 +138,11 @@ const struct software_node generic_lipo_hv_4v35_battery_node = {
        .properties = generic_lipo_hv_4v35_battery_props,
 };
 
+const struct software_node *generic_lipo_hv_4v35_battery_swnodes[] = {
+       &generic_lipo_hv_4v35_battery_node,
+       NULL
+};
+
 /* For enabling the bq24190 5V boost based on id-pin */
 static struct regulator_consumer_supply intel_int3496_consumer = {
        .supply = "vbus",
index b9cbc291aa4d45eca621d34859e2167aa4d01a2f..e5ba1c65d62b7e076693d89c3322d75e305b52fa 100644 (file)
@@ -20,8 +20,12 @@ 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_4v2_battery_swnodes[];
+
 extern const struct software_node generic_lipo_hv_4v35_battery_node;
+extern const struct software_node *generic_lipo_hv_4v35_battery_swnodes[];
 
 extern struct bq24190_platform_data bq24190_pdata;
 extern const char * const bq24190_modules[];
index f4a67a9b74ea141d2cb66de3a0ef8fc61ac60ced..4bf4bcdf50c02c7a19874e52176672f3c30a9626 100644 (file)
@@ -82,7 +82,7 @@ struct x86_serdev_info {
 
 struct x86_dev_info {
        const char * const *modules;
-       const struct software_node *bat_swnode;
+       const struct software_node **swnode_group;
        const struct x86_i2c_client_info *i2c_client_info;
        const struct x86_spi_dev_info *spi_dev_info;
        const struct platform_device_info *pdev_info;