summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 21:45:11 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 21:45:11 +0300
commit5c43019f25977fb6119dff471d592321ed0d2333 (patch)
tree17589e88fe53f2492db4bbc133e324bbae701571 /include
parentc25949d4cc22449414fe73bc930bdf650078e877 (diff)
parent265b60497a57da56a4be7d5c72983ae89dc0765e (diff)
downloadlinux-5c43019f25977fb6119dff471d592321ed0d2333.tar.xz
Merge tag 'for-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "I have mostly fixes in the power-supply tree for the 4.5 kernel. I should mention, that the top-most commit has not been in next, but it's a fix changing only a single register offset. Summary: - uncouple CONFIG_POWER_RESET from CONFIG_POWER_SUPPLY - misc fixes" * tag 'for-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: bq27xxx_battery: Fix bq27541 AveragePower register address power: test_power: correctly handle empty writes power: generic-adc-battery: use to_delayed_work power: isp1704_charger: Fix isp1704_write() definition power: bq27xxx: fix register numbers of bq27500 power: bq27xxx: fix reading for bq27000 and bq27010 power: Fix unmet dependency on POWER_SUPPLY by POWER_RESET by uncoupling them power: bq27xxx_battery: Reorganize I2C into a module power: bq27xxx: don't fill system log by missing battery power: max8903_charger: set IRQF_ONESHOT if no primary handler is specified power/reset: at91-reset: add missing of_node_put power: ds2782_battery: constify ds278x_battery_ops structure power: bq2415x_charger: Delete unnecessary checks before the function call "of_node_put"
Diffstat (limited to 'include')
-rw-r--r--include/linux/power/bq27xxx_battery.h57
1 files changed, 47 insertions, 10 deletions
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 45f6a7b5b3cb..998d8f1c3c91 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -1,6 +1,16 @@
#ifndef __LINUX_BQ27X00_BATTERY_H__
#define __LINUX_BQ27X00_BATTERY_H__
+enum bq27xxx_chip {
+ BQ27000 = 1, /* bq27000, bq27200 */
+ BQ27010, /* bq27010, bq27210 */
+ BQ27500, /* bq27500, bq27510, bq27520 */
+ BQ27530, /* bq27530, bq27531 */
+ BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
+ BQ27545, /* bq27545 */
+ BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
+};
+
/**
* struct bq27xxx_plaform_data - Platform data for bq27xxx devices
* @name: Name of the battery.
@@ -12,20 +22,47 @@
* register to be read. The return value should either be the content of
* the passed register or an error value.
*/
-enum bq27xxx_chip {
- BQ27000 = 1, /* bq27000, bq27200 */
- BQ27010, /* bq27010, bq27210 */
- BQ27500, /* bq27500, bq27510, bq27520 */
- BQ27530, /* bq27530, bq27531 */
- BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
- BQ27545, /* bq27545 */
- BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
-};
-
struct bq27xxx_platform_data {
const char *name;
enum bq27xxx_chip chip;
int (*read)(struct device *dev, unsigned int);
};
+struct bq27xxx_device_info;
+struct bq27xxx_access_methods {
+ int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single);
+};
+
+struct bq27xxx_reg_cache {
+ int temperature;
+ int time_to_empty;
+ int time_to_empty_avg;
+ int time_to_full;
+ int charge_full;
+ int cycle_count;
+ int capacity;
+ int energy;
+ int flags;
+ int power_avg;
+ int health;
+};
+
+struct bq27xxx_device_info {
+ struct device *dev;
+ enum bq27xxx_chip chip;
+ const char *name;
+ struct bq27xxx_access_methods bus;
+ struct bq27xxx_reg_cache cache;
+ int charge_design_full;
+ unsigned long last_update;
+ struct delayed_work work;
+ struct power_supply *bat;
+ struct mutex lock;
+ u8 *regs;
+};
+
+void bq27xxx_battery_update(struct bq27xxx_device_info *di);
+int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
+void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
+
#endif