Skip to content

Commit e60fea7

Browse files
anish198519851985jic23
authored andcommitted
power: battery: Generic battery driver using IIO
Driver to allow use of the ADC drivers supported by the IIO subsystem for battery status monitoring. Connecting this driver to the relevant IIO device requires registration of the appropriate iio_map structure array by the IIO device driver (usually from platform data). If specified the driver will also make use of a gpio to provide interrupt driven notification that the battery is fully charged. In last version: Addressed concerns raised by lars: a. made the adc_bat per device. b. get the IIO channel using hardcoded channel names. c. Minor issues related to gpio_is_valid and some code refactoring. In V1: Addressed concerns raised by Anton: a. changed the struct name to gab(generic adc battery). b. Added some functions to neaten the code. c. Some minor coding guidelines changes. d. Used the latest function introduce by lars: iio_read_channel_processed to streamline the code. In V2: Addressed concerns by lars: a. No need of allocating memory for channels.Make it array. b. Code restructring, coding style and following kernel guidelines changes suggested by him. In V3: Addressed conerns by Anton: a. Added the copyright. b. Coding guidelines changes suggested by him. c. Added Makefile and Kconfig Signed-off-by: anish kumar <anish198519851985@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent f2f13a6 commit e60fea7

4 files changed

Lines changed: 459 additions & 0 deletions

File tree

‎drivers/power/Kconfig‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ config APM_POWER
2929
Say Y here to enable support APM status emulation using
3030
battery class devices.
3131

32+
config GENERIC_ADC_BATTERY
33+
tristate "Generic battery support using IIO"
34+
depends on IIO
35+
help
36+
Say Y here to enable support for the generic battery driver
37+
which uses IIO framework to read adc.
38+
3239
config MAX8925_POWER
3340
tristate "MAX8925 battery charger support"
3441
depends on MFD_MAX8925

‎drivers/power/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ power_supply-$(CONFIG_SYSFS) += power_supply_sysfs.o
55
power_supply-$(CONFIG_LEDS_TRIGGERS) += power_supply_leds.o
66

77
obj-$(CONFIG_POWER_SUPPLY) += power_supply.o
8+
obj-$(CONFIG_GENERIC_ADC_BATTERY) += generic-adc-battery.o
89

910
obj-$(CONFIG_PDA_POWER) += pda_power.o
1011
obj-$(CONFIG_APM_POWER) += apm_power.o

0 commit comments

Comments
 (0)