diff options
Diffstat (limited to 'drivers/power/bq2415x_charger.c')
-rw-r--r-- | drivers/power/bq2415x_charger.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index e384844a1ae1..1f49986fc605 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c | |||
@@ -1579,8 +1579,15 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1579 | if (np) { | 1579 | if (np) { |
1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); | 1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); |
1581 | 1581 | ||
1582 | if (!bq->notify_psy) | 1582 | if (IS_ERR(bq->notify_psy)) { |
1583 | return -EPROBE_DEFER; | 1583 | dev_info(&client->dev, |
1584 | "no 'ti,usb-charger-detection' property (err=%ld)\n", | ||
1585 | PTR_ERR(bq->notify_psy)); | ||
1586 | bq->notify_psy = NULL; | ||
1587 | } else if (!bq->notify_psy) { | ||
1588 | ret = -EPROBE_DEFER; | ||
1589 | goto error_2; | ||
1590 | } | ||
1584 | } | 1591 | } |
1585 | else if (pdata->notify_device) | 1592 | else if (pdata->notify_device) |
1586 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); | 1593 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); |
@@ -1602,27 +1609,27 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1602 | ret = of_property_read_u32(np, "ti,current-limit", | 1609 | ret = of_property_read_u32(np, "ti,current-limit", |
1603 | &bq->init_data.current_limit); | 1610 | &bq->init_data.current_limit); |
1604 | if (ret) | 1611 | if (ret) |
1605 | return ret; | 1612 | goto error_2; |
1606 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", | 1613 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", |
1607 | &bq->init_data.weak_battery_voltage); | 1614 | &bq->init_data.weak_battery_voltage); |
1608 | if (ret) | 1615 | if (ret) |
1609 | return ret; | 1616 | goto error_2; |
1610 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", | 1617 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", |
1611 | &bq->init_data.battery_regulation_voltage); | 1618 | &bq->init_data.battery_regulation_voltage); |
1612 | if (ret) | 1619 | if (ret) |
1613 | return ret; | 1620 | goto error_2; |
1614 | ret = of_property_read_u32(np, "ti,charge-current", | 1621 | ret = of_property_read_u32(np, "ti,charge-current", |
1615 | &bq->init_data.charge_current); | 1622 | &bq->init_data.charge_current); |
1616 | if (ret) | 1623 | if (ret) |
1617 | return ret; | 1624 | goto error_2; |
1618 | ret = of_property_read_u32(np, "ti,termination-current", | 1625 | ret = of_property_read_u32(np, "ti,termination-current", |
1619 | &bq->init_data.termination_current); | 1626 | &bq->init_data.termination_current); |
1620 | if (ret) | 1627 | if (ret) |
1621 | return ret; | 1628 | goto error_2; |
1622 | ret = of_property_read_u32(np, "ti,resistor-sense", | 1629 | ret = of_property_read_u32(np, "ti,resistor-sense", |
1623 | &bq->init_data.resistor_sense); | 1630 | &bq->init_data.resistor_sense); |
1624 | if (ret) | 1631 | if (ret) |
1625 | return ret; | 1632 | goto error_2; |
1626 | } else { | 1633 | } else { |
1627 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); | 1634 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); |
1628 | } | 1635 | } |