From d6d5b31791efacbc10ae665ad52d69d6c9f17f7d Mon Sep 17 00:00:00 2001 From: Jishnu Prakash Date: Mon, 22 Mar 2021 13:28:47 +0530 Subject: [PATCH] dt-bindings: iio: qcom,spmi-vadc: Add PMIC5 GEN3 ADC bindings PMIC5 GEN3 ADC has support for clients to read voltage and current on supported channels connected to the PMIC. Clients include reading voltage phone power and on board system thermistors for thermal management. ADCs on certain PMICs have support to read battery current. Change-Id: Ief7cbdf77d227ba2cb4ef7919aa66d9962d98e37 Signed-off-by: Jishnu Prakash [quic_amelende@quicinc.com: Converted binding change from .txt to .yaml] Signed-off-by: Anjelique Melendez --- bindings/iio/adc/qcom,spmi-vadc.yaml | 157 ++++++++++++++++++++++++++- 1 file changed, 153 insertions(+), 4 deletions(-) diff --git a/bindings/iio/adc/qcom,spmi-vadc.yaml b/bindings/iio/adc/qcom,spmi-vadc.yaml index 298c895f..8df7061d 100644 --- a/bindings/iio/adc/qcom,spmi-vadc.yaml +++ b/bindings/iio/adc/qcom,spmi-vadc.yaml @@ -25,6 +25,7 @@ properties: - enum: - qcom,spmi-vadc - qcom,spmi-adc5 + - qcom,spmi-adc5-gen3 - qcom,spmi-adc5-lite - qcom,spmi-adc-rev2 - qcom,spmi-adc7 @@ -39,6 +40,14 @@ properties: - For compatible property "qcom,spmi-adc7-sw-calib", two registers are required. First register is the VADC peripheral base address and the second is the ADC common peripheral base addess. + - For compatible property "qcom,spmi-adc5-gen3", each reg corresponds + to the SDAM peripheral base address that is being used. + + qcom,debug-base: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Debug ADC peripheral base address in the SPMI PMIC register map. Defined for + compatible "qcom,spmi-adc5-gen3". '#address-cells': const: 1 @@ -49,10 +58,25 @@ properties: '#io-channel-cells': const: 1 + '#thermal-sensor-cells': + const: 1 + description: | + For compatible property "qcom,spmi-adc5-gen3", property is required for ADC_TM device. + interrupts: - maxItems: 1 - description: + minItems: 1 + maxItems: 2 + description: | End of conversion interrupt. + - For compatible property "qcom,spmi-adc5-gen3", interrupts are defined + for each SDAM being used. + + interrupt-names: + minItems: 1 + maxItems: 2 + description: | + For compatible property "qcom,spmi-adc5-gen3", names should be defined + as "adc-sdam" where represents the SDAM index. required: - compatible @@ -168,10 +192,31 @@ patternProperties: $ref: /schemas/types.yaml#/definitions/uint32 description: | The index of the VADC scale function used to convert raw ADC code to - physical scaled unites for the channel. Defined for compatibles - "qcom,spmi-adc5" and "qcom,spmi-adc7". + physical scaled units for the channel. Defined for compatibles + "qcom,spmi-adc5", "qcom,spmi-adc7" and "qcom,spmi-adc5-gen3". See include/dt-bindings/iio/qcom,spmi-vadc.h for values. + qcom,adc-tm-type: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Type of ADC_TM usage defined for a given channel. Defined for compatible + "qcom,spmi-adc5-gen3". + 0 - not used for ADC_TM + 1 - connected to thermistor; supports temperature threshold violation detection + and temperature reading + 2 - connected to thermistor; supports temperature reading + 3 - not connected to thermistor; supports non-thermal threshold violation detection + enum: [ 0, 1, 2, 3] + default: 0 + + qcom,rscale-type: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Type of reverse scaling function used for the ADC_TM channels. Defined for + compatible "qcom,spmi-adc5-gen3" and valid only for the case of + non-thermal ADC_TM client. + const: 0 + required: - reg @@ -186,6 +231,9 @@ allOf: properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -203,6 +251,8 @@ allOf: default: 1 qcom,no-cal: false + qcom,adc-tm-type: false + qcom,rscale-type: false - if: properties: @@ -214,6 +264,9 @@ allOf: properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -231,6 +284,8 @@ allOf: default: 1 qcom,no-cal: false + qcom,adc-tm-type: false + qcom,rscale-type: false - if: properties: @@ -242,6 +297,9 @@ allOf: properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -259,6 +317,45 @@ allOf: default: 1 qcom,no-cal: false + qcom,adc-tm-type: false + qcom,rscale-type: false + + - if: + properties: + compatible: + contains: + const: qcom,spmi-adc5-gen3 + + then: + properties: + reg: + minItems: 2 + interrupts: + minItems: 2 + interrupt-names: + items: + - const: adc-sdam0 + - const: adc-sdam1 + required: + - interrupts + - interrupt-names + patternProperties: + "^channel@[0-9a-f]+$": + properties: + qcom,decimation: + enum: [ 85, 340, 1360 ] + default: 1360 + + qcom,hw-settle-time: + enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, + 8000, 16000, 32000, 64000, 128000 ] + default: 15 + + qcom,avg-samples: + enum: [ 1, 2, 4, 8, 16 ] + default: 1 + + qcom,no-cal: false - if: properties: @@ -270,6 +367,9 @@ allOf: properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -287,6 +387,8 @@ allOf: default: 1 qcom,no-cal: false + qcom,adc-tm-type: false + qcom,rscale-type: false - if: properties: @@ -298,6 +400,9 @@ allOf: properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -315,6 +420,8 @@ allOf: default: 1 qcom,no-cal: false + qcom,adc-tm-type: false + qcom,rscale-type: false - if: properties: @@ -326,6 +433,9 @@ allOf: properties: reg: minItems: 2 + interrupts: + maxItems: 1 + qcom,debug-base: false patternProperties: "^channel@[0-9a-f]+$": properties: @@ -342,6 +452,9 @@ allOf: enum: [ 1, 2, 4, 8, 16 ] default: 1 + qcom,adc-tm-type: false + qcom,rscale-type: false + not: required: - qcom,no-cal @@ -422,3 +535,39 @@ examples: }; }; }; + + - | + #include + #include + + spmi { + #address-cells = <1>; + #size-cells = <0>; + vadc@9000 { + compatible = "qcom,spmi-adc5-gen3"; + reg = <0x9000>, <0x9100>; + qcom,debug-base = <0x7600>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + #thermal-sensor-cells = <1>; + interrupt-names = "adc-sdam0", "adc-sdam1"; + interrupts = <0x0 0x90 0x1 IRQ_TYPE_EDGE_RISING>, + <0x0 0x91 0x1 IRQ_TYPE_EDGE_RISING>; + + channel@0 { + reg = ; + label = "pmk8550_offset_ref"; + qcom,pre-scaling = <1 1>; + }; + + channel@4 { + reg = ; + label = "pmk8550_xo_therm"; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + qcom,adc-tm-type = <1>; + }; + }; + };