//struct timer_list timer;
struct workqueue_struct *wq;
struct delayed_work delay_work;
+ struct delayed_work check_work;
struct work_struct dcwakeup_work;
struct work_struct lowerpower_work;
bool resume;
int full_times;
int charge_full_flag;
+ int stop_check;
};
#ifdef CONFIG_PM
if (bat ->resume) {
- if( (bat->resume_time - bat->suspend_time) >= 1800 )
+ // if( (bat->resume_time - bat->suspend_time) >= 1800 )
rk30_adc_battery_resume_check(bat);
- else
- bat->bat_capacity = bat->suspend_capacity;
+ //else
+ //bat->bat_capacity = bat->suspend_capacity;
bat ->resume = false;
bat ->bat_change =1;
}
#endif
-
+ bat->stop_check = 1;
if (bat ->poweron_check){
bat ->poweron_check = 0;
rk30_adc_battery_poweron_capacity_check(bat);
return IRQ_HANDLED;
}
+static void rk_adc_battery_check_work(struct work_struct *work)
+{
+ struct rk30_adc_battery_data *bat = container_of((work), \
+ struct rk30_adc_battery_data, check_work);
+
+ if(1 == get_ac_status(bat)){
+ bat->bat_status = POWER_SUPPLY_STATUS_CHARGING;
+ bat -> ac_charging = 1;
+ }
+
+ power_supply_changed(&bat ->ac);
+ if(bat->stop_check != 1)
+ queue_delayed_work(bat ->wq, &bat ->check_work, msecs_to_jiffies(TIMER_MS_COUNTS));
+
+}
static int rk30_adc_battery_probe(struct platform_device *pdev)
{
int ret;
data->start_voltage_status = 0;
data->charge_full_flag =0;
data->pSamples = data->adc_samples;
+ data->stop_check = 0;
data->bat_status = POWER_SUPPLY_STATUS_NOT_CHARGING;
wake_lock_init(&batt_wake_lock, WAKE_LOCK_SUSPEND, "batt_lock");
queue_delayed_work(data->wq, &data->delay_work, msecs_to_jiffies(TIMER_MS_COUNTS));
data ->poweron_check = 0;
}
+ INIT_DELAYED_WORK(&data->check_work, rk_adc_battery_check_work);
+ queue_delayed_work(data ->wq, &data ->check_work, msecs_to_jiffies(TIMER_MS_COUNTS));
if( pdata->batt_low_pin != INVALID_GPIO){
if (gpio_get_value(pdata->batt_low_pin) ==0){
if (pdata->dc_det_pin != INVALID_GPIO)
cancel_delayed_work_sync(&data->dcwakeup_work);
#endif
+ cancel_delayed_work_sync(&data->check_work);
if( pdata->batt_low_pin != INVALID_GPIO)
cancel_delayed_work_sync(&data->lowerpower_work);
{
platform_driver_unregister(&rk30_adc_battery_driver);
}
-module_init(rk30_adc_battery_init);//module_init(rk30_adc_battery_init);//
-//subsys_initcall(rk30_adc_battery_init);
+//module_init(rk30_adc_battery_init);//module_init(rk30_adc_battery_init);//
+subsys_initcall(rk30_adc_battery_init);
//fs_initcall(rk30_adc_battery_init);
module_exit(rk30_adc_battery_exit);