Skip to content

Commit eee9cd5

Browse files
committed
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
1 parent 9578db7 commit eee9cd5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • drivers/platform/x86/x86-android-tablets

drivers/platform/x86/x86-android-tablets/core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@
2424

2525
static struct platform_device *x86_android_tablet_device;
2626

27+
/*
28+
* This helper allows getting a gpio_desc *before* the actual device consuming
29+
* the GPIO has been instantiated. This function _must_ only be used to handle
30+
* this special case such as e.g. :
31+
*
32+
* 1. Getting an IRQ from a GPIO for i2c_board_info.irq which is passed to
33+
* i2c_client_new() to instantiate i2c_client-s; or
34+
* 2. Calling desc_to_gpio() to get an old style GPIO number for gpio_keys
35+
* platform_data which still uses old style GPIO numbers.
36+
*
37+
* Since the consuming device has not been instatiated yet a dynamic lookup
38+
* is generated using the special x86_android_tablet dev for dev_id.
39+
*
40+
* For normal GPIO lookups a standard static gpiod_lookup_table _must_ be used.
41+
*/
2742
int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
2843
bool active_low, enum gpiod_flags dflags,
2944
struct gpio_desc **desc)

0 commit comments

Comments
 (0)