iio: adc: add device tree bindings for Qualcomm PM8xxx ADCs
Subsystems (3)
PATCH v2 1/3 iio: adc: add device tree bindings for Qualcomm PM8xxx ADCs
This adds the device tree bindings for the Qualcomm PM8xxx ADCs. This is based on the existing DT bindings for the SPMI ADC so there are hopefully no controversial features.
---
ChangeLog v1->v2:
- Spelling fixes
--- .../bindings/iio/adc/qcom,pm8xxx-xoadc.txt | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +160 -0
@@ -0,0 +1,160 @@ +Qualcomm's PM8xxx voltage XOADC + +The Qualcomm PM8xxx PMICs contain a HK/XO ADC (Housekeeping/Crystal +oscillator ADC) encompassing PM8018, PM8038, PM8058, PM8917 and PM8921. + +Required properties: + +- compatible: should be one of: + "qcom,pm8018-adc" + "qcom,pm8038-adc" + "qcom,pm8058-adc" + "qcom,pm8917-adc" + "qcom,pm8921-adc" + +- reg: should contain the ADC base address in the PMIC, typically + 0x197. + +The following required properties are standard for IO channels, see +iio-bindings.txt for more details: + +- #address-cells: should be set to <1> + +- #size-cells: should be set to <0> + +- #io-channel-cells: should be set to <1> + +- 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: + +ref_625mv { + reg = <0x0c>; +}; + +ref_1250mv { + reg = <0x0d>; +}; + +ref_muxoff { + reg = <0x0f>; +}; + +These three nodes are used for absolute and ratiometric calibration +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. + +Required channel node properties: + +- reg: should contain the hardware channel number in the range + 0 .. 0x0f (4 bits). The hardware only supports 16 channels. + +Optional channel node properties: + +- qcom,decimation: + Value type: <u32> + Definition: This parameter is used to decrease the ADC sampling rate. + Quicker measurements can be made by reducing the decimation ratio. + Valid values are 512, 1024, 2048, 4096. + If the property is not found, a default value of 512 will be used. + +- qcom,ratiometric: + Value type: <empty> + Definition: Channel calibration type. If this property is specified + VADC will use the VDD reference (1.8V) and GND for channel + calibration. If the property is not found, the channel will be + calibrated with the 0.625V and 1.25V reference channels, also + known as an absolute calibration. + +- qcom,ratiometric-ref: + Value type: <u32> + Definition: The reference voltage pair when using ratiometric + calibration: + 0 = XO_IN/XOADC_GND + 1 = PMIC_IN/XOADC_GND + 2 = PMIC_IN/BMS_CSP + 3 (invalid) + 4 = XOADC_GND/XOADC_GND + 5 = XOADC_VREF/XOADC_GND + +Example: + +xoadc: xoadc at 197 { + compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupt-parent = <&pm8058>; + interrupts = <76 1>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + + vcoin { + reg = <0x00>; + }; + vbat { + reg = <0x01>; + }; + dcin { + reg = <0x02>; + }; + ichg { + reg = <0x03>; + }; + vph_pwr { + reg = <0x04>; + }; + mpp5 { + reg = <0x05>; + }; + mpp6 { + reg = <0x06>; + }; + mpp7 { + reg = <0x07>; + }; + mpp8 { + reg = <0x08>; + }; + mpp9 { + reg = <0x09>; + }; + usb_vbus { + reg = <0x0a>; + }; + die_temp { + reg = <0x0b>; + }; + ref_625mv { + reg = <0x0c>; + }; + ref_1250mv { + reg = <0x0d>; + }; + ref_325mv { + reg = <0x0e>; + }; + ref_muxoff { + reg = <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 */ +};
Signature · 1 line
2.7.4
Rob Herring
maintainerPATCH v2 1/3 iio: adc: add device tree bindings for Qualcomm PM8xxx ADCs
Quoted 52 lines · Linus Walleij
This adds the device tree bindings for the Qualcomm PM8xxx ADCs. This is based on the existing DT bindings for the SPMI ADC so there are hopefully no controversial features.
Cc devicetree at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-arm-msm at vger.kernel.orgCc Ivan T. Ivanov <[email protected]>Cc Andy Gross <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Stephen Boyd <[email protected]>Cc Srinivas Kandagatla <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
ChangeLogv1->v2:
- Spelling fixes--- .../bindings/iio/adc/qcom,pm8xxx-xoadc.txt | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txtDocumentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +25
-0@@ -0,0 +1,160 @@ +Qualcomm's PM8xxx voltage XOADC + +The Qualcomm PM8xxx PMICs contain a HK/XO ADC (Housekeeping/Crystal +oscillator ADC) encompassing PM8018, PM8038, PM8058, PM8917 and PM8921. + +Required properties: + +- compatible: should be one of: + "qcom,pm8018-adc" + "qcom,pm8038-adc" + "qcom,pm8058-adc" + "qcom,pm8917-adc" + "qcom,pm8921-adc" + +- reg: should contain the ADC base address in the PMIC, typically + 0x197. + +The following required properties are standard for IO channels, see +iio-bindings.txt for more details: + +- #address-cells: should be set to <1> + +- #size-cells: should be set to <0> + +- #io-channel-cells: should be set to <1>
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt line 35
Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +10
-0+ +- 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: + +ref_625mv {
ref at c
Quoted 55 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +55
-0+ reg = <0x0c>; +}; + +ref_1250mv { + reg = <0x0d>; +}; + +ref_muxoff { + reg = <0x0f>; +}; + +These three nodes are used for absolute and ratiometric calibration +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. + +Required channel node properties: + +- reg: should contain the hardware channel number in the range + 0 .. 0x0f (4 bits). The hardware only supports 16 channels. + +Optional channel node properties: + +- qcom,decimation: + Value type: <u32> + Definition: This parameter is used to decrease the ADC sampling rate. + Quicker measurements can be made by reducing the decimation ratio. + Valid values are 512, 1024, 2048, 4096. + If the property is not found, a default value of 512 will be used. + +- qcom,ratiometric: + Value type: <empty> + Definition: Channel calibration type. If this property is specified + VADC will use the VDD reference (1.8V) and GND for channel + calibration. If the property is not found, the channel will be + calibrated with the 0.625V and 1.25V reference channels, also + known as an absolute calibration. + +- qcom,ratiometric-ref: + Value type: <u32> + Definition: The reference voltage pair when using ratiometric + calibration: + 0 = XO_IN/XOADC_GND + 1 = PMIC_IN/XOADC_GND + 2 = PMIC_IN/BMS_CSP + 3 (invalid) + 4 = XOADC_GND/XOADC_GND + 5 = XOADC_VREF/XOADC_GND + +Example: + +xoadc: xoadc at 197 {
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt line 100
Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +10
-0+ compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupt-parent = <&pm8058>; + interrupts = <76 1>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + + vcoin { + reg = <0x00>;
If you have a reg property, then you should have a unit address on all of these.
These should really all be something like adc-channel at ... Not sure if we have a standard node name for ADC channels. Or don't put any of this in DT.
Quoted 47 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file +47
-0+ }; + vbat { + reg = <0x01>; + }; + dcin { + reg = <0x02>; + }; + ichg { + reg = <0x03>; + }; + vph_pwr { + reg = <0x04>; + }; + mpp5 { + reg = <0x05>; + }; + mpp6 { + reg = <0x06>; + }; + mpp7 { + reg = <0x07>; + }; + mpp8 { + reg = <0x08>; + }; + mpp9 { + reg = <0x09>; + }; + usb_vbus { + reg = <0x0a>; + }; + die_temp { + reg = <0x0b>; + }; + ref_625mv { + reg = <0x0c>; + }; + ref_1250mv { + reg = <0x0d>; + }; + ref_325mv { + reg = <0x0e>; + }; + ref_muxoff { + reg = <0x0f>; + }; +};
PATCH v2 1/3 iio: adc: add device tree bindings for Qualcomm PM8xxx ADCs
In reply to Linus WalleijOn Thu 15 Dec 14:48 PST 2016, Linus Walleij wrote:
Sorry for taking so long time to give this a test.
Quoted 6 lines
--- .../bindings/iio/adc/qcom,pm8xxx-xoadc.txt | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txtDocumentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +0
-0
[..]
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt line 16
Quoted 3 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +3
-0+ +- reg: should contain the ADC base address in the PMIC, typically + 0x197.
xoadc-ref is "required" by the code (setting 2.2V on the dummy regulator returned in its absence will fail), so it should be mentioned here.
On 8064 pm8921_l14 seems to be our reference, which is 1.8V.
[..]
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt line 75
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +8
-0+ +- qcom,ratiometric: + Value type: <empty> + Definition: Channel calibration type. If this property is specified + VADC will use the VDD reference (1.8V) and GND for channel + calibration. If the property is not found, the channel will be + calibrated with the 0.625V and 1.25V reference channels, also + known as an absolute calibration.
So if I specify this property the reference should be 1.8V and if I specify qcom,ratiometric-ref I will override this? Also, the implementation requires that qcom,ratiometric-ref is specified if the boolean property is used.
Am I missing something or should we just squash them?
Quoted 12 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +12
-0+ +- qcom,ratiometric-ref: + Value type: <u32> + Definition: The reference voltage pair when using ratiometric + calibration: + 0 = XO_IN/XOADC_GND + 1 = PMIC_IN/XOADC_GND + 2 = PMIC_IN/BMS_CSP + 3 (invalid) + 4 = XOADC_GND/XOADC_GND + 5 = XOADC_VREF/XOADC_GND +
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt line 97
Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +10
-0+Example: + +xoadc: xoadc at 197 { + compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupt-parent = <&pm8058>; + interrupts = <76 1>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>;
xoadc-ref-supply = <>;
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt
Quoted 2 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +2
-0+ + vcoin {
As the node has a "reg" you need to add @0 on these.
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt
Quoted 2 lines
Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt +2
-0+ reg = <0x00>; + };
Regards,
Bjorn