示例#1
0
static void sec_bat_update_info(struct sec_bat_info *info)
{
	info->batt_presoc = info->batt_soc;
	info->batt_raw_soc = sec_bat_get_fuelgauge_data(info, FG_T_PSOC);
	info->batt_soc = sec_bat_get_fuelgauge_data(info, FG_T_SOC);
	info->batt_vcell = sec_bat_get_fuelgauge_data(info, FG_T_VCELL);
 }
static void sec_bat_update_info(struct sec_bat_info *info)
{
	struct power_supply *psy_main = power_supply_get_by_name(info->charger_name);
	struct power_supply *psy_sub = power_supply_get_by_name(info->sub_charger_name);
	union power_supply_propval value;

	if (!psy_main &&  !psy_sub) {
		dev_err(info->dev, "%s: fail to get charger ps\n", __func__);
		return -ENODEV;
	}

	info->batt_soc = sec_bat_get_fuelgauge_data(info, FG_T_SOC);
	info->batt_vcell = sec_bat_get_fuelgauge_data(info, FG_T_VCELL);

	/* Remove this */
	if (info->use_sub_charger)
		psy_sub->get_property(psy_sub, POWER_SUPPLY_PROP_STATUS, &value);
	else
		psy_main->get_property(psy_main, POWER_SUPPLY_PROP_ONLINE, &value);
}