Battery monitor MAX1721x with w1-regmap and w1-slave (resend v2)
PATCH 1/3 regmap: Add 1-Wire bus support
In reply to Alex A. MihaylovAdd basic support regmap (register map access) API for 1-Wire bus
--- drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-w1.c | 245 ++++++++++++++++++++++++++++++++++++++++ include/linux/regmap.h | 34 ++++++ 4 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 drivers/base/regmap/regmap-w1.c
drivers/base/regmap/Kconfig +5 -1
@@ -3,7 +3,7 @@ # subsystems should select the appropriate symbols. config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) + default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) select LZO_COMPRESS select LZO_DECOMPRESS select IRQ_DOMAIN if REGMAP_IRQ
@@ -24,6 +24,10 @@ config REGMAP_SPMI tristate depends on SPMI +config REGMAP_W1 + tristate + depends on W1 + config REGMAP_MMIO tristate
drivers/base/regmap/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o obj-$(CONFIG_REGMAP_IRQ) += regmap-irq.o +obj-$(CONFIG_REGMAP_W1) += regmap-w1.o
drivers/base/regmap/regmap-w1.c new file +245 -0
245 lines not on this page · raw message
include/linux/regmap.h +34 -0
@@ -461,6 +461,10 @@ struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,const struct regmap_config *config, struct lock_class_key *lock_key, const char *lock_name); +struct regmap *__regmap_init_w1 (struct device *w1_dev, +const struct regmap_config *config, +struct lock_class_key *lock_key, +const char *lock_name); struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id, void __iomem *regs, const struct regmap_config *config,
@@ -493,6 +497,10 @@ struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,const struct regmap_config *config, struct lock_class_key *lock_key, const char *lock_name); +struct regmap *__devm_regmap_init_w1 (struct device *w1_dev, +const struct regmap_config *config, +struct lock_class_key *lock_key, +const char *lock_name); struct regmap *__devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, void __iomem *regs,
@@ -597,6 +605,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, dev, config)/** +* regmap_init_w1() - Initialise register map +* +* @w1_dev: Device that will be interacted with +* @config: Configuration for register map +* +* The return value will be an ERR_PTR() on error or a valid pointer to +* a struct regmap. +*/ +#define regmap_init_w1 (w1_dev, config) \ + __regmap_lockdep_wrapper(__regmap_init_w1, #config, \ + w1_dev, config) + +/** * regmap_init_mmio_clk() - Initialise register map with register clock * * @dev: Device that will be interacted with
@@ -712,6 +733,19 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); dev, config)/** +* devm_regmap_init_w1() - Initialise managed register map +* +* @w1_dev: Device that will be interacted with +* @config: Configuration for register map +* +* The return value will be an ERR_PTR() on error or a valid pointer +* to a struct regmap. The regmap will be automatically freed by the +* device management code. +*/ +#define devm_regmap_init_w1 (w1_dev, config) \ + __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \ + w1_dev, config) +/** * devm_regmap_init_mmio_clk() - Initialise managed register map with clock * * @dev: Device that will be interacted with
Signature · 1 line
2.13.0
PATCH 3/3 power: supply: Add support MAX1721x battery monitor
In reply to Alex A. MihaylovAdd support for battery monitor MAX1721x (power_supply class). Maxim Semiconductor MAX1721x Standalone Fuel Gauge battery monitor. MAX17211 used for singlecell, MAX17215 for multicell batteryes.
--- drivers/power/supply/Kconfig | 14 ++ drivers/power/supply/Makefile | 1 + drivers/power/supply/max1721x_battery.c | 357 ++++++++++++++++++++++++++++++++ 3 files changed, 372 insertions(+) create mode 100644 drivers/power/supply/max1721x_battery.c
drivers/power/supply/Kconfig +14 -0
@@ -268,6 +268,20 @@ config BATTERY_MAX17042 with MAX17042. This driver also supports max17047/50 chips which are improved version of max17042. +config BATTERY_MAX1721X + tristate "MAX17211/MAX17215 standalone gas-gauge" + depends on W1 + select W1_SLAVE_MAX1721X + select REGMAP_W1 + help + MAX1721x is fuel-gauge systems for lithium-ion (Li+) batteries + in handheld and portable equipment. MAX17211 used with single cell + battery. MAX17215 designed for muticell battery. Both them have + 1-Wire (W1) host interface. + + Say Y here to enable support for the MAX17211/MAX17215 standalone + battery gas-gauge. + config BATTERY_Z2 tristate "Z2 battery driver" depends on I2C && MACH_ZIPIT2
drivers/power/supply/Makefile +1 -0
@@ -41,6 +41,7 @@ obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o +obj-$(CONFIG_BATTERY_MAX1721X) += max1721x_battery.o obj-$(CONFIG_BATTERY_Z2) += z2_battery.o obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o obj-$(CONFIG_CHARGER_RT9455) += rt9455_charger.o
drivers/power/supply/max1721x_battery.c new file +357 -0
357 lines not on this page · raw message
Signature · 1 line
2.13.0
cover Battery monitor MAX1721x with w1-regmap and w1-slave (resend v2)
Coding style fixes.
Alex A. Mihaylov (3):
regmap: Add 1-Wire bus support
w1: MAX1721x Stanalone Fuel Gauge - add 1-Wire slave drivers
power: supply: Add support MAX1721x battery monitor
drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-w1.c | 245 ++++++++++++++++++++++ drivers/power/supply/Kconfig | 14 ++ drivers/power/supply/Makefile | 1 + drivers/power/supply/max1721x_battery.c | 357 ++++++++++++++++++++++++++++++++ drivers/w1/slaves/Kconfig | 12 ++ drivers/w1/slaves/Makefile | 1 + drivers/w1/slaves/w1_max1721x.c | 73 +++++++ drivers/w1/slaves/w1_max1721x.h | 102 +++++++++ drivers/w1/w1_family.h | 1 + include/linux/regmap.h | 34 +++ 12 files changed, 846 insertions(+), 1 deletion(-) create mode 100644 drivers/base/regmap/regmap-w1.c create mode 100644 drivers/power/supply/max1721x_battery.c create mode 100644 drivers/w1/slaves/w1_max1721x.c create mode 100644 drivers/w1/slaves/w1_max1721x.h
Signature · 1 line
2.13.0
PATCH 2/3 w1: MAX1721x Stanalone Fuel Gauge - add 1-Wire slave drivers
Add support for Maxim Semiconductor MAX17211/MAX17215 Standlone Fuel Gauge chips (1-Wire family 0x26)
--- drivers/w1/slaves/Kconfig | 12 +++++ drivers/w1/slaves/Makefile | 1 + drivers/w1/slaves/w1_max1721x.c | 73 ++++++++++++++++++++++++++++ drivers/w1/slaves/w1_max1721x.h | 102 ++++++++++++++++++++++++++++++++++++++++ drivers/w1/w1_family.h | 1 + 5 files changed, 189 insertions(+) create mode 100644 drivers/w1/slaves/w1_max1721x.c create mode 100644 drivers/w1/slaves/w1_max1721x.h
drivers/w1/slaves/Kconfig +12 -0
@@ -86,6 +86,18 @@ config W1_SLAVE_DS2433_CRC Each block has 30 bytes of data and a two byte CRC16. Full block writes are only allowed if the CRC is valid. +config W1_SLAVE_MAX1721X + tristate "Maxim MAX17211/MAX17215 battery monitor chip" + help + If you enable this you will have the MAX17211/MAX17215 battery + monitor chip support. + + The battery monitor chip is used in many batteries/devices + as the one who is responsible for charging/discharging/monitoring + Li+ batteries. + + If you are unsure, say N. + config W1_SLAVE_DS2760 tristate "Dallas 2760 battery monitor chip (HP iPAQ & others)" help
drivers/w1/slaves/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_W1_SLAVE_DS2406) += w1_ds2406.o obj-$(CONFIG_W1_SLAVE_DS2423) += w1_ds2423.o obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o +obj-$(CONFIG_W1_SLAVE_MAX1721X) += w1_max1721x.o obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o
drivers/w1/slaves/w1_max1721x.c new file +73 -0
73 lines not on this page · raw message
drivers/w1/slaves/w1_max1721x.h new file +102 -0
102 lines not on this page · raw message
drivers/w1/w1_family.h +1 -0
@@ -29,6 +29,7 @@#define W1_COUNTER_DS2423 0x1D#define W1_THERM_DS1822 0x22#define W1_EEPROM_DS2433 0x23 +#define W1_FAMILY_MAX17211 0x26#define W1_THERM_DS18B20 0x28#define W1_FAMILY_DS2408 0x29#define W1_EEPROM_DS2431 0x2D
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerQuoted 1 line · Alex A. Mihaylov
Coding style fixes.
Huh?
Please version your patch series properly, and show the whole history. This is described in the Documentation/SubmittingPatches file.
Please fix up and resend.
thanks,
greg k-h