diff mbox

[1/7] Documentation: DT: bindings: iio: adc: add documentation for Allwinner SoCs' GPADC driver

Message ID 20161220102709.9504-2-quentin.schulz@free-electrons.com
State New
Headers show

Commit Message

Quentin Schulz Dec. 20, 2016, 10:27 a.m. UTC
The Allwinner SoCs all have an ADC that can also act as a thermal sensor
and sometimes as a touchscreen controller. If there is a touchscreen
controller, the first four channels can be used either for the ADC or
the touchscreen and the fifth channel is used for the thermal sensor.
If there is not a touchscreen controller, the one and only channel is
used for the thermal sensor.

This patch adds the documentation for the driver of the Allwinner SoCs'
GPADC.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

---
 .../bindings/iio/adc/sun4i-gpadc-iio.txt           | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt

-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Maxime Ripard Dec. 20, 2016, 2:25 p.m. UTC | #1
Hi,

On Tue, Dec 20, 2016 at 11:27:03AM +0100, Quentin Schulz wrote:
> The Allwinner SoCs all have an ADC that can also act as a thermal sensor

> and sometimes as a touchscreen controller. If there is a touchscreen

> controller, the first four channels can be used either for the ADC or

> the touchscreen and the fifth channel is used for the thermal sensor.

> If there is not a touchscreen controller, the one and only channel is

> used for the thermal sensor.

> 

> This patch adds the documentation for the driver of the Allwinner SoCs'

> GPADC.

> 

> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

> ---

>  .../bindings/iio/adc/sun4i-gpadc-iio.txt           | 57 ++++++++++++++++++++++

>  1 file changed, 57 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt

> 

> diff --git a/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt

> new file mode 100644

> index 0000000..aab768d

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt

> @@ -0,0 +1,57 @@

> +Allwinner SoCs' GPADC Device Tree bindings

> +------------------------------------------

> +

> +The Allwinner SoCs all have an ADC that can also act as a thermal sensor and

> +sometimes as a touchscreen controller. If there is a touchscreen controller, the

> +first four channels can be used either for the ADC or the touchscreen and the

> +fifth channel is used for the thermal sensor.

> +If there is not a touchscreen controller, the one and only channel is used for

> +the thermal sensor.

> +

> +Currently, the touchscreen controller does not have a driver using this ADC

> +driver. The touchscreen controller is currently driven only by

> +input/touchscreen/sun4i-ts.c which is absolutely incompatible with this driver.

> +

> +The Allwinner A10, A13 and A31 SoCs already have a DT binding for the

> +aforementioned input driver, thus an MFD driver matches the existing DT binding

> +(mfd/sun4i-gpadc.c) and replaces the input driver. No DT binding is required for

> +these SoCs' ADC, everything is handled by the MFD which is matching the existing

> +DT binding for input/touchscreen/sun4i-ts.c.

> +

> +The Allwinner A33 GPADC only have a thermal sensor and have a proper DT binding

> +for this driver unlike the previously mentioned SoCs.


The DT bindings should be agnostic from the OS. You can remove all
mention of the implementations details in Linux.

(and you should wrap at 72 characters).

But we already have a binding document for that controller, so you
shouldn't create a new one, reuse the old one that is already there.

> +Required properties:

> + - compatible: "allwinner,sun8i-a33-gpadc-iio"


IIO is an implementation detail. The IP is called GPADC.
You're also missing reg.

> +

> +Optional properties:

> +(for use with thermal framework for CPU thermal throttling for example, and/or

> + IIO consumers)

> + - #thermal-sensor-cells = <0>; (see

> +Documentation/devicetree/bindings/thermal/thermal.txt)

> + - #io-channel-cells = <0>; (see

> +Documentation/devicetree/bindings/iio/iio-bindings.txt)


I wouldn't list that as optional.

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Maxime Ripard Dec. 21, 2016, 12:20 p.m. UTC | #2
Hi,

On Tue, Dec 20, 2016 at 04:43:58PM +0100, Quentin Schulz wrote:
> >> +

> >> +Optional properties:

> >> +(for use with thermal framework for CPU thermal throttling for example, and/or

> >> + IIO consumers)

> >> + - #thermal-sensor-cells = <0>; (see

> >> +Documentation/devicetree/bindings/thermal/thermal.txt)

> >> + - #io-channel-cells = <0>; (see

> >> +Documentation/devicetree/bindings/iio/iio-bindings.txt)

> > 

> > I wouldn't list that as optional.

> 

> In what sense? Do you mean you wouldn't put them here at all or you

> would require them?


I would require them.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt
new file mode 100644
index 0000000..aab768d
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc-iio.txt
@@ -0,0 +1,57 @@ 
+Allwinner SoCs' GPADC Device Tree bindings
+------------------------------------------
+
+The Allwinner SoCs all have an ADC that can also act as a thermal sensor and
+sometimes as a touchscreen controller. If there is a touchscreen controller, the
+first four channels can be used either for the ADC or the touchscreen and the
+fifth channel is used for the thermal sensor.
+If there is not a touchscreen controller, the one and only channel is used for
+the thermal sensor.
+
+Currently, the touchscreen controller does not have a driver using this ADC
+driver. The touchscreen controller is currently driven only by
+input/touchscreen/sun4i-ts.c which is absolutely incompatible with this driver.
+
+The Allwinner A10, A13 and A31 SoCs already have a DT binding for the
+aforementioned input driver, thus an MFD driver matches the existing DT binding
+(mfd/sun4i-gpadc.c) and replaces the input driver. No DT binding is required for
+these SoCs' ADC, everything is handled by the MFD which is matching the existing
+DT binding for input/touchscreen/sun4i-ts.c.
+
+The Allwinner A33 GPADC only have a thermal sensor and have a proper DT binding
+for this driver unlike the previously mentioned SoCs.
+
+Required properties:
+ - compatible: "allwinner,sun8i-a33-gpadc-iio"
+
+Optional properties:
+(for use with thermal framework for CPU thermal throttling for example, and/or
+ IIO consumers)
+ - #thermal-sensor-cells = <0>; (see
+Documentation/devicetree/bindings/thermal/thermal.txt)
+ - #io-channel-cells = <0>; (see
+Documentation/devicetree/bindings/iio/iio-bindings.txt)
+
+Example:
+
+thermal-zones {
+	cpu_thermal {
+		thermal-sensors = <&rtp>;
+		[...]
+	};
+};
+
+soc@01c00000 {
+	[...]
+	rtp: rtp@01c25000 {
+		compatible = "allwinner,sun8i-a33-gpadc-iio";
+		reg = <0x01c25000 0x100>;
+		#thermal-sensor-cells = <0>;
+		#io-channel-cells = <0>;
+	};
+}
+
+iio_hwmon {
+	compatible = "iio-hwmon";
+	io-channels = <&rtp>;
+};