]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 20 Sep 2025 20:07:02 +0000 (22:07 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 26 Sep 2025 11:26:25 +0000 (14:26 +0300)
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>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://patch.msgid.link/20250920200713.20193-10-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/lenovo/yoga-tab2-pro-1380-fastcharger.c
drivers/platform/x86/x86-android-tablets/lenovo.c

index 1b33c977f6d76f01ec050ee251c626eb340d5e64..8551ab4d2c7dbc3a8d0b2f50071d4460a3ee65e9 100644 (file)
@@ -255,6 +255,11 @@ 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 */
+       device_set_node(&serdev->dev, dev_fwnode(&pdev->dev));
+       /* The fwnode is a managed node, so it will be auto-put on serdev_device_put() */
+       fwnode_handle_get(dev_fwnode(&serdev->dev));
+
        ret = serdev_device_add(serdev);
        if (ret) {
                serdev_device_put(serdev);
index aaa946bb1e7cf48868aab97d1d81da580449eb6a..7d1808a3437f8eec29e138d5f3bf7c75c0c647cc 100644 (file)
@@ -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,
 };