diff options
Diffstat (limited to 'drivers/power/charger-manager.c')
-rw-r--r-- | drivers/power/charger-manager.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 9e4dab46eefd..7098a1ce2d3c 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
@@ -1656,7 +1656,7 @@ static inline struct charger_desc *cm_get_drv_data(struct platform_device *pdev) | |||
1656 | { | 1656 | { |
1657 | if (pdev->dev.of_node) | 1657 | if (pdev->dev.of_node) |
1658 | return of_cm_parse_desc(&pdev->dev); | 1658 | return of_cm_parse_desc(&pdev->dev); |
1659 | return (struct charger_desc *)dev_get_platdata(&pdev->dev); | 1659 | return dev_get_platdata(&pdev->dev); |
1660 | } | 1660 | } |
1661 | 1661 | ||
1662 | static int charger_manager_probe(struct platform_device *pdev) | 1662 | static int charger_manager_probe(struct platform_device *pdev) |
@@ -1677,7 +1677,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1677 | } | 1677 | } |
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | if (!desc) { | 1680 | if (IS_ERR(desc)) { |
1681 | dev_err(&pdev->dev, "No platform data (desc) found\n"); | 1681 | dev_err(&pdev->dev, "No platform data (desc) found\n"); |
1682 | return -ENODEV; | 1682 | return -ENODEV; |
1683 | } | 1683 | } |
@@ -1720,6 +1720,11 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1720 | return -EINVAL; | 1720 | return -EINVAL; |
1721 | } | 1721 | } |
1722 | 1722 | ||
1723 | if (!desc->psy_fuel_gauge) { | ||
1724 | dev_err(&pdev->dev, "No fuel gauge power supply defined\n"); | ||
1725 | return -EINVAL; | ||
1726 | } | ||
1727 | |||
1723 | /* Counting index only */ | 1728 | /* Counting index only */ |
1724 | while (desc->psy_charger_stat[i]) | 1729 | while (desc->psy_charger_stat[i]) |
1725 | i++; | 1730 | i++; |
@@ -1839,6 +1844,13 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1839 | device_init_wakeup(&pdev->dev, true); | 1844 | device_init_wakeup(&pdev->dev, true); |
1840 | device_set_wakeup_capable(&pdev->dev, false); | 1845 | device_set_wakeup_capable(&pdev->dev, false); |
1841 | 1846 | ||
1847 | /* | ||
1848 | * Charger-manager have to check the charging state right after | ||
1849 | * tialization of charger-manager and then update current charging | ||
1850 | * state. | ||
1851 | */ | ||
1852 | cm_monitor(); | ||
1853 | |||
1842 | schedule_work(&setup_polling); | 1854 | schedule_work(&setup_polling); |
1843 | 1855 | ||
1844 | return 0; | 1856 | return 0; |