aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_charger.c
diff options
context:
space:
mode:
authorMichel JAOUEN <michel.jaouen@stericsson.com>2012-04-26 04:00:04 -0400
committerLee Jones <lee.jones@linaro.org>2013-01-23 06:33:02 -0500
commit01ec8c5423901c4fe8d97f786ed9a0c31215b53a (patch)
tree51e12bce93f8d030f7896a7df8dc5a66ec052d3f /drivers/power/ab8500_charger.c
parent8fd526fd18233887ba652079a369f4eee0de9d9d (diff)
pm2301: Provide u9540 support for the pm2301 charger
AC charger driver for the DB9540 based platforms. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Loic Pallardy <loic.pallardy@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Diffstat (limited to 'drivers/power/ab8500_charger.c')
-rw-r--r--drivers/power/ab8500_charger.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index d5a8bdadb49a..43ec82ba4275 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2830,8 +2830,11 @@ static int ab8500_charger_remove(struct platform_device *pdev)
2830 destroy_workqueue(di->charger_wq); 2830 destroy_workqueue(di->charger_wq);
2831 2831
2832 flush_scheduled_work(); 2832 flush_scheduled_work();
2833 power_supply_unregister(&di->usb_chg.psy); 2833 if(di->usb_chg.enabled)
2834 power_supply_unregister(&di->ac_chg.psy); 2834 power_supply_unregister(&di->usb_chg.psy);
2835 if(di->ac_chg.enabled)
2836 power_supply_unregister(&di->ac_chg.psy);
2837
2835 platform_set_drvdata(pdev, NULL); 2838 platform_set_drvdata(pdev, NULL);
2836 2839
2837 return 0; 2840 return 0;
@@ -2899,6 +2902,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2899 ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; 2902 ARRAY_SIZE(ab8500_charger_voltage_map) - 1];
2900 di->ac_chg.max_out_curr = ab8500_charger_current_map[ 2903 di->ac_chg.max_out_curr = ab8500_charger_current_map[
2901 ARRAY_SIZE(ab8500_charger_current_map) - 1]; 2904 ARRAY_SIZE(ab8500_charger_current_map) - 1];
2905 di->ac_chg.enabled = di->pdata->ac_enabled;
2902 2906
2903 /* USB supply */ 2907 /* USB supply */
2904 /* power_supply base class */ 2908 /* power_supply base class */
@@ -2917,7 +2921,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2917 ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; 2921 ARRAY_SIZE(ab8500_charger_voltage_map) - 1];
2918 di->usb_chg.max_out_curr = ab8500_charger_current_map[ 2922 di->usb_chg.max_out_curr = ab8500_charger_current_map[
2919 ARRAY_SIZE(ab8500_charger_current_map) - 1]; 2923 ARRAY_SIZE(ab8500_charger_current_map) - 1];
2920 2924 di->usb_chg.enabled = di->pdata->usb_enabled;
2921 2925
2922 /* Create a work queue for the charger */ 2926 /* Create a work queue for the charger */
2923 di->charger_wq = 2927 di->charger_wq =
@@ -2995,17 +2999,21 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2995 } 2999 }
2996 3000
2997 /* Register AC charger class */ 3001 /* Register AC charger class */
2998 ret = power_supply_register(di->dev, &di->ac_chg.psy); 3002 if(di->ac_chg.enabled) {
2999 if (ret) { 3003 ret = power_supply_register(di->dev, &di->ac_chg.psy);
3000 dev_err(di->dev, "failed to register AC charger\n"); 3004 if (ret) {
3001 goto free_charger_wq; 3005 dev_err(di->dev, "failed to register AC charger\n");
3006 goto free_charger_wq;
3007 }
3002 } 3008 }
3003 3009
3004 /* Register USB charger class */ 3010 /* Register USB charger class */
3005 ret = power_supply_register(di->dev, &di->usb_chg.psy); 3011 if(di->usb_chg.enabled) {
3006 if (ret) { 3012 ret = power_supply_register(di->dev, &di->usb_chg.psy);
3007 dev_err(di->dev, "failed to register USB charger\n"); 3013 if (ret) {
3008 goto free_ac; 3014 dev_err(di->dev, "failed to register USB charger\n");
3015 goto free_ac;
3016 }
3009 } 3017 }
3010 3018
3011 di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); 3019 di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
@@ -3085,9 +3093,11 @@ free_irq:
3085put_usb_phy: 3093put_usb_phy:
3086 usb_put_phy(di->usb_phy); 3094 usb_put_phy(di->usb_phy);
3087free_usb: 3095free_usb:
3088 power_supply_unregister(&di->usb_chg.psy); 3096 if(di->usb_chg.enabled)
3097 power_supply_unregister(&di->usb_chg.psy);
3089free_ac: 3098free_ac:
3090 power_supply_unregister(&di->ac_chg.psy); 3099 if(di->ac_chg.enabled)
3100 power_supply_unregister(&di->ac_chg.psy);
3091free_charger_wq: 3101free_charger_wq:
3092 destroy_workqueue(di->charger_wq); 3102 destroy_workqueue(di->charger_wq);
3093 return ret; 3103 return ret;