summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2022-02-05 20:13:51 +0100
committerHans de Goede <hdegoede@redhat.com>2022-02-11 10:46:07 +0100
commit5c8e4c8662fff4f50bd4fdb9512164d57550132f (patch)
treed7b4f4f32533347b11f5de56d6b3368631d8d4af /drivers/platform/x86
parentd717e4509af0380a94dbc28b61839df39f17e1eb (diff)
downloadlinux-stable-5c8e4c8662fff4f50bd4fdb9512164d57550132f.tar.gz
linux-stable-5c8e4c8662fff4f50bd4fdb9512164d57550132f.tar.bz2
linux-stable-5c8e4c8662fff4f50bd4fdb9512164d57550132f.zip
platform/x86: x86-android-tablets: Add battery swnode support
power_supply_get_battery_info() which is used by charger and fuel-gauge drivers on x86-android-tablets, expects the battery properties to be described in a stand-alone battery fwnode which is then referenced from both the charger and fuel-gauge device's fwnodes. Add support for registering + unregistering a swnode for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220205191356.225505-1-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/x86-android-tablets.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 3120acf9837c..80d113c41623 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -146,6 +146,7 @@ struct x86_serdev_info {
struct x86_dev_info {
char *invalid_aei_gpiochip;
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 platform_device_info *pdev_info;
@@ -727,6 +728,7 @@ static struct i2c_client **i2c_clients;
static struct platform_device **pdevs;
static struct serdev_device **serdevs;
static struct gpiod_lookup_table * const *gpiod_lookup_tables;
+static const struct software_node *bat_swnode;
static void (*exit_handler)(void);
static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,
@@ -850,6 +852,8 @@ static void x86_android_tablet_cleanup(void)
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_init(void)
@@ -886,6 +890,13 @@ static __init int x86_android_tablet_init(void)
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);
+ 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]);