* [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
@ 2025-08-11 2:22 Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
` (12 more replies)
0 siblings, 13 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
This series came about because now software nodes can be used to
describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
eventually get rid of gpio_keys_platform_data structure.
So while I was doing the conversions from GPIO_LOOKUP() tables for
gpio_keys devices I decided to convert the rest of them as well. Maybe
some time in the future we can drop support for GPIO_LOOKUP() and rely
on device properties exclusively.
This is completely untested.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Changes in v2:
- Reworked on top of the current linux-next
- Link to v1: https://lore.kernel.org/r/20230512001815.591817-1-dmitry.torokhov@gmail.com
---
Dmitry Torokhov (11):
platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
platform/x86: x86-android-tablets: convert Wacom devices to GPIO references
platform/x86: x86-android-tablets: convert HiDeep devices to GPIO references
platform/x86: x86-android-tablets: convert Novatek devices to GPIO references
platform/x86: x86-android-tablets: convert EDT devices to GPIO references
platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
platform/x86: x86-android-tablets: convert wm1502 devices to GPIO references
platform/x86: x86-android-tablets: convert HID-I2C devices to GPIO references
platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
platform/x86: x86-android-tablets: remove support for GPIO lookup tables
platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references
drivers/platform/x86/x86-android-tablets/asus.c | 102 ++++----
drivers/platform/x86/x86-android-tablets/core.c | 109 +++++---
drivers/platform/x86/x86-android-tablets/lenovo.c | 279 +++++++++++---------
drivers/platform/x86/x86-android-tablets/other.c | 289 ++++++++++-----------
.../x86/x86-android-tablets/shared-psy-info.c | 20 --
.../x86/x86-android-tablets/shared-psy-info.h | 5 -
.../x86/x86-android-tablets/x86-android-tablets.h | 23 +-
7 files changed, 436 insertions(+), 391 deletions(-)
---
base-commit: b1549501188cc9eba732c25b033df7a53ccc341f
change-id: 20250810-x86-andoroid-tablet-df93908b426b
Best regards,
--
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 10:09 ` Hans de Goede
2025-08-11 2:22 ` [PATCH v2 02/11] platform/x86: x86-android-tablets: convert Wacom " Dmitry Torokhov
` (11 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for Goodix touchscreens to
using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Since the tablets are using either Baytrail or Cherryview GPIO
controllers x86_dev_info structure has been extended to carry gpiochip
type information so that the code can instantiate correct set of
software nodes representing the GPIO chip.
Because this adds a new point of failure in x86_android_tablet_probe(),
x86_android_tablet_remove() is rearranged to handle cases where battery
swnode has not been registered yet, and registering of GPIO lookup
tables is moved earlier as it can not fail.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/asus.c | 23 ++++----
drivers/platform/x86/x86-android-tablets/core.c | 69 +++++++++++++++++++---
drivers/platform/x86/x86-android-tablets/lenovo.c | 23 ++++----
drivers/platform/x86/x86-android-tablets/other.c | 37 +++---------
.../x86/x86-android-tablets/x86-android-tablets.h | 11 ++++
5 files changed, 105 insertions(+), 58 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c
index 97cd14c1fd23..6c4468f4004b 100644
--- a/drivers/platform/x86/x86-android-tablets/asus.c
+++ b/drivers/platform/x86/x86-android-tablets/asus.c
@@ -9,6 +9,7 @@
*/
#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
#include <linux/input.h>
#include <linux/platform_device.h>
@@ -77,6 +78,16 @@ static const struct software_node asus_me176c_ug3105_node = {
.properties = asus_me176c_ug3105_props,
};
+static const struct property_entry asus_me176c_touchscreen_props[] = {
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[0], 60, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("irq-gpios", &baytrail_gpiochip_nodes[2], 28, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node asus_me176c_touchscreen_node = {
+ .properties = asus_me176c_touchscreen_props,
+};
+
static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst = {
{
/* bq24297 battery charger */
@@ -132,6 +143,7 @@ static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst =
.type = "GDIX1001:00",
.addr = 0x14,
.dev_name = "goodix_ts",
+ .swnode = &asus_me176c_touchscreen_node,
},
.adapter_path = "\\_SB_.I2C6",
.irq_data = {
@@ -152,18 +164,8 @@ static const struct x86_serdev_info asus_me176c_serdevs[] __initconst = {
},
};
-static struct gpiod_lookup_table asus_me176c_goodix_gpios = {
- .dev_id = "i2c-goodix_ts",
- .table = {
- GPIO_LOOKUP("INT33FC:00", 60, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FC:02", 28, "irq", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
&int3496_gpo2_pin22_gpios,
- &asus_me176c_goodix_gpios,
NULL
};
@@ -179,6 +181,7 @@ const struct x86_dev_info asus_me176c_info __initconst = {
.gpiod_lookup_tables = asus_me176c_gpios,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/* Asus TF103C tablets have an Android factory image with everything hardcoded */
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 2a9c47178505..b0d63d3c05cd 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -155,6 +155,7 @@ static struct serdev_device **serdevs;
static struct gpio_keys_button *buttons;
static struct gpiod_lookup_table * const *gpiod_lookup_tables;
static const struct software_node *bat_swnode;
+static const struct software_node **gpiochip_node_group;
static void (*exit_handler)(void);
static __init struct i2c_adapter *
@@ -331,6 +332,34 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
return ret;
}
+const struct software_node baytrail_gpiochip_nodes[] = {
+ { .name = "INT33FC:00" },
+ { .name = "INT33FC:01" },
+ { .name = "INT33FC:02" },
+};
+
+static const struct software_node *baytrail_gpiochip_node_group[] = {
+ &baytrail_gpiochip_nodes[0],
+ &baytrail_gpiochip_nodes[1],
+ &baytrail_gpiochip_nodes[2],
+ NULL
+};
+
+const struct software_node cherryview_gpiochip_nodes[] = {
+ { .name = "INT33FF:00" },
+ { .name = "INT33FF:01" },
+ { .name = "INT33FF:02" },
+ { .name = "INT33FF:03" },
+};
+
+static const struct software_node *cherryview_gpiochip_node_group[] = {
+ &cherryview_gpiochip_nodes[0],
+ &cherryview_gpiochip_nodes[1],
+ &cherryview_gpiochip_nodes[2],
+ &cherryview_gpiochip_nodes[3],
+ NULL
+};
+
static void x86_android_tablet_remove(struct platform_device *pdev)
{
int i;
@@ -361,10 +390,14 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
if (exit_handler)
exit_handler();
+ if (bat_swnode)
+ software_node_unregister(bat_swnode);
+
+ if (gpiochip_node_group)
+ software_node_unregister_node_group(gpiochip_node_group);
+
for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
-
- software_node_unregister(bat_swnode);
}
static __init int x86_android_tablet_probe(struct platform_device *pdev)
@@ -388,16 +421,36 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
for (i = 0; dev_info->modules && dev_info->modules[i]; i++)
request_module(dev_info->modules[i]);
- bat_swnode = dev_info->bat_swnode;
- if (bat_swnode) {
- ret = software_node_register(bat_swnode);
+ gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
+ for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
+ gpiod_add_lookup_table(gpiod_lookup_tables[i]);
+
+ switch (dev_info->gpiochip_type) {
+ case X86_GPIOCHIP_BAYTRAIL:
+ gpiochip_node_group = baytrail_gpiochip_node_group;
+ break;
+ case X86_GPIOCHIP_CHERRYVIEW:
+ gpiochip_node_group = cherryview_gpiochip_node_group;
+ break;
+ case X86_GPIOCHIP_UNSPECIFIED:
+ gpiochip_node_group = NULL;
+ break;
+ }
+
+ if (gpiochip_node_group) {
+ ret = software_node_register_node_group(gpiochip_node_group);
if (ret)
return ret;
}
- gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
- for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
- gpiod_add_lookup_table(gpiod_lookup_tables[i]);
+ if (dev_info->bat_swnode) {
+ ret = software_node_register(dev_info->bat_swnode);
+ if (ret) {
+ x86_android_tablet_remove(pdev);
+ return ret;
+ }
+ bat_swnode = dev_info->bat_swnode;
+ }
if (dev_info->init) {
ret = dev_info->init(&pdev->dev);
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 1241a97cda39..22fe76ef5b5a 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -12,6 +12,7 @@
#include <linux/efi.h>
#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
#include <linux/mfd/arizona/pdata.h>
#include <linux/mfd/arizona/registers.h>
#include <linux/mfd/intel_soc_pmic.h>
@@ -61,6 +62,16 @@ static struct lp855x_platform_data lenovo_lp8557_reg_only_pdata = {
/* Lenovo Yoga Book X90F / X90L's Android factory image has everything hardcoded */
+static const struct property_entry lenovo_yb1_x90_goodix_props[] = {
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[1], 53, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("irq-gpios", &cherryview_gpiochip_nodes[1], 56, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node lenovo_yb1_x90_goodix_node = {
+ .properties = lenovo_yb1_x90_goodix_props,
+};
+
static const struct property_entry lenovo_yb1_x90_wacom_props[] = {
PROPERTY_ENTRY_U32("hid-descr-addr", 0x0001),
PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 150),
@@ -108,6 +119,7 @@ static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst
.type = "GDIX1001:00",
.addr = 0x14,
.dev_name = "goodix_ts",
+ .swnode = &lenovo_yb1_x90_goodix_node,
},
.adapter_path = "\\_SB_.PCI0.I2C2",
.irq_data = {
@@ -198,15 +210,6 @@ static const struct x86_gpio_button lenovo_yb1_x90_lid __initconst = {
.pin = 19,
};
-static struct gpiod_lookup_table lenovo_yb1_x90_goodix_gpios = {
- .dev_id = "i2c-goodix_ts",
- .table = {
- GPIO_LOOKUP("INT33FF:01", 53, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FF:01", 56, "irq", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
.dev_id = "i2c-hideep_ts",
.table = {
@@ -225,7 +228,6 @@ static struct gpiod_lookup_table lenovo_yb1_x90_wacom_gpios = {
static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
&lenovo_yb1_x90_hideep_gpios,
- &lenovo_yb1_x90_goodix_gpios,
&lenovo_yb1_x90_wacom_gpios,
NULL
};
@@ -259,6 +261,7 @@ const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
.gpio_button = &lenovo_yb1_x90_lid,
.gpio_button_count = 1,
.gpiod_lookup_tables = lenovo_yb1_x90_gpios,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
.init = lenovo_yb1_x90_init,
};
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index f7bd9f863c85..e3907812c8bc 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -10,6 +10,7 @@
#include <linux/acpi.h>
#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
#include <linux/input.h>
#include <linux/leds.h>
#include <linux/pci.h>
@@ -297,6 +298,8 @@ static const struct software_node medion_lifetab_s10346_accel_node = {
static const struct property_entry medion_lifetab_s10346_touchscreen_props[] = {
PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("irq-gpios", &baytrail_gpiochip_nodes[2], 3, GPIO_ACTIVE_HIGH),
{ }
};
@@ -340,24 +343,10 @@ static const struct x86_i2c_client_info medion_lifetab_s10346_i2c_clients[] __in
},
};
-static struct gpiod_lookup_table medion_lifetab_s10346_goodix_gpios = {
- .dev_id = "i2c-goodix_ts",
- .table = {
- GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FC:02", 3, "irq", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const medion_lifetab_s10346_gpios[] = {
- &medion_lifetab_s10346_goodix_gpios,
- NULL
-};
-
const struct x86_dev_info medion_lifetab_s10346_info __initconst = {
.i2c_client_info = medion_lifetab_s10346_i2c_clients,
.i2c_client_count = ARRAY_SIZE(medion_lifetab_s10346_i2c_clients),
- .gpiod_lookup_tables = medion_lifetab_s10346_gpios,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/* Nextbook Ares 8 (BYT) tablets have an Android factory image with everything hardcoded */
@@ -543,6 +532,8 @@ static const struct property_entry whitelabel_tm800a550l_goodix_props[] = {
PROPERTY_ENTRY_STRING("firmware-name", "gt912-tm800a550l.fw"),
PROPERTY_ENTRY_STRING("goodix,config-name", "gt912-tm800a550l.cfg"),
PROPERTY_ENTRY_U32("goodix,main-clk", 54),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("irq-gpios", &baytrail_gpiochip_nodes[2], 3, GPIO_ACTIVE_HIGH),
{ }
};
@@ -578,24 +569,10 @@ static const struct x86_i2c_client_info whitelabel_tm800a550l_i2c_clients[] __in
},
};
-static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios = {
- .dev_id = "i2c-goodix_ts",
- .table = {
- GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FC:02", 3, "irq", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const whitelabel_tm800a550l_gpios[] = {
- &whitelabel_tm800a550l_goodix_gpios,
- NULL
-};
-
const struct x86_dev_info whitelabel_tm800a550l_info __initconst = {
.i2c_client_info = whitelabel_tm800a550l_i2c_clients,
.i2c_client_count = ARRAY_SIZE(whitelabel_tm800a550l_i2c_clients),
- .gpiod_lookup_tables = whitelabel_tm800a550l_gpios,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
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 dcf8d49e3b5f..a54d09408866 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -32,6 +32,12 @@ enum x86_acpi_irq_type {
X86_ACPI_IRQ_TYPE_PMIC,
};
+enum x86_gpiochip_type {
+ X86_GPIOCHIP_UNSPECIFIED = 0,
+ X86_GPIOCHIP_BAYTRAIL,
+ X86_GPIOCHIP_CHERRYVIEW,
+};
+
struct x86_acpi_irq_data {
char *chip; /* GPIO chip label (GPIOINT) or PMIC ACPI path (PMIC) */
enum x86_acpi_irq_type type;
@@ -99,6 +105,7 @@ struct x86_dev_info {
int (*init)(struct device *dev);
void (*exit)(void);
bool use_pci;
+ enum x86_gpiochip_type gpiochip_type;
};
int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
@@ -106,6 +113,10 @@ int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
struct gpio_desc **desc);
int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data);
+/* Software nodes representing GPIO chips used by various tablets */
+extern const struct software_node baytrail_gpiochip_nodes[];
+extern const struct software_node cherryview_gpiochip_nodes[];
+
/*
* Extern declarations of x86_dev_info structs so there can be a single
* MODULE_DEVICE_TABLE(dmi, ...), while splitting the board descriptions.
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 02/11] platform/x86: x86-android-tablets: convert Wacom devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 03/11] platform/x86: x86-android-tablets: convert HiDeep " Dmitry Torokhov
` (10 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for Wacom touchscreens to using
PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/lenovo.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 22fe76ef5b5a..f8d261d37284 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -75,6 +75,7 @@ static const struct software_node lenovo_yb1_x90_goodix_node = {
static const struct property_entry lenovo_yb1_x90_wacom_props[] = {
PROPERTY_ENTRY_U32("hid-descr-addr", 0x0001),
PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 150),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[0], 82, GPIO_ACTIVE_LOW),
{ }
};
@@ -218,17 +219,8 @@ static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
},
};
-static struct gpiod_lookup_table lenovo_yb1_x90_wacom_gpios = {
- .dev_id = "i2c-wacom",
- .table = {
- GPIO_LOOKUP("INT33FF:00", 82, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
&lenovo_yb1_x90_hideep_gpios,
- &lenovo_yb1_x90_wacom_gpios,
NULL
};
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 03/11] platform/x86: x86-android-tablets: convert HiDeep devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 02/11] platform/x86: x86-android-tablets: convert Wacom " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 04/11] platform/x86: x86-android-tablets: convert Novatek " Dmitry Torokhov
` (9 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for HiDeep touchscreens to using
PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/lenovo.c | 26 +++--------------------
1 file changed, 3 insertions(+), 23 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index f8d261d37284..49388266201b 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -97,6 +97,7 @@ static const struct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
PROPERTY_ENTRY_U32("touchscreen-max-pressure", 16384),
PROPERTY_ENTRY_BOOL("hideep,force-native-protocol"),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[0], 7, GPIO_ACTIVE_LOW),
{ }
};
@@ -211,19 +212,6 @@ static const struct x86_gpio_button lenovo_yb1_x90_lid __initconst = {
.pin = 19,
};
-static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
- .dev_id = "i2c-hideep_ts",
- .table = {
- GPIO_LOOKUP("INT33FF:00", 7, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
- &lenovo_yb1_x90_hideep_gpios,
- NULL
-};
-
static int __init lenovo_yb1_x90_init(struct device *dev)
{
/* Enable the regulators used by the touchscreens */
@@ -252,7 +240,6 @@ const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
.serdev_count = ARRAY_SIZE(lenovo_yb1_x90_serdevs),
.gpio_button = &lenovo_yb1_x90_lid,
.gpio_button_count = 1,
- .gpiod_lookup_tables = lenovo_yb1_x90_gpios,
.gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
.init = lenovo_yb1_x90_init,
};
@@ -819,6 +806,7 @@ static const struct property_entry lenovo_yt3_hideep_ts_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
PROPERTY_ENTRY_U32("touchscreen-size-y", 2560),
PROPERTY_ENTRY_U32("touchscreen-max-pressure", 255),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[0], 7, GPIO_ACTIVE_LOW),
{ }
};
@@ -1008,14 +996,6 @@ static int __init lenovo_yt3_init(struct device *dev)
return 0;
}
-static struct gpiod_lookup_table lenovo_yt3_hideep_gpios = {
- .dev_id = "i2c-hideep_ts",
- .table = {
- GPIO_LOOKUP("INT33FF:00", 7, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
static struct gpiod_lookup_table lenovo_yt3_wm5102_gpios = {
.dev_id = "spi1.0",
.table = {
@@ -1028,7 +1008,6 @@ static struct gpiod_lookup_table lenovo_yt3_wm5102_gpios = {
};
static struct gpiod_lookup_table * const lenovo_yt3_gpios[] = {
- &lenovo_yt3_hideep_gpios,
&lenovo_yt3_wm5102_gpios,
NULL
};
@@ -1039,5 +1018,6 @@ const struct x86_dev_info lenovo_yt3_info __initconst = {
.spi_dev_info = lenovo_yt3_spi_devs,
.spi_dev_count = ARRAY_SIZE(lenovo_yt3_spi_devs),
.gpiod_lookup_tables = lenovo_yt3_gpios,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
.init = lenovo_yt3_init,
};
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 04/11] platform/x86: x86-android-tablets: convert Novatek devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (2 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 03/11] platform/x86: x86-android-tablets: convert HiDeep " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 05/11] platform/x86: x86-android-tablets: convert EDT " Dmitry Torokhov
` (8 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for Novatek touchscreens to
using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/other.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index e3907812c8bc..95c5001004a1 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -38,6 +38,15 @@ static const struct software_node acer_b1_750_bma250e_node = {
.properties = acer_b1_750_bma250e_props,
};
+static const struct property_entry acer_b1_750_novatek_props[] = {
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_LOW),
+ { }
+};
+
+static const struct software_node acer_b1_750_novatek_node = {
+ .properties = acer_b1_750_novatek_props,
+};
+
static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst = {
{
/* Novatek NVT-ts touchscreen */
@@ -45,6 +54,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
.type = "nt11205-ts",
.addr = 0x34,
.dev_name = "NVT-ts",
+ .swnode = &acer_b1_750_novatek_node,
},
.adapter_path = "\\_SB_.I2C4",
.irq_data = {
@@ -74,16 +84,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
},
};
-static struct gpiod_lookup_table acer_b1_750_nvt_ts_gpios = {
- .dev_id = "i2c-NVT-ts",
- .table = {
- GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
static struct gpiod_lookup_table * const acer_b1_750_gpios[] = {
- &acer_b1_750_nvt_ts_gpios,
&int3496_reference_gpios,
NULL
};
@@ -94,6 +95,7 @@ const struct x86_dev_info acer_b1_750_info __initconst = {
.pdev_info = int3496_pdevs,
.pdev_count = 1,
.gpiod_lookup_tables = acer_b1_750_gpios,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 05/11] platform/x86: x86-android-tablets: convert EDT devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (3 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 04/11] platform/x86: x86-android-tablets: convert Novatek " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 06/11] platform/x86: x86-android-tablets: convert int3496 " Dmitry Torokhov
` (7 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for EDT touchscreens to using
PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/other.c | 28 +++++++++++-------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 95c5001004a1..0f3cc0ea877e 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -436,6 +436,17 @@ static const struct software_node nextbook_ares8a_accel_node = {
.properties = nextbook_ares8a_accel_props,
};
+static const struct property_entry nextbook_ares8a_ft5416_props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 800),
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[1], 25, GPIO_ACTIVE_LOW),
+ { }
+};
+
+static const struct software_node nextbook_ares8a_ft5416_node = {
+ .properties = nextbook_ares8a_ft5416_props,
+};
+
static const struct x86_i2c_client_info nextbook_ares8a_i2c_clients[] __initconst = {
{
/* Freescale MMA8653FC accelerometer */
@@ -452,7 +463,7 @@ static const struct x86_i2c_client_info nextbook_ares8a_i2c_clients[] __initcons
.type = "edt-ft5x06",
.addr = 0x38,
.dev_name = "ft5416",
- .swnode = &nextbook_ares8_touchscreen_node,
+ .swnode = &nextbook_ares8a_ft5416_node,
},
.adapter_path = "\\_SB_.PCI0.I2C6",
.irq_data = {
@@ -466,23 +477,10 @@ static const struct x86_i2c_client_info nextbook_ares8a_i2c_clients[] __initcons
},
};
-static struct gpiod_lookup_table nextbook_ares8a_ft5416_gpios = {
- .dev_id = "i2c-ft5416",
- .table = {
- GPIO_LOOKUP("INT33FF:01", 25, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const nextbook_ares8a_gpios[] = {
- &nextbook_ares8a_ft5416_gpios,
- NULL
-};
-
const struct x86_dev_info nextbook_ares8a_info __initconst = {
.i2c_client_info = nextbook_ares8a_i2c_clients,
.i2c_client_count = ARRAY_SIZE(nextbook_ares8a_i2c_clients),
- .gpiod_lookup_tables = nextbook_ares8a_gpios,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
};
/*
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 06/11] platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (4 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 05/11] platform/x86: x86-android-tablets: convert EDT " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 07/11] platform/x86: x86-android-tablets: convert wm1502 " Dmitry Torokhov
` (6 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
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>
---
drivers/platform/x86/x86-android-tablets/asus.c | 37 ++++++++++------------
drivers/platform/x86/x86-android-tablets/lenovo.c | 24 ++++++++------
drivers/platform/x86/x86-android-tablets/other.c | 34 ++++++++++++--------
.../x86/x86-android-tablets/shared-psy-info.c | 20 ------------
.../x86/x86-android-tablets/shared-psy-info.h | 5 ---
5 files changed, 51 insertions(+), 69 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c
index 6c4468f4004b..ce581d161551 100644
--- a/drivers/platform/x86/x86-android-tablets/asus.c
+++ b/drivers/platform/x86/x86-android-tablets/asus.c
@@ -17,11 +17,17 @@
#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,
};
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 49388266201b..db6337671357 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -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,
};
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 0f3cc0ea877e..6f2d389a0258 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -22,6 +22,23 @@
#include "shared-psy-info.h"
#include "x86-android-tablets.h"
+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 */
+static const struct platform_device_info int3496_pdevs[] __initconst = {
+ {
+ /* For micro USB ID pin handling */
+ .name = "intel-int3496",
+ .id = PLATFORM_DEVID_NONE,
+ .properties = int3496_reference_props,
+ },
+};
+
/* Acer Iconia One 7 B1-750 has an Android factory image with everything hardcoded */
static const char * const acer_b1_750_mount_matrix[] = {
"-1", "0", "0",
@@ -84,17 +101,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,
+ .pdev_count = ARRAY_SIZE(int3496_pdevs),
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
@@ -407,17 +418,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,
+ .pdev_count = ARRAY_SIZE(int3496_pdevs),
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/* Nextbook Ares 8A (CHT) tablets have an Android factory image with everything hardcoded */
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 fe34cedb6257..8aa5db7351c3 100644
--- a/drivers/platform/x86/x86-android-tablets/shared-psy-info.c
+++ b/drivers/platform/x86/x86-android-tablets/shared-psy-info.c
@@ -8,7 +8,6 @@
* Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com>
*/
-#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
#include <linux/power/bq24190_charger.h>
#include <linux/property.h>
@@ -155,22 +154,3 @@ const char * const bq24190_modules[] __initconst = {
"bq24190_charger", /* For the Vbus regulator for intel-int3496 */
NULL
};
-
-/* Generic platform device array and GPIO lookup table 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),
- { }
- },
-};
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 bcf9845ad275..fabfdfe4ffce 100644
--- a/drivers/platform/x86/x86-android-tablets/shared-psy-info.h
+++ b/drivers/platform/x86/x86-android-tablets/shared-psy-info.h
@@ -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;
@@ -26,8 +25,4 @@ extern const struct software_node generic_lipo_hv_4v35_battery_node;
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
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 07/11] platform/x86: x86-android-tablets: convert wm1502 devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (5 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 06/11] platform/x86: x86-android-tablets: convert int3496 " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 08/11] platform/x86: x86-android-tablets: convert HID-I2C " Dmitry Torokhov
` (5 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for wm1502 devices to using
PROPERTY_ENTRY_GPIO().
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/lenovo.c | 108 +++++++++++++++-------
1 file changed, 76 insertions(+), 32 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index db6337671357..811400d59697 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -383,19 +383,34 @@ static const struct platform_device_info lenovo_yoga_tab2_830_1050_pdevs[] __ini
#define LENOVO_YOGA_TAB2_830_1050_CODEC_NAME "spi-10WM5102:00"
-static struct gpiod_lookup_table lenovo_yoga_tab2_830_1050_codec_gpios = {
- .dev_id = LENOVO_YOGA_TAB2_830_1050_CODEC_NAME,
- .table = {
- GPIO_LOOKUP("gpio_crystalcove", 3, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FC:01", 23, "wlf,ldoena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("arizona", 2, "wlf,spkvdd-ena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("arizona", 4, "wlf,micd-pol", GPIO_ACTIVE_LOW),
- { }
- },
+static const struct software_node lenovo_yoga_tab2_830_1050_crystalcove = {
+ .name = "gpio_crystalcove",
+};
+
+static const struct software_node lenovo_yoga_tab2_830_1050_arizona = {
+ .name = "arizona",
+};
+
+static const struct property_entry lenovo_yoga_tab2_830_1050_wm1502_props[] = {
+ PROPERTY_ENTRY_GPIO("reset-gpios",
+ &lenovo_yoga_tab2_830_1050_crystalcove, 3, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("wlf,ldoena-gpios",
+ &baytrail_gpiochip_nodes[1], 23, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("wlf,spkvdd-ena-gpios",
+ &lenovo_yoga_tab2_830_1050_arizona, 2, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("wlf,micd-pol-gpios",
+ &lenovo_yoga_tab2_830_1050_arizona, 4, GPIO_ACTIVE_LOW),
+ { }
+};
+
+static const struct software_node lenovo_yoga_tab2_830_1050_wm5102 = {
+ .properties = lenovo_yoga_tab2_830_1050_wm1502_props,
};
-static struct gpiod_lookup_table * const lenovo_yoga_tab2_830_1050_gpios[] = {
- &lenovo_yoga_tab2_830_1050_codec_gpios,
+static const struct software_node *lenovo_yoga_tab2_830_1050_swnodes[] = {
+ &lenovo_yoga_tab2_830_1050_crystalcove,
+ &lenovo_yoga_tab2_830_1050_arizona,
+ &lenovo_yoga_tab2_830_1050_wm5102,
NULL
};
@@ -409,7 +424,6 @@ const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
.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,
@@ -469,6 +483,7 @@ static const struct pinctrl_map lenovo_yoga_tab2_830_1050_codec_pinctrl_map =
PIN_MAP_MUX_GROUP(LENOVO_YOGA_TAB2_830_1050_CODEC_NAME, "codec_32khz_clk",
"INT33FC:02", "pmu_clk2_grp", "pmu_clk");
+static struct device *lenovo_yoga_tab2_830_1050_codec_dev;
static struct pinctrl *lenovo_yoga_tab2_830_1050_codec_pinctrl;
static struct sys_off_handler *lenovo_yoga_tab2_830_1050_sys_off_handler;
@@ -495,12 +510,24 @@ static int __init lenovo_yoga_tab2_830_1050_init_codec(void)
goto err_unregister_mappings;
}
- /* We're done with the codec_dev now */
- put_device(codec_dev);
+ ret = software_node_register_node_group(lenovo_yoga_tab2_830_1050_swnodes);
+ if (ret) {
+ ret = dev_err_probe(codec_dev, ret, "registering software nodes\n");
+ goto err_unregister_mappings;
+ }
+
+ ret = device_add_software_node(codec_dev, &lenovo_yoga_tab2_830_1050_wm5102);
+ if (ret) {
+ ret = dev_err_probe(codec_dev, ret, "adding software node\n");
+ goto err_unregister_swnodes;
+ }
+ lenovo_yoga_tab2_830_1050_codec_dev = codec_dev;
lenovo_yoga_tab2_830_1050_codec_pinctrl = pinctrl;
return 0;
+err_unregister_swnodes:
+ software_node_unregister_node_group(lenovo_yoga_tab2_830_1050_swnodes);
err_unregister_mappings:
pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
err_put_device:
@@ -548,6 +575,12 @@ static void lenovo_yoga_tab2_830_1050_exit(void)
{
unregister_sys_off_handler(lenovo_yoga_tab2_830_1050_sys_off_handler);
+ if (lenovo_yoga_tab2_830_1050_codec_dev) {
+ device_remove_software_node(lenovo_yoga_tab2_830_1050_codec_dev);
+ put_device(lenovo_yoga_tab2_830_1050_codec_dev);
+ software_node_unregister_node_group(lenovo_yoga_tab2_830_1050_swnodes);
+ }
+
if (lenovo_yoga_tab2_830_1050_codec_pinctrl) {
pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
@@ -750,7 +783,6 @@ static struct gpiod_lookup_table lenovo_yoga_tab2_1380_fc_gpios = {
};
static struct gpiod_lookup_table * const lenovo_yoga_tab2_1380_gpios[] = {
- &lenovo_yoga_tab2_830_1050_codec_gpios,
&lenovo_yoga_tab2_1380_fc_gpios,
NULL
};
@@ -947,12 +979,37 @@ static struct arizona_pdata lenovo_yt3_wm5102_pdata = {
},
};
+static const struct software_node lenovo_yt3_arizona = {
+ .name = "arizona",
+};
+
+static const struct property_entry lenovo_yt3_wm1502_props[] = {
+ PROPERTY_ENTRY_GPIO("wlf,spkvdd-ena-gpios",
+ &cherryview_gpiochip_nodes[0], 75, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("wlf,ldoena-gpios",
+ &cherryview_gpiochip_nodes[0], 81, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &cherryview_gpiochip_nodes[0], 82, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("wlf,micd-pol-gpios", &lenovo_yt3_arizona, 2, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node lenovo_yt3_wm5102 = {
+ .properties = lenovo_yt3_wm1502_props,
+};
+
+static const struct software_node *lenovo_yt3_swnodes[] = {
+ &lenovo_yt3_arizona,
+ &lenovo_yt3_wm5102,
+ NULL
+};
+
static const struct x86_spi_dev_info lenovo_yt3_spi_devs[] __initconst = {
{
/* WM5102 codec */
.board_info = {
.modalias = "wm5102",
.platform_data = &lenovo_yt3_wm5102_pdata,
+ .swnode = &lenovo_yt3_wm5102,
.max_speed_hz = 5000000,
},
.ctrl_path = "\\_SB_.PCI0.SPI1",
@@ -999,31 +1056,18 @@ static int __init lenovo_yt3_init(struct device *dev)
intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9b, 0x02, 0xff);
intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa0, 0x02, 0xff);
+ ret = software_node_register_node_group(lenovo_yt3_swnodes);
+ if (ret)
+ return dev_err_probe(dev, ret, "registering software nodes\n");
+
return 0;
}
-static struct gpiod_lookup_table lenovo_yt3_wm5102_gpios = {
- .dev_id = "spi1.0",
- .table = {
- GPIO_LOOKUP("INT33FF:00", 75, "wlf,spkvdd-ena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FF:00", 81, "wlf,ldoena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FF:00", 82, "reset", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("arizona", 2, "wlf,micd-pol", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const lenovo_yt3_gpios[] = {
- &lenovo_yt3_wm5102_gpios,
- NULL
-};
-
const struct x86_dev_info lenovo_yt3_info __initconst = {
.i2c_client_info = lenovo_yt3_i2c_clients,
.i2c_client_count = ARRAY_SIZE(lenovo_yt3_i2c_clients),
.spi_dev_info = lenovo_yt3_spi_devs,
.spi_dev_count = ARRAY_SIZE(lenovo_yt3_spi_devs),
- .gpiod_lookup_tables = lenovo_yt3_gpios,
.gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
.init = lenovo_yt3_init,
};
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 08/11] platform/x86: x86-android-tablets: convert HID-I2C devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (6 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 07/11] platform/x86: x86-android-tablets: convert wm1502 " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 09/11] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " Dmitry Torokhov
` (4 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for HID-I2C touchscreens to
using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/other.c | 32 +++---------------------
1 file changed, 4 insertions(+), 28 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 6f2d389a0258..38c5e7bd88b0 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -588,6 +588,7 @@ const struct x86_dev_info whitelabel_tm800a550l_info __initconst = {
static const struct property_entry vexia_edu_atla10_5v_touchscreen_props[] = {
PROPERTY_ENTRY_U32("hid-descr-addr", 0x0000),
PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 120),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_LOW),
{ }
};
@@ -622,23 +623,10 @@ static const struct x86_i2c_client_info vexia_edu_atla10_5v_i2c_clients[] __init
}
};
-static struct gpiod_lookup_table vexia_edu_atla10_5v_ft5416_gpios = {
- .dev_id = "i2c-FTSC1000",
- .table = {
- GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const vexia_edu_atla10_5v_gpios[] = {
- &vexia_edu_atla10_5v_ft5416_gpios,
- NULL
-};
-
const struct x86_dev_info vexia_edu_atla10_5v_info __initconst = {
.i2c_client_info = vexia_edu_atla10_5v_i2c_clients,
.i2c_client_count = ARRAY_SIZE(vexia_edu_atla10_5v_i2c_clients),
- .gpiod_lookup_tables = vexia_edu_atla10_5v_gpios,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
@@ -674,6 +662,7 @@ static const struct software_node vexia_edu_atla10_9v_accel_node = {
static const struct property_entry vexia_edu_atla10_9v_touchscreen_props[] = {
PROPERTY_ENTRY_U32("hid-descr-addr", 0x0000),
PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 120),
+ PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[0], 60, GPIO_ACTIVE_LOW),
{ }
};
@@ -766,19 +755,6 @@ static const struct x86_serdev_info vexia_edu_atla10_9v_serdevs[] __initconst =
},
};
-static struct gpiod_lookup_table vexia_edu_atla10_9v_ft5416_gpios = {
- .dev_id = "i2c-FTSC1000",
- .table = {
- GPIO_LOOKUP("INT33FC:00", 60, "reset", GPIO_ACTIVE_LOW),
- { }
- },
-};
-
-static struct gpiod_lookup_table * const vexia_edu_atla10_9v_gpios[] = {
- &vexia_edu_atla10_9v_ft5416_gpios,
- NULL
-};
-
static int __init vexia_edu_atla10_9v_init(struct device *dev)
{
struct pci_dev *pdev;
@@ -808,9 +784,9 @@ const struct x86_dev_info vexia_edu_atla10_9v_info __initconst = {
.i2c_client_count = ARRAY_SIZE(vexia_edu_atla10_9v_i2c_clients),
.serdev_info = vexia_edu_atla10_9v_serdevs,
.serdev_count = ARRAY_SIZE(vexia_edu_atla10_9v_serdevs),
- .gpiod_lookup_tables = vexia_edu_atla10_9v_gpios,
.init = vexia_edu_atla10_9v_init,
.use_pci = true,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 09/11] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (7 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 08/11] platform/x86: x86-android-tablets: convert HID-I2C " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 10/11] platform/x86: x86-android-tablets: remove support for GPIO lookup tables Dmitry Torokhov
` (3 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
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>
---
drivers/platform/x86/x86-android-tablets/lenovo.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 811400d59697..7c6a6fc6be42 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -739,11 +739,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[] = {
+ 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,
},
};
@@ -773,20 +780,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),
@@ -794,9 +787,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.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 10/11] platform/x86: x86-android-tablets: remove support for GPIO lookup tables
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (8 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 09/11] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 11/11] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references Dmitry Torokhov
` (2 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that everything that used the lookup tables has been switched to
using property entries to describe GPIOs, we can remove support for
registering and unregistering the lookup tables.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/core.c | 8 --------
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h | 2 --
2 files changed, 10 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index b0d63d3c05cd..94942921b203 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -153,7 +153,6 @@ static struct spi_device **spi_devs;
static struct platform_device **pdevs;
static struct serdev_device **serdevs;
static struct gpio_keys_button *buttons;
-static struct gpiod_lookup_table * const *gpiod_lookup_tables;
static const struct software_node *bat_swnode;
static const struct software_node **gpiochip_node_group;
static void (*exit_handler)(void);
@@ -395,9 +394,6 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
if (gpiochip_node_group)
software_node_unregister_node_group(gpiochip_node_group);
-
- for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
- gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
}
static __init int x86_android_tablet_probe(struct platform_device *pdev)
@@ -421,10 +417,6 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
for (i = 0; dev_info->modules && dev_info->modules[i]; i++)
request_module(dev_info->modules[i]);
- gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
- for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
- gpiod_add_lookup_table(gpiod_lookup_tables[i]);
-
switch (dev_info->gpiochip_type) {
case X86_GPIOCHIP_BAYTRAIL:
gpiochip_node_group = baytrail_gpiochip_node_group;
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 a54d09408866..d037e3962a51 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -17,7 +17,6 @@
#include <linux/spi/spi.h>
struct gpio_desc;
-struct gpiod_lookup_table;
struct platform_device_info;
struct software_node;
@@ -91,7 +90,6 @@ struct x86_gpio_button {
struct x86_dev_info {
const char * const *modules;
const struct software_node *bat_swnode;
- struct gpiod_lookup_table * const *gpiod_lookup_tables;
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.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 11/11] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (9 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 10/11] platform/x86: x86-android-tablets: remove support for GPIO lookup tables Dmitry Torokhov
@ 2025-08-11 2:22 ` Dmitry Torokhov
2025-08-11 9:41 ` [PATCH v2 00/11] x86-android-tablets: convert to use " Hans de Goede
2025-09-19 19:53 ` Hans de Goede
12 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:22 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Now that gpiolib supports software nodes to describe GPIOs, switch the
driver away from using GPIO lookup tables for wm1502 devices to using
PROPERTY_ENTRY_GPIO().
With that we can remove support for gpiod_lookup_tables from the driver.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/platform/x86/x86-android-tablets/asus.c | 42 ++++---
drivers/platform/x86/x86-android-tablets/core.c | 44 +++----
drivers/platform/x86/x86-android-tablets/lenovo.c | 79 +++++++-----
drivers/platform/x86/x86-android-tablets/other.c | 138 +++++++++++++--------
.../x86/x86-android-tablets/x86-android-tablets.h | 10 +-
5 files changed, 177 insertions(+), 136 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c
index ce581d161551..91245f1bfd87 100644
--- a/drivers/platform/x86/x86-android-tablets/asus.c
+++ b/drivers/platform/x86/x86-android-tablets/asus.c
@@ -10,7 +10,7 @@
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
-#include <linux/input.h>
+#include <linux/input-event-codes.h>
#include <linux/platform_device.h>
#include "shared-psy-info.h"
@@ -31,17 +31,29 @@ static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst
},
};
-static const struct x86_gpio_button asus_me176c_tf103c_lid __initconst = {
- .button = {
- .code = SW_LID,
- .active_low = true,
- .desc = "lid_sw",
- .type = EV_SW,
- .wakeup = true,
- .debounce_interval = 50,
- },
- .chip = "INT33FC:02",
- .pin = 12,
+static const struct software_node asus_me176c_tf103c_gpio_keys_node = {
+ .name = "lid_sw",
+};
+
+static const struct property_entry asus_me176c_tf103c_lid_props[] = {
+ PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
+ PROPERTY_ENTRY_U32("linux,code", SW_LID),
+ PROPERTY_ENTRY_STRING("label", "lid_sw"),
+ PROPERTY_ENTRY_GPIO("gpios", &baytrail_gpiochip_nodes[2], 12, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ PROPERTY_ENTRY_BOOL("wakeup-source"),
+ { }
+};
+
+static const struct software_node asus_me176c_tf103c_lid_node = {
+ .parent = &asus_me176c_tf103c_gpio_keys_node,
+ .properties = asus_me176c_tf103c_lid_props,
+};
+
+static const struct software_node *asus_me176c_tf103c_lid_swnodes[] = {
+ &asus_me176c_tf103c_gpio_keys_node,
+ &asus_me176c_tf103c_lid_node,
+ NULL
};
/* Asus ME176C tablets have an Android factory image with everything hardcoded */
@@ -177,8 +189,7 @@ const struct x86_dev_info asus_me176c_info __initconst = {
.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,
+ .gpio_button_swnodes = asus_me176c_tf103c_lid_swnodes,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
@@ -301,8 +312,7 @@ const struct x86_dev_info asus_tf103c_info __initconst = {
.i2c_client_count = ARRAY_SIZE(asus_tf103c_i2c_clients),
.pdev_info = asus_me176c_tf103c_pdevs,
.pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
- .gpio_button = &asus_me176c_tf103c_lid,
- .gpio_button_count = 1,
+ .gpio_button_swnodes = asus_me176c_tf103c_lid_swnodes,
.bat_swnode = &generic_lipo_4v2_battery_node,
.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 94942921b203..232f6076aa99 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -152,7 +152,7 @@ static struct i2c_client **i2c_clients;
static struct spi_device **spi_devs;
static struct platform_device **pdevs;
static struct serdev_device **serdevs;
-static struct gpio_keys_button *buttons;
+static const struct software_node **gpio_button_swnodes;
static const struct software_node *bat_swnode;
static const struct software_node **gpiochip_node_group;
static void (*exit_handler)(void);
@@ -374,7 +374,6 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
platform_device_unregister(pdevs[i]);
kfree(pdevs);
- kfree(buttons);
for (i = spi_dev_count - 1; i >= 0; i--)
spi_unregister_device(spi_devs[i]);
@@ -389,6 +388,9 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
if (exit_handler)
exit_handler();
+ if (gpio_button_swnodes)
+ software_node_unregister_node_group(gpio_button_swnodes);
+
if (bat_swnode)
software_node_unregister(bat_swnode);
@@ -515,38 +517,22 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
}
}
- if (dev_info->gpio_button_count) {
- struct gpio_keys_platform_data pdata = { };
- struct gpio_desc *gpiod;
+ if (dev_info->gpio_button_swnodes) {
+ struct platform_device_info button_info = {
+ .name = "gpio-keys",
+ .id = PLATFORM_DEVID_AUTO,
+ };
- buttons = kcalloc(dev_info->gpio_button_count, sizeof(*buttons), GFP_KERNEL);
- if (!buttons) {
+ ret = software_node_register_node_group(dev_info->gpio_button_swnodes);
+ if (ret < 0) {
x86_android_tablet_remove(pdev);
- return -ENOMEM;
- }
-
- for (i = 0; i < dev_info->gpio_button_count; i++) {
- ret = x86_android_tablet_get_gpiod(dev_info->gpio_button[i].chip,
- dev_info->gpio_button[i].pin,
- dev_info->gpio_button[i].button.desc,
- false, GPIOD_IN, &gpiod);
- if (ret < 0) {
- x86_android_tablet_remove(pdev);
- return ret;
- }
-
- buttons[i] = dev_info->gpio_button[i].button;
- buttons[i].gpio = desc_to_gpio(gpiod);
- /* Release GPIO descriptor so that gpio-keys can request it */
- devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
+ return ret;
}
- pdata.buttons = buttons;
- pdata.nbuttons = dev_info->gpio_button_count;
+ gpio_button_swnodes = dev_info->gpio_button_swnodes;
- pdevs[pdev_count] = platform_device_register_data(&pdev->dev, "gpio-keys",
- PLATFORM_DEVID_AUTO,
- &pdata, sizeof(pdata));
+ button_info.fwnode = software_node_fwnode(dev_info->gpio_button_swnodes[0]);
+ pdevs[pdev_count] = platform_device_register_full(&button_info);
if (IS_ERR(pdevs[pdev_count])) {
ret = PTR_ERR(pdevs[pdev_count]);
x86_android_tablet_remove(pdev);
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 7c6a6fc6be42..0cee7f4f1f98 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -13,6 +13,7 @@
#include <linux/efi.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
+#include <linux/input-event-codes.h>
#include <linux/mfd/arizona/pdata.h>
#include <linux/mfd/arizona/registers.h>
#include <linux/mfd/intel_soc_pmic.h>
@@ -199,17 +200,34 @@ static const struct x86_serdev_info lenovo_yb1_x90_serdevs[] __initconst = {
},
};
-static const struct x86_gpio_button lenovo_yb1_x90_lid __initconst = {
- .button = {
- .code = SW_LID,
- .active_low = true,
- .desc = "lid_sw",
- .type = EV_SW,
- .wakeup = true,
- .debounce_interval = 50,
- },
- .chip = "INT33FF:02",
- .pin = 19,
+/*
+ * Software node attached to gpio-keys device representing the LID and
+ * serving as a parent to software nodes representing individual keys/buttons
+ * as required by the device tree binding.
+ */
+static const struct software_node lenovo_lid_gpio_keys_node = {
+ .name = "lid_sw",
+};
+
+static const struct property_entry lenovo_yb1_x90_lid_props[] = {
+ PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
+ PROPERTY_ENTRY_U32("linux,code", SW_LID),
+ PROPERTY_ENTRY_STRING("label", "lid_sw"),
+ PROPERTY_ENTRY_GPIO("gpios", &cherryview_gpiochip_nodes[2], 19, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ PROPERTY_ENTRY_BOOL("wakeup-source"),
+ { }
+};
+
+static const struct software_node lenovo_yb1_x90_lid_node = {
+ .parent = &lenovo_lid_gpio_keys_node,
+ .properties = lenovo_yb1_x90_lid_props,
+};
+
+static const struct software_node *lenovo_yb1_x90_lid_swnodes[] = {
+ &lenovo_lid_gpio_keys_node,
+ &lenovo_yb1_x90_lid_node,
+ NULL
};
static int __init lenovo_yb1_x90_init(struct device *dev)
@@ -238,8 +256,7 @@ const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
.pdev_count = ARRAY_SIZE(lenovo_yb1_x90_pdevs),
.serdev_info = lenovo_yb1_x90_serdevs,
.serdev_count = ARRAY_SIZE(lenovo_yb1_x90_serdevs),
- .gpio_button = &lenovo_yb1_x90_lid,
- .gpio_button_count = 1,
+ .gpio_button_swnodes = lenovo_yb1_x90_lid_swnodes,
.gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
.init = lenovo_yb1_x90_init,
};
@@ -276,17 +293,25 @@ static const struct software_node lenovo_yoga_tab2_830_1050_bq24190_node = {
.properties = lenovo_yoga_tab2_830_1050_bq24190_props,
};
-static const struct x86_gpio_button lenovo_yoga_tab2_830_1050_lid __initconst = {
- .button = {
- .code = SW_LID,
- .active_low = true,
- .desc = "lid_sw",
- .type = EV_SW,
- .wakeup = true,
- .debounce_interval = 50,
- },
- .chip = "INT33FC:02",
- .pin = 26,
+static const struct property_entry lenovo_yoga_tab2_830_1050_lid_props[] = {
+ PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
+ PROPERTY_ENTRY_U32("linux,code", SW_LID),
+ PROPERTY_ENTRY_STRING("label", "lid_sw"),
+ PROPERTY_ENTRY_GPIO("gpios", &baytrail_gpiochip_nodes[2], 26, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ PROPERTY_ENTRY_BOOL("wakeup-source"),
+ { }
+};
+
+static const struct software_node lenovo_yoga_tab2_830_1050_lid_node = {
+ .parent = &lenovo_lid_gpio_keys_node,
+ .properties = lenovo_yoga_tab2_830_1050_lid_props,
+};
+
+static const struct software_node *lenovo_yoga_tab2_830_1050_lid_swnodes[] = {
+ &lenovo_lid_gpio_keys_node,
+ &lenovo_yoga_tab2_830_1050_lid_node,
+ NULL
};
/* This gets filled by lenovo_yoga_tab2_830_1050_init() */
@@ -422,8 +447,7 @@ const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients),
.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,
+ .gpio_button_swnodes = lenovo_yoga_tab2_830_1050_lid_swnodes,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
@@ -785,8 +809,7 @@ const struct x86_dev_info lenovo_yoga_tab2_1380_info __initconst = {
.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_i2c_clients),
.pdev_info = lenovo_yoga_tab2_1380_pdevs,
.pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_pdevs),
- .gpio_button = &lenovo_yoga_tab2_830_1050_lid,
- .gpio_button_count = 1,
+ .gpio_button_swnodes = lenovo_yoga_tab2_830_1050_lid_swnodes,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = lenovo_yoga_tab2_1380_modules,
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 38c5e7bd88b0..8bb63546097f 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -11,7 +11,7 @@
#include <linux/acpi.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
-#include <linux/input.h>
+#include <linux/input-event-codes.h>
#include <linux/leds.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
@@ -115,22 +115,32 @@ const struct x86_dev_info acer_b1_750_info __initconst = {
* which is not described in the ACPI tables in anyway.
* Use the x86-android-tablets infra to create a gpio-keys device for this.
*/
-static const struct x86_gpio_button advantech_mica_071_button __initconst = {
- .button = {
- .code = KEY_PROG1,
- .active_low = true,
- .desc = "prog1_key",
- .type = EV_KEY,
- .wakeup = false,
- .debounce_interval = 50,
- },
- .chip = "INT33FC:00",
- .pin = 2,
+static const struct software_node advantech_mica_071_gpio_keys_node = {
+ .name = "prog1_key",
+};
+
+static const struct property_entry advantech_mica_071_prog1_key_props[] = {
+ PROPERTY_ENTRY_U32("linux,code", KEY_PROG1),
+ PROPERTY_ENTRY_STRING("label", "prog1_key"),
+ PROPERTY_ENTRY_GPIO("gpios", &baytrail_gpiochip_nodes[0], 2, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ { }
+};
+
+static const struct software_node advantech_mica_071_prog1_key_node = {
+ .parent = &advantech_mica_071_gpio_keys_node,
+ .properties = advantech_mica_071_prog1_key_props,
+};
+
+static const struct software_node *advantech_mica_071_button_swnodes[] = {
+ &advantech_mica_071_gpio_keys_node,
+ &advantech_mica_071_prog1_key_node,
+ NULL
};
const struct x86_dev_info advantech_mica_071_info __initconst = {
- .gpio_button = &advantech_mica_071_button,
- .gpio_button_count = 1,
+ .gpio_button_swnodes = advantech_mica_071_button_swnodes,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
@@ -226,36 +236,46 @@ const struct x86_dev_info chuwi_hi8_info __initconst = {
* in the button row with the power + volume-buttons labeled P and F.
* Use the x86-android-tablets infra to create a gpio-keys device for these.
*/
-static const struct x86_gpio_button cyberbook_t116_buttons[] __initconst = {
- {
- .button = {
- .code = KEY_PROG1,
- .active_low = true,
- .desc = "prog1_key",
- .type = EV_KEY,
- .wakeup = false,
- .debounce_interval = 50,
- },
- .chip = "INT33FF:00",
- .pin = 30,
- },
- {
- .button = {
- .code = KEY_PROG2,
- .active_low = true,
- .desc = "prog2_key",
- .type = EV_KEY,
- .wakeup = false,
- .debounce_interval = 50,
- },
- .chip = "INT33FF:03",
- .pin = 48,
- },
+static const struct software_node cyberbook_t116_gpio_keys_node = {
+ .name = "prog_keys",
+};
+
+static const struct property_entry cyberbook_t116_prog1_key_props[] = {
+ PROPERTY_ENTRY_U32("linux,code", KEY_PROG1),
+ PROPERTY_ENTRY_STRING("label", "prog1_key"),
+ PROPERTY_ENTRY_GPIO("gpios", &cherryview_gpiochip_nodes[0], 30, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ { }
+};
+
+static const struct software_node cyberbook_t116_prog1_key_node = {
+ .parent = &cyberbook_t116_gpio_keys_node,
+ .properties = cyberbook_t116_prog1_key_props,
+};
+
+static const struct property_entry cyberbook_t116_prog2_key_props[] = {
+ PROPERTY_ENTRY_U32("linux,code", KEY_PROG2),
+ PROPERTY_ENTRY_STRING("label", "prog2_key"),
+ PROPERTY_ENTRY_GPIO("gpios", &cherryview_gpiochip_nodes[3], 48, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ { }
+};
+
+static const struct software_node cyberbook_t116_prog2_key_node = {
+ .parent = &cyberbook_t116_gpio_keys_node,
+ .properties = cyberbook_t116_prog2_key_props,
+};
+
+static const struct software_node *cyberbook_t116_buttons_swnodes[] = {
+ &cyberbook_t116_gpio_keys_node,
+ &cyberbook_t116_prog1_key_node,
+ &cyberbook_t116_prog2_key_node,
+ NULL
};
const struct x86_dev_info cyberbook_t116_info __initconst = {
- .gpio_button = cyberbook_t116_buttons,
- .gpio_button_count = ARRAY_SIZE(cyberbook_t116_buttons),
+ .gpio_button_swnodes = cyberbook_t116_buttons_swnodes,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
};
#define CZC_EC_EXTRA_PORT 0x68
@@ -495,22 +515,32 @@ const struct x86_dev_info nextbook_ares8a_info __initconst = {
* This button has a WMI interface, but that is broken. Instead of trying to
* use the broken WMI interface, instantiate a gpio-keys device for this.
*/
-static const struct x86_gpio_button peaq_c1010_button __initconst = {
- .button = {
- .code = KEY_SOUND,
- .active_low = true,
- .desc = "dolby_key",
- .type = EV_KEY,
- .wakeup = false,
- .debounce_interval = 50,
- },
- .chip = "INT33FC:00",
- .pin = 3,
+static const struct software_node peaq_c1010_gpio_keys_node = {
+ .name = "gpio_keys",
+};
+
+static const struct property_entry peaq_c1010_dolby_key_props[] = {
+ PROPERTY_ENTRY_U32("linux,code", KEY_SOUND),
+ PROPERTY_ENTRY_STRING("label", "dolby_key"),
+ PROPERTY_ENTRY_GPIO("gpios", &baytrail_gpiochip_nodes[0], 3, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_U32("debounce-interval", 50),
+ { }
+};
+
+static const struct software_node peaq_c1010_dolby_key_node = {
+ .parent = &peaq_c1010_gpio_keys_node,
+ .properties = peaq_c1010_dolby_key_props,
+};
+
+static const struct software_node *peaq_c1010_button_swnodes[] = {
+ &peaq_c1010_gpio_keys_node,
+ &peaq_c1010_dolby_key_node,
+ NULL
};
const struct x86_dev_info peaq_c1010_info __initconst = {
- .gpio_button = &peaq_c1010_button,
- .gpio_button_count = 1,
+ .gpio_button_swnodes = peaq_c1010_button_swnodes,
+ .gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
};
/*
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 d037e3962a51..f4a67a9b74ea 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -11,7 +11,6 @@
#define __PDX86_X86_ANDROID_TABLETS_H
#include <linux/gpio/consumer.h>
-#include <linux/gpio_keys.h>
#include <linux/i2c.h>
#include <linux/irqdomain_defs.h>
#include <linux/spi/spi.h>
@@ -81,12 +80,6 @@ struct x86_serdev_info {
const char *serdev_hid;
};
-struct x86_gpio_button {
- struct gpio_keys_button button;
- const char *chip;
- int pin;
-};
-
struct x86_dev_info {
const char * const *modules;
const struct software_node *bat_swnode;
@@ -94,12 +87,11 @@ struct x86_dev_info {
const struct x86_spi_dev_info *spi_dev_info;
const struct platform_device_info *pdev_info;
const struct x86_serdev_info *serdev_info;
- const struct x86_gpio_button *gpio_button;
+ const struct software_node **gpio_button_swnodes;
int i2c_client_count;
int spi_dev_count;
int pdev_count;
int serdev_count;
- int gpio_button_count;
int (*init)(struct device *dev);
void (*exit)(void);
bool use_pci;
--
2.51.0.rc0.155.g4a0f42376b-goog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (10 preceding siblings ...)
2025-08-11 2:22 ` [PATCH v2 11/11] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references Dmitry Torokhov
@ 2025-08-11 9:41 ` Hans de Goede
2025-08-11 16:03 ` Dmitry Torokhov
2025-09-19 19:53 ` Hans de Goede
12 siblings, 1 reply; 20+ messages in thread
From: Hans de Goede @ 2025-08-11 9:41 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi Dmitry,
On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> This series came about because now software nodes can be used to
> describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
> eventually get rid of gpio_keys_platform_data structure.
>
> So while I was doing the conversions from GPIO_LOOKUP() tables for
> gpio_keys devices I decided to convert the rest of them as well. Maybe
> some time in the future we can drop support for GPIO_LOOKUP() and rely
> on device properties exclusively.
>
> This is completely untested.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> Changes in v2:
> - Reworked on top of the current linux-next
> - Link to v1: https://lore.kernel.org/r/20230512001815.591817-1-dmitry.torokhov@gmail.com
Thanks this is an interesting series. I don't know why I missed / dropped
the ball on v1.
It will be a while before I can get around to this due to travel, but
I'll take a look and either provide a Tested-by or fixup any issues
I encounter and then post a fixed v3 myself.
Regards,
Hans
>
> ---
> Dmitry Torokhov (11):
> platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
> platform/x86: x86-android-tablets: convert Wacom devices to GPIO references
> platform/x86: x86-android-tablets: convert HiDeep devices to GPIO references
> platform/x86: x86-android-tablets: convert Novatek devices to GPIO references
> platform/x86: x86-android-tablets: convert EDT devices to GPIO references
> platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
> platform/x86: x86-android-tablets: convert wm1502 devices to GPIO references
> platform/x86: x86-android-tablets: convert HID-I2C devices to GPIO references
> platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
> platform/x86: x86-android-tablets: remove support for GPIO lookup tables
> platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references
>
> drivers/platform/x86/x86-android-tablets/asus.c | 102 ++++----
> drivers/platform/x86/x86-android-tablets/core.c | 109 +++++---
> drivers/platform/x86/x86-android-tablets/lenovo.c | 279 +++++++++++---------
> drivers/platform/x86/x86-android-tablets/other.c | 289 ++++++++++-----------
> .../x86/x86-android-tablets/shared-psy-info.c | 20 --
> .../x86/x86-android-tablets/shared-psy-info.h | 5 -
> .../x86/x86-android-tablets/x86-android-tablets.h | 23 +-
> 7 files changed, 436 insertions(+), 391 deletions(-)
> ---
> base-commit: b1549501188cc9eba732c25b033df7a53ccc341f
> change-id: 20250810-x86-andoroid-tablet-df93908b426b
>
> Best regards,
> --
> Dmitry
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
2025-08-11 2:22 ` [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
@ 2025-08-11 10:09 ` Hans de Goede
2025-08-11 16:01 ` Dmitry Torokhov
0 siblings, 1 reply; 20+ messages in thread
From: Hans de Goede @ 2025-08-11 10:09 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi,
On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> Now that gpiolib supports software nodes to describe GPIOs, switch the
> driver away from using GPIO lookup tables for Goodix touchscreens to
> using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
>
> Since the tablets are using either Baytrail or Cherryview GPIO
> controllers x86_dev_info structure has been extended to carry gpiochip
> type information so that the code can instantiate correct set of
> software nodes representing the GPIO chip.
>
> Because this adds a new point of failure in x86_android_tablet_probe(),
> x86_android_tablet_remove() is rearranged to handle cases where battery
> swnode has not been registered yet, and registering of GPIO lookup
> tables is moved earlier as it can not fail.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks.
So I was curious and took a quick peek at the code, mainly at
the core changes.
...
> diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
> index 2a9c47178505..b0d63d3c05cd 100644
> --- a/drivers/platform/x86/x86-android-tablets/core.c
> +++ b/drivers/platform/x86/x86-android-tablets/core.c
> @@ -155,6 +155,7 @@ static struct serdev_device **serdevs;
> static struct gpio_keys_button *buttons;
> static struct gpiod_lookup_table * const *gpiod_lookup_tables;
> static const struct software_node *bat_swnode;
> +static const struct software_node **gpiochip_node_group;
> static void (*exit_handler)(void);
>
> static __init struct i2c_adapter *
> @@ -331,6 +332,34 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
> return ret;
> }
>
> +const struct software_node baytrail_gpiochip_nodes[] = {
> + { .name = "INT33FC:00" },
> + { .name = "INT33FC:01" },
> + { .name = "INT33FC:02" },
> +};
I'm afraid that just setting the names here, and then
registering the node group below is not enough, see
the comment below.
> +
> +static const struct software_node *baytrail_gpiochip_node_group[] = {
> + &baytrail_gpiochip_nodes[0],
> + &baytrail_gpiochip_nodes[1],
> + &baytrail_gpiochip_nodes[2],
> + NULL
> +};
...
> @@ -361,10 +390,14 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
> if (exit_handler)
> exit_handler();
>
> + if (bat_swnode)
> + software_node_unregister(bat_swnode);
> +
> + if (gpiochip_node_group)
> + software_node_unregister_node_group(gpiochip_node_group);
> +
> for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
> -
> - software_node_unregister(bat_swnode);
> }
>
> static __init int x86_android_tablet_probe(struct platform_device *pdev)
> @@ -388,16 +421,36 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
> for (i = 0; dev_info->modules && dev_info->modules[i]; i++)
> request_module(dev_info->modules[i]);
>
> - bat_swnode = dev_info->bat_swnode;
> - if (bat_swnode) {
> - ret = software_node_register(bat_swnode);
> + gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
> + for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> + gpiod_add_lookup_table(gpiod_lookup_tables[i]);
> +
> + switch (dev_info->gpiochip_type) {
> + case X86_GPIOCHIP_BAYTRAIL:
> + gpiochip_node_group = baytrail_gpiochip_node_group;
> + break;
> + case X86_GPIOCHIP_CHERRYVIEW:
> + gpiochip_node_group = cherryview_gpiochip_node_group;
> + break;
> + case X86_GPIOCHIP_UNSPECIFIED:
> + gpiochip_node_group = NULL;
> + break;
> + }
> +
> + if (gpiochip_node_group) {
> + ret = software_node_register_node_group(gpiochip_node_group);
> if (ret)
> return ret;
> }
As mentioned above just registering the node group here is not enough,
the nodes need to actually be assigned to the platform-devices which
are the parents of the GPIO controller, something like this from
a recent patch of mine which is not upstream yet:
static int __init acer_a1_840_init(struct device *dev)
{
int ret;
acer_a1_840_fg_dev = bus_find_device_by_name(&platform_bus_type, NULL, "chtdc_ti_batterry");
if (!acer_a1_840_fg_dev)
return dev_err_probe(dev, -EPROBE_DEFER, "getting chtdc_ti_battery dev\n");
acer_a1_840_fg_node = fwnode_create_software_node(acer_a1_840_fg_props, NULL);
if (IS_ERR(acer_a1_840_fg_node)) {
ret = PTR_ERR(acer_a1_840_fg_node);
goto err_put;
}
ret = device_add_software_node(acer_a1_840_fg_dev,
to_software_node(acer_a1_840_fg_node));
if (ret)
goto err_put;
Except that this will only work if the GPIO controller gets probed()
after assigning the swnodes. Otherwise the GPIO controller itself will
not have the fwnode_handle inside struct gpio_chip set ...
Oh wait, that fwnode will already be set, it will point to the ACPI
fwnode. So setting the swnode on the platform device will likely work,
because that will be assigned to fwnode_handle->secondary and
the fwnode_handle pointer is shared between the platform-device
and the gpiochip, so adding the software_node to the platform-device
will also set fwnode_handle->secondary for the gpiochio (as it is
the same fwnode_handle).
So thinking more about it calling device_add_software_node() on
the GPIO controller parent platform-device doing something like\
the above should work ...
But only calling software_node_register_node_group() definitely
is not enough.
Regards,
Hans
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
2025-08-11 10:09 ` Hans de Goede
@ 2025-08-11 16:01 ` Dmitry Torokhov
2025-08-11 17:45 ` Hans de Goede
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 16:01 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi Hans,
On Mon, Aug 11, 2025 at 12:09:18PM +0200, Hans de Goede wrote:
> Hi,
>
> On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> > Now that gpiolib supports software nodes to describe GPIOs, switch the
> > driver away from using GPIO lookup tables for Goodix touchscreens to
> > using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
> >
> > Since the tablets are using either Baytrail or Cherryview GPIO
> > controllers x86_dev_info structure has been extended to carry gpiochip
> > type information so that the code can instantiate correct set of
> > software nodes representing the GPIO chip.
> >
> > Because this adds a new point of failure in x86_android_tablet_probe(),
> > x86_android_tablet_remove() is rearranged to handle cases where battery
> > swnode has not been registered yet, and registering of GPIO lookup
> > tables is moved earlier as it can not fail.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> Thanks.
>
> So I was curious and took a quick peek at the code, mainly at
> the core changes.
>
> ...
>
> > diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
> > index 2a9c47178505..b0d63d3c05cd 100644
> > --- a/drivers/platform/x86/x86-android-tablets/core.c
> > +++ b/drivers/platform/x86/x86-android-tablets/core.c
> > @@ -155,6 +155,7 @@ static struct serdev_device **serdevs;
> > static struct gpio_keys_button *buttons;
> > static struct gpiod_lookup_table * const *gpiod_lookup_tables;
> > static const struct software_node *bat_swnode;
> > +static const struct software_node **gpiochip_node_group;
> > static void (*exit_handler)(void);
> >
> > static __init struct i2c_adapter *
> > @@ -331,6 +332,34 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
> > return ret;
> > }
> >
> > +const struct software_node baytrail_gpiochip_nodes[] = {
> > + { .name = "INT33FC:00" },
> > + { .name = "INT33FC:01" },
> > + { .name = "INT33FC:02" },
> > +};
>
> I'm afraid that just setting the names here, and then
> registering the node group below is not enough, see
> the comment below.
Please see explanation below why it actually is enough.
>
>
> > +
> > +static const struct software_node *baytrail_gpiochip_node_group[] = {
> > + &baytrail_gpiochip_nodes[0],
> > + &baytrail_gpiochip_nodes[1],
> > + &baytrail_gpiochip_nodes[2],
> > + NULL
> > +};
>
> ...
>
> > @@ -361,10 +390,14 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
> > if (exit_handler)
> > exit_handler();
> >
> > + if (bat_swnode)
> > + software_node_unregister(bat_swnode);
> > +
> > + if (gpiochip_node_group)
> > + software_node_unregister_node_group(gpiochip_node_group);
> > +
> > for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> > gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
> > -
> > - software_node_unregister(bat_swnode);
> > }
> >
> > static __init int x86_android_tablet_probe(struct platform_device *pdev)
> > @@ -388,16 +421,36 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
> > for (i = 0; dev_info->modules && dev_info->modules[i]; i++)
> > request_module(dev_info->modules[i]);
> >
> > - bat_swnode = dev_info->bat_swnode;
> > - if (bat_swnode) {
> > - ret = software_node_register(bat_swnode);
> > + gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
> > + for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> > + gpiod_add_lookup_table(gpiod_lookup_tables[i]);
> > +
> > + switch (dev_info->gpiochip_type) {
> > + case X86_GPIOCHIP_BAYTRAIL:
> > + gpiochip_node_group = baytrail_gpiochip_node_group;
> > + break;
> > + case X86_GPIOCHIP_CHERRYVIEW:
> > + gpiochip_node_group = cherryview_gpiochip_node_group;
> > + break;
> > + case X86_GPIOCHIP_UNSPECIFIED:
> > + gpiochip_node_group = NULL;
> > + break;
> > + }
> > +
> > + if (gpiochip_node_group) {
> > + ret = software_node_register_node_group(gpiochip_node_group);
> > if (ret)
> > return ret;
> > }
>
> As mentioned above just registering the node group here is not enough,
> the nodes need to actually be assigned to the platform-devices which
> are the parents of the GPIO controller, something like this from
> a recent patch of mine which is not upstream yet:
No, I'm afraid you misunderstand how software nodes for GPIOs work.
If you look into drivers/gpio/gpiolib-swnode.c, in particular at
swnode_get_gpio_device(), is uses the name from the software node to
match with the name of registered gpiochip to locate it. The node itself
does not need to be attached to the gpiochip or it's parent device, it
is simply there to establish a link between GPIO reference
(SOFTWARE_NODE_REFEREMCE) and gpiochip structure.
So PROPERTY_ENTRY_GPIO is pretty much PROPERTY_ENTRY_REF which is:
#define PROPERTY_ENTRY_REF(_name_, _ref_, ...) \
(struct property_entry) { \
.name = _name_, \
.length = sizeof(struct software_node_ref_args), \
.type = DEV_PROP_REF, \
{ .pointer = &SOFTWARE_NODE_REFERENCE(_ref_, ##__VA_ARGS__), }, \
}
and SOFTWARE_NODE_REFERENCE is
#define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
(const struct software_node_ref_args) { \
.node = _ref_, \
.nargs = COUNT_ARGS(__VA_ARGS__), \
.args = { __VA_ARGS__ }, \
}
swnode_find_gpio() scans these entries looking for the matching name,
and then resolves the references by taking the _ref_ software node,
using its name and doing:
gdev = gpio_device_find_by_label(gdev_node->name);
Where gdev_node is that potentially unattached software node and name is
"INT33FC:00" or whatever.
>
> static int __init acer_a1_840_init(struct device *dev)
> {
> int ret;
>
> acer_a1_840_fg_dev = bus_find_device_by_name(&platform_bus_type, NULL, "chtdc_ti_batterry");
> if (!acer_a1_840_fg_dev)
> return dev_err_probe(dev, -EPROBE_DEFER, "getting chtdc_ti_battery dev\n");
>
> acer_a1_840_fg_node = fwnode_create_software_node(acer_a1_840_fg_props, NULL);
> if (IS_ERR(acer_a1_840_fg_node)) {
> ret = PTR_ERR(acer_a1_840_fg_node);
> goto err_put;
> }
>
> ret = device_add_software_node(acer_a1_840_fg_dev,
> to_software_node(acer_a1_840_fg_node));
> if (ret)
> goto err_put;
>
> Except that this will only work if the GPIO controller gets probed()
> after assigning the swnodes. Otherwise the GPIO controller itself will
> not have the fwnode_handle inside struct gpio_chip set ...
>
> Oh wait, that fwnode will already be set, it will point to the ACPI
> fwnode. So setting the swnode on the platform device will likely work,
> because that will be assigned to fwnode_handle->secondary and
> the fwnode_handle pointer is shared between the platform-device
> and the gpiochip, so adding the software_node to the platform-device
> will also set fwnode_handle->secondary for the gpiochio (as it is
> the same fwnode_handle).
>
> So thinking more about it calling device_add_software_node() on
> the GPIO controller parent platform-device doing something like\
> the above should work ...
>
> But only calling software_node_register_node_group() definitely
> is not enough.
Yes, it actually is.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
2025-08-11 9:41 ` [PATCH v2 00/11] x86-android-tablets: convert to use " Hans de Goede
@ 2025-08-11 16:03 ` Dmitry Torokhov
0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 16:03 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi Hans,
On Mon, Aug 11, 2025 at 11:41:46AM +0200, Hans de Goede wrote:
> Hi Dmitry,
>
> On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> > This series came about because now software nodes can be used to
> > describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
> > eventually get rid of gpio_keys_platform_data structure.
> >
> > So while I was doing the conversions from GPIO_LOOKUP() tables for
> > gpio_keys devices I decided to convert the rest of them as well. Maybe
> > some time in the future we can drop support for GPIO_LOOKUP() and rely
> > on device properties exclusively.
> >
> > This is completely untested.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> > Changes in v2:
> > - Reworked on top of the current linux-next
> > - Link to v1: https://lore.kernel.org/r/20230512001815.591817-1-dmitry.torokhov@gmail.com
>
> Thanks this is an interesting series. I don't know why I missed / dropped
> the ball on v1.
It's actually on me: I sent it as you were reworking/adding more devices
to the driver and I was supposed to update the series but did not have
time.
>
> It will be a while before I can get around to this due to travel, but
> I'll take a look and either provide a Tested-by or fixup any issues
> I encounter and then post a fixed v3 myself.
Thanks!
--
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
2025-08-11 16:01 ` Dmitry Torokhov
@ 2025-08-11 17:45 ` Hans de Goede
0 siblings, 0 replies; 20+ messages in thread
From: Hans de Goede @ 2025-08-11 17:45 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi,
On 11-Aug-25 6:01 PM, Dmitry Torokhov wrote:
> Hi Hans,
>
> On Mon, Aug 11, 2025 at 12:09:18PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
>>> Now that gpiolib supports software nodes to describe GPIOs, switch the
>>> driver away from using GPIO lookup tables for Goodix touchscreens to
>>> using PROPERTY_ENTRY_GPIO() to keep all touchscreen properties together.
>>>
>>> Since the tablets are using either Baytrail or Cherryview GPIO
>>> controllers x86_dev_info structure has been extended to carry gpiochip
>>> type information so that the code can instantiate correct set of
>>> software nodes representing the GPIO chip.
>>>
>>> Because this adds a new point of failure in x86_android_tablet_probe(),
>>> x86_android_tablet_remove() is rearranged to handle cases where battery
>>> swnode has not been registered yet, and registering of GPIO lookup
>>> tables is moved earlier as it can not fail.
>>>
>>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>
>> Thanks.
>>
>> So I was curious and took a quick peek at the code, mainly at
>> the core changes.
>>
>> ...
>>
>>> diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
>>> index 2a9c47178505..b0d63d3c05cd 100644
>>> --- a/drivers/platform/x86/x86-android-tablets/core.c
>>> +++ b/drivers/platform/x86/x86-android-tablets/core.c
>>> @@ -155,6 +155,7 @@ static struct serdev_device **serdevs;
>>> static struct gpio_keys_button *buttons;
>>> static struct gpiod_lookup_table * const *gpiod_lookup_tables;
>>> static const struct software_node *bat_swnode;
>>> +static const struct software_node **gpiochip_node_group;
>>> static void (*exit_handler)(void);
>>>
>>> static __init struct i2c_adapter *
>>> @@ -331,6 +332,34 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
>>> return ret;
>>> }
>>>
>>> +const struct software_node baytrail_gpiochip_nodes[] = {
>>> + { .name = "INT33FC:00" },
>>> + { .name = "INT33FC:01" },
>>> + { .name = "INT33FC:02" },
>>> +};
>>
>> I'm afraid that just setting the names here, and then
>> registering the node group below is not enough, see
>> the comment below.
>
> Please see explanation below why it actually is enough.
>
>>
>>
>>> +
>>> +static const struct software_node *baytrail_gpiochip_node_group[] = {
>>> + &baytrail_gpiochip_nodes[0],
>>> + &baytrail_gpiochip_nodes[1],
>>> + &baytrail_gpiochip_nodes[2],
>>> + NULL
>>> +};
>>
>> ...
>>
>>> @@ -361,10 +390,14 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
>>> if (exit_handler)
>>> exit_handler();
>>>
>>> + if (bat_swnode)
>>> + software_node_unregister(bat_swnode);
>>> +
>>> + if (gpiochip_node_group)
>>> + software_node_unregister_node_group(gpiochip_node_group);
>>> +
>>> for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
>>> gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
>>> -
>>> - software_node_unregister(bat_swnode);
>>> }
>>>
>>> static __init int x86_android_tablet_probe(struct platform_device *pdev)
>>> @@ -388,16 +421,36 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
>>> for (i = 0; dev_info->modules && dev_info->modules[i]; i++)
>>> request_module(dev_info->modules[i]);
>>>
>>> - bat_swnode = dev_info->bat_swnode;
>>> - if (bat_swnode) {
>>> - ret = software_node_register(bat_swnode);
>>> + gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
>>> + for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
>>> + gpiod_add_lookup_table(gpiod_lookup_tables[i]);
>>> +
>>> + switch (dev_info->gpiochip_type) {
>>> + case X86_GPIOCHIP_BAYTRAIL:
>>> + gpiochip_node_group = baytrail_gpiochip_node_group;
>>> + break;
>>> + case X86_GPIOCHIP_CHERRYVIEW:
>>> + gpiochip_node_group = cherryview_gpiochip_node_group;
>>> + break;
>>> + case X86_GPIOCHIP_UNSPECIFIED:
>>> + gpiochip_node_group = NULL;
>>> + break;
>>> + }
>>> +
>>> + if (gpiochip_node_group) {
>>> + ret = software_node_register_node_group(gpiochip_node_group);
>>> if (ret)
>>> return ret;
>>> }
>>
>> As mentioned above just registering the node group here is not enough,
>> the nodes need to actually be assigned to the platform-devices which
>> are the parents of the GPIO controller, something like this from
>> a recent patch of mine which is not upstream yet:
>
> No, I'm afraid you misunderstand how software nodes for GPIOs work.
<snip>
Ack. I've already replied to the same remark in the
"[PATCH] platform/x86: barco-p50-gpio: use software nodes for gpio-leds/keys"
thread.
Lets continue discussing this there.
Regards,
Hans
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
` (11 preceding siblings ...)
2025-08-11 9:41 ` [PATCH v2 00/11] x86-android-tablets: convert to use " Hans de Goede
@ 2025-09-19 19:53 ` Hans de Goede
2025-09-19 21:21 ` Dmitry Torokhov
12 siblings, 1 reply; 20+ messages in thread
From: Hans de Goede @ 2025-09-19 19:53 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi,
On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> This series came about because now software nodes can be used to
> describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
> eventually get rid of gpio_keys_platform_data structure.
>
> So while I was doing the conversions from GPIO_LOOKUP() tables for
> gpio_keys devices I decided to convert the rest of them as well. Maybe
> some time in the future we can drop support for GPIO_LOOKUP() and rely
> on device properties exclusively.
>
> This is completely untested.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thank you for this series. While reviewing this I've found
a couple of issues. I've fixed these in my own tree and
I'll send out a v3 with this fixed + some extra patches.
The issues which I've found and fixed are:
- lenovo_yoga_tab2_830_1050_init_codec() is missing a pinctrl_put()
in error-exit paths after the pinctrl_get_select() succeeds
- Adding a swnode to the yt3 spi device changes the name of the SPI/codec
device and the sound/soc/intel/boards/bytcr_wm5102.c machine driver looks
up the code by name, update the machine driver to use the new name.
- In the "convert Yoga Tab2 fast charger to GPIO references" references
the fwnode is added to the wrong device. The node should be added to
the "serial0-0" device but that gets instantiated by
drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
I've made yoga-tab2-pro-1380-fastcharger.c propagate the fwnode set on
the platform-device to the serdev it creates to fix this.
- Fix the commit message of "platform/x86: x86-android-tablets: convert
gpio_keys devices to GPIO references" which contained a stray reference
to wm5102.
I've also added some follow-up patches with some cleanups, see the v3
cover-letter for details.
I'll also add a rebased version of my patches to add support for
the Acer A1-840 tablet to v3, now using software-nodes for the GPIOs.
Regards,
Hans
> ---
> Changes in v2:
> - Reworked on top of the current linux-next
> - Link to v1: https://lore.kernel.org/r/20230512001815.591817-1-dmitry.torokhov@gmail.com
>
> ---
> Dmitry Torokhov (11):
> platform/x86: x86-android-tablets: convert Goodix devices to GPIO references
> platform/x86: x86-android-tablets: convert Wacom devices to GPIO references
> platform/x86: x86-android-tablets: convert HiDeep devices to GPIO references
> platform/x86: x86-android-tablets: convert Novatek devices to GPIO references
> platform/x86: x86-android-tablets: convert EDT devices to GPIO references
> platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
> platform/x86: x86-android-tablets: convert wm1502 devices to GPIO references
> platform/x86: x86-android-tablets: convert HID-I2C devices to GPIO references
> platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
> platform/x86: x86-android-tablets: remove support for GPIO lookup tables
> platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references
>
> drivers/platform/x86/x86-android-tablets/asus.c | 102 ++++----
> drivers/platform/x86/x86-android-tablets/core.c | 109 +++++---
> drivers/platform/x86/x86-android-tablets/lenovo.c | 279 +++++++++++---------
> drivers/platform/x86/x86-android-tablets/other.c | 289 ++++++++++-----------
> .../x86/x86-android-tablets/shared-psy-info.c | 20 --
> .../x86/x86-android-tablets/shared-psy-info.h | 5 -
> .../x86/x86-android-tablets/x86-android-tablets.h | 23 +-
> 7 files changed, 436 insertions(+), 391 deletions(-)
> ---
> base-commit: b1549501188cc9eba732c25b033df7a53ccc341f
> change-id: 20250810-x86-andoroid-tablet-df93908b426b
>
> Best regards,
> --
> Dmitry
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
2025-09-19 19:53 ` Hans de Goede
@ 2025-09-19 21:21 ` Dmitry Torokhov
2025-09-20 12:53 ` Hans de Goede
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2025-09-19 21:21 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi Hans,
On Fri, Sep 19, 2025 at 09:53:53PM +0200, Hans de Goede wrote:
> Hi,
>
> On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
> > This series came about because now software nodes can be used to
> > describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
> > eventually get rid of gpio_keys_platform_data structure.
> >
> > So while I was doing the conversions from GPIO_LOOKUP() tables for
> > gpio_keys devices I decided to convert the rest of them as well. Maybe
> > some time in the future we can drop support for GPIO_LOOKUP() and rely
> > on device properties exclusively.
> >
> > This is completely untested.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> Thank you for this series. While reviewing this I've found
> a couple of issues. I've fixed these in my own tree and
> I'll send out a v3 with this fixed + some extra patches.
>
> The issues which I've found and fixed are:
>
> - lenovo_yoga_tab2_830_1050_init_codec() is missing a pinctrl_put()
> in error-exit paths after the pinctrl_get_select() succeeds
>
> - Adding a swnode to the yt3 spi device changes the name of the SPI/codec
> device and the sound/soc/intel/boards/bytcr_wm5102.c machine driver looks
> up the code by name, update the machine driver to use the new name.
>
> - In the "convert Yoga Tab2 fast charger to GPIO references" references
> the fwnode is added to the wrong device. The node should be added to
> the "serial0-0" device but that gets instantiated by
> drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
> I've made yoga-tab2-pro-1380-fastcharger.c propagate the fwnode set on
> the platform-device to the serdev it creates to fix this.
>
> - Fix the commit message of "platform/x86: x86-android-tablets: convert
> gpio_keys devices to GPIO references" which contained a stray reference
> to wm5102.
Thank you Hans for looking over the series and fixing up all the issues
that I introduced.
>
> I've also added some follow-up patches with some cleanups, see the v3
> cover-letter for details.
I've reviewed ones that I felt comfortable reviewing, thanks again.
--
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references
2025-09-19 21:21 ` Dmitry Torokhov
@ 2025-09-20 12:53 ` Hans de Goede
0 siblings, 0 replies; 20+ messages in thread
From: Hans de Goede @ 2025-09-20 12:53 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ilpo Järvinen, Arnd Bergmann, Andy Shevchenko,
platform-driver-x86, linux-kernel
Hi Dmitry,
On 19-Sep-25 11:21 PM, Dmitry Torokhov wrote:
> Hi Hans,
>
> On Fri, Sep 19, 2025 at 09:53:53PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 11-Aug-25 4:22 AM, Dmitry Torokhov wrote:
>>> This series came about because now software nodes can be used to
>>> describe GPIOs (via PROPERTY_ENTRY_GPIO() macros) and I would like to
>>> eventually get rid of gpio_keys_platform_data structure.
>>>
>>> So while I was doing the conversions from GPIO_LOOKUP() tables for
>>> gpio_keys devices I decided to convert the rest of them as well. Maybe
>>> some time in the future we can drop support for GPIO_LOOKUP() and rely
>>> on device properties exclusively.
>>>
>>> This is completely untested.
>>>
>>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>
>> Thank you for this series. While reviewing this I've found
>> a couple of issues. I've fixed these in my own tree and
>> I'll send out a v3 with this fixed + some extra patches.
>>
>> The issues which I've found and fixed are:
>>
>> - lenovo_yoga_tab2_830_1050_init_codec() is missing a pinctrl_put()
>> in error-exit paths after the pinctrl_get_select() succeeds
>>
>> - Adding a swnode to the yt3 spi device changes the name of the SPI/codec
>> device and the sound/soc/intel/boards/bytcr_wm5102.c machine driver looks
>> up the code by name, update the machine driver to use the new name.
>>
>> - In the "convert Yoga Tab2 fast charger to GPIO references" references
>> the fwnode is added to the wrong device. The node should be added to
>> the "serial0-0" device but that gets instantiated by
>> drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
>> I've made yoga-tab2-pro-1380-fastcharger.c propagate the fwnode set on
>> the platform-device to the serdev it creates to fix this.
>>
>> - Fix the commit message of "platform/x86: x86-android-tablets: convert
>> gpio_keys devices to GPIO references" which contained a stray reference
>> to wm5102.
>
> Thank you Hans for looking over the series and fixing up all the issues
> that I introduced.
You're welcome and thank you for the reviews on the new patches.
Regards,
Hans
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2025-09-20 12:53 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 2:22 [PATCH v2 00/11] x86-android-tablets: convert to use GPIO references Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 01/11] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
2025-08-11 10:09 ` Hans de Goede
2025-08-11 16:01 ` Dmitry Torokhov
2025-08-11 17:45 ` Hans de Goede
2025-08-11 2:22 ` [PATCH v2 02/11] platform/x86: x86-android-tablets: convert Wacom " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 03/11] platform/x86: x86-android-tablets: convert HiDeep " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 04/11] platform/x86: x86-android-tablets: convert Novatek " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 05/11] platform/x86: x86-android-tablets: convert EDT " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 06/11] platform/x86: x86-android-tablets: convert int3496 " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 07/11] platform/x86: x86-android-tablets: convert wm1502 " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 08/11] platform/x86: x86-android-tablets: convert HID-I2C " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 09/11] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 10/11] platform/x86: x86-android-tablets: remove support for GPIO lookup tables Dmitry Torokhov
2025-08-11 2:22 ` [PATCH v2 11/11] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references Dmitry Torokhov
2025-08-11 9:41 ` [PATCH v2 00/11] x86-android-tablets: convert to use " Hans de Goede
2025-08-11 16:03 ` Dmitry Torokhov
2025-09-19 19:53 ` Hans de Goede
2025-09-19 21:21 ` Dmitry Torokhov
2025-09-20 12:53 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox