summaryrefslogtreecommitdiff
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 12:28:15 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 12:28:15 -0800
commit400c5bd5a5b1faf3089322ace58b974446a8ddc3 (patch)
tree78594fc5e426c68b322adc11bd62a417267811eb /include/linux/mfd
parent9bd9fa6c147e68fc4dc3b35893979720ba7d0321 (diff)
parent6bd03ce3c12a22d86f59070f1da15aaa2bde8a51 (diff)
Merge tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: - new AXP20X USB Power driver - new Qualcomm SMBB driver - new TPS65217 Charger driver - BQ24257: add BQ24250/BQ24251 support - overhaul bq27x00 battery driver, rename to bq27xxx - misc fixes and cleanups * tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (54 commits) power: bq27xxx_battery: Remove unneeded dependency in Kconfig power: bq27xxx_battery: move irq handler to i2c section power: bq27xxx_battery: fix platform probe twl4030_charger: add missing iio dependency power_supply: charger-manager: add missing of_node_put Documentation: power: bq24257: Document exported sysfs entries power: bq24257: Add various device-specific sysfs properties power: bq24257: Allow input current limit sysfs access power: bq24257: Add input DPM voltage threshold setting support power: bq24257: Add over voltage protection setting support power: bq24257: Add SW-based approach for Power Good determination power: bq24257: Allow manual setting of input current limit power: bq24257: Add bit definition for temp sense enable power: bq24257: Add basic support for bq24250/bq24251 dt: power: bq24257-charger: Cover additional devices power: bq24257: Simplify bq24257_power_supply_init() power: bq24257: Use managed power supply register power: bq24257: Streamline input current limit setup power: bq24257: Remove IRQ config through stat-gpios power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health() ...
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/axp20x.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index cc8ad1e1a307..b24c771cebd5 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -11,6 +11,8 @@
#ifndef __LINUX_MFD_AXP20X_H
#define __LINUX_MFD_AXP20X_H
+#include <linux/regmap.h>
+
enum {
AXP152_ID = 0,
AXP202_ID,
@@ -438,4 +440,26 @@ struct axp288_extcon_pdata {
struct gpio_desc *gpio_mux_cntl;
};
+/* generic helper function for reading 9-16 bit wide regs */
+static inline int axp20x_read_variable_width(struct regmap *regmap,
+ unsigned int reg, unsigned int width)
+{
+ unsigned int reg_val, result;
+ int err;
+
+ err = regmap_read(regmap, reg, &reg_val);
+ if (err)
+ return err;
+
+ result = reg_val << (width - 8);
+
+ err = regmap_read(regmap, reg + 1, &reg_val);
+ if (err)
+ return err;
+
+ result |= reg_val;
+
+ return result;
+}
+
#endif /* __LINUX_MFD_AXP20X_H */