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

Commit 8f0939f8 authored by Harry Yang's avatar Harry Yang
Browse files

iio: adc: add snapshot of rradc and tadc drivers



Snapshot of rradc and tadc drivers as of kernel 4.9
'commit fc9ce0e0a100f ("Merge changes  into msm-4.9")'.

Change-Id: I948b993a9803892170839cb98333205e17702ca4
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent a54f83c3
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
Qualcomm Technologies Inc., PMIC Round Robin ADC (RRADC)

PMIC RRADC provides an interface to the clients to read
the voltage, current and temperature for supported channels
such as battery ID, battery thermistor, die temperature,
charger temperature, USB_IN and DC_IN voltage and current.

Main node properties:

- compatible:
    Usage: required
    Value type: <string>
    Definition: Should contain "qcom,rradc".

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

- #address-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. Child node 'channel' property should define ADC
            channel number. For details about IIO bindings see:
            Documentation/devicetree/bindings/iio/iio-bindings.txt

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

- #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

IIO client nodes need to specify the RRADC channel number while requesting ADC reads.
The channel list supported by the RRADC driver is available in the enum rradc_channel_id
located at at drivers/iio/adc/qcom-rradc.c. Clients can use this index from the enum
as the channel number while requesting ADC reads.

Optional property:
- qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the
		    PMIC fabrication ID for applying the appropriate temperature
		    compensation parameters.
Example:

	/* RRADC node */
	pmic_rradc: rradc@4500 {
		compatible = "qcom,rradc";
		reg = <0x4500 0x100>;
		#address-cells = <1>;
		#size-cells = <0>;
		#io-channel-cells = <1>;
	};

	/* IIO client node */
	charger {
		io-channels = <&pmic_rradc 0>;
		io-channel-names = "rradc_batt_id";
	};
+141 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. TADC Specific Bindings

TADC (Telemetry ADC) is a 10 bit resolution ADC which has 8 channels: battery
temperature, skin temperature, die temperature, battery current, battery
voltage, input current, input voltage, and OTG current.

=======================
Required Node Structure
=======================

A TADC must be described in two levels of devices nodes.

=======================
First Level Node - TADC
=======================

- reg
  Usage:      required
  Value type: <prop-encoded-array>
  Definition: Address and size of the TADC register block.

TADC specific properties:
- compatible
  Usage:      required
  Value type: <string>
  Definition: Must be "qcom,tadc".

- interrupts
  Usage:      required
  Value type: <prop-encoded-array>
  Definition: Peripheral interrupt specifier.

- interrupt-names
  Usage:      required
  Value type: <stringlist>
  Definition: Interrupt names.  This list must match up 1-to-1 with the
	      interrupts specified in the 'interrupts' property.

=============================================
Second Level Nodes - TADC Thermistor Channels
=============================================

- reg
  Usage:      required
  Value type: <u32>
  Definition: The 0 based channel number.

TADC thermistor channel specific properties:
- qcom,rbias
  Usage:      required
  Value type: <u32>
  Definition: The bias resistor value.

- qcom,therm-at-25degc
  Usage:      required
  Value type: <u32>
  Definition: The thermistor resistance at 25 DegC.

- qcom,beta-coefficient
  Usage:      required
  Value type: <u32>
  Definition: The beta coefficeent or B-parameter of the thermistor.

===============================================
Second Level Nodes - TADC Scale/Offset Channels
===============================================

- reg
  Usage:      required
  Value type: <u32>
  Definition: The 0 based channel number.

TADC scale/offset channel specific properties:
- qcom,scale
  Usage:      required
  Value type: <s32>
  Definition: The RAW scaling factor.

- qcom,offset
  Usage:      optional
  Value type: <s32>
  Definition: The offset after scaling.

=======
Example
=======

smb138x_tadc: qcom,tadc@3600 {
	compatible = "qcom,tadc";
	#address-cells = <1>;
	#size-cells = <0>;
	#io-channel-cells = <1>;
	interrupts = <0x36 0x0 IRQ_TYPE_EDGE_BOTH>;
	interrupt-names = "eoc";

	batt_temp@0 {
		reg = <0>;
		qcom,rbias = <68100>;
		qcom,rtherm-at-25degc = <68000>;
		qcom,beta-coefficient = <3450>;
	};

	skin_temp@1 {
		reg = <1>;
		qcom,rbias = <33000>;
		qcom,rtherm-at-25degc = <68000>;
		qcom,beta-coefficient = <3450>;
	};

	die_temp@2 {
		reg = <2>;
		qcom,scale = <(-1032)>;
		qcom,offset = <344125>;
	};

	batt_i@3 {
		reg = <3>;
		qcom,channel = <3>;
		qcom,scale = <20000000>;
	};

	batt_v@4 {
		reg = <4>;
		qcom,scale = <5000000>;
	};

	input_i@5 {
		reg = <5>;
		qcom,scale = <14285714>;
	};

	input_v@6 {
		reg = <6>;
		qcom,scale = <25000000>;
	};

	otg_i@7 {
		reg = <7>;
		qcom,scale = <5714286>;
	};
};
+24 −0
Original line number Diff line number Diff line
@@ -593,6 +593,30 @@ config QCOM_SPMI_VADC
	  To compile this driver as a module, choose M here: the module will
	  be called qcom-spmi-vadc.

config QCOM_TADC
	tristate "Qualcomm Technologies, Inc. TADC driver"
	depends on MFD_I2C_PMIC
	help
	  Say yes here to support the Qualcomm Technologies, Inc. telemetry ADC.
	  The TADC provides battery temperature, skin temperature,
	  die temperature, battery voltage, battery current, input voltage,
	  input current, and OTG current.

config QCOM_RRADC
	tristate "Qualcomm Technologies Inc. PMIC Round robin ADC"
	depends on SPMI
	select REGMAP_SPMI
	help
	  This is the PMIC Round Robin ADC driver.

	  The driver supports multiple channels read used for telemetry
	  and supports clients to read batt_id, batt_therm, PMIC die
	  temperature, USB_IN and DC_IN voltage and current.
	  The RRADC is a 10-bit ADC.

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

config RCAR_GYRO_ADC
	tristate "Renesas R-Car GyroADC driver"
	depends on ARCH_RCAR_GEN2 || (ARM && COMPILE_TEST)
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o
obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o
obj-$(CONFIG_QCOM_VADC_COMMON) += qcom-vadc-common.o
obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
obj-$(CONFIG_QCOM_TADC) += qcom-tadc.o
obj-$(CONFIG_QCOM_RRADC) += qcom-rradc.o
obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o
obj-$(CONFIG_RCAR_GYRO_ADC) += rcar-gyroadc.o
obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
+1209 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading