summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-09-11 23:09:28 +0200
committerHans de Goede <hdegoede@redhat.com>2023-09-12 10:16:25 +0200
commiteee9cd5d25f1be6120fdf1c90c81324d22b4cc49 (patch)
tree3cf4fb84c31f9bc4f2012949aeac5239c0a7327d /drivers
parent9578db7939fcfa0bdfa6ab767fd0386adf2302eb (diff)
platform/x86: x86-android-tablets: Add a comment about x86_android_tablet_get_gpiod()
Add a comment explaining why the special x86_android_tablet_get_gpiod() helper is necessary for some of the GPIOs used in the x86-android-tablets; and that for normal GPIO lookups this example should not be followed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20230911210928.264908-1-hdegoede@redhat.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/x86-android-tablets/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 8a1f22aaac00..b55957bde034 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -24,6 +24,21 @@
static struct platform_device *x86_android_tablet_device;
+/*
+ * This helper allows getting a gpio_desc *before* the actual device consuming
+ * the GPIO has been instantiated. This function _must_ only be used to handle
+ * this special case such as e.g. :
+ *
+ * 1. Getting an IRQ from a GPIO for i2c_board_info.irq which is passed to
+ * i2c_client_new() to instantiate i2c_client-s; or
+ * 2. Calling desc_to_gpio() to get an old style GPIO number for gpio_keys
+ * platform_data which still uses old style GPIO numbers.
+ *
+ * Since the consuming device has not been instatiated yet a dynamic lookup
+ * is generated using the special x86_android_tablet dev for dev_id.
+ *
+ * For normal GPIO lookups a standard static gpiod_lookup_table _must_ be used.
+ */
int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
bool active_low, enum gpiod_flags dflags,
struct gpio_desc **desc)