diff options
Diffstat (limited to 'include/linux/power_supply.h')
| -rw-r--r-- | include/linux/power_supply.h | 40 | 
1 files changed, 33 insertions, 7 deletions
| diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 3965503315ef..de89066b72b1 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -146,6 +146,7 @@ enum power_supply_property {  	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,  	POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */  	POWER_SUPPLY_PROP_SCOPE, +	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,  	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,  	POWER_SUPPLY_PROP_CALIBRATE,  	/* Properties of type `const char *' */ @@ -159,13 +160,14 @@ enum power_supply_type {  	POWER_SUPPLY_TYPE_BATTERY,  	POWER_SUPPLY_TYPE_UPS,  	POWER_SUPPLY_TYPE_MAINS, -	POWER_SUPPLY_TYPE_USB,		/* Standard Downstream Port */ -	POWER_SUPPLY_TYPE_USB_DCP,	/* Dedicated Charging Port */ -	POWER_SUPPLY_TYPE_USB_CDP,	/* Charging Downstream Port */ -	POWER_SUPPLY_TYPE_USB_ACA,	/* Accessory Charger Adapters */ -	POWER_SUPPLY_TYPE_USB_TYPE_C,	/* Type C Port */ -	POWER_SUPPLY_TYPE_USB_PD,	/* Power Delivery Port */ -	POWER_SUPPLY_TYPE_USB_PD_DRP,	/* PD Dual Role Port */ +	POWER_SUPPLY_TYPE_USB,			/* Standard Downstream Port */ +	POWER_SUPPLY_TYPE_USB_DCP,		/* Dedicated Charging Port */ +	POWER_SUPPLY_TYPE_USB_CDP,		/* Charging Downstream Port */ +	POWER_SUPPLY_TYPE_USB_ACA,		/* Accessory Charger Adapters */ +	POWER_SUPPLY_TYPE_USB_TYPE_C,		/* Type C Port */ +	POWER_SUPPLY_TYPE_USB_PD,		/* Power Delivery Port */ +	POWER_SUPPLY_TYPE_USB_PD_DRP,		/* PD Dual Role Port */ +	POWER_SUPPLY_TYPE_APPLE_BRICK_ID,	/* Apple Charging Method */  };  enum power_supply_notifier_events { @@ -288,6 +290,25 @@ struct power_supply_info {  	int use_for_apm;  }; +/* + * This is the recommended struct to manage static battery parameters, + * populated by power_supply_get_battery_info(). Most platform drivers should + * use these for consistency. + * Its field names must correspond to elements in enum power_supply_property. + * The default field value is -EINVAL. + * Power supply class itself doesn't use this. + */ + +struct power_supply_battery_info { +	int energy_full_design_uwh;	    /* microWatt-hours */ +	int charge_full_design_uah;	    /* microAmp-hours */ +	int voltage_min_design_uv;	    /* microVolts */ +	int precharge_current_ua;	    /* microAmps */ +	int charge_term_current_ua;	    /* microAmps */ +	int constant_charge_current_max_ua; /* microAmps */ +	int constant_charge_voltage_max_uv; /* microVolts */ +}; +  extern struct atomic_notifier_head power_supply_notifier;  extern int power_supply_reg_notifier(struct notifier_block *nb);  extern void power_supply_unreg_notifier(struct notifier_block *nb); @@ -306,6 +327,9 @@ static inline struct power_supply *  devm_power_supply_get_by_phandle(struct device *dev, const char *property)  { return NULL; }  #endif /* CONFIG_OF */ + +extern int power_supply_get_battery_info(struct power_supply *psy, +					 struct power_supply_battery_info *info);  extern void power_supply_changed(struct power_supply *psy);  extern int power_supply_am_i_supplied(struct power_supply *psy);  extern int power_supply_set_battery_charged(struct power_supply *psy); @@ -359,6 +383,8 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)  	case POWER_SUPPLY_PROP_CHARGE_NOW:  	case POWER_SUPPLY_PROP_CHARGE_AVG:  	case POWER_SUPPLY_PROP_CHARGE_COUNTER: +	case POWER_SUPPLY_PROP_PRECHARGE_CURRENT: +	case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:  	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:  	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:  	case POWER_SUPPLY_PROP_CURRENT_MAX: |