*/
static bool is_polling_required(struct charger_manager *cm)
{
- switch (cm->desc->polling_mode) {
+ enum polling_modes polling_mode;
+
+ if (cm_suspended
+ && cm->desc->poll_mode_sleep >= 0)
+ polling_mode = cm->desc->poll_mode_sleep;
+ else
+ polling_mode = cm->desc->poll_mode_normal;
+
+ switch (polling_mode) {
case CM_POLL_DISABLE:
return false;
case CM_POLL_ALWAYS:
return is_charging(cm);
default:
dev_warn(cm->dev, "Incorrect polling_mode (%d)\n",
- cm->desc->polling_mode);
+ polling_mode);
}
return false;
u32 poll_mode = CM_POLL_DISABLE;
u32 battery_stat = CM_NO_BATTERY;
int num_chgs = 0;
+ int ret;
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
if (!desc)
of_property_read_string(np, "cm-name", &desc->psy_name);
of_property_read_u32(np, "cm-poll-mode", &poll_mode);
- desc->polling_mode = poll_mode;
+ desc->poll_mode_normal = poll_mode;
+
+ /* Polling mode in sleep state */
+ ret = of_property_read_u32(np, "cm-poll-mode-sleep", &poll_mode);
+ desc->poll_mode_sleep = (!ret) ? poll_mode : -EINVAL;
of_property_read_u32(np, "cm-poll-interval",
&desc->polling_interval_ms);
/**
* struct charger_desc
* @psy_name: the name of power-supply-class for charger manager
- * @polling_mode:
- * Determine which polling mode will be used
+ * @poll_mode_normal:
+ * Determine which polling mode will be used in normal state.
+ * @poll_mode_sleep:
+ * Determine which polling mode will be used in sleep state.
* @fullbatt_vchkdrop_uV:
* Check voltage drop after the battery is fully charged.
* If it has dropped more than fullbatt_vchkdrop_uV
struct charger_desc {
const char *psy_name;
- enum polling_modes polling_mode;
+ enum polling_modes poll_mode_normal;
+ enum polling_modes poll_mode_sleep;
unsigned int polling_interval_ms;
unsigned int fullbatt_vchkdrop_uV;