ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property;
- result = power_supply_register(&ac->device->dev, &ac->charger);
+ result = power_supply_register(&ac->device->dev, &ac->charger, NULL);
if (result)
goto end;
battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
battery->bat.get_property = acpi_battery_get_property;
- result = power_supply_register_no_ws(&battery->device->dev, &battery->bat);
+ result = power_supply_register_no_ws(&battery->device->dev,
+ &battery->bat, NULL);
if (result)
return result;
ARRAY_SIZE(sbs_energy_battery_props);
}
battery->bat.get_property = acpi_sbs_battery_get_property;
- result = power_supply_register(&sbs->device->dev, &battery->bat);
+ result = power_supply_register(&sbs->device->dev, &battery->bat, NULL);
if (result)
goto end;
sbs->charger.properties = sbs_ac_props;
sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
sbs->charger.get_property = sbs_get_ac_property;
- power_supply_register(&sbs->device->dev, &sbs->charger);
+ power_supply_register(&sbs->device->dev, &sbs->charger, NULL);
printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
dev->battery_report_type = report_type;
dev->battery_report_id = field->report->id;
- ret = power_supply_register(&dev->dev, battery);
+ ret = power_supply_register(&dev->dev, battery, NULL);
if (ret != 0) {
hid_warn(dev, "can't register power supply: %d\n", ret);
kfree(battery->name);
if (!sc->battery.name)
return -ENOMEM;
- ret = power_supply_register(&hdev->dev, &sc->battery);
+ ret = power_supply_register(&hdev->dev, &sc->battery, NULL);
if (ret) {
hid_err(hdev, "Unable to register battery device\n");
goto err_free;
if (!wdata->battery.name)
return -ENOMEM;
- ret = power_supply_register(&wdata->hdev->dev, &wdata->battery);
+ ret = power_supply_register(&wdata->hdev->dev, &wdata->battery, NULL);
if (ret) {
hid_err(wdata->hdev, "cannot register battery device\n");
goto err_free;
wacom->ac.use_for_apm = 0;
error = power_supply_register(&wacom->hdev->dev,
- &wacom->battery);
+ &wacom->battery, NULL);
if (error)
return error;
power_supply_powers(&wacom->battery, &wacom->hdev->dev);
- error = power_supply_register(&wacom->hdev->dev, &wacom->ac);
+ error = power_supply_register(&wacom->hdev->dev, &wacom->ac,
+ NULL);
if (error) {
power_supply_unregister(&wacom->battery);
return error;
/* Power supply */
initialize_power_supply_data(data);
- err = power_supply_register(&compal_device->dev, &data->psy);
+ err = power_supply_register(&compal_device->dev, &data->psy, NULL);
if (err < 0)
goto remove;
else
info->resistor = 300; /* set default internal resistor */
- ret = power_supply_register(&pdev->dev, &info->battery);
+ ret = power_supply_register(&pdev->dev, &info->battery, NULL);
if (ret)
return ret;
info->battery.dev->parent = &pdev->dev;
static int pm860x_charger_probe(struct platform_device *pdev)
{
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
+ struct power_supply_config psy_cfg = {};
struct pm860x_charger_info *info;
int ret;
int count;
info->usb.name = "usb";
info->usb.type = POWER_SUPPLY_TYPE_USB;
- info->usb.supplied_to = pm860x_supplied_to;
- info->usb.num_supplicants = ARRAY_SIZE(pm860x_supplied_to);
info->usb.properties = pm860x_usb_props;
info->usb.num_properties = ARRAY_SIZE(pm860x_usb_props);
info->usb.get_property = pm860x_usb_get_prop;
- ret = power_supply_register(&pdev->dev, &info->usb);
+ psy_cfg.supplied_to = pm860x_supplied_to;
+ psy_cfg.num_supplicants = ARRAY_SIZE(pm860x_supplied_to);
+ ret = power_supply_register(&pdev->dev, &info->usb, &psy_cfg);
if (ret)
goto out;
{
struct device_node *np = pdev->dev.of_node;
struct abx500_bm_data *plat = pdev->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct ab8500_btemp *di;
int irq, i, ret = 0;
u8 val;
di->btemp_psy.properties = ab8500_btemp_props;
di->btemp_psy.num_properties = ARRAY_SIZE(ab8500_btemp_props);
di->btemp_psy.get_property = ab8500_btemp_get_property;
- di->btemp_psy.supplied_to = supply_interface;
- di->btemp_psy.num_supplicants = ARRAY_SIZE(supply_interface);
di->btemp_psy.external_power_changed =
ab8500_btemp_external_power_changed;
+ psy_cfg.supplied_to = supply_interface;
+ psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
/* Create a work queue for the btemp */
di->btemp_wq =
}
/* Register BTEMP power supply class */
- ret = power_supply_register(di->dev, &di->btemp_psy);
+ ret = power_supply_register(di->dev, &di->btemp_psy, &psy_cfg);
if (ret) {
dev_err(di->dev, "failed to register BTEMP psy\n");
goto free_btemp_wq;
{
struct device_node *np = pdev->dev.of_node;
struct abx500_bm_data *plat = pdev->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct ab8500_charger *di;
int irq, i, charger_status, ret = 0, ch_stat;
di->autopower = false;
di->invalid_charger_detect_state = 0;
+ /* AC and USB supply config */
+ psy_cfg.supplied_to = supply_interface;
+ psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
+
/* AC supply */
/* power_supply base class */
di->ac_chg.psy.name = "ab8500_ac";
di->ac_chg.psy.properties = ab8500_charger_ac_props;
di->ac_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_ac_props);
di->ac_chg.psy.get_property = ab8500_charger_ac_get_property;
- di->ac_chg.psy.supplied_to = supply_interface;
- di->ac_chg.psy.num_supplicants = ARRAY_SIZE(supply_interface),
/* ux500_charger sub-class */
di->ac_chg.ops.enable = &ab8500_charger_ac_en;
di->ac_chg.ops.check_enable = &ab8500_charger_ac_check_enable;
di->usb_chg.psy.properties = ab8500_charger_usb_props;
di->usb_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_usb_props);
di->usb_chg.psy.get_property = ab8500_charger_usb_get_property;
- di->usb_chg.psy.supplied_to = supply_interface;
- di->usb_chg.psy.num_supplicants = ARRAY_SIZE(supply_interface),
/* ux500_charger sub-class */
di->usb_chg.ops.enable = &ab8500_charger_usb_en;
di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable;
/* Register AC charger class */
if (di->ac_chg.enabled) {
- ret = power_supply_register(di->dev, &di->ac_chg.psy);
+ ret = power_supply_register(di->dev, &di->ac_chg.psy,
+ &psy_cfg);
if (ret) {
dev_err(di->dev, "failed to register AC charger\n");
goto free_charger_wq;
/* Register USB charger class */
if (di->usb_chg.enabled) {
- ret = power_supply_register(di->dev, &di->usb_chg.psy);
+ ret = power_supply_register(di->dev, &di->usb_chg.psy,
+ &psy_cfg);
if (ret) {
dev_err(di->dev, "failed to register USB charger\n");
goto free_ac;
{
struct device_node *np = pdev->dev.of_node;
struct abx500_bm_data *plat = pdev->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct ab8500_fg *di;
int i, irq;
int ret = 0;
di->fg_psy.properties = ab8500_fg_props;
di->fg_psy.num_properties = ARRAY_SIZE(ab8500_fg_props);
di->fg_psy.get_property = ab8500_fg_get_property;
- di->fg_psy.supplied_to = supply_interface;
- di->fg_psy.num_supplicants = ARRAY_SIZE(supply_interface),
di->fg_psy.external_power_changed = ab8500_fg_external_power_changed;
+ psy_cfg.supplied_to = supply_interface;
+ psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
+
di->bat_cap.max_mah_design = MILLI_TO_MICRO *
di->bm->bat_type[di->bm->batt_id].charge_full_design;
di->flags.batt_id_received = false;
/* Register FG power supply class */
- ret = power_supply_register(di->dev, &di->fg_psy);
+ ret = power_supply_register(di->dev, &di->fg_psy, &psy_cfg);
if (ret) {
dev_err(di->dev, "failed to register FG psy\n");
goto free_inst_curr_wq;
{
struct device_node *np = pdev->dev.of_node;
struct abx500_bm_data *plat = pdev->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct abx500_chargalg *di;
int ret = 0;
di->chargalg_psy.properties = abx500_chargalg_props;
di->chargalg_psy.num_properties = ARRAY_SIZE(abx500_chargalg_props);
di->chargalg_psy.get_property = abx500_chargalg_get_property;
- di->chargalg_psy.supplied_to = supply_interface;
- di->chargalg_psy.num_supplicants = ARRAY_SIZE(supply_interface),
di->chargalg_psy.external_power_changed =
abx500_chargalg_external_power_changed;
+ psy_cfg.supplied_to = supply_interface;
+ psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
+
/* Initilialize safety timer */
hrtimer_init(&di->safety_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
di->safety_timer.function = abx500_chargalg_safety_timer_expired;
di->chg_info.prev_conn_chg = -1;
/* Register chargalg power supply class */
- ret = power_supply_register(di->dev, &di->chargalg_psy);
+ ret = power_supply_register(di->dev, &di->chargalg_psy, &psy_cfg);
if (ret) {
dev_err(di->dev, "failed to register chargalg psy\n");
goto free_chargalg_wq;
info->bat.set_property = fuel_gauge_set_property;
info->bat.property_is_writeable = fuel_gauge_property_is_writeable;
info->bat.external_power_changed = fuel_gauge_external_power_changed;
- ret = power_supply_register(&pdev->dev, &info->bat);
+ ret = power_supply_register(&pdev->dev, &info->bat, NULL);
if (ret) {
dev_err(&pdev->dev, "failed to register battery: %d\n", ret);
return ret;
return -ENOMEM;
}
- ret = power_supply_register(bq->dev, &bq->charger);
+ ret = power_supply_register(bq->dev, &bq->charger, NULL);
if (ret) {
kfree(bq->model);
return ret;
bq24190_charger_init(&bdi->charger);
- ret = power_supply_register(dev, &bdi->charger);
+ ret = power_supply_register(dev, &bdi->charger, NULL);
if (ret) {
dev_err(dev, "Can't register charger\n");
goto out2;
bq24190_battery_init(&bdi->battery);
- ret = power_supply_register(dev, &bdi->battery);
+ ret = power_supply_register(dev, &bdi->battery, NULL);
if (ret) {
dev_err(dev, "Can't register battery\n");
goto out3;
int ret;
struct bq24735 *charger;
struct power_supply *supply;
+ struct power_supply_config psy_cfg = {};
char *name;
charger = devm_kzalloc(&client->dev, sizeof(*charger), GFP_KERNEL);
supply->properties = bq24735_charger_properties;
supply->num_properties = ARRAY_SIZE(bq24735_charger_properties);
supply->get_property = bq24735_charger_get_property;
- supply->supplied_to = charger->pdata->supplied_to;
- supply->num_supplicants = charger->pdata->num_supplicants;
- supply->of_node = client->dev.of_node;
+
+ psy_cfg.supplied_to = charger->pdata->supplied_to;
+ psy_cfg.num_supplicants = charger->pdata->num_supplicants;
+ psy_cfg.of_node = client->dev.of_node;
i2c_set_clientdata(client, charger);
}
}
- ret = power_supply_register(&client->dev, supply);
+ ret = power_supply_register(&client->dev, supply, &psy_cfg);
if (ret < 0) {
dev_err(&client->dev, "Failed to register power supply: %d\n",
ret);
INIT_DELAYED_WORK(&di->work, bq27x00_battery_poll);
mutex_init(&di->lock);
- ret = power_supply_register_no_ws(di->dev, &di->bat);
+ ret = power_supply_register_no_ws(di->dev, &di->bat, NULL);
if (ret) {
dev_err(di->dev, "failed to register battery: %d\n", ret);
return ret;
INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk);
- ret = power_supply_register(NULL, &cm->charger_psy);
+ ret = power_supply_register(NULL, &cm->charger_psy, NULL);
if (ret) {
dev_err(&pdev->dev, "Cannot register charger-manager with name \"%s\"\n",
cm->charger_psy.name);
INIT_WORK(&bat_work, collie_bat_work);
- ret = power_supply_register(&dev->ucb->dev, &collie_bat_main.psy);
+ ret = power_supply_register(&dev->ucb->dev, &collie_bat_main.psy, NULL);
if (ret)
goto err_psy_reg_main;
- ret = power_supply_register(&dev->ucb->dev, &collie_bat_bu.psy);
+ ret = power_supply_register(&dev->ucb->dev, &collie_bat_bu.psy, NULL);
if (ret)
goto err_psy_reg_bu;
goto err_notifier;
da9030_battery_setup_psy(charger);
- ret = power_supply_register(&pdev->dev, &charger->psy);
+ ret = power_supply_register(&pdev->dev, &charger->psy, NULL);
if (ret)
goto err_ps_register;
}
}
- ret = power_supply_register(&pdev->dev, &bat->psy);
+ ret = power_supply_register(&pdev->dev, &bat->psy, NULL);
if (ret)
goto err;
usb->properties = da9150_charger_props;
usb->num_properties = ARRAY_SIZE(da9150_charger_props);
usb->get_property = da9150_charger_get_prop;
- ret = power_supply_register(dev, usb);
+ ret = power_supply_register(dev, usb, NULL);
if (ret)
goto usb_fail;
battery->properties = da9150_charger_bat_props;
battery->num_properties = ARRAY_SIZE(da9150_charger_bat_props);
battery->get_property = da9150_charger_battery_get_prop;
- ret = power_supply_register(dev, battery);
+ ret = power_supply_register(dev, battery, NULL);
if (ret)
goto battery_fail;
if (current_accum)
ds2760_battery_set_current_accum(di, current_accum);
- retval = power_supply_register(&pdev->dev, &di->bat);
+ retval = power_supply_register(&pdev->dev, &di->bat, NULL);
if (retval) {
dev_err(di->dev, "failed to register battery\n");
goto batt_failed;
dev_info->bat.num_properties = ARRAY_SIZE(ds2780_battery_props);
dev_info->bat.get_property = ds2780_battery_get_property;
- ret = power_supply_register(&pdev->dev, &dev_info->bat);
+ ret = power_supply_register(&pdev->dev, &dev_info->bat, NULL);
if (ret) {
dev_err(dev_info->dev, "failed to register battery\n");
goto fail;
dev_info->bat.num_properties = ARRAY_SIZE(ds2781_battery_props);
dev_info->bat.get_property = ds2781_battery_get_property;
- ret = power_supply_register(&pdev->dev, &dev_info->bat);
+ ret = power_supply_register(&pdev->dev, &dev_info->bat, NULL);
if (ret) {
dev_err(dev_info->dev, "failed to register battery\n");
goto fail;
INIT_DELAYED_WORK(&info->bat_work, ds278x_bat_work);
- ret = power_supply_register(&client->dev, &info->battery);
+ ret = power_supply_register(&client->dev, &info->battery, NULL);
if (ret) {
dev_err(&client->dev, "failed to register battery\n");
goto fail_register;
*/
psy->num_properties = ARRAY_SIZE(gab_props) + index;
- ret = power_supply_register(&pdev->dev, psy);
+ ret = power_supply_register(&pdev->dev, psy, NULL);
if (ret)
goto err_reg_fail;
if (ret)
return ret;
- ret = power_supply_register(&pdev->dev, &data->ac);
+ ret = power_supply_register(&pdev->dev, &data->ac, NULL);
if (ret)
return ret;
- ret = power_supply_register(&pdev->dev, &data->battery);
+ ret = power_supply_register(&pdev->dev, &data->battery, NULL);
if (ret) {
power_supply_unregister(&data->ac);
return ret;
static int gpio_charger_probe(struct platform_device *pdev)
{
const struct gpio_charger_platform_data *pdata = pdev->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct gpio_charger *gpio_charger;
struct power_supply *charger;
int ret;
charger->properties = gpio_charger_properties;
charger->num_properties = ARRAY_SIZE(gpio_charger_properties);
charger->get_property = gpio_charger_get_property;
- charger->supplied_to = pdata->supplied_to;
- charger->num_supplicants = pdata->num_supplicants;
- charger->of_node = pdev->dev.of_node;
+
+ psy_cfg.supplied_to = pdata->supplied_to;
+ psy_cfg.num_supplicants = pdata->num_supplicants;
+ psy_cfg.of_node = pdev->dev.of_node;
ret = gpio_request(pdata->gpio, dev_name(&pdev->dev));
if (ret) {
gpio_charger->pdata = pdata;
- ret = power_supply_register(&pdev->dev, charger);
+ ret = power_supply_register(&pdev->dev, charger, &psy_cfg);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to register power supply: %d\n",
ret);
pbi->batt.properties = pmic_battery_props;
pbi->batt.num_properties = ARRAY_SIZE(pmic_battery_props);
pbi->batt.get_property = pmic_battery_get_property;
- retval = power_supply_register(dev, &pbi->batt);
+ retval = power_supply_register(dev, &pbi->batt, NULL);
if (retval) {
dev_err(dev,
"%s(): failed to register pmic battery device with power supply subsystem\n",
pbi->usb.properties = pmic_usb_props;
pbi->usb.num_properties = ARRAY_SIZE(pmic_usb_props);
pbi->usb.get_property = pmic_usb_get_property;
- retval = power_supply_register(dev, &pbi->usb);
+ retval = power_supply_register(dev, &pbi->usb, NULL);
if (retval) {
dev_err(dev,
"%s(): failed to register pmic usb device with power supply subsystem\n",
platform_set_drvdata(pdev, mb);
queue_delayed_work(mb->wq, &mb->update, 1);
- ret = power_supply_register(&pdev->dev, µ_batt_power);
+ ret = power_supply_register(&pdev->dev, µ_batt_power, NULL);
if (ret < 0)
goto batt_err;
- ret = power_supply_register(&pdev->dev, µ_ac_power);
+ ret = power_supply_register(&pdev->dev, µ_ac_power, NULL);
if (ret < 0)
goto ac_err;
isp->psy.num_properties = ARRAY_SIZE(power_props);
isp->psy.get_property = isp1704_charger_get_property;
- ret = power_supply_register(isp->dev, &isp->psy);
+ ret = power_supply_register(isp->dev, &isp->psy, NULL);
if (ret)
goto fail1;
else
jz4740_adc_set_config(pdev->dev.parent, JZ_ADC_CONFIG_BAT_MB, 0);
- ret = power_supply_register(&pdev->dev, &jz_battery->battery);
+ ret = power_supply_register(&pdev->dev, &jz_battery->battery, NULL);
if (ret) {
dev_err(&pdev->dev, "power supply battery register failed.\n");
goto err_free_charge_irq;
static int lp8727_register_psy(struct lp8727_chg *pchg)
{
+ struct power_supply_config psy_cfg = {}; /* Only for ac and usb */
struct lp8727_psy *psy;
psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL);
pchg->psy = psy;
+ psy_cfg.supplied_to = battery_supplied_to;
+ psy_cfg.num_supplicants = ARRAY_SIZE(battery_supplied_to);
+
psy->ac.name = "ac";
psy->ac.type = POWER_SUPPLY_TYPE_MAINS;
psy->ac.properties = lp8727_charger_prop;
psy->ac.num_properties = ARRAY_SIZE(lp8727_charger_prop);
psy->ac.get_property = lp8727_charger_get_property;
- psy->ac.supplied_to = battery_supplied_to;
- psy->ac.num_supplicants = ARRAY_SIZE(battery_supplied_to);
- if (power_supply_register(pchg->dev, &psy->ac))
+ if (power_supply_register(pchg->dev, &psy->ac, &psy_cfg))
goto err_psy_ac;
psy->usb.name = "usb";
psy->usb.properties = lp8727_charger_prop;
psy->usb.num_properties = ARRAY_SIZE(lp8727_charger_prop);
psy->usb.get_property = lp8727_charger_get_property;
- psy->usb.supplied_to = battery_supplied_to;
- psy->usb.num_supplicants = ARRAY_SIZE(battery_supplied_to);
- if (power_supply_register(pchg->dev, &psy->usb))
+ if (power_supply_register(pchg->dev, &psy->usb, &psy_cfg))
goto err_psy_usb;
psy->batt.name = "main_batt";
psy->batt.get_property = lp8727_battery_get_property;
psy->batt.external_power_changed = lp8727_charger_changed;
- if (power_supply_register(pchg->dev, &psy->batt))
+ if (power_supply_register(pchg->dev, &psy->batt, NULL))
goto err_psy_batt;
return 0;
static int lp8788_psy_register(struct platform_device *pdev,
struct lp8788_charger *pchg)
{
+ struct power_supply_config charger_cfg = {};
+
pchg->charger.name = LP8788_CHARGER_NAME;
pchg->charger.type = POWER_SUPPLY_TYPE_MAINS;
pchg->charger.properties = lp8788_charger_prop;
pchg->charger.num_properties = ARRAY_SIZE(lp8788_charger_prop);
pchg->charger.get_property = lp8788_charger_get_property;
- pchg->charger.supplied_to = battery_supplied_to;
- pchg->charger.num_supplicants = ARRAY_SIZE(battery_supplied_to);
- if (power_supply_register(&pdev->dev, &pchg->charger))
+ charger_cfg.supplied_to = battery_supplied_to;
+ charger_cfg.num_supplicants = ARRAY_SIZE(battery_supplied_to);
+
+ if (power_supply_register(&pdev->dev, &pchg->charger, &charger_cfg))
return -EPERM;
pchg->battery.name = LP8788_BATTERY_NAME;
pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop);
pchg->battery.get_property = lp8788_battery_get_property;
- if (power_supply_register(&pdev->dev, &pchg->battery)) {
+ if (power_supply_register(&pdev->dev, &pchg->battery, NULL)) {
power_supply_unregister(&pchg->charger);
return -EPERM;
}
goto fail_comm;
}
- ret = power_supply_register(&client->dev, &info->supply);
+ ret = power_supply_register(&client->dev, &info->supply, NULL);
if (ret) {
dev_err(&client->dev, "failed to register ltc2941\n");
goto fail_register;
return ret;
}
- ret = power_supply_register(&pdev->dev, &chg->charger);
+ ret = power_supply_register(&pdev->dev, &chg->charger, NULL);
if (ret) {
dev_err(&pdev->dev, "failed: power supply register\n");
goto err;
chip->battery.properties = max17040_battery_props;
chip->battery.num_properties = ARRAY_SIZE(max17040_battery_props);
- ret = power_supply_register(&client->dev, &chip->battery);
+ ret = power_supply_register(&client->dev, &chip->battery, NULL);
if (ret) {
dev_err(&client->dev, "failed: power supply register\n");
return ret;
regmap_write(chip->regmap, MAX17042_LearnCFG, 0x0007);
}
- ret = power_supply_register(&client->dev, &chip->battery);
+ ret = power_supply_register(&client->dev, &chip->battery, NULL);
if (ret) {
dev_err(&client->dev, "failed: power supply register\n");
return ret;
goto err;
}
- ret = power_supply_register(&pdev->dev, &chg->charger);
+ ret = power_supply_register(&pdev->dev, &chg->charger, NULL);
if (ret) {
dev_err(&pdev->dev, "failed: power supply register\n");
goto err;
data->psy.properties = max8903_charger_props;
data->psy.num_properties = ARRAY_SIZE(max8903_charger_props);
- ret = power_supply_register(dev, &data->psy);
+ ret = power_supply_register(dev, &data->psy, NULL);
if (ret) {
dev_err(dev, "failed: power supply register.\n");
goto err;
static int max8925_power_probe(struct platform_device *pdev)
{
struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+ struct power_supply_config psy_cfg = {}; /* Only for ac and usb */
struct max8925_power_pdata *pdata = NULL;
struct max8925_power_info *info;
int ret;
info->adc = chip->adc;
platform_set_drvdata(pdev, info);
+ psy_cfg.supplied_to = pdata->supplied_to;
+ psy_cfg.num_supplicants = pdata->num_supplicants;
+
info->ac.name = "max8925-ac";
info->ac.type = POWER_SUPPLY_TYPE_MAINS;
info->ac.properties = max8925_ac_props;
info->ac.num_properties = ARRAY_SIZE(max8925_ac_props);
info->ac.get_property = max8925_ac_get_prop;
- info->ac.supplied_to = pdata->supplied_to;
- info->ac.num_supplicants = pdata->num_supplicants;
- ret = power_supply_register(&pdev->dev, &info->ac);
+ ret = power_supply_register(&pdev->dev, &info->ac, &psy_cfg);
if (ret)
goto out;
info->ac.dev->parent = &pdev->dev;
info->usb.properties = max8925_usb_props;
info->usb.num_properties = ARRAY_SIZE(max8925_usb_props);
info->usb.get_property = max8925_usb_get_prop;
- info->usb.supplied_to = pdata->supplied_to;
- info->usb.num_supplicants = pdata->num_supplicants;
- ret = power_supply_register(&pdev->dev, &info->usb);
+ ret = power_supply_register(&pdev->dev, &info->usb, &psy_cfg);
if (ret)
goto out_usb;
info->usb.dev->parent = &pdev->dev;
info->battery.properties = max8925_battery_props;
info->battery.num_properties = ARRAY_SIZE(max8925_battery_props);
info->battery.get_property = max8925_bat_get_prop;
- ret = power_supply_register(&pdev->dev, &info->battery);
+ ret = power_supply_register(&pdev->dev, &info->battery, NULL);
if (ret)
goto out_battery;
info->battery.dev->parent = &pdev->dev;
charger->dev = &pdev->dev;
charger->iodev = iodev;
- ret = power_supply_register(&pdev->dev, &charger->battery);
+ ret = power_supply_register(&pdev->dev, &charger->battery, NULL);
if (ret) {
dev_err(&pdev->dev, "failed: power supply register\n");
return ret;
max8998->battery.properties = max8998_battery_props;
max8998->battery.num_properties = ARRAY_SIZE(max8998_battery_props);
- ret = power_supply_register(max8998->dev, &max8998->battery);
+ ret = power_supply_register(max8998->dev, &max8998->battery, NULL);
if (ret) {
dev_err(max8998->dev, "failed: power supply register\n");
goto err;
/* Ignore the status. It doesn't actually matter */
- ret = power_supply_register(&pdev->dev, &olpc_ac);
+ ret = power_supply_register(&pdev->dev, &olpc_ac, NULL);
if (ret)
return ret;
olpc_bat.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
}
- ret = power_supply_register(&pdev->dev, &olpc_bat);
+ ret = power_supply_register(&pdev->dev, &olpc_bat, NULL);
if (ret)
goto battery_failed;
static int pcf50633_mbc_probe(struct platform_device *pdev)
{
+ struct power_supply_config psy_cfg = {};
struct pcf50633_mbc *mbc;
int ret;
int i;
pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i],
pcf50633_mbc_irq_handler, mbc);
+ psy_cfg.supplied_to = mbc->pcf->pdata->batteries;
+ psy_cfg.num_supplicants = mbc->pcf->pdata->num_batteries;
+
/* Create power supplies */
mbc->adapter.name = "adapter";
mbc->adapter.type = POWER_SUPPLY_TYPE_MAINS;
mbc->adapter.properties = power_props;
mbc->adapter.num_properties = ARRAY_SIZE(power_props);
mbc->adapter.get_property = &adapter_get_property;
- mbc->adapter.supplied_to = mbc->pcf->pdata->batteries;
- mbc->adapter.num_supplicants = mbc->pcf->pdata->num_batteries;
mbc->usb.name = "usb";
mbc->usb.type = POWER_SUPPLY_TYPE_USB;
mbc->usb.properties = power_props;
mbc->usb.num_properties = ARRAY_SIZE(power_props);
mbc->usb.get_property = usb_get_property;
- mbc->usb.supplied_to = mbc->pcf->pdata->batteries;
- mbc->usb.num_supplicants = mbc->pcf->pdata->num_batteries;
mbc->ac.name = "ac";
mbc->ac.type = POWER_SUPPLY_TYPE_MAINS;
mbc->ac.properties = power_props;
mbc->ac.num_properties = ARRAY_SIZE(power_props);
mbc->ac.get_property = ac_get_property;
- mbc->ac.supplied_to = mbc->pcf->pdata->batteries;
- mbc->ac.num_supplicants = mbc->pcf->pdata->num_batteries;
- ret = power_supply_register(&pdev->dev, &mbc->adapter);
+ ret = power_supply_register(&pdev->dev, &mbc->adapter, &psy_cfg);
if (ret) {
dev_err(mbc->pcf->dev, "failed to register adapter\n");
return ret;
}
- ret = power_supply_register(&pdev->dev, &mbc->usb);
+ ret = power_supply_register(&pdev->dev, &mbc->usb, &psy_cfg);
if (ret) {
dev_err(mbc->pcf->dev, "failed to register usb\n");
power_supply_unregister(&mbc->adapter);
return ret;
}
- ret = power_supply_register(&pdev->dev, &mbc->ac);
+ ret = power_supply_register(&pdev->dev, &mbc->ac, &psy_cfg);
if (ret) {
dev_err(mbc->pcf->dev, "failed to register ac\n");
power_supply_unregister(&mbc->adapter);
static struct power_supply pda_psy_ac = {
.name = "ac",
.type = POWER_SUPPLY_TYPE_MAINS,
- .supplied_to = pda_power_supplied_to,
- .num_supplicants = ARRAY_SIZE(pda_power_supplied_to),
.properties = pda_power_props,
.num_properties = ARRAY_SIZE(pda_power_props),
.get_property = pda_power_get_property,
static struct power_supply pda_psy_usb = {
.name = "usb",
.type = POWER_SUPPLY_TYPE_USB,
- .supplied_to = pda_power_supplied_to,
- .num_supplicants = ARRAY_SIZE(pda_power_supplied_to),
.properties = pda_power_props,
.num_properties = ARRAY_SIZE(pda_power_props),
.get_property = pda_power_get_property,
static int pda_power_probe(struct platform_device *pdev)
{
+ struct power_supply_config psy_cfg = {};
int ret = 0;
dev = &pdev->dev;
usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb");
if (pdata->supplied_to) {
- pda_psy_ac.supplied_to = pdata->supplied_to;
- pda_psy_ac.num_supplicants = pdata->num_supplicants;
- pda_psy_usb.supplied_to = pdata->supplied_to;
- pda_psy_usb.num_supplicants = pdata->num_supplicants;
+ psy_cfg.supplied_to = pdata->supplied_to;
+ psy_cfg.num_supplicants = pdata->num_supplicants;
+ } else {
+ psy_cfg.supplied_to = pda_power_supplied_to;
+ psy_cfg.num_supplicants = ARRAY_SIZE(pda_power_supplied_to);
}
#if IS_ENABLED(CONFIG_USB_PHY)
#endif
if (pdata->is_ac_online) {
- ret = power_supply_register(&pdev->dev, &pda_psy_ac);
+ ret = power_supply_register(&pdev->dev, &pda_psy_ac, &psy_cfg);
if (ret) {
dev_err(dev, "failed to register %s power supply\n",
pda_psy_ac.name);
}
if (pdata->is_usb_online) {
- ret = power_supply_register(&pdev->dev, &pda_psy_usb);
+ ret = power_supply_register(&pdev->dev, &pda_psy_usb, &psy_cfg);
if (ret) {
dev_err(dev, "failed to register %s power supply\n",
pda_psy_usb.name);
const struct i2c_device_id *id)
{
struct pm2xxx_platform_data *pl_data = i2c_client->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
struct pm2xxx_charger *pm2;
int ret = 0;
u8 val;
pm2->ac_chg.psy.properties = pm2xxx_charger_ac_props;
pm2->ac_chg.psy.num_properties = ARRAY_SIZE(pm2xxx_charger_ac_props);
pm2->ac_chg.psy.get_property = pm2xxx_charger_ac_get_property;
- pm2->ac_chg.psy.supplied_to = pm2->pdata->supplied_to;
- pm2->ac_chg.psy.num_supplicants = pm2->pdata->num_supplicants;
+
+ psy_cfg.supplied_to = pm2->pdata->supplied_to;
+ psy_cfg.num_supplicants = pm2->pdata->num_supplicants;
/* pm2xxx_charger sub-class */
pm2->ac_chg.ops.enable = &pm2xxx_charger_ac_en;
pm2->ac_chg.ops.kick_wd = &pm2xxx_charger_watchdog_kick;
}
/* Register AC charger class */
- ret = power_supply_register(pm2->dev, &pm2->ac_chg.psy);
+ ret = power_supply_register(pm2->dev, &pm2->ac_chg.psy, &psy_cfg);
if (ret) {
dev_err(pm2->dev, "failed to register AC charger\n");
goto free_regulator;
goto pdev_register_failed;
}
- ret = power_supply_register(&bat_pdev->dev, &pmu_ac);
+ ret = power_supply_register(&bat_pdev->dev, &pmu_ac, NULL);
if (ret)
goto ac_register_failed;
pbat->bat.get_property = pmu_bat_get_property;
pbat->pbi = &pmu_batteries[i];
- ret = power_supply_register(&bat_pdev->dev, &pbat->bat);
+ ret = power_supply_register(&bat_pdev->dev, &pbat->bat, NULL);
if (ret) {
kfree(pbat);
goto battery_register_failed;
#endif
static int __power_supply_register(struct device *parent,
- struct power_supply *psy, bool ws)
+ struct power_supply *psy,
+ const struct power_supply_config *cfg,
+ bool ws)
{
struct device *dev;
int rc;
dev->release = power_supply_dev_release;
dev_set_drvdata(dev, psy);
psy->dev = dev;
+ if (cfg) {
+ psy->drv_data = cfg->drv_data;
+ psy->of_node = cfg->of_node;
+ psy->supplied_to = cfg->supplied_to;
+ psy->num_supplicants = cfg->num_supplicants;
+ }
rc = dev_set_name(dev, "%s", psy->name);
if (rc)
return rc;
}
-int power_supply_register(struct device *parent, struct power_supply *psy)
+int power_supply_register(struct device *parent, struct power_supply *psy,
+ const struct power_supply_config *cfg)
{
- return __power_supply_register(parent, psy, true);
+ return __power_supply_register(parent, psy, cfg, true);
}
EXPORT_SYMBOL_GPL(power_supply_register);
-int power_supply_register_no_ws(struct device *parent, struct power_supply *psy)
+int power_supply_register_no_ws(struct device *parent, struct power_supply *psy,
+ const struct power_supply_config *cfg)
{
- return __power_supply_register(parent, psy, false);
+ return __power_supply_register(parent, psy, cfg, false);
}
EXPORT_SYMBOL_GPL(power_supply_register_no_ws);
power_supply_unregister(*psy);
}
-int devm_power_supply_register(struct device *parent, struct power_supply *psy)
+int devm_power_supply_register(struct device *parent, struct power_supply *psy,
+ const struct power_supply_config *cfg)
{
struct power_supply **ptr = devres_alloc(devm_power_supply_release,
sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return -ENOMEM;
- ret = __power_supply_register(parent, psy, true);
+ ret = __power_supply_register(parent, psy, cfg, true);
if (ret < 0)
devres_free(ptr);
else {
}
EXPORT_SYMBOL_GPL(devm_power_supply_register);
-int devm_power_supply_register_no_ws(struct device *parent, struct power_supply *psy)
+int devm_power_supply_register_no_ws(struct device *parent, struct power_supply *psy,
+ const struct power_supply_config *cfg)
{
struct power_supply **ptr = devres_alloc(devm_power_supply_release,
sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return -ENOMEM;
- ret = __power_supply_register(parent, psy, false);
+ ret = __power_supply_register(parent, psy, cfg, false);
if (ret < 0)
devres_free(ptr);
else {
battery->psy.properties = rt5033_battery_props;
battery->psy.num_properties = ARRAY_SIZE(rt5033_battery_props);
- ret = power_supply_register(&client->dev, &battery->psy);
+ ret = power_supply_register(&client->dev, &battery->psy, NULL);
if (ret) {
dev_err(&client->dev, "Failed to register power supply\n");
return ret;
goto error_channel_bsi;
}
- ret = power_supply_register(di->dev, &di->bat);
+ ret = power_supply_register(di->dev, &di->bat, NULL);
if (ret)
goto error_channel_vbat;
main_bat.cable_plugged = 0;
main_bat.status = POWER_SUPPLY_STATUS_DISCHARGING;
- ret = power_supply_register(&pdev->dev, &main_bat.psy);
+ ret = power_supply_register(&pdev->dev, &main_bat.psy, NULL);
if (ret)
goto err_reg_main;
if (pdata->backup_volt_mult) {
backup_bat.client = client;
backup_bat.pdata = pdev->dev.platform_data;
backup_bat.volt_value = -1;
- ret = power_supply_register(&pdev->dev, &backup_bat.psy);
+ ret = power_supply_register(&pdev->dev, &backup_bat.psy, NULL);
if (ret)
goto err_reg_backup;
}
{
struct sbs_info *chip;
struct sbs_platform_data *pdata = client->dev.platform_data;
+ struct power_supply_config psy_cfg = {};
int rc;
int irq;
char *name;
chip->power_supply.properties = sbs_properties;
chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties);
chip->power_supply.get_property = sbs_get_property;
- chip->power_supply.of_node = client->dev.of_node;
+ psy_cfg.of_node = client->dev.of_node;
/* ignore first notification of external change, it is generated
* from the power_supply_register call back
*/
goto exit_psupply;
}
- rc = power_supply_register(&client->dev, &chip->power_supply);
+ rc = power_supply_register(&client->dev, &chip->power_supply,
+ &psy_cfg);
if (rc) {
dev_err(&client->dev,
"%s: Failed to register power supply\n", __func__);
{
static char *battery[] = { "smb347-battery" };
const struct smb347_charger_platform_data *pdata;
+ struct power_supply_config psy_cfg = {}; /* Only for mains and usb */
struct device *dev = &client->dev;
struct smb347_charger *smb;
int ret;
if (ret < 0)
return ret;
+ psy_cfg.supplied_to = battery;
+ psy_cfg.num_supplicants = ARRAY_SIZE(battery);
if (smb->pdata->use_mains) {
smb->mains.name = "smb347-mains";
smb->mains.type = POWER_SUPPLY_TYPE_MAINS;
smb->mains.get_property = smb347_mains_get_property;
smb->mains.properties = smb347_mains_properties;
smb->mains.num_properties = ARRAY_SIZE(smb347_mains_properties);
- smb->mains.supplied_to = battery;
- smb->mains.num_supplicants = ARRAY_SIZE(battery);
- ret = power_supply_register(dev, &smb->mains);
+ ret = power_supply_register(dev, &smb->mains, &psy_cfg);
if (ret < 0)
return ret;
}
smb->usb.get_property = smb347_usb_get_property;
smb->usb.properties = smb347_usb_properties;
smb->usb.num_properties = ARRAY_SIZE(smb347_usb_properties);
- smb->usb.supplied_to = battery;
- smb->usb.num_supplicants = ARRAY_SIZE(battery);
- ret = power_supply_register(dev, &smb->usb);
+ ret = power_supply_register(dev, &smb->usb, &psy_cfg);
if (ret < 0) {
if (smb->pdata->use_mains)
power_supply_unregister(&smb->mains);
smb->battery.num_properties = ARRAY_SIZE(smb347_battery_properties);
- ret = power_supply_register(dev, &smb->battery);
+ ret = power_supply_register(dev, &smb->battery, NULL);
if (ret < 0) {
if (smb->pdata->use_usb)
power_supply_unregister(&smb->usb);
[TEST_AC] = {
.name = "test_ac",
.type = POWER_SUPPLY_TYPE_MAINS,
- .supplied_to = test_power_ac_supplied_to,
- .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
.properties = test_power_ac_props,
.num_properties = ARRAY_SIZE(test_power_ac_props),
.get_property = test_power_get_ac_property,
[TEST_USB] = {
.name = "test_usb",
.type = POWER_SUPPLY_TYPE_USB,
- .supplied_to = test_power_ac_supplied_to,
- .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
.properties = test_power_ac_props,
.num_properties = ARRAY_SIZE(test_power_ac_props),
.get_property = test_power_get_usb_property,
},
};
+static const struct power_supply_config test_power_configs[] = {
+ {
+ /* test_ac */
+ .supplied_to = test_power_ac_supplied_to,
+ .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
+ }, {
+ /* test_battery */
+ }, {
+ /* test_usb */
+ .supplied_to = test_power_ac_supplied_to,
+ .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
+ },
+};
static int __init test_power_init(void)
{
int ret;
BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies));
+ BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_configs));
for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++) {
- ret = power_supply_register(NULL, &test_power_supplies[i]);
+ ret = power_supply_register(NULL, &test_power_supplies[i],
+ &test_power_configs[i]);
if (ret) {
pr_err("%s: failed to register %s\n", __func__,
test_power_supplies[i].name);
INIT_WORK(&bat_work, tosa_bat_work);
- ret = power_supply_register(&dev->dev, &tosa_bat_main.psy);
+ ret = power_supply_register(&dev->dev, &tosa_bat_main.psy, NULL);
if (ret)
goto err_psy_reg_main;
- ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy);
+ ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy, NULL);
if (ret)
goto err_psy_reg_jacket;
- ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy);
+ ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy, NULL);
if (ret)
goto err_psy_reg_bu;
{
struct tps65090_charger *cdata;
struct tps65090_platform_data *pdata;
+ struct power_supply_config psy_cfg = {};
uint8_t status1 = 0;
int ret;
int irq;
cdata->ac.get_property = tps65090_ac_get_property;
cdata->ac.properties = tps65090_ac_props;
cdata->ac.num_properties = ARRAY_SIZE(tps65090_ac_props);
- cdata->ac.supplied_to = pdata->supplied_to;
- cdata->ac.num_supplicants = pdata->num_supplicants;
- cdata->ac.of_node = pdev->dev.of_node;
- ret = power_supply_register(&pdev->dev, &cdata->ac);
+ psy_cfg.supplied_to = pdata->supplied_to;
+ psy_cfg.num_supplicants = pdata->num_supplicants;
+ psy_cfg.of_node = pdev->dev.of_node;
+
+ ret = power_supply_register(&pdev->dev, &cdata->ac, &psy_cfg);
if (ret) {
dev_err(&pdev->dev, "failed: power supply register\n");
return ret;
bci->ac.num_properties = ARRAY_SIZE(twl4030_charger_props);
bci->ac.get_property = twl4030_bci_get_property;
- ret = power_supply_register(&pdev->dev, &bci->ac);
+ ret = power_supply_register(&pdev->dev, &bci->ac, NULL);
if (ret) {
dev_err(&pdev->dev, "failed to register ac: %d\n", ret);
goto fail_register_ac;
bci->usb_reg = regulator_get(bci->dev, "bci3v1");
- ret = power_supply_register(&pdev->dev, &bci->usb);
+ ret = power_supply_register(&pdev->dev, &bci->usb, NULL);
if (ret) {
dev_err(&pdev->dev, "failed to register usb: %d\n", ret);
goto fail_register_usb;
twl4030_madc_bat->pdata = pdata;
platform_set_drvdata(pdev, twl4030_madc_bat);
- ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
+ ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy, NULL);
if (ret < 0)
kfree(twl4030_madc_bat);
backup->properties = wm831x_backup_props;
backup->num_properties = ARRAY_SIZE(wm831x_backup_props);
backup->get_property = wm831x_backup_get_prop;
- ret = power_supply_register(&pdev->dev, backup);
+ ret = power_supply_register(&pdev->dev, backup, NULL);
return ret;
}
wall->properties = wm831x_wall_props;
wall->num_properties = ARRAY_SIZE(wm831x_wall_props);
wall->get_property = wm831x_wall_get_prop;
- ret = power_supply_register(&pdev->dev, wall);
+ ret = power_supply_register(&pdev->dev, wall, NULL);
if (ret)
goto err_kmalloc;
usb->properties = wm831x_usb_props;
usb->num_properties = ARRAY_SIZE(wm831x_usb_props);
usb->get_property = wm831x_usb_get_prop;
- ret = power_supply_register(&pdev->dev, usb);
+ ret = power_supply_register(&pdev->dev, usb, NULL);
if (ret)
goto err_wall;
battery->num_properties = ARRAY_SIZE(wm831x_bat_props);
battery->get_property = wm831x_bat_get_prop;
battery->use_for_apm = 1;
- ret = power_supply_register(&pdev->dev, battery);
+ ret = power_supply_register(&pdev->dev, battery, NULL);
if (ret)
goto err_usb;
}
ac->properties = wm8350_ac_props;
ac->num_properties = ARRAY_SIZE(wm8350_ac_props);
ac->get_property = wm8350_ac_get_prop;
- ret = power_supply_register(&pdev->dev, ac);
+ ret = power_supply_register(&pdev->dev, ac, NULL);
if (ret)
return ret;
battery->num_properties = ARRAY_SIZE(wm8350_bat_props);
battery->get_property = wm8350_bat_get_property;
battery->use_for_apm = 1;
- ret = power_supply_register(&pdev->dev, battery);
+ ret = power_supply_register(&pdev->dev, battery, NULL);
if (ret)
goto battery_failed;
usb->properties = wm8350_usb_props;
usb->num_properties = ARRAY_SIZE(wm8350_usb_props);
usb->get_property = wm8350_usb_get_prop;
- ret = power_supply_register(&pdev->dev, usb);
+ ret = power_supply_register(&pdev->dev, usb, NULL);
if (ret)
goto usb_failed;
bat_ps.properties = prop;
bat_ps.num_properties = props;
- ret = power_supply_register(&dev->dev, &bat_ps);
+ ret = power_supply_register(&dev->dev, &bat_ps, NULL);
if (!ret)
schedule_work(&bat_work);
else
INIT_WORK(&charger->bat_work, z2_batt_work);
- ret = power_supply_register(&client->dev, &charger->batt_ps);
+ ret = power_supply_register(&client->dev, &charger->batt_ps, NULL);
if (ret)
goto err4;
static struct power_supply nvec_psy = {
.name = "ac",
.type = POWER_SUPPLY_TYPE_MAINS,
- .supplied_to = nvec_power_supplied_to,
- .num_supplicants = ARRAY_SIZE(nvec_power_supplied_to),
.properties = nvec_power_props,
.num_properties = ARRAY_SIZE(nvec_power_props),
.get_property = nvec_power_get_property,
struct power_supply *psy;
struct nvec_power *power;
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
+ struct power_supply_config psy_cfg = {};
power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT);
if (power == NULL)
switch (pdev->id) {
case AC:
psy = &nvec_psy;
+ psy_cfg.supplied_to = nvec_power_supplied_to;
+ psy_cfg.num_supplicants = ARRAY_SIZE(nvec_power_supplied_to);
power->notifier.notifier_call = nvec_power_notifier;
if (pdev->id == BAT)
get_bat_mfg_data(power);
- return power_supply_register(&pdev->dev, psy);
+ return power_supply_register(&pdev->dev, psy, &psy_cfg);
}
static int nvec_power_remove(struct platform_device *pdev)
struct device;
struct device_node;
+/* Power supply instance specific configuration */
+struct power_supply_config {
+ struct device_node *of_node;
+ /* Driver private data */
+ void *drv_data;
+
+ char **supplied_to;
+ size_t num_supplicants;
+};
+
struct power_supply {
const char *name;
enum power_supply_type type;
#endif
extern int power_supply_register(struct device *parent,
- struct power_supply *psy);
+ struct power_supply *psy,
+ const struct power_supply_config *cfg);
extern int power_supply_register_no_ws(struct device *parent,
- struct power_supply *psy);
+ struct power_supply *psy,
+ const struct power_supply_config *cfg);
extern int devm_power_supply_register(struct device *parent,
- struct power_supply *psy);
+ struct power_supply *psy,
+ const struct power_supply_config *cfg);
extern int devm_power_supply_register_no_ws(struct device *parent,
- struct power_supply *psy);
+ struct power_supply *psy,
+ const struct power_supply_config *cfg);
extern void power_supply_unregister(struct power_supply *psy);
extern int power_supply_powers(struct power_supply *psy, struct device *dev);