static int sec_fg_set_property(struct power_supply *psy, enum power_supply_property psp, const union power_supply_propval *val) { struct sec_fuelgauge_info *fuelgauge = container_of(psy, struct sec_fuelgauge_info, psy_fg); switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (val->intval == POWER_SUPPLY_STATUS_FULL) sec_hal_fg_full_charged(fuelgauge->client); break; case POWER_SUPPLY_PROP_ONLINE: fuelgauge->cable_type = val->intval; if (val->intval == POWER_SUPPLY_TYPE_BATTERY) fuelgauge->is_charging = false; else fuelgauge->is_charging = true; case POWER_SUPPLY_PROP_CAPACITY: if (val->intval == SEC_FUELGAUGE_CAPACITY_TYPE_RESET) { if (!sec_hal_fg_reset(fuelgauge->client)) return -EINVAL; else break; } case POWER_SUPPLY_PROP_TEMP: case POWER_SUPPLY_PROP_TEMP_AMBIENT: if (!sec_hal_fg_set_property(fuelgauge->client, psp, val)) return -EINVAL; break; default: return -EINVAL; } return 0; }
static int sec_fg_set_property(struct power_supply *psy, enum power_supply_property psp, const union power_supply_propval *val) { struct sec_fuelgauge_info *fuelgauge = container_of(psy, struct sec_fuelgauge_info, psy_fg); sec_battery_platform_data_t *pdata = fuelgauge->pdata; switch (psp) { case POWER_SUPPLY_PROP_CHARGE_TYPE: if (!pdata->jig_irq) sec_hal_fg_set_property(fuelgauge->client, psp, val); break; case POWER_SUPPLY_PROP_STATUS: if (val->intval == POWER_SUPPLY_STATUS_FULL) sec_hal_fg_full_charged(fuelgauge->client); break; case POWER_SUPPLY_PROP_CHARGE_FULL: if (val->intval == POWER_SUPPLY_TYPE_BATTERY) { if (fuelgauge->pdata->capacity_calculation_type & SEC_FUELGAUGE_CAPACITY_TYPE_DYNAMIC_SCALE) sec_fg_calculate_dynamic_scale(fuelgauge); } break; case POWER_SUPPLY_PROP_ONLINE: fuelgauge->cable_type = val->intval; if (val->intval == POWER_SUPPLY_TYPE_BATTERY) fuelgauge->is_charging = false; else fuelgauge->is_charging = true; /* fall through */ case POWER_SUPPLY_PROP_CAPACITY: if (val->intval == SEC_FUELGAUGE_CAPACITY_TYPE_RESET) { fuelgauge->initial_update_of_soc = true; if (!sec_hal_fg_reset(fuelgauge->client)) return -EINVAL; else break; } case POWER_SUPPLY_PROP_TEMP: case POWER_SUPPLY_PROP_TEMP_AMBIENT: if (!sec_hal_fg_set_property(fuelgauge->client, psp, val)) return -EINVAL; break; default: return -EINVAL; } return 0; }