* [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support
@ 2022-02-05 19:13 Hans de Goede
2022-02-05 19:13 ` [PATCH 2/6] platform/x86: x86-android-tablets: Add Asus ME176C/TF103C charger and fuelgauge props Hans de Goede
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
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>
---
drivers/platform/x86/x86-android-tablets.c | 11 +++++++++++
1 file changed, 11 insertions(+)
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]);
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] platform/x86: x86-android-tablets: Add Asus ME176C/TF103C charger and fuelgauge props
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
@ 2022-02-05 19:13 ` Hans de Goede
2022-02-05 19:13 ` [PATCH 3/6] platform/x86: x86-android-tablets: Add x86_android_tablet_get_gpiod() helper Hans de Goede
` (5 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
Add properties describing the battery on the Asus ME176C / TF103C
tablets. The max constant charge volt / current settings were taken
from the factory Android image on these tablets.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 97 +++++++++++++++++++---
1 file changed, 85 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 80d113c41623..45a951002401 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -158,21 +158,27 @@ struct x86_dev_info {
void (*exit)(void);
};
-/* Generic / shared bq24190 settings */
-static const char * const bq24190_suppliers[] = { "tusb1210-psy" };
-
-static const struct property_entry bq24190_props[] = {
- PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_suppliers),
- PROPERTY_ENTRY_BOOL("omit-battery-class"),
- PROPERTY_ENTRY_BOOL("disable-reset"),
+/* Generic / shared charger / battery settings */
+static const char * const bq24190_suppliers[] = { "tusb1211-charger-detect" };
+static const char * const ug3105_suppliers[] = { "bq24190-charger" };
+
+/* LiPo HighVoltage (max 4.35V) settings used by most devs with a HV bat. */
+static const struct property_entry generic_lipo_hv_4v35_battery_props[] = {
+ PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
+ PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion"),
+ PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
+ PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
+ PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 1856000),
+ PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4352000),
+ PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
{ }
};
-static const struct software_node bq24190_node = {
- .properties = bq24190_props,
+static const struct software_node generic_lipo_hv_4v35_battery_node = {
+ .properties = generic_lipo_hv_4v35_battery_props,
};
-/* For enableing the bq24190 5V boost based on id-pin */
+/* For enabling the bq24190 5V boost based on id-pin */
static struct regulator_consumer_supply intel_int3496_consumer = {
.supply = "vbus",
.dev_name = "intel-int3496",
@@ -230,6 +236,30 @@ static const struct software_node asus_me176c_accel_node = {
.properties = asus_me176c_accel_props,
};
+static const struct property_entry asus_me176c_bq24190_props[] = {
+ PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_suppliers),
+ PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node),
+ PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
+ PROPERTY_ENTRY_BOOL("omit-battery-class"),
+ PROPERTY_ENTRY_BOOL("disable-reset"),
+ { }
+};
+
+static const struct software_node asus_me176c_bq24190_node = {
+ .properties = asus_me176c_bq24190_props,
+};
+
+static const struct property_entry asus_me176c_ug3105_props[] = {
+ PROPERTY_ENTRY_STRING_ARRAY("supplied-from", ug3105_suppliers),
+ PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node),
+ PROPERTY_ENTRY_U32("upi,rsns-microohm", 10000),
+ { }
+};
+
+static const struct software_node asus_me176c_ug3105_node = {
+ .properties = asus_me176c_ug3105_props,
+};
+
static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst = {
{
/* bq24190 battery charger */
@@ -237,7 +267,7 @@ static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst =
.type = "bq24190",
.addr = 0x6b,
.dev_name = "bq24190",
- .swnode = &bq24190_node,
+ .swnode = &asus_me176c_bq24190_node,
.platform_data = &bq24190_pdata,
},
.adapter_path = "\\_SB_.I2C1",
@@ -253,6 +283,7 @@ static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst =
.type = "ug3105",
.addr = 0x70,
.dev_name = "ug3105",
+ .swnode = &asus_me176c_ug3105_node,
},
.adapter_path = "\\_SB_.I2C1",
}, {
@@ -321,6 +352,7 @@ static const struct x86_dev_info asus_me176c_info __initconst = {
.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",
};
@@ -350,6 +382,45 @@ static const struct software_node asus_tf103c_touchscreen_node = {
.properties = asus_tf103c_touchscreen_props,
};
+static const struct property_entry asus_tf103c_battery_props[] = {
+ PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
+ PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion-polymer"),
+ PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
+ PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
+ PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 2048000),
+ PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4208000),
+ PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
+ { }
+};
+
+static const struct software_node asus_tf103c_battery_node = {
+ .properties = asus_tf103c_battery_props,
+};
+
+static const struct property_entry asus_tf103c_bq24190_props[] = {
+ PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_suppliers),
+ PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node),
+ PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
+ PROPERTY_ENTRY_BOOL("omit-battery-class"),
+ PROPERTY_ENTRY_BOOL("disable-reset"),
+ { }
+};
+
+static const struct software_node asus_tf103c_bq24190_node = {
+ .properties = asus_tf103c_bq24190_props,
+};
+
+static const struct property_entry asus_tf103c_ug3105_props[] = {
+ PROPERTY_ENTRY_STRING_ARRAY("supplied-from", ug3105_suppliers),
+ PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node),
+ PROPERTY_ENTRY_U32("upi,rsns-microohm", 5000),
+ { }
+};
+
+static const struct software_node asus_tf103c_ug3105_node = {
+ .properties = asus_tf103c_ug3105_props,
+};
+
static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst = {
{
/* bq24190 battery charger */
@@ -357,7 +428,7 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst =
.type = "bq24190",
.addr = 0x6b,
.dev_name = "bq24190",
- .swnode = &bq24190_node,
+ .swnode = &asus_tf103c_bq24190_node,
.platform_data = &bq24190_pdata,
},
.adapter_path = "\\_SB_.I2C1",
@@ -373,6 +444,7 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst =
.type = "ug3105",
.addr = 0x70,
.dev_name = "ug3105",
+ .swnode = &asus_tf103c_ug3105_node,
},
.adapter_path = "\\_SB_.I2C1",
}, {
@@ -422,6 +494,7 @@ static const struct x86_dev_info asus_tf103c_info __initconst = {
.pdev_info = int3496_pdevs,
.pdev_count = ARRAY_SIZE(int3496_pdevs),
.gpiod_lookup_tables = asus_tf103c_gpios,
+ .bat_swnode = &asus_tf103c_battery_node,
.modules = bq24190_modules,
.invalid_aei_gpiochip = "INT33FC:02",
};
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] platform/x86: x86-android-tablets: Add x86_android_tablet_get_gpiod() helper
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
2022-02-05 19:13 ` [PATCH 2/6] platform/x86: x86-android-tablets: Add Asus ME176C/TF103C charger and fuelgauge props Hans de Goede
@ 2022-02-05 19:13 ` Hans de Goede
2022-02-05 19:13 ` [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C Hans de Goede
` (4 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
Factor the code to go from a gpiochip label + pin-numer to a gpio_desc
out of x86_acpi_irq_helper_get() and make it into a new
x86_android_tablet_get_gpiod() helper, as this will be necessary in some
x86_dev_info.init() functions too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 35 ++++++++++++++--------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 45a951002401..40243ea3ae39 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -53,13 +53,33 @@ static int gpiochip_find_match_label(struct gpio_chip *gc, void *data)
return gc->label && !strcmp(gc->label, data);
}
+static int x86_android_tablet_get_gpiod(char *label, int pin, struct gpio_desc **desc)
+{
+ struct gpio_desc *gpiod;
+ struct gpio_chip *chip;
+
+ chip = gpiochip_find(label, gpiochip_find_match_label);
+ if (!chip) {
+ pr_err("error cannot find GPIO chip %s\n", label);
+ return -ENODEV;
+ }
+
+ gpiod = gpiochip_get_desc(chip, pin);
+ if (IS_ERR(gpiod)) {
+ pr_err("error %ld getting GPIO %s %d\n", PTR_ERR(gpiod), label, pin);
+ return PTR_ERR(gpiod);
+ }
+
+ *desc = gpiod;
+ return 0;
+}
+
static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data)
{
struct irq_fwspec fwspec = { };
struct irq_domain *domain;
struct acpi_device *adev;
struct gpio_desc *gpiod;
- struct gpio_chip *chip;
unsigned int irq_type;
acpi_handle handle;
acpi_status status;
@@ -74,18 +94,9 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data)
return irq;
case X86_ACPI_IRQ_TYPE_GPIOINT:
/* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */
- chip = gpiochip_find(data->chip, gpiochip_find_match_label);
- if (!chip) {
- pr_err("error cannot find GPIO chip %s\n", data->chip);
- return -ENODEV;
- }
-
- gpiod = gpiochip_get_desc(chip, data->index);
- if (IS_ERR(gpiod)) {
- ret = PTR_ERR(gpiod);
- pr_err("error %d getting GPIO %s %d\n", ret, data->chip, data->index);
+ ret = x86_android_tablet_get_gpiod(data->chip, data->index, &gpiod);
+ if (ret)
return ret;
- }
irq = gpiod_to_irq(gpiod);
if (irq < 0) {
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
2022-02-05 19:13 ` [PATCH 2/6] platform/x86: x86-android-tablets: Add Asus ME176C/TF103C charger and fuelgauge props Hans de Goede
2022-02-05 19:13 ` [PATCH 3/6] platform/x86: x86-android-tablets: Add x86_android_tablet_get_gpiod() helper Hans de Goede
@ 2022-02-05 19:13 ` Hans de Goede
2022-02-05 20:40 ` Andy Shevchenko
2022-02-05 19:13 ` [PATCH 5/6] platform/x86: x86-android-tablets: Add IRQ to Asus ME176C accelerometer info Hans de Goede
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
The Asus ME176C + TF103C both have a lid-switch (for a cover in the ME176C
case), add a gpio-keys platform-device and platform-data describing the
lid-switch on both.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 57 ++++++++++++++++++++--
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 40243ea3ae39..6174aad572bc 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -12,10 +12,12 @@
#include <linux/acpi.h>
#include <linux/dmi.h>
+#include <linux/gpio_keys.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h>
+#include <linux/input.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/module.h>
@@ -231,6 +233,51 @@ static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = {
},
};
+/* Asus ME176C and TF103C tablets shared data */
+static struct gpio_keys_button asus_me176c_tf103c_lid = {
+ .code = SW_LID,
+ /* .gpio gets filled in by asus_me176c_tf103c_init() */
+ .active_low = true,
+ .desc = "lid_sw",
+ .type = EV_SW,
+ .wakeup = true,
+ .debounce_interval = 50,
+};
+
+static const struct gpio_keys_platform_data asus_me176c_tf103c_lid_pdata __initconst = {
+ .buttons = &asus_me176c_tf103c_lid,
+ .nbuttons = 1,
+ .name = "lid_sw",
+};
+
+static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
+ {
+ .name = "gpio-keys",
+ .id = PLATFORM_DEVID_AUTO,
+ .data = &asus_me176c_tf103c_lid_pdata,
+ .size_data = sizeof(asus_me176c_tf103c_lid_pdata),
+ },
+ {
+ /* For micro USB ID pin handling */
+ .name = "intel-int3496",
+ .id = PLATFORM_DEVID_NONE,
+ },
+};
+
+static int __init asus_me176c_tf103c_init(void)
+{
+ struct gpio_desc *gpiod;
+ int ret;
+
+ ret = x86_android_tablet_get_gpiod("INT33FC:02", 12, &gpiod);
+ if (ret < 0)
+ return ret;
+ asus_me176c_tf103c_lid.gpio = desc_to_gpio(gpiod);
+
+ return 0;
+}
+
+
/* Asus ME176C tablets have an Android factory img with everything hardcoded */
static const char * const asus_me176c_accel_mount_matrix[] = {
"-1", "0", "0",
@@ -358,14 +405,15 @@ static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
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),
- .pdev_info = int3496_pdevs,
- .pdev_count = ARRAY_SIZE(int3496_pdevs),
+ .pdev_info = asus_me176c_tf103c_pdevs,
+ .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",
+ .init = asus_me176c_tf103c_init,
};
/* Asus TF103C tablets have an Android factory img with everything hardcoded */
@@ -502,12 +550,13 @@ static struct gpiod_lookup_table * const asus_tf103c_gpios[] = {
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 = int3496_pdevs,
- .pdev_count = ARRAY_SIZE(int3496_pdevs),
+ .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",
+ .init = asus_me176c_tf103c_init,
};
/*
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] platform/x86: x86-android-tablets: Add IRQ to Asus ME176C accelerometer info
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
` (2 preceding siblings ...)
2022-02-05 19:13 ` [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C Hans de Goede
@ 2022-02-05 19:13 ` Hans de Goede
2022-02-05 19:13 ` [PATCH 6/6] platform/x86: x86-android-tablets: Add Nextbook Ares 8 data Hans de Goede
` (2 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
Add the IRQ for the accelerometer to the Asus ME176C board info.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 6174aad572bc..6d3a453d90eb 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -361,6 +361,12 @@ static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst =
.swnode = &asus_me176c_accel_node,
},
.adapter_path = "\\_SB_.I2C5",
+ .irq_data = {
+ .type = X86_ACPI_IRQ_TYPE_APIC,
+ .index = 0x44,
+ .trigger = ACPI_EDGE_SENSITIVE,
+ .polarity = ACPI_ACTIVE_LOW,
+ },
}, {
/* goodix touchscreen */
.board_info = {
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] platform/x86: x86-android-tablets: Add Nextbook Ares 8 data
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
` (3 preceding siblings ...)
2022-02-05 19:13 ` [PATCH 5/6] platform/x86: x86-android-tablets: Add IRQ to Asus ME176C accelerometer info Hans de Goede
@ 2022-02-05 19:13 ` Hans de Goede
2022-02-05 20:41 ` [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Andy Shevchenko
2022-02-11 9:51 ` Hans de Goede
6 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-05 19:13 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, Stephan Gerhold, platform-driver-x86
The Nextbook Ares 8 is a x86 ACPI tablet which ships with Android x86
as factory OS. Its DSDT contains a bunch of I2C devices which are not
actually there, causing various resource conflicts. Enumeration of these
is skipped through the acpi_quirk_skip_i2c_client_enumeration().
Add support for manually instantiating the I2C devices which are
actually present on this tablet by adding the necessary device info to
the x86-android-tablets module.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 88 +++++++++++++++++++++-
1 file changed, 87 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 6d3a453d90eb..838d667126e5 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -669,6 +669,84 @@ static const struct x86_dev_info czc_p10t __initconst = {
.init = czc_p10t_init,
};
+/* Nextbook Ares 8 tablets have an Android factory img with everything hardcoded */
+static const char * const nextbook_ares8_accel_mount_matrix[] = {
+ "0", "-1", "0",
+ "-1", "0", "0",
+ "0", "0", "1"
+};
+
+static const struct property_entry nextbook_ares8_accel_props[] = {
+ PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", nextbook_ares8_accel_mount_matrix),
+ { }
+};
+
+static const struct software_node nextbook_ares8_accel_node = {
+ .properties = nextbook_ares8_accel_props,
+};
+
+static const struct property_entry nextbook_ares8_touchscreen_props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 800),
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
+ { }
+};
+
+static const struct software_node nextbook_ares8_touchscreen_node = {
+ .properties = nextbook_ares8_touchscreen_props,
+};
+
+static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst = {
+ {
+ /* Freescale MMA8653FC accel */
+ .board_info = {
+ .type = "mma8653",
+ .addr = 0x1d,
+ .dev_name = "mma8653",
+ .swnode = &nextbook_ares8_accel_node,
+ },
+ .adapter_path = "\\_SB_.I2C3",
+ }, {
+ /* FT5416DQ9 touchscreen controller */
+ .board_info = {
+ .type = "edt-ft5x06",
+ .addr = 0x38,
+ .dev_name = "ft5416",
+ .swnode = &nextbook_ares8_touchscreen_node,
+ },
+ .adapter_path = "\\_SB_.I2C4",
+ .irq_data = {
+ .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+ .chip = "INT33FC:02",
+ .index = 3,
+ .trigger = ACPI_EDGE_SENSITIVE,
+ .polarity = ACPI_ACTIVE_LOW,
+ },
+ },
+};
+
+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 struct gpiod_lookup_table * const nextbook_ares8_gpios[] = {
+ &nextbook_ares8_int3496_gpios,
+ NULL
+};
+
+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,
+ .invalid_aei_gpiochip = "INT33FC:02",
+};
+
/*
* Whitelabel (sold as various brands) TM800A550L tablets.
* These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices
@@ -830,7 +908,7 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
.driver_data = (void *)&czc_p10t,
},
{
- /* A variant of CZC P10T */
+ /* CZC P10T variant */
.ident = "ViewSonic ViewPad 10",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ViewSonic"),
@@ -838,6 +916,14 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
},
.driver_data = (void *)&czc_p10t,
},
+ {
+ /* Nextbook Ares 8 */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "M890BAP"),
+ },
+ .driver_data = (void *)&nextbook_ares8_info,
+ },
{
/* Whitelabel (sold as various brands) TM800A550L */
.matches = {
--
2.33.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C
2022-02-05 19:13 ` [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C Hans de Goede
@ 2022-02-05 20:40 ` Andy Shevchenko
2022-02-06 19:22 ` Hans de Goede
0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2022-02-05 20:40 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> The Asus ME176C + TF103C both have a lid-switch (for a cover in the ME176C
> case), add a gpio-keys platform-device and platform-data describing the
> lid-switch on both.
USB ID change is not described here.
...
+/* Asus ME176C and TF103C tablets shared data */
> +static struct gpio_keys_button asus_me176c_tf103c_lid = {
> + .code = SW_LID,
> + /* .gpio gets filled in by asus_me176c_tf103c_init() */
I'm wondering if we can switch gpio_keys*.c drivers to accept GPIO
descriptor directly.
> + .active_low = true,
> + .desc = "lid_sw",
> + .type = EV_SW,
> + .wakeup = true,
> + .debounce_interval = 50,
> +};
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
` (4 preceding siblings ...)
2022-02-05 19:13 ` [PATCH 6/6] platform/x86: x86-android-tablets: Add Nextbook Ares 8 data Hans de Goede
@ 2022-02-05 20:41 ` Andy Shevchenko
2022-02-06 19:10 ` Hans de Goede
2022-02-11 9:51 ` Hans de Goede
6 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2022-02-05 20:41 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> 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.
All non-commented looks good to me,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/platform/x86/x86-android-tablets.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> 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]);
> --
> 2.33.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support
2022-02-05 20:41 ` [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Andy Shevchenko
@ 2022-02-06 19:10 ` Hans de Goede
2022-02-06 19:46 ` Andy Shevchenko
0 siblings, 1 reply; 14+ messages in thread
From: Hans de Goede @ 2022-02-06 19:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
Hi,
On 2/5/22 21:41, Andy Shevchenko wrote:
> On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> 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.
>
> All non-commented looks good to me,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Just to be clear, you mean that I may add your Reviewed-by
tag to all patches in this series to which you did not comment,
correct ?
Regards,
Hans
>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/platform/x86/x86-android-tablets.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> 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]);
>> --
>> 2.33.1
>>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C
2022-02-05 20:40 ` Andy Shevchenko
@ 2022-02-06 19:22 ` Hans de Goede
2022-02-06 19:50 ` Andy Shevchenko
0 siblings, 1 reply; 14+ messages in thread
From: Hans de Goede @ 2022-02-06 19:22 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
Hi,
On 2/5/22 21:40, Andy Shevchenko wrote:
> On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> The Asus ME176C + TF103C both have a lid-switch (for a cover in the ME176C
>> case), add a gpio-keys platform-device and platform-data describing the
>> lid-switch on both.
>
> USB ID change is not described here.
There is no USB-ID change, the
- .pdev_info = int3496_pdevs,
- .pdev_count = ARRAY_SIZE(int3496_pdevs),
members of struct x86_dev_info used to point to int3496_pdevs which
is a generic pdev array with just the single:
/* 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,
},
};
entry in there.
Since adding lid_switch support involves adding a second pdev,
the contents of the generic int3496_pdevs now gets duplicated into
the new pdevs array which adds the lid gpio_keys pdev:
static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
{
.name = "gpio-keys",
.id = PLATFORM_DEVID_AUTO,
.data = &asus_me176c_tf103c_lid_pdata,
.size_data = sizeof(asus_me176c_tf103c_lid_pdata),
},
{
/* For micro USB ID pin handling */
.name = "intel-int3496",
.id = PLATFORM_DEVID_NONE,
},
};
So only the "gpio-keys" pdev is new, the other one just needs to be duplicated
because pdev_info now points to the new asus_me176c_tf103c_pdevs array:
+ .pdev_info = asus_me176c_tf103c_pdevs,
+ .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
And without the duplication the dropping of the reference to the old array
would cause the "intel-int3496" pdev to go away. So what looks like an
extra change actually is there to avoid changing behavior.
> ...
>
> +/* Asus ME176C and TF103C tablets shared data */
>> +static struct gpio_keys_button asus_me176c_tf103c_lid = {
>> + .code = SW_LID,
>
>> + /* .gpio gets filled in by asus_me176c_tf103c_init() */
>
> I'm wondering if we can switch gpio_keys*.c drivers to accept GPIO
> descriptor directly.
The current gpio_keys_platform_data struct which expects an
old style gpio integer number is used in a ton of places:
drivers/platform/surface/surface3_button.c
drivers/platform/x86/meraki-mx100.c
drivers/platform/x86/barco-p50-gpio.c
drivers/platform/x86/pcengines-apuv2.c
drivers/platform/x86/x86-android-tablets.c
drivers/mfd/rohm-bd718x7.c
drivers/mfd/rohm-bd71828.c
drivers/mfd/ucb1x00-assabet.c
drivers/input/keyboard/gpio_keys_polled.c
drivers/input/keyboard/gpio_keys.c
drivers/input/misc/soc_button_array.c
arch/x86/platform/geode/net5501.c
arch/x86/platform/geode/alix.c
arch/x86/platform/geode/geos.c
arch/sh/boards/mach-x3proto/setup.c
arch/sh/boards/mach-rsk/devices-rsk7203.c
arch/arm/mach-sa1100/h3xxx.c
arch/arm/mach-sa1100/collie.c
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/simpad.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-orion5x/ls_hgl-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/net2big-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-s3c/mach-h1940.c
arch/arm/mach-s3c/mach-rx1950.c
arch/arm/mach-s3c/mach-mini2440.c
arch/arm/mach-s3c/mach-gta02.c
arch/arm/mach-s3c/mach-n30.c
arch/arm/mach-s3c/mach-smartq7.c
arch/arm/mach-s3c/mach-smartq5.c
arch/arm/mach-s3c/mach-crag6410.c
arch/arm/mach-pxa/hx4700.c
arch/arm/mach-pxa/palmld.c
arch/arm/mach-pxa/tosa.c
arch/arm/mach-pxa/palmt5.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/csb701.c
arch/arm/mach-pxa/vpac270.c
arch/arm/mach-pxa/z2.c
arch/arm/mach-pxa/palmtx.c
arch/arm/mach-pxa/palmte2.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/palmtc.c
arch/arm/mach-pxa/mioa701.c
arch/arm/mach-pxa/spitz.c
arch/arm/mach-pxa/ezx.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-davinci/board-da850-evm.c
arch/mips/bcm47xx/buttons.c
arch/mips/alchemy/board-mtx1.c
arch/mips/alchemy/devboards/db1300.c
So changing this is going to be a lot of work, it certainly is
out of scope for this patch-set.
Regards,
Hans
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support
2022-02-06 19:10 ` Hans de Goede
@ 2022-02-06 19:46 ` Andy Shevchenko
0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2022-02-06 19:46 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
On Sun, Feb 6, 2022 at 9:10 PM Hans de Goede <hdegoede@redhat.com> wrote:
> On 2/5/22 21:41, Andy Shevchenko wrote:
> > On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
...
> > All non-commented looks good to me,
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> Just to be clear, you mean that I may add your Reviewed-by
> tag to all patches in this series to which you did not comment,
> correct ?
Yep!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C
2022-02-06 19:22 ` Hans de Goede
@ 2022-02-06 19:50 ` Andy Shevchenko
2022-02-11 9:51 ` Hans de Goede
0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2022-02-06 19:50 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
On Sun, Feb 6, 2022 at 9:22 PM Hans de Goede <hdegoede@redhat.com> wrote:
> On 2/5/22 21:40, Andy Shevchenko wrote:
> > On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
...
> > USB ID change is not described here.
>
> There is no USB-ID change,
...
> Since adding lid_switch support involves adding a second pdev,
> the contents of the generic int3496_pdevs now gets duplicated into
> the new pdevs array which adds the lid gpio_keys pdev:
I see now. Perhaps a comment about it in the commit message?
...
> >> + /* .gpio gets filled in by asus_me176c_tf103c_init() */
> >
> > I'm wondering if we can switch gpio_keys*.c drivers to accept GPIO
> > descriptor directly.
> The current gpio_keys_platform_data struct which expects an
> old style gpio integer number is used in a ton of places:
Yes.
> So changing this is going to be a lot of work,
gpio_keys does already operate with descriptors inside. It would be
easy to add a new member and extend a check, but...
> it certainly is
> out of scope for this patch-set.
...yes, it's not directly related to this series.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C
2022-02-06 19:50 ` Andy Shevchenko
@ 2022-02-11 9:51 ` Hans de Goede
0 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-11 9:51 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mark Gross, Andy Shevchenko, Stephan Gerhold, Platform Driver
Hi,
On 2/6/22 20:50, Andy Shevchenko wrote:
> On Sun, Feb 6, 2022 at 9:22 PM Hans de Goede <hdegoede@redhat.com> wrote:
>> On 2/5/22 21:40, Andy Shevchenko wrote:
>>> On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> ...
>
>>> USB ID change is not described here.
>>
>> There is no USB-ID change,
>
> ...
>
>> Since adding lid_switch support involves adding a second pdev,
>> the contents of the generic int3496_pdevs now gets duplicated into
>> the new pdevs array which adds the lid gpio_keys pdev:
>
> I see now. Perhaps a comment about it in the commit message?
Ok, I've added a comment to the commit msg while merging this
series into my review-hans branch.
Regards,
Hans
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
` (5 preceding siblings ...)
2022-02-05 20:41 ` [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Andy Shevchenko
@ 2022-02-11 9:51 ` Hans de Goede
6 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2022-02-11 9:51 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko; +Cc: Stephan Gerhold, platform-driver-x86
Hi,
On 2/5/22 20:13, Hans de Goede wrote:
> 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>
I've added this series to my review-hans (soon to be for-next) branch now.
Regards,
Hans
> ---
> drivers/platform/x86/x86-android-tablets.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> 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]);
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-02-11 9:52 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-05 19:13 [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Hans de Goede
2022-02-05 19:13 ` [PATCH 2/6] platform/x86: x86-android-tablets: Add Asus ME176C/TF103C charger and fuelgauge props Hans de Goede
2022-02-05 19:13 ` [PATCH 3/6] platform/x86: x86-android-tablets: Add x86_android_tablet_get_gpiod() helper Hans de Goede
2022-02-05 19:13 ` [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C Hans de Goede
2022-02-05 20:40 ` Andy Shevchenko
2022-02-06 19:22 ` Hans de Goede
2022-02-06 19:50 ` Andy Shevchenko
2022-02-11 9:51 ` Hans de Goede
2022-02-05 19:13 ` [PATCH 5/6] platform/x86: x86-android-tablets: Add IRQ to Asus ME176C accelerometer info Hans de Goede
2022-02-05 19:13 ` [PATCH 6/6] platform/x86: x86-android-tablets: Add Nextbook Ares 8 data Hans de Goede
2022-02-05 20:41 ` [PATCH 1/6] platform/x86: x86-android-tablets: Add battery swnode support Andy Shevchenko
2022-02-06 19:10 ` Hans de Goede
2022-02-06 19:46 ` Andy Shevchenko
2022-02-11 9:51 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.