@@ -1351,7 +1351,10 @@ static void bq27xxx_external_power_changed(struct power_supply *psy)
int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
{
struct power_supply_desc *psy_desc;
- struct power_supply_config psy_cfg = { .drv_data = di, };
+ struct power_supply_config psy_cfg = {};
+
+ psy_cfg.drv_data = di;
+ psy_cfg.of_node = di->of_node;
INIT_DELAYED_WORK(&di->work, bq27xxx_battery_poll);
mutex_init(&di->lock);
@@ -96,6 +96,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,
di->chip = id->driver_data;
di->name = name;
di->bus.read = bq27xxx_battery_i2c_read;
+ di->of_node = client->dev.of_node;
ret = bq27xxx_battery_setup(di);
if (ret)
@@ -63,6 +63,7 @@ struct bq27xxx_device_info {
const char *name;
struct bq27xxx_access_methods bus;
struct bq27xxx_reg_cache cache;
+ struct device_node *of_node;
int charge_design_full;
unsigned long last_update;
struct delayed_work work;
This passes the of_node from the bq27xxx i2c battery driver to the common code, so that it can be registered and provide external supplies linked with device-tree. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> --- drivers/power/supply/bq27xxx_battery.c | 5 ++++- drivers/power/supply/bq27xxx_battery_i2c.c | 1 + include/linux/power/bq27xxx_battery.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)