power: core: add power supply APIs
Add two APIs, 1) set_current_limit API and 2) set_charging_by.
set_current_limit api is used for external control, such as for USB
driver to tell a charger driver the maximum current to draw.
set_charging_by is used to change the state of the charger.
Change-Id: I147eab37836b54627ca1458167eb117ba3eacd7a
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 2287c321..cab042b 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -157,6 +157,8 @@
enum power_supply_property psp);
void (*external_power_changed)(struct power_supply *psy);
void (*set_charged)(struct power_supply *psy);
+ int (*set_current_limit)(struct power_supply *psy, int limit);
+ int (*set_charging_by)(struct power_supply *psy, bool enable);
/* For APM emulation, think legacy userspace. */
int use_for_apm;
@@ -205,6 +207,8 @@
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);
+extern int power_supply_set_current_limit(struct power_supply *psy, int limit);
+extern int power_supply_set_charging_by(struct power_supply *psy, bool enable);
#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE)
extern int power_supply_is_system_supplied(void);