X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Arnd Bergmann" <arnd@kernel.org>
Cc: Hans de Goede <hansg@kernel.org>, platform-driver-x86@vger.kernel.org
Subject: [PATCH v3 12/19] platform/x86: x86-android-tablets: replace bat_swnode with swnode_group
Date: Fri, 19 Sep 2025 22:47:35 +0200	[thread overview]
Message-ID: <20250919204742.25581-13-hansg@kernel.org> (raw)
In-Reply-To: <20250919204742.25581-1-hansg@kernel.org>

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.

Signed-off-by: Hans de Goede <hansg@kernel.org>
---
 drivers/platform/x86/x86-android-tablets/asus.c      |  4 ++--
 drivers/platform/x86/x86-android-tablets/core.c      | 12 ++++++------
 drivers/platform/x86/x86-android-tablets/lenovo.c    |  4 ++--
 .../x86/x86-android-tablets/shared-psy-info.c        | 10 ++++++++++
 .../x86/x86-android-tablets/shared-psy-info.h        |  4 ++++
 .../x86/x86-android-tablets/x86-android-tablets.h    |  2 +-
 6 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c
index 91245f1bfd87..39eb2f9dc031 100644
--- a/drivers/platform/x86/x86-android-tablets/asus.c
+++ b/drivers/platform/x86/x86-android-tablets/asus.c
@@ -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,
 };
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 955a2c83a9bf..5675e888d84f 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -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) {
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 9a28216642c3..66617f6ff13e 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -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,
diff --git a/drivers/platform/x86/x86-android-tablets/shared-psy-info.c b/drivers/platform/x86/x86-android-tablets/shared-psy-info.c
index 6ebe282bda6e..62f41c14e6ba 100644
--- a/drivers/platform/x86/x86-android-tablets/shared-psy-info.c
+++ b/drivers/platform/x86/x86-android-tablets/shared-psy-info.c
@@ -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",
diff --git a/drivers/platform/x86/x86-android-tablets/shared-psy-info.h b/drivers/platform/x86/x86-android-tablets/shared-psy-info.h
index b9cbc291aa4d..e5ba1c65d62b 100644
--- a/drivers/platform/x86/x86-android-tablets/shared-psy-info.h
+++ b/drivers/platform/x86/x86-android-tablets/shared-psy-info.h
@@ -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[];
diff --git a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
index f4a67a9b74ea..4bf4bcdf50c0 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -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;
-- 
2.51.0


  parent reply	other threads:[~2025-09-19 20:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 20:47 [PATCH v3 00/19] x86-android-tablets: convert to use GPIO references + Acer A1-840 support Hans de Goede
2025-09-19 20:47 ` [PATCH v3 01/19] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references Hans de Goede
2025-09-19 20:47 ` [PATCH v3 02/19] platform/x86: x86-android-tablets: convert Wacom " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 03/19] platform/x86: x86-android-tablets: convert HiDeep " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 04/19] platform/x86: x86-android-tablets: convert Novatek " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 05/19] platform/x86: x86-android-tablets: convert EDT " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 06/19] platform/x86: x86-android-tablets: convert int3496 " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 07/19] platform/x86: x86-android-tablets: convert wm1502 " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 08/19] platform/x86: x86-android-tablets: convert HID-I2C " Hans de Goede
2025-09-19 20:47 ` [PATCH v3 09/19] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " Hans de Goede
2025-09-20 11:05   ` Andy Shevchenko
2025-09-20 12:57     ` Hans de Goede
2025-09-19 20:47 ` [PATCH v3 10/19] platform/x86: x86-android-tablets: remove support for GPIO lookup tables Hans de Goede
2025-09-19 20:47 ` [PATCH v3 11/19] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references Hans de Goede
2025-09-19 20:47 ` Hans de Goede [this message]
2025-09-19 21:08   ` [PATCH v3 12/19] platform/x86: x86-android-tablets: replace bat_swnode with swnode_group Dmitry Torokhov
2025-09-20 11:09   ` Andy Shevchenko
2025-09-20 12:45     ` Hans de Goede
2025-09-19 20:47 ` [PATCH v3 13/19] platform/x86: x86-android-tablets: use swnode_group instead of manual registering Hans de Goede
2025-09-19 21:09   ` Dmitry Torokhov
2025-09-19 20:47 ` [PATCH v3 14/19] platform/x86: x86-android-tablets: Update my email address Hans de Goede
2025-09-19 20:47 ` [PATCH v3 15/19] platform/x86: x86-android-tablets: Move Acer info to its own file Hans de Goede
2025-09-19 21:10   ` Dmitry Torokhov
2025-09-19 20:47 ` [PATCH v3 16/19] platform/x86: x86-android-tablets: Add support for Acer A1-840 tablet Hans de Goede
2025-09-19 20:47 ` [PATCH v3 17/19] platform/x86: x86-android-tablets: Simplify lenovo_yoga_tab2_830_1050_exit() Hans de Goede
2025-09-19 21:12   ` Dmitry Torokhov
2025-09-19 20:47 ` [PATCH v3 18/19] platform/x86: x86-android-tablets: Fix modules lists for Lenovo devices Hans de Goede
2025-09-19 20:47 ` [PATCH v3 19/19] platform/x86: x86-android-tablets: Stop using EPROBE_DEFER Hans de Goede
2025-09-19 21:20   ` Dmitry Torokhov
2025-09-20 11:21   ` Andy Shevchenko
2025-09-20 11:35     ` Hans de Goede
2025-09-20 11:22 ` [PATCH v3 00/19] x86-android-tablets: convert to use GPIO references + Acer A1-840 support Andy Shevchenko
2025-09-20 12:45   ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250919204742.25581-13-hansg@kernel.org \
    --to=hansg@kernel.org \
    --cc=andy@kernel.org \
    --cc=arnd@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox