[v3,1/5] Documentation: add DT bindings for ARM SCPI sensors

Message ID 1442235619-4029-2-git-send-email-punit.agrawal@arm.com
State New
Headers show

Commit Message

Punit Agrawal Sept. 14, 2015, 1 p.m.
The System Control Processor (SCP) provides access to SoC sensors via
the System Control and Power Interface (SCPI) Message Protocol. Add
bindings to allow probing of these sensors. Also support referencing
of the sensors for setting up thermal zones via the thermal DT
bindings.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
---
 Documentation/devicetree/bindings/arm/arm,scpi.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Mark Rutland Sept. 14, 2015, 1:14 p.m. | #1
On Mon, Sep 14, 2015 at 02:00:14PM +0100, Punit Agrawal wrote:
> The System Control Processor (SCP) provides access to SoC sensors via
> the System Control and Power Interface (SCPI) Message Protocol. Add
> bindings to allow probing of these sensors. Also support referencing
> of the sensors for setting up thermal zones via the thermal DT
> bindings.
> 
> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  Documentation/devicetree/bindings/arm/arm,scpi.txt | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/arm,scpi.txt b/Documentation/devicetree/bindings/arm/arm,scpi.txt
> index f002460..af66f7f 100644
> --- a/Documentation/devicetree/bindings/arm/arm,scpi.txt
> +++ b/Documentation/devicetree/bindings/arm/arm,scpi.txt
> @@ -72,8 +72,18 @@ Required sub-node properties:
>  - compatible : should be "arm,juno-scp-shmem" for Non-secure SRAM based
>  	       shared memory on Juno platforms
>  
> +Sensor bindings for the sensors based on SCPI Message Protocol
> +--------------------------------------------------------------
> +SCPI provides an API to access the various sensors on the SoC.
> +
> +Required properties:
> +- compatible : should be "arm,scpi-sensors".
> +- #thermal-sensor-cells: should be set to 1. This property follows the
> +			 thermal device tree bindings[2].

You need to specify what the valid values for this cell are.

Mark.

> +
>  [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
>  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
> +[2] Documentation/devicetree/bindings/thermal/thermal.txt
>  
>  Example:
>  
> @@ -122,6 +132,11 @@ scpi_protocol: scpi@2e000000 {
>  			clock-output-names = "pxlclk0", "pxlclk1";
>  		};
>  	};
> +
> +	scpi_sensors0: sensors {
> +		compatible = "arm,scpi-sensors";
> +		#thermal-sensor-cells = <1>;
> +	};
>  };
>  
>  cpu@0 {
> -- 
> 2.5.0
> 
--
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
Punit Agrawal Sept. 14, 2015, 1:34 p.m. | #2
Hi Mark,

Thanks for taking a look.

Mark Rutland <mark.rutland@arm.com> writes:

> On Mon, Sep 14, 2015 at 02:00:14PM +0100, Punit Agrawal wrote:
>> The System Control Processor (SCP) provides access to SoC sensors via
>> the System Control and Power Interface (SCPI) Message Protocol. Add
>> bindings to allow probing of these sensors. Also support referencing
>> of the sensors for setting up thermal zones via the thermal DT
>> bindings.
>> 
>> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  Documentation/devicetree/bindings/arm/arm,scpi.txt | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/bindings/arm/arm,scpi.txt b/Documentation/devicetree/bindings/arm/arm,scpi.txt
>> index f002460..af66f7f 100644
>> --- a/Documentation/devicetree/bindings/arm/arm,scpi.txt
>> +++ b/Documentation/devicetree/bindings/arm/arm,scpi.txt
>> @@ -72,8 +72,18 @@ Required sub-node properties:
>>  - compatible : should be "arm,juno-scp-shmem" for Non-secure SRAM based
>>  	       shared memory on Juno platforms
>>  
>> +Sensor bindings for the sensors based on SCPI Message Protocol
>> +--------------------------------------------------------------
>> +SCPI provides an API to access the various sensors on the SoC.
>> +
>> +Required properties:
>> +- compatible : should be "arm,scpi-sensors".
>> +- #thermal-sensor-cells: should be set to 1. This property follows the
>> +			 thermal device tree bindings[2].
>
> You need to specify what the valid values for this cell are.

The enumeration depends on the number of sensors exported by SCP
firmware - which is platform dependent. I could add add something like
if you think that is helpful -

"Valid cell value is a number between 0..n-1, where n is the number
of sensors exported by SCP firmware."

Thanks,

Punit

>
> Mark.
>
>> +
>>  [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
>>  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
>> +[2] Documentation/devicetree/bindings/thermal/thermal.txt
>>  
>>  Example:
>>  
>> @@ -122,6 +132,11 @@ scpi_protocol: scpi@2e000000 {
>>  			clock-output-names = "pxlclk0", "pxlclk1";
>>  		};
>>  	};
>> +
>> +	scpi_sensors0: sensors {
>> +		compatible = "arm,scpi-sensors";
>> +		#thermal-sensor-cells = <1>;
>> +	};
>>  };
>>  
>>  cpu@0 {
>> -- 
>> 2.5.0
>> 
> --
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Rutland Sept. 14, 2015, 1:49 p.m. | #3
> >> +Sensor bindings for the sensors based on SCPI Message Protocol
> >> +--------------------------------------------------------------
> >> +SCPI provides an API to access the various sensors on the SoC.
> >> +
> >> +Required properties:
> >> +- compatible : should be "arm,scpi-sensors".
> >> +- #thermal-sensor-cells: should be set to 1. This property follows the
> >> +			 thermal device tree bindings[2].
> >
> > You need to specify what the valid values for this cell are.
> 
> The enumeration depends on the number of sensors exported by SCP
> firmware - which is platform dependent. I could add add something like
> if you think that is helpful -
> 
> "Valid cell value is a number between 0..n-1, where n is the number
> of sensors exported by SCP firmware."

Can the FW identifer space have holes? Or are they always contiguous?

If this is the same as the raw FW identifer value, specify that.
Otherwise, you need to specify the mapping.

There needs to be enough information for a dts author to figure out
which values to place in the DT.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Punit Agrawal Sept. 14, 2015, 2:38 p.m. | #4
Mark Rutland <mark.rutland@arm.com> writes:

>> >> +Sensor bindings for the sensors based on SCPI Message Protocol
>> >> +--------------------------------------------------------------
>> >> +SCPI provides an API to access the various sensors on the SoC.
>> >> +
>> >> +Required properties:
>> >> +- compatible : should be "arm,scpi-sensors".
>> >> +- #thermal-sensor-cells: should be set to 1. This property follows the
>> >> +			 thermal device tree bindings[2].
>> >
>> > You need to specify what the valid values for this cell are.
>> 
>> The enumeration depends on the number of sensors exported by SCP
>> firmware - which is platform dependent. I could add add something like
>> if you think that is helpful -
>> 
>> "Valid cell value is a number between 0..n-1, where n is the number
>> of sensors exported by SCP firmware."
>
> Can the FW identifer space have holes? Or are they always contiguous?

The way the SCP interface is defined, the sensor identifiers are
contiguous, but not all are temperature sensors.

>
> If this is the same as the raw FW identifer value, specify that.
> Otherwise, you need to specify the mapping.

I'll update the patch to add mappings for Juno r0 (and r1 if I can get
my hands on one).

>
> There needs to be enough information for a dts author to figure out
> which values to place in the DT.

I understand. Except sometimes it is hard to get the firmware to commit to not
modify the ordering - discoverability and all that. :)

>
> Thanks,
> Mark.
> --
> 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
--
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
Mark Rutland Sept. 14, 2015, 2:43 p.m. | #5
On Mon, Sep 14, 2015 at 03:38:36PM +0100, Punit Agrawal wrote:
> Mark Rutland <mark.rutland@arm.com> writes:
> 
> >> >> +Sensor bindings for the sensors based on SCPI Message Protocol
> >> >> +--------------------------------------------------------------
> >> >> +SCPI provides an API to access the various sensors on the SoC.
> >> >> +
> >> >> +Required properties:
> >> >> +- compatible : should be "arm,scpi-sensors".
> >> >> +- #thermal-sensor-cells: should be set to 1. This property follows the
> >> >> +			 thermal device tree bindings[2].
> >> >
> >> > You need to specify what the valid values for this cell are.
> >> 
> >> The enumeration depends on the number of sensors exported by SCP
> >> firmware - which is platform dependent. I could add add something like
> >> if you think that is helpful -
> >> 
> >> "Valid cell value is a number between 0..n-1, where n is the number
> >> of sensors exported by SCP firmware."
> >
> > Can the FW identifer space have holes? Or are they always contiguous?
> 
> The way the SCP interface is defined, the sensor identifiers are
> contiguous, but not all are temperature sensors.

Ok. So how exactly are they enumerated for this binding?

> > If this is the same as the raw FW identifer value, specify that.
> > Otherwise, you need to specify the mapping.
> 
> I'll update the patch to add mappings for Juno r0 (and r1 if I can get
> my hands on one).

If there's identical logic mapping the two, we might just be able to
describe that rather than having to add tables all the time.

> > There needs to be enough information for a dts author to figure out
> > which values to place in the DT.
> 
> I understand. Except sometimes it is hard to get the firmware to commit to not
> modify the ordering - discoverability and all that. :)

If they do that, then things are broken regardless, no? I guess that'll
be clear if/when I see how the mapping works.

Thanks,
Mark.
--
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
Punit Agrawal Sept. 14, 2015, 3:01 p.m. | #6
Mark Rutland <mark.rutland@arm.com> writes:

> On Mon, Sep 14, 2015 at 03:38:36PM +0100, Punit Agrawal wrote:
>> Mark Rutland <mark.rutland@arm.com> writes:
>> 
>> >> >> +Sensor bindings for the sensors based on SCPI Message Protocol
>> >> >> +--------------------------------------------------------------
>> >> >> +SCPI provides an API to access the various sensors on the SoC.
>> >> >> +
>> >> >> +Required properties:
>> >> >> +- compatible : should be "arm,scpi-sensors".
>> >> >> +- #thermal-sensor-cells: should be set to 1. This property follows the
>> >> >> +			 thermal device tree bindings[2].
>> >> >
>> >> > You need to specify what the valid values for this cell are.
>> >> 
>> >> The enumeration depends on the number of sensors exported by SCP
>> >> firmware - which is platform dependent. I could add add something like
>> >> if you think that is helpful -
>> >> 
>> >> "Valid cell value is a number between 0..n-1, where n is the number
>> >> of sensors exported by SCP firmware."
>> >
>> > Can the FW identifer space have holes? Or are they always contiguous?
>> 
>> The way the SCP interface is defined, the sensor identifiers are
>> contiguous, but not all are temperature sensors.
>
> Ok. So how exactly are they enumerated for this binding?

The sensor enumeration for r0 (which I've verified) and r1 can be found
at [0]. The valid cell values are identifiers for the temperature sensors.

>
>> > If this is the same as the raw FW identifer value, specify that.
>> > Otherwise, you need to specify the mapping.
>> 
>> I'll update the patch to add mappings for Juno r0 (and r1 if I can get
>> my hands on one).
>
> If there's identical logic mapping the two, we might just be able to
> describe that rather than having to add tables all the time.
>

After seeing the mapping already published, I am wondering if there is
any value in duplicating the information. If there are no objections,
I'll update this patch to add pointers instead.

>> > There needs to be enough information for a dts author to figure out
>> > which values to place in the DT.
>> 
>> I understand. Except sometimes it is hard to get the firmware to commit to not
>> modify the ordering - discoverability and all that. :)
>
> If they do that, then things are broken regardless, no? I guess that'll
> be clear if/when I see how the mapping works.

[0] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0922b/apas03s22.html

>
> Thanks,
> Mark.
> --
> 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
--
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
Mark Rutland Sept. 14, 2015, 3:15 p.m. | #7
On Mon, Sep 14, 2015 at 04:01:09PM +0100, Punit Agrawal wrote:
> Mark Rutland <mark.rutland@arm.com> writes:
> 
> > On Mon, Sep 14, 2015 at 03:38:36PM +0100, Punit Agrawal wrote:
> >> Mark Rutland <mark.rutland@arm.com> writes:
> >> 
> >> >> >> +Sensor bindings for the sensors based on SCPI Message Protocol
> >> >> >> +--------------------------------------------------------------
> >> >> >> +SCPI provides an API to access the various sensors on the SoC.
> >> >> >> +
> >> >> >> +Required properties:
> >> >> >> +- compatible : should be "arm,scpi-sensors".
> >> >> >> +- #thermal-sensor-cells: should be set to 1. This property follows the
> >> >> >> +			 thermal device tree bindings[2].
> >> >> >
> >> >> > You need to specify what the valid values for this cell are.
> >> >> 
> >> >> The enumeration depends on the number of sensors exported by SCP
> >> >> firmware - which is platform dependent. I could add add something like
> >> >> if you think that is helpful -
> >> >> 
> >> >> "Valid cell value is a number between 0..n-1, where n is the number
> >> >> of sensors exported by SCP firmware."
> >> >
> >> > Can the FW identifer space have holes? Or are they always contiguous?
> >> 
> >> The way the SCP interface is defined, the sensor identifiers are
> >> contiguous, but not all are temperature sensors.
> >
> > Ok. So how exactly are they enumerated for this binding?
> 
> The sensor enumeration for r0 (which I've verified) and r1 can be found
> at [0]. The valid cell values are identifiers for the temperature sensors.

Ok. That's fine by me; I was confused and thought that there was some
internal mapping.

> >> > If this is the same as the raw FW identifer value, specify that.
> >> > Otherwise, you need to specify the mapping.
> >> 
> >> I'll update the patch to add mappings for Juno r0 (and r1 if I can get
> >> my hands on one).
> >
> > If there's identical logic mapping the two, we might just be able to
> > describe that rather than having to add tables all the time.
> >
> 
> After seeing the mapping already published, I am wondering if there is
> any value in duplicating the information. If there are no objections,
> I'll update this patch to add pointers instead.

That's fine by me. The important part is that the value is a raw Sensor
ID as the FW uses. So long as we state that, the IDs themselves can come
from whatever documentation is valid for a particular instance.

Thanks for the info!

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Punit Agrawal Sept. 14, 2015, 4:03 p.m. | #8
Mark Rutland <mark.rutland@arm.com> writes:

> On Mon, Sep 14, 2015 at 04:01:09PM +0100, Punit Agrawal wrote:
>> Mark Rutland <mark.rutland@arm.com> writes:
>> 

[...]

>> 
>> After seeing the mapping already published, I am wondering if there is
>> any value in duplicating the information. If there are no objections,
>> I'll update this patch to add pointers instead.
>
> That's fine by me. The important part is that the value is a raw Sensor
> ID as the FW uses. So long as we state that, the IDs themselves can come
> from whatever documentation is valid for a particular instance.
>
> Thanks for the info!

Sure. I've updated the patch to explain what the valid cell values are
along with a pointer to platform documentation for Juno R0 and R1.

I've also added an example to show usage of the sensors to create a
thermal zone.

I'll post a new version shortly.

Thanks for your having a look.

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

Patch

diff --git a/Documentation/devicetree/bindings/arm/arm,scpi.txt b/Documentation/devicetree/bindings/arm/arm,scpi.txt
index f002460..af66f7f 100644
--- a/Documentation/devicetree/bindings/arm/arm,scpi.txt
+++ b/Documentation/devicetree/bindings/arm/arm,scpi.txt
@@ -72,8 +72,18 @@  Required sub-node properties:
 - compatible : should be "arm,juno-scp-shmem" for Non-secure SRAM based
 	       shared memory on Juno platforms
 
+Sensor bindings for the sensors based on SCPI Message Protocol
+--------------------------------------------------------------
+SCPI provides an API to access the various sensors on the SoC.
+
+Required properties:
+- compatible : should be "arm,scpi-sensors".
+- #thermal-sensor-cells: should be set to 1. This property follows the
+			 thermal device tree bindings[2].
+
 [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] Documentation/devicetree/bindings/thermal/thermal.txt
 
 Example:
 
@@ -122,6 +132,11 @@  scpi_protocol: scpi@2e000000 {
 			clock-output-names = "pxlclk0", "pxlclk1";
 		};
 	};
+
+	scpi_sensors0: sensors {
+		compatible = "arm,scpi-sensors";
+		#thermal-sensor-cells = <1>;
+	};
 };
 
 cpu@0 {