summaryrefslogtreecommitdiffstats
path: root/include/linux/power_supply.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/power_supply.h')
-rw-r--r--include/linux/power_supply.h49
1 files changed, 30 insertions, 19 deletions
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7ae60346465f..ea15eb68f609 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,6 +13,7 @@
#ifndef __LINUX_POWER_SUPPLY_H__
#define __LINUX_POWER_SUPPLY_H__
+#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/leds.h>
#include <linux/spinlock.h>
@@ -173,10 +174,10 @@ union power_supply_propval {
const char *strval;
};
-struct device;
struct device_node;
+struct power_supply;
-/* Power supply instance specific configuration */
+/* Run-time specific power supply configuration */
struct power_supply_config {
struct device_node *of_node;
/* Driver private data */
@@ -186,19 +187,13 @@ struct power_supply_config {
size_t num_supplicants;
};
-struct power_supply {
+/* Description of power supply */
+struct power_supply_desc {
const char *name;
enum power_supply_type type;
enum power_supply_property *properties;
size_t num_properties;
- char **supplied_to;
- size_t num_supplicants;
-
- char **supplied_from;
- size_t num_supplies;
- struct device_node *of_node;
-
/*
* Functions for drivers implementing power supply class.
* These shouldn't be called directly by other drivers for accessing
@@ -224,12 +219,23 @@ struct power_supply {
bool no_thermal;
/* For APM emulation, think legacy userspace. */
int use_for_apm;
+};
+
+struct power_supply {
+ const struct power_supply_desc *desc;
+
+ char **supplied_to;
+ size_t num_supplicants;
+
+ char **supplied_from;
+ size_t num_supplies;
+ struct device_node *of_node;
/* Driver private data */
void *drv_data;
/* private */
- struct device *dev;
+ struct device dev;
struct work_struct changed_work;
spinlock_t changed_lock;
bool changed;
@@ -303,17 +309,22 @@ extern int power_supply_set_property(struct power_supply *psy,
extern int power_supply_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp);
extern void power_supply_external_power_changed(struct power_supply *psy);
-extern int power_supply_register(struct device *parent,
- struct power_supply *psy,
+
+extern struct power_supply *__must_check
+power_supply_register(struct device *parent,
+ const struct power_supply_desc *desc,
const struct power_supply_config *cfg);
-extern int power_supply_register_no_ws(struct device *parent,
- struct power_supply *psy,
+extern struct power_supply *__must_check
+power_supply_register_no_ws(struct device *parent,
+ const struct power_supply_desc *desc,
const struct power_supply_config *cfg);
-extern int devm_power_supply_register(struct device *parent,
- struct power_supply *psy,
+extern struct power_supply *__must_check
+devm_power_supply_register(struct device *parent,
+ const struct power_supply_desc *desc,
const struct power_supply_config *cfg);
-extern int devm_power_supply_register_no_ws(struct device *parent,
- struct power_supply *psy,
+extern struct power_supply *__must_check
+devm_power_supply_register_no_ws(struct device *parent,
+ const struct power_supply_desc *desc,
const struct power_supply_config *cfg);
extern void power_supply_unregister(struct power_supply *psy);
extern int power_supply_powers(struct power_supply *psy, struct device *dev);
OpenPOWER on IntegriCloud