Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2051f25d authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman
Browse files

iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System



The AD7280A monitoring system contains all the functions required for
general purpose monitoring and maintenance of stacked
lithium ion batteries as used in hybrid electric vehicles,
battery backup applications, etc.

Changes since V1:

Make cell channels all type IIO_IN_DIFF, update documentation accordingly.
Remove unused and redundant defines.
Use SI units where applicable.
Remove unnecessary wrapper function.
Remove redundant initialization.
Add comments where requested.
Revise event handler.
Use const where applicable.

Changes since V2:

Remove redundant adc.h include file, scheduled for removal.

Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1c5e6a3f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
What:		/sys/bus/iio/devices/deviceX/inY-inZ_balance_switch_en
KernelVersion:	3.0.0
Contact:	linux-iio@vger.kernel.org
Description:
		Writing 1 enables the cell balance output switch corresponding
		to input Y. Writing 0 disables it. If the inY-inZ_balance_timer
		is set to a none zero value, the corresponding switch will
		enable for the programmed amount of time, before it
		automatically disables.

What:		/sys/bus/iio/devices/deviceX/inY-inZ_balance_timer
KernelVersion:	3.0.0
Contact:	linux-iio@vger.kernel.org
Description:
		The inY-inZ_balance_timer file allows the user to program
		individual times for each cell balance output. The AD7280A
		allows the user to set the timer to a value from 0 minutes to
		36.9 minutes. The resolution of the timer is 71.5 sec.
		The value written is the on-time in milliseconds. When the
		timer value is set 0, the timer is disabled. The cell balance
		outputs are controlled only by inY-inZ_balance_switch_en.
+10 −0
Original line number Diff line number Diff line
@@ -182,6 +182,16 @@ config ADT7410
	  Say yes here to build support for Analog Devices ADT7410
	  temperature sensors.

config AD7280
	tristate "Analog Devices AD7280A Lithium Ion Battery Monitoring System"
	depends on SPI
	help
	  Say yes here to build support for Analog Devices AD7280A
	  Lithium Ion Battery Monitoring System.

	  To compile this driver as a module, choose M here: the
	  module will be called ad7280a

config MAX1363
	tristate "Maxim max1363 ADC driver"
	depends on I2C
+1 −0
Original line number Diff line number Diff line
@@ -40,3 +40,4 @@ obj-$(CONFIG_AD7816) += ad7816.o
obj-$(CONFIG_ADT75) += adt75.o
obj-$(CONFIG_ADT7310) += adt7310.o
obj-$(CONFIG_ADT7410) += adt7410.o
obj-$(CONFIG_AD7280) += ad7280a.o
+992 −0

File added.

Preview size limit exceeded, changes collapsed.

+38 −0
Original line number Diff line number Diff line
/*
 * AD7280A Lithium Ion Battery Monitoring System
 *
 * Copyright 2011 Analog Devices Inc.
 *
 * Licensed under the GPL-2.
 */

#ifndef IIO_ADC_AD7280_H_
#define IIO_ADC_AD7280_H_

/*
 * TODO: struct ad7280_platform_data needs to go into include/linux/iio
 */

#define AD7280A_ACQ_TIME_400ns			0
#define AD7280A_ACQ_TIME_800ns			1
#define AD7280A_ACQ_TIME_1200ns			2
#define AD7280A_ACQ_TIME_1600ns			3

#define AD7280A_CONV_AVG_DIS			0
#define AD7280A_CONV_AVG_2			1
#define AD7280A_CONV_AVG_4			2
#define AD7280A_CONV_AVG_8			3

#define AD7280A_ALERT_REMOVE_VIN5		(1 << 2)
#define AD7280A_ALERT_REMOVE_VIN4_VIN5		(2 << 2)
#define AD7280A_ALERT_REMOVE_AUX5		(1 << 0)
#define AD7280A_ALERT_REMOVE_AUX4_AUX5		(2 << 0)

struct ad7280_platform_data {
	unsigned acquisition_time;
	unsigned conversion_averaging;
	unsigned chain_last_alert_ignore;
	bool thermistor_term_en;
};

#endif /* IIO_ADC_AD7280_H_ */