Skip to contentSkip to conversation

platform/x86: intel_cht_int33fe: Set supplied-from property on max17047 dev

PATCH In review Hans de Goede 2 participants 2 messages May 26, 2017 – May 30, 2017 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: intel_cht_int33fe: Set supplied-from property on max17047 dev

Devices with the intel_cht_int33fe ACPI device use a max17047 fuel-gauge combined with a bq24272i charger, in order for the fuel-gauge driver to correctly display charging / discharging status it needs to know which charger is supplying the battery.

This commit sets the supplied-from device property to the name of the bq24272i charger for this.

---
 drivers/platform/x86/intel_cht_int33fe.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/platform/x86/intel_cht_int33fe.c +8 -0
index 6a1b2ca5b6fe..da706e2c4232 100644
@@ -34,6 +34,13 @@ struct cht_int33fe_data {
 	struct i2c_client *pi3usb30532;
 };
 
+static const char * const max17047_suppliers[] = { "bq24190-charger" };
+
+static const struct property_entry max17047_props[] = {
+	PROPERTY_ENTRY_STRING_ARRAY("supplied-from", max17047_suppliers),
+	{ }
+};
+
 static int cht_int33fe_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -70,6 +77,7 @@ static int cht_int33fe_probe(struct i2c_client *client)
 
 	memset(&board_info, 0, sizeof(board_info));
 	strlcpy(board_info.type, "max17047", I2C_NAME_SIZE);
+	board_info.properties = max17047_props;
 
 	data->max17047 = i2c_acpi_new_device(dev, 1, &board_info);
 	if (!data->max17047)
Signature · 1 line
2.13.0
#1 lore raw
Quoted 7 lines · Hans de Goede

Devices with the intel_cht_int33fe ACPI device use a max17047 fuel-gauge combined with a bq24272i charger, in order for the fuel-gauge driver to correctly display charging / discharging status it needs to know which charger is supplying the battery.

This commit sets the supplied-from device property to the name of the bq24272i charger for this.

Pushed to testing, thanks!

Quoted 35 lines
---
 drivers/platform/x86/intel_cht_int33fe.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/platform/x86/intel_cht_int33fe.c +8 -1
index 6a1b2ca5b6fe..da706e2c4232 100644
@@ -34,6 +34,13 @@ struct cht_int33fe_data {
        struct i2c_client *pi3usb30532;
 };
 
+static const char * const max17047_suppliers[] = { "bq24190-charger" };
+
+static const struct property_entry max17047_props[] = {
+       PROPERTY_ENTRY_STRING_ARRAY("supplied-from", max17047_suppliers),
+       { }
+};
+
 static int cht_int33fe_probe(struct i2c_client *client)
 {
        struct device *dev = &client->dev;
@@ -70,6 +77,7 @@ static int cht_int33fe_probe(struct i2c_client *client)
 
        memset(&board_info, 0, sizeof(board_info));
        strlcpy(board_info.type, "max17047", I2C_NAME_SIZE);
+       board_info.properties = max17047_props;
 
        data->max17047 = i2c_acpi_new_device(dev, 1, &board_info);
        if (!data->max17047)
--

2.13.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko