static int mc13892_battery_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct mc13892_dev_info *di = to_mc13892_dev_info(psy); switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (di->battery_status == POWER_SUPPLY_STATUS_UNKNOWN) { #ifdef CONFIG_MACH_MX51_ERDOS mc13892_charger_update_status(di); /* first call */ mc13892_battery_update_status(di); #else mc13892_battery_update_status(di); mc13892_charger_update_status(di); #endif /* CONFIG_MACH_MX51_ERDOS */ } val->intval = di->battery_status; return 0; default: break; } mc13892_battery_read_status(di); switch (psp) { case POWER_SUPPLY_PROP_VOLTAGE_NOW: val->intval = di->voltage_uV; break; #ifndef CONFIG_MACH_MX51_ERDOS case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = di->current_uA; break; case POWER_SUPPLY_PROP_CHARGE_NOW: val->intval = di->accum_current_uAh; break; #endif /* CONFIG_MACH_MX51_ERDOS */ default: return -EINVAL; } return 0; }
static void mc13892_battery_work(struct work_struct *work) { struct mc13892_dev_info *di = container_of(work, struct mc13892_dev_info, monitor_work.work); const int interval =HZ * 30; /*HZ * 60 msecs_to_jiffies(5000);*/ mc13892_battery_update_status(di); queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); }
static void mc13892_battery_work(struct work_struct *work) { struct mc13892_dev_info *di = container_of(work, struct mc13892_dev_info, monitor_work.work); const int interval = HZ * 60; dev_dbg(di->dev, "%s\n", __func__); mc13892_battery_update_status(di); queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); }
static void mc13892_battery_work(struct work_struct *work) { struct mc13892_dev_info *di = container_of(work, struct mc13892_dev_info, monitor_work.work); #ifdef CONFIG_MACH_MX51_ERDOS const int interval = HZ * 5; mc13892_charger_update_status(di); mc13892_battery_sample(di->charger_online, 1, 0); #else const int interval = HZ * 60; #endif /* CONFIG_MACH_MX51_ERDOS */ dev_dbg(di->dev, "%s\n", __func__); mc13892_battery_update_status(di); queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); }
static int mc13892_battery_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct mc13892_dev_info *di = to_mc13892_dev_info(psy); switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (di->battery_status == POWER_SUPPLY_STATUS_UNKNOWN) { mc13892_charger_update_status(di); mc13892_battery_update_status(di); } val->intval = di->battery_status; return 0; default: break; } mc13892_battery_read_status(di); switch (psp) { case POWER_SUPPLY_PROP_VOLTAGE_NOW: val->intval = di->voltage_uV; break; case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = di->current_uA; break; case POWER_SUPPLY_PROP_CHARGE_NOW: val->intval = di->accum_current_uAh; break; case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: val->intval = 3800000; break; case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: val->intval = 3300000; break; default: return -EINVAL; } return 0; }
static int mc13892_battery_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct mc13892_dev_info *di = to_mc13892_dev_info(psy); unsigned int online=0; static int lowBattaryCount =0; //bool bInLowBattaryState = false; online = get_charger_state(); switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (di->battery_status == POWER_SUPPLY_STATUS_UNKNOWN) { mc13892_charger_update_status(di); mc13892_battery_update_status(di); } val->intval = di->battery_status; return 0; default: break; } mc13892_battery_read_status(di); switch (psp) { case POWER_SUPPLY_PROP_VOLTAGE_NOW: val->intval = di->voltage_uV; break; case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = di->current_uA; break; case POWER_SUPPLY_PROP_CHARGE_NOW: val->intval = di->accum_current_uAh; break; case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: val->intval = PMIC_VOLTAGE_MAX_WORK; break; case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: val->intval = PMIC_VOLTAGE_MIN_WORK; break; case POWER_SUPPLY_PROP_CAPACITY: val->intval = di->capacity; break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: val->intval = PMIC_VOLTAGE_MAX_WORK; break; case POWER_SUPPLY_PROP_VOLTAGE_MIN: val->intval = PMIC_VOLTAGE_MIN_WORK; break; case POWER_SUPPLY_PROP_HEALTH: val->intval = POWER_SUPPLY_HEALTH_GOOD; break; default: return -EINVAL; } return 0; }