static enum power_supply_property sec_power_props[] = {
POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_VOLTAGE_MAX,
+ POWER_SUPPLY_PROP_CURRENT_MAX,
};
static enum power_supply_property sec_ps_props[] = {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_usb);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_HEALTH_UNDERVOLTAGE)) {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_ac);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_HEALTH_UNDERVOLTAGE)) {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_wireless);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if (battery->wc_status)
val->intval = 1;
static enum power_supply_property sec_power_props[] = {
POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_VOLTAGE_MAX,
+ POWER_SUPPLY_PROP_CURRENT_MAX,
};
static enum power_supply_property sec_ps_props[] = {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_usb);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_HEALTH_UNDERVOLTAGE)) {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_ac);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_HEALTH_UNDERVOLTAGE)) {
struct sec_battery_info *battery =
container_of(psy, struct sec_battery_info, psy_wireless);
- if (psp != POWER_SUPPLY_PROP_ONLINE)
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+ /* V -> uV */
+ val->intval = battery->input_voltage * 1000000;
+ return 0;
+ case POWER_SUPPLY_PROP_CURRENT_MAX:
+ /* mA -> uA */
+ val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
+ return 0;
+ default:
return -EINVAL;
+ }
if (battery->wc_status)
val->intval = 1;