diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/hid.h | 6 | ||||
| -rw-r--r-- | include/linux/mfd/abx500/ux500_chargalg.h | 11 | ||||
| -rw-r--r-- | include/linux/mfd/rt5033.h | 2 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/supply.h | 6 | ||||
| -rw-r--r-- | include/linux/power/charger-manager.h | 3 | ||||
| -rw-r--r-- | include/linux/power/max17042_battery.h | 9 | ||||
| -rw-r--r-- | include/linux/power_supply.h | 78 |
7 files changed, 89 insertions, 26 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index efc7787a41a8..f94cf28e4b7c 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -514,10 +514,10 @@ struct hid_device { /* device report descriptor */ | |||
| 514 | #ifdef CONFIG_HID_BATTERY_STRENGTH | 514 | #ifdef CONFIG_HID_BATTERY_STRENGTH |
| 515 | /* | 515 | /* |
| 516 | * Power supply information for HID devices which report | 516 | * Power supply information for HID devices which report |
| 517 | * battery strength. power_supply is registered iff | 517 | * battery strength. power_supply was successfully registered if |
| 518 | * battery.name is non-NULL. | 518 | * battery is non-NULL. |
| 519 | */ | 519 | */ |
| 520 | struct power_supply battery; | 520 | struct power_supply *battery; |
| 521 | __s32 battery_min; | 521 | __s32 battery_min; |
| 522 | __s32 battery_max; | 522 | __s32 battery_max; |
| 523 | __s32 battery_report_type; | 523 | __s32 battery_report_type; |
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h index 234c99143bf7..67703f23e7ba 100644 --- a/include/linux/mfd/abx500/ux500_chargalg.h +++ b/include/linux/mfd/abx500/ux500_chargalg.h | |||
| @@ -9,8 +9,13 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/power_supply.h> | 10 | #include <linux/power_supply.h> |
| 11 | 11 | ||
| 12 | #define psy_to_ux500_charger(x) container_of((x), \ | 12 | /* |
| 13 | struct ux500_charger, psy) | 13 | * Valid only for supplies of type: |
| 14 | * - POWER_SUPPLY_TYPE_MAINS, | ||
| 15 | * - POWER_SUPPLY_TYPE_USB, | ||
| 16 | * because only them store as drv_data pointer to struct ux500_charger. | ||
| 17 | */ | ||
| 18 | #define psy_to_ux500_charger(x) power_supply_get_drvdata(psy) | ||
| 14 | 19 | ||
| 15 | /* Forward declaration */ | 20 | /* Forward declaration */ |
| 16 | struct ux500_charger; | 21 | struct ux500_charger; |
| @@ -35,7 +40,7 @@ struct ux500_charger_ops { | |||
| 35 | * @power_path USB power path support | 40 | * @power_path USB power path support |
| 36 | */ | 41 | */ |
| 37 | struct ux500_charger { | 42 | struct ux500_charger { |
| 38 | struct power_supply psy; | 43 | struct power_supply *psy; |
| 39 | struct ux500_charger_ops ops; | 44 | struct ux500_charger_ops ops; |
| 40 | int max_out_volt; | 45 | int max_out_volt; |
| 41 | int max_out_curr; | 46 | int max_out_curr; |
diff --git a/include/linux/mfd/rt5033.h b/include/linux/mfd/rt5033.h index 010cff49a98e..6cff5cf458d2 100644 --- a/include/linux/mfd/rt5033.h +++ b/include/linux/mfd/rt5033.h | |||
| @@ -39,7 +39,7 @@ struct rt5033_battery { | |||
| 39 | struct i2c_client *client; | 39 | struct i2c_client *client; |
| 40 | struct rt5033_dev *rt5033; | 40 | struct rt5033_dev *rt5033; |
| 41 | struct regmap *regmap; | 41 | struct regmap *regmap; |
| 42 | struct power_supply psy; | 42 | struct power_supply *psy; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | /* RT5033 charger platform data */ | 45 | /* RT5033 charger platform data */ |
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h index 2b9479310bbd..8dc93673e34a 100644 --- a/include/linux/mfd/wm8350/supply.h +++ b/include/linux/mfd/wm8350/supply.h | |||
| @@ -123,9 +123,9 @@ struct wm8350_charger_policy { | |||
| 123 | 123 | ||
| 124 | struct wm8350_power { | 124 | struct wm8350_power { |
| 125 | struct platform_device *pdev; | 125 | struct platform_device *pdev; |
| 126 | struct power_supply battery; | 126 | struct power_supply *battery; |
| 127 | struct power_supply usb; | 127 | struct power_supply *usb; |
| 128 | struct power_supply ac; | 128 | struct power_supply *ac; |
| 129 | struct wm8350_charger_policy *policy; | 129 | struct wm8350_charger_policy *policy; |
| 130 | 130 | ||
| 131 | int rev_g_coeff; | 131 | int rev_g_coeff; |
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index 416ebeb6ee1e..eadf28cb2fc9 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
| @@ -242,7 +242,8 @@ struct charger_manager { | |||
| 242 | int emergency_stop; | 242 | int emergency_stop; |
| 243 | 243 | ||
| 244 | char psy_name_buf[PSY_NAME_MAX + 1]; | 244 | char psy_name_buf[PSY_NAME_MAX + 1]; |
| 245 | struct power_supply charger_psy; | 245 | struct power_supply_desc charger_psy_desc; |
| 246 | struct power_supply *charger_psy; | ||
| 246 | 247 | ||
| 247 | u64 charging_start_time; | 248 | u64 charging_start_time; |
| 248 | u64 charging_end_time; | 249 | u64 charging_end_time; |
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h index 89dd84f47c6e..cf112b4075c8 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h | |||
| @@ -126,7 +126,14 @@ enum max17047_register { | |||
| 126 | MAX17047_QRTbl30 = 0x42, | 126 | MAX17047_QRTbl30 = 0x42, |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | enum max170xx_chip_type {MAX17042, MAX17047}; | 129 | enum max170xx_chip_type { |
| 130 | MAXIM_DEVICE_TYPE_UNKNOWN = 0, | ||
| 131 | MAXIM_DEVICE_TYPE_MAX17042, | ||
| 132 | MAXIM_DEVICE_TYPE_MAX17047, | ||
| 133 | MAXIM_DEVICE_TYPE_MAX17050, | ||
| 134 | |||
| 135 | MAXIM_DEVICE_TYPE_NUM | ||
| 136 | }; | ||
| 130 | 137 | ||
| 131 | /* | 138 | /* |
| 132 | * used for setting a register to a desired value | 139 | * used for setting a register to a desired value |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 096dbced02ac..75a1dd8dc56e 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #ifndef __LINUX_POWER_SUPPLY_H__ | 13 | #ifndef __LINUX_POWER_SUPPLY_H__ |
| 14 | #define __LINUX_POWER_SUPPLY_H__ | 14 | #define __LINUX_POWER_SUPPLY_H__ |
| 15 | 15 | ||
| 16 | #include <linux/device.h> | ||
| 16 | #include <linux/workqueue.h> | 17 | #include <linux/workqueue.h> |
| 17 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
| 18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
| @@ -173,22 +174,32 @@ union power_supply_propval { | |||
| 173 | const char *strval; | 174 | const char *strval; |
| 174 | }; | 175 | }; |
| 175 | 176 | ||
| 176 | struct device; | ||
| 177 | struct device_node; | 177 | struct device_node; |
| 178 | struct power_supply; | ||
| 178 | 179 | ||
| 179 | struct power_supply { | 180 | /* Run-time specific power supply configuration */ |
| 180 | const char *name; | 181 | struct power_supply_config { |
| 181 | enum power_supply_type type; | 182 | struct device_node *of_node; |
| 182 | enum power_supply_property *properties; | 183 | /* Driver private data */ |
| 183 | size_t num_properties; | 184 | void *drv_data; |
| 184 | 185 | ||
| 185 | char **supplied_to; | 186 | char **supplied_to; |
| 186 | size_t num_supplicants; | 187 | size_t num_supplicants; |
| 188 | }; | ||
| 187 | 189 | ||
| 188 | char **supplied_from; | 190 | /* Description of power supply */ |
| 189 | size_t num_supplies; | 191 | struct power_supply_desc { |
| 190 | struct device_node *of_node; | 192 | const char *name; |
| 193 | enum power_supply_type type; | ||
| 194 | enum power_supply_property *properties; | ||
| 195 | size_t num_properties; | ||
| 191 | 196 | ||
| 197 | /* | ||
| 198 | * Functions for drivers implementing power supply class. | ||
| 199 | * These shouldn't be called directly by other drivers for accessing | ||
| 200 | * this power supply. Instead use power_supply_*() functions (for | ||
| 201 | * example power_supply_get_property()). | ||
| 202 | */ | ||
| 192 | int (*get_property)(struct power_supply *psy, | 203 | int (*get_property)(struct power_supply *psy, |
| 193 | enum power_supply_property psp, | 204 | enum power_supply_property psp, |
| 194 | union power_supply_propval *val); | 205 | union power_supply_propval *val); |
| @@ -208,12 +219,27 @@ struct power_supply { | |||
| 208 | bool no_thermal; | 219 | bool no_thermal; |
| 209 | /* For APM emulation, think legacy userspace. */ | 220 | /* For APM emulation, think legacy userspace. */ |
| 210 | int use_for_apm; | 221 | int use_for_apm; |
| 222 | }; | ||
| 223 | |||
| 224 | struct power_supply { | ||
| 225 | const struct power_supply_desc *desc; | ||
| 226 | |||
| 227 | char **supplied_to; | ||
| 228 | size_t num_supplicants; | ||
| 229 | |||
| 230 | char **supplied_from; | ||
| 231 | size_t num_supplies; | ||
| 232 | struct device_node *of_node; | ||
| 233 | |||
| 234 | /* Driver private data */ | ||
| 235 | void *drv_data; | ||
| 211 | 236 | ||
| 212 | /* private */ | 237 | /* private */ |
| 213 | struct device *dev; | 238 | struct device dev; |
| 214 | struct work_struct changed_work; | 239 | struct work_struct changed_work; |
| 215 | spinlock_t changed_lock; | 240 | spinlock_t changed_lock; |
| 216 | bool changed; | 241 | bool changed; |
| 242 | atomic_t use_cnt; | ||
| 217 | #ifdef CONFIG_THERMAL | 243 | #ifdef CONFIG_THERMAL |
| 218 | struct thermal_zone_device *tzd; | 244 | struct thermal_zone_device *tzd; |
| 219 | struct thermal_cooling_device *tcd; | 245 | struct thermal_cooling_device *tcd; |
| @@ -256,6 +282,7 @@ extern struct atomic_notifier_head power_supply_notifier; | |||
| 256 | extern int power_supply_reg_notifier(struct notifier_block *nb); | 282 | extern int power_supply_reg_notifier(struct notifier_block *nb); |
| 257 | extern void power_supply_unreg_notifier(struct notifier_block *nb); | 283 | extern void power_supply_unreg_notifier(struct notifier_block *nb); |
| 258 | extern struct power_supply *power_supply_get_by_name(const char *name); | 284 | extern struct power_supply *power_supply_get_by_name(const char *name); |
| 285 | extern void power_supply_put(struct power_supply *psy); | ||
| 259 | #ifdef CONFIG_OF | 286 | #ifdef CONFIG_OF |
| 260 | extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, | 287 | extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, |
| 261 | const char *property); | 288 | const char *property); |
| @@ -274,13 +301,36 @@ extern int power_supply_is_system_supplied(void); | |||
| 274 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } | 301 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } |
| 275 | #endif | 302 | #endif |
| 276 | 303 | ||
| 277 | extern int power_supply_register(struct device *parent, | 304 | extern int power_supply_get_property(struct power_supply *psy, |
| 278 | struct power_supply *psy); | 305 | enum power_supply_property psp, |
| 279 | extern int power_supply_register_no_ws(struct device *parent, | 306 | union power_supply_propval *val); |
| 280 | struct power_supply *psy); | 307 | extern int power_supply_set_property(struct power_supply *psy, |
| 308 | enum power_supply_property psp, | ||
| 309 | const union power_supply_propval *val); | ||
| 310 | extern int power_supply_property_is_writeable(struct power_supply *psy, | ||
| 311 | enum power_supply_property psp); | ||
| 312 | extern void power_supply_external_power_changed(struct power_supply *psy); | ||
| 313 | |||
| 314 | extern struct power_supply *__must_check | ||
| 315 | power_supply_register(struct device *parent, | ||
| 316 | const struct power_supply_desc *desc, | ||
| 317 | const struct power_supply_config *cfg); | ||
| 318 | extern struct power_supply *__must_check | ||
| 319 | power_supply_register_no_ws(struct device *parent, | ||
| 320 | const struct power_supply_desc *desc, | ||
| 321 | const struct power_supply_config *cfg); | ||
| 322 | extern struct power_supply *__must_check | ||
| 323 | devm_power_supply_register(struct device *parent, | ||
| 324 | const struct power_supply_desc *desc, | ||
| 325 | const struct power_supply_config *cfg); | ||
| 326 | extern struct power_supply *__must_check | ||
| 327 | devm_power_supply_register_no_ws(struct device *parent, | ||
| 328 | const struct power_supply_desc *desc, | ||
| 329 | const struct power_supply_config *cfg); | ||
| 281 | extern void power_supply_unregister(struct power_supply *psy); | 330 | extern void power_supply_unregister(struct power_supply *psy); |
| 282 | extern int power_supply_powers(struct power_supply *psy, struct device *dev); | 331 | extern int power_supply_powers(struct power_supply *psy, struct device *dev); |
| 283 | 332 | ||
| 333 | extern void *power_supply_get_drvdata(struct power_supply *psy); | ||
| 284 | /* For APM emulation, think legacy userspace. */ | 334 | /* For APM emulation, think legacy userspace. */ |
| 285 | extern struct class *power_supply_class; | 335 | extern struct class *power_supply_class; |
| 286 | 336 | ||
