aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoic Pallardy <loic.pallardy@stericsson.com>2012-05-10 09:33:56 -0400
committerLee Jones <lee.jones@linaro.org>2013-01-23 09:39:15 -0500
commite07a56453b14b929cf01bf032cc3e3220094609c (patch)
tree78fff3a900cdb885a58da090575e66656a6861c8
parente3455002d04276c256a531f7175dce0f7d1cb78a (diff)
pm2301: Update watchdog for pm2xxx support
AB and PMxxx doesn't have same watchdog refresh period. Add watchdog to refresh period parameters in x500 charger structure, this should kick watchdog every 30sec. The AC charging should also kick both pm2xxx and the AB charger watchdog. 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> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--drivers/power/ab8500_charger.c6
-rw-r--r--drivers/power/abx500_chargalg.c12
-rw-r--r--drivers/power/pm2301_charger.c2
-rw-r--r--drivers/power/pm2301_charger.h2
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h3
5 files changed, 23 insertions, 2 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index 4c66172aaa64..0483e7cb2268 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -93,6 +93,8 @@
93 93
94#define CHARGER_STATUS_POLL 10 /* in ms */ 94#define CHARGER_STATUS_POLL 10 /* in ms */
95 95
96#define CHG_WD_INTERVAL (60 * HZ)
97
96/* UsbLineStatus register - usb types */ 98/* UsbLineStatus register - usb types */
97enum ab8500_charger_link_status { 99enum ab8500_charger_link_status {
98 USB_STAT_NOT_CONFIGURED, 100 USB_STAT_NOT_CONFIGURED,
@@ -2953,7 +2955,9 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2953 ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; 2955 ARRAY_SIZE(ab8500_charger_voltage_map) - 1];
2954 di->ac_chg.max_out_curr = ab8500_charger_current_map[ 2956 di->ac_chg.max_out_curr = ab8500_charger_current_map[
2955 ARRAY_SIZE(ab8500_charger_current_map) - 1]; 2957 ARRAY_SIZE(ab8500_charger_current_map) - 1];
2958 di->ac_chg.wdt_refresh = CHG_WD_INTERVAL;
2956 di->ac_chg.enabled = di->pdata->ac_enabled; 2959 di->ac_chg.enabled = di->pdata->ac_enabled;
2960 di->ac_chg.external = false;
2957 2961
2958 /* USB supply */ 2962 /* USB supply */
2959 /* power_supply base class */ 2963 /* power_supply base class */
@@ -2972,7 +2976,9 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2972 ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; 2976 ARRAY_SIZE(ab8500_charger_voltage_map) - 1];
2973 di->usb_chg.max_out_curr = ab8500_charger_current_map[ 2977 di->usb_chg.max_out_curr = ab8500_charger_current_map[
2974 ARRAY_SIZE(ab8500_charger_current_map) - 1]; 2978 ARRAY_SIZE(ab8500_charger_current_map) - 1];
2979 di->usb_chg.wdt_refresh = CHG_WD_INTERVAL;
2975 di->usb_chg.enabled = di->pdata->usb_enabled; 2980 di->usb_chg.enabled = di->pdata->usb_enabled;
2981 di->usb_chg.external = false;
2976 2982
2977 /* Create a work queue for the charger */ 2983 /* Create a work queue for the charger */
2978 di->charger_wq = 2984 di->charger_wq =
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index f59bc025ca58..7defb3e91d59 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -445,8 +445,18 @@ static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di)
445{ 445{
446 /* Check if charger exists and kick watchdog if charging */ 446 /* Check if charger exists and kick watchdog if charging */
447 if (di->ac_chg && di->ac_chg->ops.kick_wd && 447 if (di->ac_chg && di->ac_chg->ops.kick_wd &&
448 di->chg_info.online_chg & AC_CHG) 448 di->chg_info.online_chg & AC_CHG) {
449 /*
450 * If AB charger watchdog expired, pm2xxx charging
451 * gets disabled. To be safe, kick both AB charger watchdog
452 * and pm2xxx watchdog.
453 */
454 if (di->ac_chg->external &&
455 di->usb_chg && di->usb_chg->ops.kick_wd)
456 di->usb_chg->ops.kick_wd(di->usb_chg);
457
449 return di->ac_chg->ops.kick_wd(di->ac_chg); 458 return di->ac_chg->ops.kick_wd(di->ac_chg);
459 }
450 else if (di->usb_chg && di->usb_chg->ops.kick_wd && 460 else if (di->usb_chg && di->usb_chg->ops.kick_wd &&
451 di->chg_info.online_chg & USB_CHG) 461 di->chg_info.online_chg & USB_CHG)
452 return di->usb_chg->ops.kick_wd(di->usb_chg); 462 return di->usb_chg->ops.kick_wd(di->usb_chg);
diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c
index 085e468d8a2b..8c1dd5628d16 100644
--- a/drivers/power/pm2301_charger.c
+++ b/drivers/power/pm2301_charger.c
@@ -875,7 +875,9 @@ static int __devinit pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
875 ARRAY_SIZE(pm2xxx_charger_voltage_map) - 1]; 875 ARRAY_SIZE(pm2xxx_charger_voltage_map) - 1];
876 pm2->ac_chg.max_out_curr = pm2xxx_charger_current_map[ 876 pm2->ac_chg.max_out_curr = pm2xxx_charger_current_map[
877 ARRAY_SIZE(pm2xxx_charger_current_map) - 1]; 877 ARRAY_SIZE(pm2xxx_charger_current_map) - 1];
878 pm2->ac_chg.wdt_refresh = WD_KICK_INTERVAL;
878 pm2->ac_chg.enabled = true; 879 pm2->ac_chg.enabled = true;
880 pm2->ac_chg.external = true;
879 881
880 /* Create a work queue for the charger */ 882 /* Create a work queue for the charger */
881 pm2->charger_wq = 883 pm2->charger_wq =
diff --git a/drivers/power/pm2301_charger.h b/drivers/power/pm2301_charger.h
index da804716aa82..3531cc5a9056 100644
--- a/drivers/power/pm2301_charger.h
+++ b/drivers/power/pm2301_charger.h
@@ -32,7 +32,7 @@
32 32
33/* Watchdog timeout constant */ 33/* Watchdog timeout constant */
34#define WD_TIMER 0x30 /* 4min */ 34#define WD_TIMER 0x30 /* 4min */
35#define WD_KICK_INTERVAL (60 * HZ) 35#define WD_KICK_INTERVAL (30 * HZ)
36 36
37#define PM2XXX_NUM_INT_REG 0x6 37#define PM2XXX_NUM_INT_REG 0x6
38 38
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index 5b77a610c6b6..d43ac0f35526 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -28,13 +28,16 @@ struct ux500_charger_ops {
28 * @max_out_volt maximum output charger voltage in mV 28 * @max_out_volt maximum output charger voltage in mV
29 * @max_out_curr maximum output charger current in mA 29 * @max_out_curr maximum output charger current in mA
30 * @enabled indicates if this charger is used or not 30 * @enabled indicates if this charger is used or not
31 * @external external charger unit (pm2xxx)
31 */ 32 */
32struct ux500_charger { 33struct ux500_charger {
33 struct power_supply psy; 34 struct power_supply psy;
34 struct ux500_charger_ops ops; 35 struct ux500_charger_ops ops;
35 int max_out_volt; 36 int max_out_volt;
36 int max_out_curr; 37 int max_out_curr;
38 int wdt_refresh;
37 bool enabled; 39 bool enabled;
40 bool external;
38}; 41};
39 42
40#endif 43#endif