From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
Date: Thu, 11 May 2023 17:18:11 -0700 [thread overview]
Message-ID: <20230512001815.591817-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20230512001815.591817-1-dmitry.torokhov@gmail.com>
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.c | 89 +++++++++-------------
1 file changed, 38 insertions(+), 51 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index e187fb66b6d7..f7f80237cfa9 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -263,23 +263,6 @@ static const char * const bq24190_modules[] __initconst = {
NULL
};
-/* 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,
- },
-};
-
-static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = {
- .dev_id = "intel-int3496",
- .table = {
- GPIO_LOOKUP("INT33FC:02", 22, "id", GPIO_ACTIVE_HIGH),
- { }
- },
-};
-
/*
* Advantech MICA-071
* This is a standard Windows tablet, but it has an extra "quick launch" button
@@ -347,6 +330,12 @@ static const struct gpio_keys_platform_data asus_me176c_tf103c_lid_pdata __initc
.name = "lid_sw",
};
+static const struct property_entry asus_me176c_tf103c_int3496_props[] = {
+ PROPERTY_ENTRY_GPIO("id-gpios",
+ &int33fc_gpiochip_nodes[2], 22, GPIO_ACTIVE_HIGH),
+ { }
+};
+
static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
{
.name = "gpio-keys",
@@ -358,6 +347,7 @@ 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,
},
};
@@ -503,11 +493,6 @@ static const struct x86_serdev_info asus_me176c_serdevs[] __initconst = {
},
};
-static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
- &int3496_gpo2_pin22_gpios,
- NULL
-};
-
static 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),
@@ -515,7 +500,6 @@ static 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),
- .gpiod_lookup_tables = asus_me176c_gpios,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,
.invalid_aei_gpiochip = "INT33FC:02",
@@ -648,17 +632,11 @@ 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
-};
-
static 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 = asus_me176c_tf103c_pdevs,
.pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
- .gpiod_lookup_tables = asus_tf103c_gpios,
.bat_swnode = &asus_tf103c_battery_node,
.modules = bq24190_modules,
.invalid_aei_gpiochip = "INT33FC:02",
@@ -877,12 +855,20 @@ static const struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[]
},
};
-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[] = {
+ PROPERTY_ENTRY_GPIO("mux-gpios",
+ &int33fc_gpiochip_nodes[2], 1, GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_GPIO("id-gpios",
+ &int33fc_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,
},
};
@@ -900,7 +886,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
};
@@ -911,8 +896,8 @@ static void lenovo_yoga_tab2_830_1050_exit(void);
static struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initdata = {
.i2c_client_info = lenovo_yoga_tab2_830_1050_i2c_clients,
/* i2c_client_count gets set by lenovo_yoga_tab2_830_1050_init() */
- .pdev_info = int3496_pdevs,
- .pdev_count = ARRAY_SIZE(int3496_pdevs),
+ .pdev_info = lenovo_yoga_tab2_830_1050_pdevs,
+ .pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_pdevs),
.gpiod_lookup_tables = lenovo_yoga_tab2_830_1050_gpios,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,
@@ -1305,26 +1290,28 @@ static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst
},
};
-static struct gpiod_lookup_table nextbook_ares8_int3496_gpios = {
- .dev_id = "intel-int3496",
- .table = {
- GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("INT33FC:02", 18, "id", GPIO_ACTIVE_HIGH),
- { }
- },
+static const struct property_entry nextbook_ares8_int3496_props[] = {
+ PROPERTY_ENTRY_GPIO("mux-gpios",
+ &int33fc_gpiochip_nodes[2], 1, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("id-gpios",
+ &int33fc_gpiochip_nodes[2], 18, GPIO_ACTIVE_HIGH),
+ { }
};
-static struct gpiod_lookup_table * const nextbook_ares8_gpios[] = {
- &nextbook_ares8_int3496_gpios,
- NULL
+static const struct platform_device_info nextbook_ares8_pdevs[] __initconst = {
+ {
+ /* For micro USB ID pin handling */
+ .name = "intel-int3496",
+ .id = PLATFORM_DEVID_NONE,
+ .properties = nextbook_ares8_int3496_props,
+ },
};
static 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 = ARRAY_SIZE(int3496_pdevs),
- .gpiod_lookup_tables = nextbook_ares8_gpios,
+ .pdev_info = nextbook_ares8_pdevs,
+ .pdev_count = ARRAY_SIZE(nextbook_ares8_pdevs),
.invalid_aei_gpiochip = "INT33FC:02",
};
--
2.40.1.606.ga4b1b128d6-goog
next prev parent reply other threads:[~2023-05-12 0:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 0:18 [PATCH 0/4] x86-android-tablets: convert to using GPIO references Dmitry Torokhov
2023-05-12 0:18 ` [PATCH 1/4] platform/x86: x86-android-tablets: convert Goodix devices to " Dmitry Torokhov
2023-05-12 0:18 ` Dmitry Torokhov [this message]
2023-05-12 0:18 ` [PATCH 3/4] platform/x86: x86-android-tablets: convert wm1502 " Dmitry Torokhov
2023-05-12 0:18 ` [PATCH 4/4] platform/x86: x86-android-tablets: convert gpio_keys " Dmitry Torokhov
2023-05-14 20:21 ` [PATCH 0/4] x86-android-tablets: convert to using " Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230512001815.591817-3-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox