]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 20 Sep 2025 20:06:59 +0000 (22:06 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 26 Sep 2025 11:26:21 +0000 (14:26 +0300)
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for int3496 devices 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-7-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/lenovo.c
drivers/platform/x86/x86-android-tablets/other.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.c
drivers/platform/x86/x86-android-tablets/shared-psy-info.h

index 6c4468f4004b62b8dad5a1e0cc12368012296df8..ce581d161551878728e38ae330cfa8a860547de5 100644 (file)
 #include "x86-android-tablets.h"
 
 /* Asus ME176C and TF103C tablets shared data */
-static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = {
-       .dev_id = "intel-int3496",
-       .table = {
-               GPIO_LOOKUP("INT33FC:02", 22, "id", GPIO_ACTIVE_HIGH),
-               { }
+static const struct property_entry asus_me176c_tf103c_int3496_props[] __initconst = {
+       PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 22, GPIO_ACTIVE_HIGH),
+       { }
+};
+
+static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
+       {
+               /* For micro USB ID pin handling */
+               .name = "intel-int3496",
+               .id = PLATFORM_DEVID_NONE,
+               .properties = asus_me176c_tf103c_int3496_props,
        },
 };
 
@@ -164,21 +170,15 @@ static const struct x86_serdev_info asus_me176c_serdevs[] __initconst = {
        },
 };
 
-static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
-       &int3496_gpo2_pin22_gpios,
-       NULL
-};
-
 const struct x86_dev_info asus_me176c_info __initconst = {
        .i2c_client_info = asus_me176c_i2c_clients,
        .i2c_client_count = ARRAY_SIZE(asus_me176c_i2c_clients),
-       .pdev_info = int3496_pdevs,
-       .pdev_count = 1,
+       .pdev_info = asus_me176c_tf103c_pdevs,
+       .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
        .serdev_info = asus_me176c_serdevs,
        .serdev_count = ARRAY_SIZE(asus_me176c_serdevs),
        .gpio_button = &asus_me176c_tf103c_lid,
        .gpio_button_count = 1,
-       .gpiod_lookup_tables = asus_me176c_gpios,
        .bat_swnode = &generic_lipo_hv_4v35_battery_node,
        .modules = bq24190_modules,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
@@ -296,19 +296,14 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst =
        },
 };
 
-static struct gpiod_lookup_table * const asus_tf103c_gpios[] = {
-       &int3496_gpo2_pin22_gpios,
-       NULL
-};
-
 const struct x86_dev_info asus_tf103c_info __initconst = {
        .i2c_client_info = asus_tf103c_i2c_clients,
        .i2c_client_count = ARRAY_SIZE(asus_tf103c_i2c_clients),
-       .pdev_info = int3496_pdevs,
-       .pdev_count = 1,
+       .pdev_info = asus_me176c_tf103c_pdevs,
+       .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
        .gpio_button = &asus_me176c_tf103c_lid,
        .gpio_button_count = 1,
-       .gpiod_lookup_tables = asus_tf103c_gpios,
        .bat_swnode = &generic_lipo_4v2_battery_node,
        .modules = bq24190_modules,
+       .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 };
index 49388266201be9ffa36bcfe804f6cd148202e708..db63376713571fcb3a737f76090abf068b0ae6b7 100644 (file)
@@ -366,12 +366,18 @@ static struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[] __init
        },
 };
 
-static struct gpiod_lookup_table lenovo_yoga_tab2_830_1050_int3496_gpios = {
-       .dev_id = "intel-int3496",
-       .table = {
-               GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("INT33FC:02", 24, "id", GPIO_ACTIVE_HIGH),
-               { }
+static const struct property_entry lenovo_yoga_tab2_830_1050_int3496_props[] __initconst = {
+       PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_LOW),
+       PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 24, GPIO_ACTIVE_HIGH),
+       { }
+};
+
+static const struct platform_device_info lenovo_yoga_tab2_830_1050_pdevs[] __initconst = {
+       {
+               /* For micro USB ID pin handling */
+               .name = "intel-int3496",
+               .id = PLATFORM_DEVID_NONE,
+               .properties = lenovo_yoga_tab2_830_1050_int3496_props,
        },
 };
 
@@ -389,7 +395,6 @@ static struct gpiod_lookup_table lenovo_yoga_tab2_830_1050_codec_gpios = {
 };
 
 static struct gpiod_lookup_table * const lenovo_yoga_tab2_830_1050_gpios[] = {
-       &lenovo_yoga_tab2_830_1050_int3496_gpios,
        &lenovo_yoga_tab2_830_1050_codec_gpios,
        NULL
 };
@@ -400,13 +405,14 @@ static void lenovo_yoga_tab2_830_1050_exit(void);
 const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
        .i2c_client_info = lenovo_yoga_tab2_830_1050_i2c_clients,
        .i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients),
-       .pdev_info = int3496_pdevs,
-       .pdev_count = 1,
+       .pdev_info = lenovo_yoga_tab2_830_1050_pdevs,
+       .pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_pdevs),
        .gpio_button = &lenovo_yoga_tab2_830_1050_lid,
        .gpio_button_count = 1,
        .gpiod_lookup_tables = lenovo_yoga_tab2_830_1050_gpios,
        .bat_swnode = &generic_lipo_hv_4v35_battery_node,
        .modules = bq24190_modules,
+       .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
        .init = lenovo_yoga_tab2_830_1050_init,
        .exit = lenovo_yoga_tab2_830_1050_exit,
 };
index 0f3cc0ea877ee7c1322fe037c1ea787367358fb8..2f12b68080ba8d8547d1b50e15988b5066c6d988 100644 (file)
@@ -84,17 +84,11 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
        },
 };
 
-static struct gpiod_lookup_table * const acer_b1_750_gpios[] = {
-       &int3496_reference_gpios,
-       NULL
-};
-
 const struct x86_dev_info acer_b1_750_info __initconst = {
        .i2c_client_info = acer_b1_750_i2c_clients,
        .i2c_client_count = ARRAY_SIZE(acer_b1_750_i2c_clients),
        .pdev_info = int3496_pdevs,
        .pdev_count = 1,
-       .gpiod_lookup_tables = acer_b1_750_gpios,
        .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 };
 
@@ -407,17 +401,12 @@ static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst
        },
 };
 
-static struct gpiod_lookup_table * const nextbook_ares8_gpios[] = {
-       &int3496_reference_gpios,
-       NULL
-};
-
 const struct x86_dev_info nextbook_ares8_info __initconst = {
        .i2c_client_info = nextbook_ares8_i2c_clients,
        .i2c_client_count = ARRAY_SIZE(nextbook_ares8_i2c_clients),
        .pdev_info = int3496_pdevs,
        .pdev_count = 1,
-       .gpiod_lookup_tables = nextbook_ares8_gpios,
+       .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
 };
 
 /* Nextbook Ares 8A (CHT) tablets have an Android factory image with everything hardcoded */
index fe34cedb6257b38f43a2a57ff481250ca75c1080..6ebe282bda6e905a68b0261d647bc6eaa3228a00 100644 (file)
@@ -9,12 +9,14 @@
  */
 
 #include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
 #include <linux/platform_device.h>
 #include <linux/power/bq24190_charger.h>
 #include <linux/property.h>
 #include <linux/regulator/machine.h>
 
 #include "shared-psy-info.h"
+#include "x86-android-tablets.h"
 
 /* Generic / shared charger / battery settings */
 const char * const tusb1211_chg_det_psy[] = { "tusb1211-charger-detect" };
@@ -156,21 +158,19 @@ const char * const bq24190_modules[] __initconst = {
        NULL
 };
 
-/* Generic platform device array and GPIO lookup table for micro USB ID pin handling */
+static const struct property_entry int3496_reference_props[] __initconst = {
+       PROPERTY_ENTRY_GPIO("vbus-gpios", &baytrail_gpiochip_nodes[1], 15, GPIO_ACTIVE_HIGH),
+       PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_HIGH),
+       PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 18, GPIO_ACTIVE_HIGH),
+       { }
+};
+
+/* Generic pdevs array and gpio-lookups for micro USB ID pin handling */
 const struct platform_device_info int3496_pdevs[] __initconst = {
        {
                /* For micro USB ID pin handling */
                .name = "intel-int3496",
                .id = PLATFORM_DEVID_NONE,
-       },
-};
-
-struct gpiod_lookup_table int3496_reference_gpios = {
-       .dev_id = "intel-int3496",
-       .table = {
-               GPIO_LOOKUP("INT33FC:01", 15, "vbus", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("INT33FC:02", 18, "id", GPIO_ACTIVE_HIGH),
-               { }
+               .properties = int3496_reference_props,
        },
 };
index bcf9845ad275c091501f7fd20cd58b89de97ec55..b9cbc291aa4d45eca621d34859e2167aa4d01a2f 100644 (file)
@@ -11,7 +11,6 @@
 #define __PDX86_SHARED_PSY_INFO_H
 
 struct bq24190_platform_data;
-struct gpiod_lookup_table;
 struct platform_device_info;
 struct software_node;
 
@@ -28,6 +27,5 @@ extern struct bq24190_platform_data bq24190_pdata;
 extern const char * const bq24190_modules[];
 
 extern const struct platform_device_info int3496_pdevs[];
-extern struct gpiod_lookup_table int3496_reference_gpios;
 
 #endif