#define CHARGE_POWERSAVE_FREQ_ACT "charge_powersave_freq_act"
#define CHARGE_RELEASE_FREQ_ACT "charge_release_freq_act"
-#define POWER_OFF_CHECK_TIMER (30)
-
#define BATTERY_CHARGING 65535
#define BATTERY_UNKNOWN -1
#define BATTERY_DISABLED 0
#define LOWBAT_CPU_CTRL_ID "id6"
#define LOWBAT_CPU_FREQ_RATE (0.7)
-#define POWER_OFF_UNLOCK 0
-#define POWER_OFF_LOCK 1
-
#define VCONF_KEY_BATTERY_WARNING_LEVEL "db/sysman/battery_warning_level"
enum low_battery_type {
static dd_list *lpe;
static int scenario_count;
-static int power_off_lock = POWER_OFF_UNLOCK;
-static guint power_off_timer;
static int lowbat_monitor_init(void *data);
return done;
}
-static void power_off_pm_lock(void)
-{
- if (power_off_lock == POWER_OFF_UNLOCK) {
- if (disp_plgn.pm_lock_internal)
- disp_plgn.pm_lock_internal(INTERNAL_LOCK_LOWBAT, LCD_OFF, STAY_CUR_STATE, 0);
- power_off_lock = POWER_OFF_LOCK;
- }
-}
-
-static void power_off_pm_unlock(void)
-{
- if (power_off_lock == POWER_OFF_LOCK) {
- if (disp_plgn.pm_unlock_internal)
- disp_plgn.pm_unlock_internal(INTERNAL_LOCK_LOWBAT, LCD_OFF, PM_SLEEP_MARGIN);
- power_off_lock = POWER_OFF_UNLOCK;
- }
-}
-
-static gboolean power_off_cb(void *data)
-{
- power_off_pm_unlock();
- power_execute(POWER_POWEROFF);
- return G_SOURCE_REMOVE;
-}
-
-void power_off_timer_start(void)
-{
- if (power_off_timer)
- return;
- _I("Power off after %d.", POWER_OFF_CHECK_TIMER);
- power_off_pm_lock();
- power_off_timer = g_timeout_add_seconds(POWER_OFF_CHECK_TIMER,
- power_off_cb, NULL);
- if (power_off_timer == 0)
- _E("Failed to add battery init timer during booting.");
-}
-
-void power_off_timer_stop(void)
-{
- if (!power_off_timer)
- return;
- _I("Cancel power off.");
- power_off_pm_unlock();
- g_source_remove(power_off_timer);
- power_off_timer = 0;
-}
-
static int get_lowbat_noti_value(int low_battery_type, char **active_noti, char **event_noti)
{
int len;
static int battery_check_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CHARGE_CHECK_ACT);
}
static int battery_warning_low_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(WARNING_LOW_BAT_ACT);
}
static int battery_critical_low_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CRITICAL_LOW_BAT_ACT);
}
int battery_power_off_act(void *data)
{
- int ret;
- ret = lowbat_popup(CRITICAL_LOW_BAT_ACT);
- power_off_timer_start();
- return ret;
+ power_execute(POWER_POWEROFF);
+ return 0;
}
int battery_charge_err_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CHARGE_ERROR_ACT);
}
int battery_charge_err_low_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CHARGE_ERROR_LOW_ACT);
}
int battery_charge_err_high_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CHARGE_ERROR_HIGH_ACT);
}
int battery_charge_err_ovp_act(void *data)
{
- power_off_timer_stop();
return lowbat_popup(CHARGE_ERROR_OVP_ACT);
}