diff options
Diffstat (limited to 'drivers/power/pcf50633-charger.c')
-rw-r--r-- | drivers/power/pcf50633-charger.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c index 771c4f0fb8ac..88fe7db2afcf 100644 --- a/drivers/power/pcf50633-charger.c +++ b/drivers/power/pcf50633-charger.c | |||
@@ -368,6 +368,7 @@ static const u8 mbc_irq_handlers[] = { | |||
368 | 368 | ||
369 | static int pcf50633_mbc_probe(struct platform_device *pdev) | 369 | static int pcf50633_mbc_probe(struct platform_device *pdev) |
370 | { | 370 | { |
371 | struct power_supply_config psy_cfg = {}; | ||
371 | struct pcf50633_mbc *mbc; | 372 | struct pcf50633_mbc *mbc; |
372 | int ret; | 373 | int ret; |
373 | int i; | 374 | int i; |
@@ -385,45 +386,42 @@ static int pcf50633_mbc_probe(struct platform_device *pdev) | |||
385 | pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i], | 386 | pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i], |
386 | pcf50633_mbc_irq_handler, mbc); | 387 | pcf50633_mbc_irq_handler, mbc); |
387 | 388 | ||
389 | psy_cfg.supplied_to = mbc->pcf->pdata->batteries; | ||
390 | psy_cfg.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
391 | |||
388 | /* Create power supplies */ | 392 | /* Create power supplies */ |
389 | mbc->adapter.name = "adapter"; | 393 | mbc->adapter.name = "adapter"; |
390 | mbc->adapter.type = POWER_SUPPLY_TYPE_MAINS; | 394 | mbc->adapter.type = POWER_SUPPLY_TYPE_MAINS; |
391 | mbc->adapter.properties = power_props; | 395 | mbc->adapter.properties = power_props; |
392 | mbc->adapter.num_properties = ARRAY_SIZE(power_props); | 396 | mbc->adapter.num_properties = ARRAY_SIZE(power_props); |
393 | mbc->adapter.get_property = &adapter_get_property; | 397 | mbc->adapter.get_property = &adapter_get_property; |
394 | mbc->adapter.supplied_to = mbc->pcf->pdata->batteries; | ||
395 | mbc->adapter.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
396 | 398 | ||
397 | mbc->usb.name = "usb"; | 399 | mbc->usb.name = "usb"; |
398 | mbc->usb.type = POWER_SUPPLY_TYPE_USB; | 400 | mbc->usb.type = POWER_SUPPLY_TYPE_USB; |
399 | mbc->usb.properties = power_props; | 401 | mbc->usb.properties = power_props; |
400 | mbc->usb.num_properties = ARRAY_SIZE(power_props); | 402 | mbc->usb.num_properties = ARRAY_SIZE(power_props); |
401 | mbc->usb.get_property = usb_get_property; | 403 | mbc->usb.get_property = usb_get_property; |
402 | mbc->usb.supplied_to = mbc->pcf->pdata->batteries; | ||
403 | mbc->usb.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
404 | 404 | ||
405 | mbc->ac.name = "ac"; | 405 | mbc->ac.name = "ac"; |
406 | mbc->ac.type = POWER_SUPPLY_TYPE_MAINS; | 406 | mbc->ac.type = POWER_SUPPLY_TYPE_MAINS; |
407 | mbc->ac.properties = power_props; | 407 | mbc->ac.properties = power_props; |
408 | mbc->ac.num_properties = ARRAY_SIZE(power_props); | 408 | mbc->ac.num_properties = ARRAY_SIZE(power_props); |
409 | mbc->ac.get_property = ac_get_property; | 409 | mbc->ac.get_property = ac_get_property; |
410 | mbc->ac.supplied_to = mbc->pcf->pdata->batteries; | ||
411 | mbc->ac.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
412 | 410 | ||
413 | ret = power_supply_register(&pdev->dev, &mbc->adapter); | 411 | ret = power_supply_register(&pdev->dev, &mbc->adapter, &psy_cfg); |
414 | if (ret) { | 412 | if (ret) { |
415 | dev_err(mbc->pcf->dev, "failed to register adapter\n"); | 413 | dev_err(mbc->pcf->dev, "failed to register adapter\n"); |
416 | return ret; | 414 | return ret; |
417 | } | 415 | } |
418 | 416 | ||
419 | ret = power_supply_register(&pdev->dev, &mbc->usb); | 417 | ret = power_supply_register(&pdev->dev, &mbc->usb, &psy_cfg); |
420 | if (ret) { | 418 | if (ret) { |
421 | dev_err(mbc->pcf->dev, "failed to register usb\n"); | 419 | dev_err(mbc->pcf->dev, "failed to register usb\n"); |
422 | power_supply_unregister(&mbc->adapter); | 420 | power_supply_unregister(&mbc->adapter); |
423 | return ret; | 421 | return ret; |
424 | } | 422 | } |
425 | 423 | ||
426 | ret = power_supply_register(&pdev->dev, &mbc->ac); | 424 | ret = power_supply_register(&pdev->dev, &mbc->ac, &psy_cfg); |
427 | if (ret) { | 425 | if (ret) { |
428 | dev_err(mbc->pcf->dev, "failed to register ac\n"); | 426 | dev_err(mbc->pcf->dev, "failed to register ac\n"); |
429 | power_supply_unregister(&mbc->adapter); | 427 | power_supply_unregister(&mbc->adapter); |