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 09/19] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
Date: Fri, 19 Sep 2025 22:47:32 +0200	[thread overview]
Message-ID: <20250919204742.25581-10-hansg@kernel.org> (raw)
In-Reply-To: <20250919204742.25581-1-hansg@kernel.org>

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for the fast charger device
to using PROPERTY_ENTRY_GPIO().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Tested-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
---
Changes in v3:
- Make yoga-tab2-pro-1380-fastcharger.c propagate the fwnode set on
  the platform-device to the serdev it creates
- Mark lenovo_yoga_tab2_1380_fc_props[] __initconst
---
 .../lenovo/yoga-tab2-pro-1380-fastcharger.c   |  7 ++++++
 .../platform/x86/x86-android-tablets/lenovo.c | 23 +++++++------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
index 1b33c977f6d7..cca8e644f4e7 100644
--- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
+++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
@@ -255,6 +255,13 @@ static int yt2_1380_fc_pdev_probe(struct platform_device *pdev)
 	if (!serdev)
 		return -ENOMEM;
 
+	/*
+	 * Propagate pdev-fwnode set by x86-android-tablets to serdev.
+	 * The pdev-fwnode is a managed node, so it will be auto-put on
+	 * serdev_device_put().
+	 */
+	device_set_node(&serdev->dev, fwnode_handle_get(dev_fwnode(&pdev->dev)));
+
 	ret = serdev_device_add(serdev);
 	if (ret) {
 		serdev_device_put(serdev);
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index aaa946bb1e7c..7d1808a3437f 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -741,11 +741,18 @@ static const struct x86_i2c_client_info lenovo_yoga_tab2_1380_i2c_clients[] __in
 	}
 };
 
+static const struct property_entry lenovo_yoga_tab2_1380_fc_props[] __initconst = {
+	PROPERTY_ENTRY_GPIO("uart3_txd-gpios", &baytrail_gpiochip_nodes[0], 57, GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("uart3_rxd-gpios", &baytrail_gpiochip_nodes[0], 61, GPIO_ACTIVE_HIGH),
+	{ }
+};
+
 static const struct platform_device_info lenovo_yoga_tab2_1380_pdevs[] __initconst = {
 	{
 		/* For the Tablet 2 Pro 1380's custom fast charging driver */
 		.name = "lenovo-yoga-tab2-pro-1380-fastcharger",
 		.id = PLATFORM_DEVID_NONE,
+		.properties = lenovo_yoga_tab2_1380_fc_props,
 	},
 };
 
@@ -775,20 +782,6 @@ static int __init lenovo_yoga_tab2_1380_init(struct device *dev)
 	return 0;
 }
 
-static struct gpiod_lookup_table lenovo_yoga_tab2_1380_fc_gpios = {
-	.dev_id = "serial0-0",
-	.table = {
-		GPIO_LOOKUP("INT33FC:00", 57, "uart3_txd", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("INT33FC:00", 61, "uart3_rxd", GPIO_ACTIVE_HIGH),
-		{ }
-	},
-};
-
-static struct gpiod_lookup_table * const lenovo_yoga_tab2_1380_gpios[] = {
-	&lenovo_yoga_tab2_1380_fc_gpios,
-	NULL
-};
-
 const struct x86_dev_info lenovo_yoga_tab2_1380_info __initconst = {
 	.i2c_client_info = lenovo_yoga_tab2_1380_i2c_clients,
 	.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_i2c_clients),
@@ -796,9 +789,9 @@ const struct x86_dev_info lenovo_yoga_tab2_1380_info __initconst = {
 	.pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_pdevs),
 	.gpio_button = &lenovo_yoga_tab2_830_1050_lid,
 	.gpio_button_count = 1,
-	.gpiod_lookup_tables = lenovo_yoga_tab2_1380_gpios,
 	.bat_swnode = &generic_lipo_hv_4v35_battery_node,
 	.modules = lenovo_yoga_tab2_1380_modules,
+	.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 	.init = lenovo_yoga_tab2_1380_init,
 	.exit = lenovo_yoga_tab2_830_1050_exit,
 };
-- 
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 ` Hans de Goede [this message]
2025-09-20 11:05   ` [PATCH v3 09/19] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " 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 ` [PATCH v3 12/19] platform/x86: x86-android-tablets: replace bat_swnode with swnode_group Hans de Goede
2025-09-19 21:08   ` 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-10-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