Skip to contentSkip to conversation

IIO version of INA2xx

PATCH In review Marc Titinger 2 participants 5 messages Dec 18, 2015 – Dec 22, 2015 IIO

lore
Share & tools
lore
#0 lore raw

v4 cover IIO version of INA2xx

v4:
* squash previous small fixes into one patch and catch up with fixes from linux-iio git, 'testing' branch.
* fix endianness hint by the use of IIO_CPU, following Andrew's comment
* fix spacing issue.
* add separate ABI documentation entry

v3 and earlier : see http://www.spinics.net/lists/linux-iio/msg22100.html

Marc Titinger (2):
iio: ina2xx: add support for TI INA2xx Power Monitors
iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc

 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc |  24 +
 drivers/iio/adc/Kconfig                            |  10 +
 drivers/iio/adc/Makefile                           |   1 +
 drivers/iio/adc/ina2xx-adc.c                       | 745 +++++++++++++++++++++
 4 files changed, 780 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
 create mode 100644 drivers/iio/adc/ina2xx-adc.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/2 iio: ina2xx: add support for TI INA2xx Power Monitors

in SOFTWARE buffer mode, a kthread will capture the active scan_elements into a kfifo, then compute the remaining time until the next capture tick and do an active wait (udelay).

This will produce a stream of up to fours channels plus a 64bits timestamps (ns).

Tested with ina226, on BeagleBoneBlack.

Datasheet: http://www.ti.com/lit/gpn/ina226

---
 drivers/iio/adc/Kconfig      |  10 +
 drivers/iio/adc/Makefile     |   1 +
 drivers/iio/adc/ina2xx-adc.c | 745 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 756 insertions(+)
 create mode 100644 drivers/iio/adc/ina2xx-adc.c
drivers/iio/adc/Kconfig +10 -0
index eb0cd89..e5fdc7d 100644
@@ -170,6 +170,16 @@ config EXYNOS_ADC
 	  of SoCs for drivers such as the touchscreen and hwmon to use to share
 	  this resource.
 
+config INA2XX_ADC
+	tristate "Texas Instruments INA2xx Power Monitors IIO driver"
+	depends on I2C && !SENSORS_INA2XX
+	select REGMAP_I2C
+	select IIO_BUFFER
+	select IIO_KFIFO_BUF
+	help
+	  Say yes here to build support for TI INA2xx family of Power Monitors.
+	  This driver is mutually exclusive with the HWMON version.
+
 config LP8788_ADC
 	tristate "LP8788 ADC driver"
 	depends on MFD_LP8788
drivers/iio/adc/Makefile +1 -0
index a096210..2869b0ef 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o
 obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o
 obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o
 obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
+obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o
 obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
 obj-$(CONFIG_MAX1027) += max1027.o
 obj-$(CONFIG_MAX1363) += max1363.o
drivers/iio/adc/ina2xx-adc.c new file +745 -0

745 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v4 2/2 iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc

In reply to Marc Titinger

Documentation for attributes:

* in_allow_async_readout
* in_shunt_resistor

---
 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc new file +24 -0
new file mode 100644
index 0000000..8916f7e
@@ -0,0 +1,24 @@
+What:		/sys/bus/iio/devices/iio:deviceX/in_allow_async_readout
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	[email protected]
+Description:
+		By default (value '0'), the capture thread checks for the Conversion
+		Ready Flag to being set prior to committing a new value to the sample
+		buffer. This synchronizes the in-chip conversion rate with the
+		in-driver readout rate at the cost of an additional register read.
+
+		Writing '1' will remove the polling for the Conversion Ready Flags to
+		save the additional i2c transaction, which will improve the bandwidth
+		available for reading data. However, samples can be occasionally skipped
+		or repeated, depending on the beat between the capture and conversion
+		rates.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_shunt_resistor
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	[email protected]
+Description:
+		The value of the shunt resistor may be known only at runtime fom an
+		eeprom content read by a client application. This attribute allows to
+		set its value in ohms.
Signature · 1 line
1.9.1
maintainer
#3 lore raw
In reply to Marc Titinger
Quoted 13 lines · Marc Titinger

v4:
* squash previous small fixes into one patch and catch up with fixes from linux-iio git, 'testing' branch.
* fix endianness hint by the use of IIO_CPU, following Andrew's comment
* fix spacing issue.
* add separate ABI documentation entry

v3 and earlier : see http://www.spinics.net/lists/linux-iio/msg22100.html

Marc Titinger (2):
iio: ina2xx: add support for TI INA2xx Power Monitors
iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc

Quoted 8 lines
 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc |  24 +
 drivers/iio/adc/Kconfig                            |  10 +
 drivers/iio/adc/Makefile                           |   1 +
 drivers/iio/adc/ina2xx-adc.c                       | 745 +++++++++++++++++++++
 4 files changed, 780 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
 create mode 100644 drivers/iio/adc/ina2xx-adc.c

The togreg branch to which I applied the previous is a non rebasing tree and a pull request went out to Greg so a new complete version is no use now.

maintainer
#4 lore raw
Quoted 22 lines · Jonathan Cameron
Quoted 13 lines · Marc Titinger

v4:
* squash previous small fixes into one patch and catch up with fixes from linux-iio git, 'testing' branch.
* fix endianness hint by the use of IIO_CPU, following Andrew's comment
* fix spacing issue.
* add separate ABI documentation entry

v3 and earlier : see http://www.spinics.net/lists/linux-iio/msg22100.html

Marc Titinger (2):
iio: ina2xx: add support for TI INA2xx Power Monitors
iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc

Quoted 8 lines
 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc |  24 +
 drivers/iio/adc/Kconfig                            |  10 +
 drivers/iio/adc/Makefile                           |   1 +
 drivers/iio/adc/ina2xx-adc.c                       | 745 +++++++++++++++++++++
 4 files changed, 780 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
 create mode 100644 drivers/iio/adc/ina2xx-adc.c
Quoted 4 lines

The togreg branch to which I applied the previous is a non rebasing tree and a pull request went out to Greg so a new complete version is no use now.

I've just put together a patch to fixup the wrong endianness issue and applied it to the togreg branch of iio.git as I'm preparing a pull request and want this fixed as this will be the last pull of this cycle.

Jonathan

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html