static void adc_monitor_work(struct work_struct *work) { struct sec_fuelgauge_info *fuelgauge = container_of(work, struct sec_fuelgauge_info, info.monitor_work.work); fuelgauge->info.current_now = adc_get_current(fuelgauge->client); fuelgauge->info.voltage_now = adc_get_vcell(fuelgauge->client); if (fuelgauge->info.reset_percentage) adc_reset_voltage_avg(fuelgauge->client, fuelgauge->info.voltage_now, fuelgauge->info.reset_percentage); fuelgauge->info.voltage_avg = adc_get_avg_vcell(fuelgauge->client); if (fuelgauge->info.reset_percentage) { adc_reset_voltage_ocv(fuelgauge->client, fuelgauge->info.voltage_avg); fuelgauge->info.reset_percentage = 0; } fuelgauge->info.voltage_ocv = adc_get_ocv(fuelgauge->client); fuelgauge->info.current_avg = adc_get_current_average(fuelgauge->client); fuelgauge->info.capacity = adc_get_soc(fuelgauge->client); dev_info(&fuelgauge->client->dev, "%s:Vnow(%dmV),Vavg(%dmV),Vocv(%dmV)," "Inow(%dmA),Iavg(%dmA),SOC(%d%%)\n", __func__, fuelgauge->info.voltage_now, fuelgauge->info.voltage_avg, fuelgauge->info.voltage_ocv, fuelgauge->info.current_now, fuelgauge->info.current_avg, fuelgauge->info.capacity); if (fuelgauge->pdata->monitor_initial_count) schedule_delayed_work(&fuelgauge->info.monitor_work, HZ); else schedule_delayed_work(&fuelgauge->info.monitor_work, HZ * get_battery_data(fuelgauge).monitor_polling_time); if (fuelgauge->info.is_init) { fuelgauge->info.is_init--; adc_get_reset_percentage(fuelgauge); } /* save time of monitor */ do_gettimeofday(&(fuelgauge->info.last_vcell_check_time)); }
static void adc_monitor_work(struct work_struct *work) { struct sec_fuelgauge_info *fuelgauge = container_of(work, struct sec_fuelgauge_info, info.monitor_work.work); fuelgauge->info.voltage_now = adc_get_vcell(fuelgauge->client); fuelgauge->info.voltage_avg = adc_get_avg_vcell(fuelgauge->client); fuelgauge->info.voltage_ocv = adc_get_ocv(fuelgauge->client); fuelgauge->info.current_now = adc_get_current(fuelgauge->client); fuelgauge->info.current_avg = adc_get_current_average(fuelgauge->client); fuelgauge->info.capacity = adc_get_soc(fuelgauge->client); dev_info(&fuelgauge->client->dev, "%s:Vnow(%dmV),Vavg(%dmV),Vocv(%dmV)," "Inow(%dmA),Iavg(%dmA),SOC(%d%%)\n", __func__, fuelgauge->info.voltage_now, fuelgauge->info.voltage_avg, fuelgauge->info.voltage_ocv, fuelgauge->info.current_now, fuelgauge->info.current_avg, fuelgauge->info.capacity); schedule_delayed_work(&fuelgauge->info.monitor_work, HZ * get_battery_data(fuelgauge).monitor_polling_time); }