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

Commit d47e5382 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-for-4.12d' of...

Merge tag 'iio-for-4.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Fourth set of IIO new device support, features and cleanups for the 4.12 cycle

New device support
* max1117, 1118 and 1119
  - new ADC driver
* max9611
  - new ADC driver
* pm8xxx hk/xoadc
  - new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
  - A33 thermal sensor support (with associated rework)
* stm32-dac
  - new driver and bindings
* stm32 trigger
  - enable support of quadrature encoder device and counter modes

Features
* apds9960
  - use the runtime pm for normal suspend
* stm32-adc
  - add opition to sest resolution via devicetree
* xoadc
  - augment DT bindings to deal with some weird mux cases

Cleanups
* ad5933
  - protect direct mode using claim and release helpers
* ade7759
  - S_IRUGO and friends to octal in two goes
* adis16203
  - drop unnecessary brackets
* hid-sensor
  - fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
  - use actual part numbers for device name when known
  - simplify data read pin parsing
* mpu3050
  - avoid double reporting errors
parents 18125dc0 d454ae2e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
What:		/sys/bus/iio/devices/iio:deviceX/in_power_shunt_resistor
Date:		March 2017
KernelVersion:	4.12
Contact:	linux-iio@vger.kernel.org
Description: 	The value of the shunt resistor used to compute power drain on
                common input voltage pin (RS+). In Ohms.

What:		/sys/bus/iio/devices/iio:deviceX/in_current_shunt_resistor
Date:		March 2017
KernelVersion:	4.12
Contact:	linux-iio@vger.kernel.org
Description: 	The value of the shunt resistor used to compute current flowing
                between RS+ and RS- voltage sense inputs. In Ohms.

These attributes describe a single physical component, exposed as two distinct
attributes as it is used to calculate two different values: power load and
current flowing between RS+ and RS- inputs.
+67 −4
Original line number Diff line number Diff line
@@ -3,11 +3,15 @@ KernelVersion: 4.11
Contact:	benjamin.gaignard@st.com
Description:
		Reading returns the list possible master modes which are:
		- "reset"     :	The UG bit from the TIMx_EGR register is used as trigger output (TRGO).
		- "enable"    : The Counter Enable signal CNT_EN is used as trigger output.
		- "reset"     :	The UG bit from the TIMx_EGR register is
				used as trigger output (TRGO).
		- "enable"    : The Counter Enable signal CNT_EN is used
				as trigger output.
		- "update"    : The update event is selected as trigger output.
				For instance a master timer can then be used as a prescaler for a slave timer.
		- "compare_pulse" : The trigger output send a positive pulse when the CC1IF flag is to be set.
				For instance a master timer can then be used
				as a prescaler for a slave timer.
		- "compare_pulse" : The trigger output send a positive pulse
				    when the CC1IF flag is to be set.
		- "OC1REF"    : OC1REF signal is used as trigger output.
		- "OC2REF"    : OC2REF signal is used as trigger output.
		- "OC3REF"    : OC3REF signal is used as trigger output.
@@ -27,3 +31,62 @@ Description:
		Reading returns the current sampling frequency.
		Writing an value different of 0 set and start sampling.
		Writing 0 stop sampling.

What:		/sys/bus/iio/devices/iio:deviceX/in_count0_preset
KernelVersion:	4.12
Contact:	benjamin.gaignard@st.com
Description:
		Reading returns the current preset value.
		Writing sets the preset value.
		When counting up the counter starts from 0 and fires an
		event when reach preset value.
		When counting down the counter start from preset value
		and fire event when reach 0.

What:		/sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available
KernelVersion:	4.12
Contact:	benjamin.gaignard@st.com
Description:
		Reading returns the list possible quadrature modes.

What:		/sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode
KernelVersion:	4.12
Contact:	benjamin.gaignard@st.com
Description:
		Configure the device counter quadrature modes:
		channel_A:
			Encoder A input servers as the count input and B as
			the UP/DOWN direction control input.

		channel_B:
			Encoder B input serves as the count input and A as
			the UP/DOWN direction control input.

		quadrature:
			Encoder A and B inputs are mixed to get direction
			and count with a scale of 0.25.

What:		/sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
KernelVersion:	4.12
Contact:	benjamin.gaignard@st.com
Description:
		Reading returns the list possible enable modes.

What:		/sys/bus/iio/devices/iio:deviceX/in_count0_enable_mode
KernelVersion:	4.12
Contact:	benjamin.gaignard@st.com
Description:
		Configure the device counter enable modes, in all case
		counting direction is set by in_count0_count_direction
		attribute and the counter is clocked by the internal clock.
		always:
			Counter is always ON.

		gated:
			Counting is enabled when connected trigger signal
			level is high else counting is disabled.

		triggered:
			Counting is enabled on rising edge of the connected
			trigger, and remains enabled for the duration of this
			selected mode.
+21 −0
Original line number Diff line number Diff line
* MAX1117/MAX1118/MAX1119 8-bit, dual-channel ADCs

Required properties:
 - compatible: Should be one of
	* "maxim,max1117"
	* "maxim,max1118"
	* "maxim,max1119"
 - reg: spi chip select number for the device
 - (max1118 only) vref-supply: The regulator supply for ADC reference voltage

Recommended properties:
 - spi-max-frequency: Definition as per
		Documentation/devicetree/bindings/spi/spi-bus.txt

Example:
adc@0 {
	compatible = "maxim,max1118";
	reg = <0>;
	vref-supply = <&vdd_supply>;
	spi-max-frequency = <1000000>;
};
+27 −0
Original line number Diff line number Diff line
* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface

Maxim max9611/max9612 is an high-side current sense amplifier with integrated
12-bits ADC communicating over I2c bus.
The device node for this driver shall be a child of a I2c controller.

Required properties
  - compatible: Should be "maxim,max9611" or "maxim,max9612"
  - reg: The 7-bits long I2c address of the device
  - shunt-resistor-micro-ohms: Value, in micro Ohms, of the current sense shunt
			        resistor

Example:

&i2c4 {
	csa: adc@7c {
		compatible = "maxim,max9611";
		reg = <0x7c>;

		shunt-resistor-micro-ohms = <5000>;
	};
};

This device node describes a current sense amplifier sitting on I2c4 bus
with address 0x7c (read address is 0xf9, write address is 0xf8).
A sense resistor of 0,005 Ohm is installed between RS+ and RS- current-sensing
inputs.
+42 −34
Original line number Diff line number Diff line
@@ -19,32 +19,42 @@ Required properties:
  with PMIC variant but is typically something like 2.2 or 1.8V.

The following required properties are standard for IO channels, see
iio-bindings.txt for more details:
iio-bindings.txt for more details, but notice that this particular
ADC has a special addressing scheme that require two cells for
identifying each ADC channel:

- #address-cells: should be set to <1>
- #address-cells: should be set to <2>, the first cell is the
  prescaler (on PM8058) or premux (on PM8921) with two valid bits
  so legal values are 0x00, 0x01 or 0x02. The second cell
  is the main analog mux setting (0x00..0x0f). The combination
  of prescaler/premux and analog mux uniquely addresses a hardware
  channel on all systems.

- #size-cells: should be set to <0>

- #io-channel-cells: should be set to <1>
- #io-channel-cells: should be set to <2>, again the cells are
  precaler or premux followed by the analog muxing line.

- interrupts: should refer to the parent PMIC interrupt controller
  and reference the proper ADC interrupt.

Required subnodes:

The ADC channels are configured as subnodes of the ADC. Since some of
them are used for calibrating the ADC, these nodes are compulsory:
The ADC channels are configured as subnodes of the ADC.

Since some of them are used for calibrating the ADC, these nodes are
compulsory:

adc-channel@c {
	reg = <0x0c>;
	reg = <0x00 0x0c>;
};

adc-channel@d {
	reg = <0x0d>;
	reg = <0x00 0x0d>;
};

adc-channel@f {
	reg = <0x0f>;
	reg = <0x00 0x0f>;
};

These three nodes are used for absolute and ratiometric calibration
@@ -52,13 +62,13 @@ and only need to have these reg values: they are by hardware definition
1:1 ratio converters that sample 625, 1250 and 0 milliV and create
an interpolation calibration for all other ADCs.

Optional subnodes: any channels other than channel 0x0c, 0x0d and
0x0f are optional.
Optional subnodes: any channels other than channels [0x00 0x0c],
[0x00 0x0d] and [0x00 0x0f] are optional.

Required channel node properties:

- reg: should contain the hardware channel number in the range
  0 .. 0x0f (4 bits). The hardware only supports 16 channels.
  0 .. 0xff (8 bits).

Optional channel node properties:

@@ -94,56 +104,54 @@ Example:
xoadc: xoadc@197 {
	compatible = "qcom,pm8058-adc";
	reg = <0x197>;
	interrupt-parent = <&pm8058>;
	interrupts = <76 1>;
	#address-cells = <1>;
	interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>;
	#address-cells = <2>;
	#size-cells = <0>;
	#io-channel-cells = <1>;
	#io-channel-cells = <2>;

	vcoin: adc-channel@0 {
		reg = <0x00>;
		reg = <0x00 0x00>;
	};
	vbat: adc-channel@1 {
		reg = <0x01>;
		reg = <0x00 0x01>;
	};
	dcin: adc-channel@2 {
		reg = <0x02>;
		reg = <0x00 0x02>;
	};
	ichg: adc-channel@3 {
		reg = <0x03>;
		reg = <0x00 0x03>;
	};
	vph_pwr: adc-channel@4 {
		reg = <0x04>;
		reg = <0x00 0x04>;
	};
	usb_vbus: adc-channel@a {
		reg = <0x0a>;
		reg = <0x00 0x0a>;
	};
	die_temp: adc-channel@b {
		reg = <0x0b>;
		reg = <0x00 0x0b>;
	};
	ref_625mv: adc-channel@c {
		reg = <0x0c>;
		reg = <0x00 0x0c>;
	};
	ref_1250mv: adc-channel@d {
		reg = <0x0d>;
		reg = <0x00 0x0d>;
	};
	ref_325mv: adc-channel@e {
		reg = <0x0e>;
		reg = <0x00 0x0e>;
	};
	ref_muxoff: adc-channel@f {
		reg = <0x0f>;
		reg = <0x00 0x0f>;
	};
};


/* IIO client node */
iio-hwmon {
	compatible = "iio-hwmon";
	io-channels = <&xoadc 0x01>, /* Battery */
		    <&xoadc 0x02>, /* DC in (charger) */
		    <&xoadc 0x04>, /* VPH the main system voltage */
		    <&xoadc 0x0b>, /* Die temperature */
		    <&xoadc 0x0c>, /* Reference voltage 1.25V */
		    <&xoadc 0x0d>, /* Reference voltage 0.625V */
		    <&xoadc 0x0e>; /* Reference voltage 0.325V */
	io-channels = <&xoadc 0x00 0x01>, /* Battery */
		    <&xoadc 0x00 0x02>, /* DC in (charger) */
		    <&xoadc 0x00 0x04>, /* VPH the main system voltage */
		    <&xoadc 0x00 0x0b>, /* Die temperature */
		    <&xoadc 0x00 0x0c>, /* Reference voltage 1.25V */
		    <&xoadc 0x00 0x0d>, /* Reference voltage 0.625V */
		    <&xoadc 0x00 0x0e>; /* Reference voltage 0.325V */
};
Loading