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

Commit 8ec5e5b4 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dt-bindings: add bindings for ADC_TM driver"

parents 2a0c53b3 3ae33f40
Loading
Loading
Loading
Loading
+166 −0
Original line number Diff line number Diff line
Qualcomm Technologies Inc. SPMI PMIC5 voltage and current ADC

SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
voltage. The ADC is a 15-bit sigma-delta ADC.

ADC node:

- compatible:
    Usage: required
    Value type: <string>
    Definition: Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
		Should contain "qcom,spmi-adc-rev2" for PMIC refresh ADC driver.

- reg:
    Usage: required for VADC base address
    Value type: <prop-encoded-array>
    Definition: VADC base address and length in the SPMI PMIC register map.
                ADC_CAL base address and length in SPMI PMIC register map.
                ADC_CAL base is optional and is dependent on USB_IN_V channel
                read sequence for the PMIC.

- reg-names
    Usage: required
    Value type: <string>
    Definition: Names associated with base addresses. should be
                "adc5-usr-base", "adc5-cal-base".

- #address-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. Child node 'reg' property should define ADC
            channel number.

- #size-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be zero.

- #io-channel-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. For details about IIO bindings see:
            Documentation/devicetree/bindings/iio/iio-bindings.txt

- interrupts:
    Usage: optional
    Value type: <prop-encoded-array>
    Definition: End of conversion interrupt.

- qcom,pmic-revid:
    Usage: optional
    Value type:<u32>
    Definition: phandle pointing to the revision peripheral node. Use it to query the
                PMIC type and revision.

Channel node properties:

- reg:
    Usage: required
    Value type: <u32>
    Definition: ADC channel number.
            See include/dt-bindings/iio/qcom,spmi-vadc.h

- label:
    Usage: required
    Value type: <empty>
    Definition: ADC datasheet channel name.
            For thermistor inputs connected to generic AMUX or GPIO inputs
            these can vary across platform for the same pins. Hence select
            the datasheet name for this channel.

- qcom,pre-scaling:
    Usage: required
    Value type: <u32 array>
    Definition: Used for scaling the channel input signal before the signal is
            fed to VADC. The configuration for this node is to know the
            pre-determined ratio and use it for post scaling. Select one from
            the following options.
            <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
            If property is not found default value depending on chip will be used.

- qcom,decimation:
    Usage: optional
    Value type: <u32>
    Definition: This parameter is used to decrease ADC sampling rate.
            Quicker measurements can be made by reducing decimation ratio.
            For PMIC5 ADC, combined two step decimation values are 250, 420 and 840.
            If property is not found, default value of 840 will be used.
	    For PMIC refresh ADC, supported decimation values are 256, 512, 1024.
	    If property is not found, default value of 1024 will be used.

- qcom,ratiometric:
    Usage: optional
    Value type: <empty>
    Definition: Channel calibration type. If this property is specified
            VADC will use the VDD reference (1.875V) and GND for channel
            calibration. If property is not found, channel will be
            calibrated with 0V and 1.25V reference channels, also
            known as absolute calibration.

- qcom,hw-settle-time:
    Usage: optional
    Value type: <u32>
    Definition: Time between AMUX getting configured and the ADC starting
            conversion.
	    For PMIC5, delay = 15us for value 0,
			100us * (value) for values 0 < value < 11, and
			2ms * (value - 10) otherwise.
            Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800,
            900 us and 1, 2, 4, 6, 8, 10 ms
            If property is not found, channel will use 15us.
	    For PMIC rev2, delay = 100us * (value) for values 0 < value < 11, and
			2ms * (value - 10) otherwise.
            Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
            900 us and 1, 2, 4, 6, 8, 10 ms
            If property is not found, channel will use 0 us.

- qcom,avg-samples:
    Usage: optional
    Value type: <u32>
    Definition: Number of samples to be used for measurement.
            Averaging provides the option to obtain a single measurement
            from the ADC that is an average of multiple samples. The value
            selected is 2^(value).
            Valid values are: 1, 2, 4, 8, 16
            If property is not found, 1 sample will be used.

- qcom,lut-index:
    Usage: optional
    Value type: <u32>
    Definition: Lookup table index (only for bat_therm channels).
            A bat_therm channel (for 30k, 100k or 400k pull-up resistance)
            requires a voltage-temperature look-up table which depends on the target.
            The LUT to be used for a channel is selected from a table of LUTs
            for that particular channel.
            If property is not found, a default LUT is used for that channel,
            corresponding to index 0.

Example:

        /* VADC node */
        pmic_vadc: vadc@3100 {
                compatible = "qcom,spmi-adc5";
                reg = <0x3100 0x100>;
                interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
                #address-cells = <1>;
                #size-cells = <0>;
                #io-channel-cells = <1>;
                io-channel-ranges;

                /* Channel node */
                vph_pwr {
                        reg = <ADC_VPH_PWR>;
                        label = "vph_pwr";
                        qcom,decimation = <840>;
                        qcom,hw-settle-time = <0>;
                        qcom,avg-samples = <1>;
                        qcom,pre-scaling = <1 3>;
                };
        };

        /* IIO client node */
        usb {
                io-channels = <&pmic_vadc ADC_VPH_PWR>;
                io-channel-names = "vadc";
        };
+146 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. PMIC thermal monitor ADC driver (ADC_TM)

PMIC thermal monitoring (TM) provides interface to thermal clients
to set temperature thresholds and receive notification when the thresholds
are crossed. A 15 bit ADC is used for measurements. The driver is part
of the sysfs thermal framework that provides support to read the trip
points, set threshold for the trip points and enable the trip points.

ADC_TM node

- compatible:
    Usage: required
    Value type: <string>
    Definition: Should contain "qcom,adc-tm5" or "qcom,adc-tm5-iio"
                for PMIC5 ADC TM driver.

- reg:
    Usage: required
    Value type: <prop-encoded-array>
    Definition: ADC_TM base address and length in the SPMI PMIC register map.

- #address-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. Child node 'reg' property should define ADC
            channel number.

- #size-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be zero.

- interrupts:
    Usage: required
    Value type: <prop-encoded-array>
    Definition: End of conversion interrupt.

- interrupt-names:
    Usage: required
    Value type: <string>
    Definition: Should contain "thr-int-en" for PMIC5 ADC TM driver.

- qcom,decimation:
    Usage: optional
    Value type: <u32>
    Definition: This parameter is used to decrease ADC sampling rate.
            Quicker measurements can be made by reducing decimation ratio.
            For PMIC5 ADC, combined two step decimation values are 250, 420 and 840.
            If property is not found, default value of 840 will be used.

- qcom,avg-samples:
    Usage: optional
    Value type: <u32>
    Definition: Number of samples to be used for measurement.
            Averaging provides the option to obtain a single measurement
            from the ADC that is an average of multiple samples. The value
            selected is 2^(value).
            Valid values are: 1, 2, 4, 8, 16
            If property is not found, 1 sample will be used.

- #thermal-sensor-cells:
    Usage: optional
    Value type: <u32>
    Definition: Should be 1. See thermal.txt for a description.

- io-channels:
    Usage: Required
    Value type: <phandle u32>
    Definition: The phandle of the iio provider.

Channel node properties:

- reg:
    Usage: required
    Value type: <u32>
    Definition: ADC channel number.
            See include/dt-bindings/iio/qcom,spmi-vadc.h

- qcom,pre-scaling:
    Usage: optional
    Value type: <u32 array>
    Definition: Used for scaling the channel input signal before the signal is
            fed to VADC. The configuration for this node is to know the
            pre-determined ratio and use it for post scaling. Select one from
            the following options.
            <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
            If property is not found default value depending on chip will be used.

- qcom,ratiometric:
    Usage: optional
    Value type: <empty>
    Definition: Channel calibration type. If this property is specified
            VADC will use the VDD reference (1.875V) and GND for channel
            calibration. If property is not found, channel will be
            calibrated with 0V and 1.25V reference channels, also
            known as absolute calibration.

- qcom,hw-settle-time:
    Usage: optional
    Value type: <u32>
    Definition: Time between AMUX getting configured and the ADC starting
            conversion.
            For PMIC5, delay = 15us for value 0,
                        100us * (value) for values 0 < value < 11, and
                        2ms * (value - 10) otherwise.
            Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 1,
            2, 4, 8, 16, 32, 64, 128 ms
            If property is not found, channel will use 15us.

Example:

        /* ADC_TM node */
        pmic_adc_tm: adc_tm@3500 {
                compatible = "qcom,adc-tm5";
                reg = <0x3500 0x100>;
                interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
                interrupt-names = "thr-int-en";
                #address-cells = <1>;
                #size-cells = <0>;
                #thermal-sensor-cells = <1>;
                io-channels = <&pmic_vadc ADC_AMUX_THM2_PU2>;

                /* Channel node */
                skin_msm_therm {
                        reg = <ADC_AMUX_THM2_PU2>;
                        qcom,ratiometric;
                        qcom,hw-settle-time = <200>;
                };
        };

        /* Adding thermal zone to register with of_thermal */
        &thermal_zones {
                wp-therm {
                        polling-delay-passive = <0>;
                        polling-delay = <0>;
                        thermal-governor = "user_space";
                        thermal-sensors = <&pmic_adc_tm ADC_AMUX_THM2_PU2>;
                        trips {
                                active-config0 {
                                        temperature = <125000>;
                                        hysteresis = <1000>;
                                        type = "passive";
                                };
                        };
                };
        };
+1 −0
Original line number Diff line number Diff line
@@ -457,6 +457,7 @@ CONFIG_QTI_RPM_STATS_LOG=y
CONFIG_QMP_DEBUGFS_CLIENT=y
CONFIG_DEVFREQ_GOV_PASSIVE=y
CONFIG_IIO=y
CONFIG_QCOM_SPMI_ADC5=y
CONFIG_PWM=y
CONFIG_PWM_QTI_LPG=y
CONFIG_QCOM_PDC=y
+1 −0
Original line number Diff line number Diff line
@@ -472,6 +472,7 @@ CONFIG_QMP_DEBUGFS_CLIENT=y
CONFIG_DEVFREQ_GOV_PASSIVE=y
CONFIG_ARM_QCOM_DEVFREQ_FW=y
CONFIG_IIO=y
CONFIG_QCOM_SPMI_ADC5=y
CONFIG_PWM=y
CONFIG_PWM_QTI_LPG=y
CONFIG_QCOM_PDC=y
+20 −0
Original line number Diff line number Diff line
@@ -567,6 +567,26 @@ config QCOM_PM8XXX_XOADC
	  To compile this driver as a module, choose M here: the module
	  will be called qcom-pm8xxx-xoadc.

config QCOM_SPMI_ADC5
	tristate "Qualcomm Technologies Inc. SPMI PMIC5 ADC"
	depends on SPMI
	select REGMAP_SPMI
	select QCOM_VADC_COMMON
	help
	  This is the IIO Voltage PMIC5 ADC driver for Qualcomm Technologies Inc.

	  The driver supports multiple channels read. The ADC is a 16-bit
	  sigma-delta ADC. The hardware supports calibrated results for
	  conversion requests and clients include reading voltage phone
	  power, on board system thermistors connected to the PMIC ADC,
	  PMIC die temperature, charger temperature, battery current, USB voltage
	  input, voltage signals connected to supported PMIC GPIO inputs. The
	  hardware supports internal pull-up for thermistors and can choose between
	  a 100k, 30k and 400k pull up using the ADC channels.

	  To compile this driver as a module, choose M here: the module will
	  be called qcom-spmi-adc5.

config QCOM_SPMI_IADC
	tristate "Qualcomm SPMI PMIC current ADC"
	depends on SPMI
Loading