All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] iio: adc: Maxim max9611 driver
@ 2017-03-27 15:12 ` Jacopo Mondi
  0 siblings, 0 replies; 15+ messages in thread
From: Jacopo Mondi @ 2017-03-27 15:12 UTC (permalink / raw)
  To: geert-Td1EMuHUCqxL1ZNQvxDV9g,
	wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw,
	jic23-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hello,
   fourth round for max9611 driver.

Biggest shift from v3 is change in locking, now performed only at
read_single() level.
No locking in read_raw, nor in read_csa_voltage(), as the only thing to
protect is the on-chip mux configuration between and I2c write and a read.
All other functions end up in calling this read_single() one, and they do not
share variables, so concurrent accesses to sysfs attributes should be safe.

Changed scale of temperature channel, and fixed shunt resistor names, that now
appears as properties of their respective power and current channels.

Ack on dt-bindings for "shunt-resistor-ohm" property pending from device
tree guardians.

Output of iio_info on Salvator-X board for max9611 chip installed on
VDD_0.8 lines.
The VDD_0.8 line powers the CPU cluster and on-board RAM.

        iio:device0: max9611
                5 channels found:
                        voltage0:  (input)
                        1 channel-specific attributes found:
                                attr 0: input value: 4.085000000
                        voltage1:  (input)
                        3 channel-specific attributes found:
                                attr 0: scale value: 14
                                attr 1: offset value: 1
                                attr 2: raw value: 59
                        power:  (input)
                        2 channel-specific attributes found:
                                attr 0: shunt_resistor value: 5000
                                attr 1: input value: 663.404000000
                        current:  (input)
                        2 channel-specific attributes found:
                                attr 0: shunt_resistor value: 5000
                                attr 1: input value: 817.000000000
                        temp:  (input)
                        2 channel-specific attributes found:
                                attr 0: scale value: 480.076812289
                                attr 1: raw value: 57

The collected information represent:

* voltage0 (current sense voltage) Vcsa
  voltage drop between RS+ and RS- input = 4,085 mV
* voltage1: (common input voltage) Vcim
  voltage at RS+ input = (59 - 1) * 14 = 812 mV
* current flowing on shunt resistor (Icsa)
  = Vcsa / Rshunt = 817 mA
* power load on the sensed line (Pload)
  = Vcim * Icsa = 663 m
* die temperature = (57 * 480.07) = 27360 milli Celsius

Thanks
   j

v1 -> v2:
- Drop wildcard (max961x) in driver, documentation and dt-bindings. Use
  max9611 instead.
- Make 3 processed channels for csa voltage, csa current and power load
- Remove wrapper functions around i2c buffer access
- Add locking in read_raw()
- Make 2 separate attributes for shunt resistor: current and power
- Renamed shunt resistor attribute
- Fixed several review comments

v2 -> v3:
- Incorporated Geert's suggestions on using a more generic name for ADC nodes
  in device tree
- Changed "maxim,shunt-resistor-uohm" to "shunt-resistor-uohm"
- Update documentation accordingly to the two previous changes

v3 -> v4:
- Move all locking to read_single() function
- Re-structure read_raw() with Jonathan's and Peter's comments
- Rename some defines pre-pending MAX9611 prefix
- Use values from .comaptible entries for device name
- Change temperature scale to have a value in milli Celsius
- Simplify init routine using read_single

Jacopo Mondi (4):
  Documentation: dt-bindings: iio: Add max9611 ADC
  iio: Documentation: Add max9611 sysfs documentation
  iio: adc: Add Maxim max9611 ADC driver
  arm64: dts: salvator-x: Add current sense amplifiers

 .../ABI/testing/sysfs-bus-iio-adc-max9611          |  17 +
 .../devicetree/bindings/iio/adc/max9611.txt        |  26 +
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |  18 +
 drivers/iio/adc/Kconfig                            |  10 +
 drivers/iio/adc/Makefile                           |   1 +
 drivers/iio/adc/max9611.c                          | 583 +++++++++++++++++++++
 6 files changed, 655 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-max9611
 create mode 100644 Documentation/devicetree/bindings/iio/adc/max9611.txt
 create mode 100644 drivers/iio/adc/max9611.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-04-03 13:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 15:12 [PATCH v4 0/4] iio: adc: Maxim max9611 driver Jacopo Mondi
2017-03-27 15:12 ` Jacopo Mondi
     [not found] ` <1490627578-15938-1-git-send-email-jacopo+renesas-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org>
2017-03-27 15:12   ` [PATCH v4 1/4] Documentation: dt-bindings: iio: Add max9611 ADC Jacopo Mondi
2017-03-27 15:12     ` Jacopo Mondi
2017-04-02  9:35     ` Jonathan Cameron
2017-04-03 13:26     ` Rob Herring
2017-03-27 15:12   ` [PATCH v4 2/4] iio: Documentation: Add max9611 sysfs documentation Jacopo Mondi
2017-03-27 15:12     ` Jacopo Mondi
2017-04-02  9:36     ` Jonathan Cameron
2017-04-02  9:53       ` Jonathan Cameron
2017-03-27 15:12   ` [PATCH v4 3/4] iio: adc: Add Maxim max9611 ADC driver Jacopo Mondi
2017-03-27 15:12     ` Jacopo Mondi
     [not found]     ` <1490627578-15938-4-git-send-email-jacopo+renesas-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org>
2017-04-02  9:43       ` Jonathan Cameron
2017-04-02  9:43         ` Jonathan Cameron
2017-03-27 15:12 ` [PATCH v4 4/4] arm64: dts: salvator-x: Add current sense amplifiers Jacopo Mondi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.