mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
platform/x86: x86-android-tablets: Add support for registering GPIO lookup tables
Add support for registering GPIO lookup tables. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211229231431.437982-9-hdegoede@redhat.com
This commit is contained in:
parent
c2138b25d5
commit
ef2ac11493
1 changed files with 9 additions and 0 deletions
|
@ -142,6 +142,7 @@ struct x86_serdev_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct x86_dev_info {
|
struct x86_dev_info {
|
||||||
|
struct gpiod_lookup_table **gpiod_lookup_tables;
|
||||||
const struct x86_i2c_client_info *i2c_client_info;
|
const struct x86_i2c_client_info *i2c_client_info;
|
||||||
const struct platform_device_info *pdev_info;
|
const struct platform_device_info *pdev_info;
|
||||||
const struct x86_serdev_info *serdev_info;
|
const struct x86_serdev_info *serdev_info;
|
||||||
|
@ -293,6 +294,7 @@ static int serdev_count;
|
||||||
static struct i2c_client **i2c_clients;
|
static struct i2c_client **i2c_clients;
|
||||||
static struct platform_device **pdevs;
|
static struct platform_device **pdevs;
|
||||||
static struct serdev_device **serdevs;
|
static struct serdev_device **serdevs;
|
||||||
|
static struct gpiod_lookup_table **gpiod_lookup_tables;
|
||||||
|
|
||||||
static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,
|
static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,
|
||||||
int idx)
|
int idx)
|
||||||
|
@ -409,6 +411,9 @@ static void x86_android_tablet_cleanup(void)
|
||||||
i2c_unregister_device(i2c_clients[i]);
|
i2c_unregister_device(i2c_clients[i]);
|
||||||
|
|
||||||
kfree(i2c_clients);
|
kfree(i2c_clients);
|
||||||
|
|
||||||
|
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_init(void)
|
static __init int x86_android_tablet_init(void)
|
||||||
|
@ -423,6 +428,10 @@ static __init int x86_android_tablet_init(void)
|
||||||
|
|
||||||
dev_info = id->driver_data;
|
dev_info = id->driver_data;
|
||||||
|
|
||||||
|
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]);
|
||||||
|
|
||||||
i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL);
|
i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL);
|
||||||
if (!i2c_clients)
|
if (!i2c_clients)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue