diff mbox

[v3,01/11] dt-bindings: thermal: Describe Armada AP806 and CP110

Message ID 20171214103011.24713-2-miquel.raynal@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Miquel Raynal Dec. 14, 2017, 10:30 a.m. UTC
From: Baruch Siach <baruch@tkos.co.il>

Add compatible strings for AP806 and CP110 that are part of the Armada
8k/7k line of SoCs.

Add a note on the differences in the size of the control area in
different bindings. This is an existing difference between the Armada
375 binding and the other boards already supported. The new AP806 and
CP110 bindings are similar to the existing Armada 375 in this regard.

Also add a note about the new property "marvell,thermal-zone-name" to
help identify the zones from the sysfs.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
[<miquel.raynal@free-electrons.com>: reword, additional details, new
property]
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
---
 .../devicetree/bindings/thermal/armada-thermal.txt | 29 ++++++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)

Comments

Baruch Siach Dec. 15, 2017, 8:27 a.m. UTC | #1
Hi Miquel

On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:
> +- marvell,thermal-zone-name: The name to identify the thermal zone
> +                             within the sysfs, useful when multiple
> +                             thermal zones are registered (AP, CPx...).

I don't think that would be acceptable. DT is about describing the hardware. 
sysfs is a Linux implementation detail which is not tied to any specific 
hardware. If this is accepted, the property should be named 
'linux,thermal-zone-name'.

baruch
Miquel Raynal Dec. 15, 2017, 8:32 a.m. UTC | #2
Hello Baruch,

On Fri, 15 Dec 2017 10:27:59 +0200
Baruch Siach <baruch@tkos.co.il> wrote:

> Hi Miquel
> 
> On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:
> > +- marvell,thermal-zone-name: The name to identify the thermal zone
> > +                             within the sysfs, useful when multiple
> > +                             thermal zones are registered (AP,
> > CPx...).  
> 
> I don't think that would be acceptable. DT is about describing the
> hardware. sysfs is a Linux implementation detail which is not tied to
> any specific hardware. If this is accepted, the property should be
> named 'linux,thermal-zone-name'.

You are right the sysfs mention should not appear in the description.

Otherwise for the naming I'm not sure "linux," is a valid prefix in
that case.

Miquèl
Baruch Siach Dec. 15, 2017, 8:44 a.m. UTC | #3
HI Miquèl

On Fri, Dec 15, 2017 at 09:32:03AM +0100, Miquel RAYNAL wrote:
> On Fri, 15 Dec 2017 10:27:59 +0200
> Baruch Siach <baruch@tkos.co.il> wrote:
> > 
> > On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:
> > > +- marvell,thermal-zone-name: The name to identify the thermal zone
> > > +                             within the sysfs, useful when multiple
> > > +                             thermal zones are registered (AP,
> > > CPx...).  
> > 
> > I don't think that would be acceptable. DT is about describing the
> > hardware. sysfs is a Linux implementation detail which is not tied to
> > any specific hardware. If this is accepted, the property should be
> > named 'linux,thermal-zone-name'.
> 
> You are right the sysfs mention should not appear in the description.

My comment was not about the description language. I don't think that this 
property is acceptable at all. But I'll let DT maintainers comment on that.

> Otherwise for the naming I'm not sure "linux," is a valid prefix in
> that case.

We use the 'linux' prefix for input key names and led triggers, for example.

baruch
Gregory CLEMENT Dec. 15, 2017, 8:44 a.m. UTC | #4
Hi Miquel,
 
 On ven., déc. 15 2017, Miquel RAYNAL <miquel.raynal@free-electrons.com> wrote:

> Hello Baruch,
>
> On Fri, 15 Dec 2017 10:27:59 +0200
> Baruch Siach <baruch@tkos.co.il> wrote:
>
>> Hi Miquel
>> 
>> On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:
>> > +- marvell,thermal-zone-name: The name to identify the thermal zone
>> > +                             within the sysfs, useful when multiple
>> > +                             thermal zones are registered (AP,
>> > CPx...).  
>> 
>> I don't think that would be acceptable. DT is about describing the
>> hardware. sysfs is a Linux implementation detail which is not tied to
>> any specific hardware. If this is accepted, the property should be
>> named 'linux,thermal-zone-name'.
>
> You are right the sysfs mention should not appear in the description.
>
> Otherwise for the naming I'm not sure "linux," is a valid prefix in
> that case.

Actually the choice between linux or marvell make me realize that there
is something wrong. Having a name associated to a device is something
pretty usual with the device tree, however it is as the class device
level, such as clock-names, line-name, or regulator-name. So in my
opinion if we want to support naming from device tree it would be done
for all the thermal device not just for the Marvell one.

However I don't think we need it. For example for the clocks we created
the name dynamically using of the base address of the register to keep
them unique.

Gregory


>
> Miquèl
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Miquel Raynal Dec. 15, 2017, 10:52 a.m. UTC | #5
Hello Baruch and Gregory,

On Fri, 15 Dec 2017 09:44:19 +0100
Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

> Hi Miquel,
>  
>  On ven., déc. 15 2017, Miquel RAYNAL
> <miquel.raynal@free-electrons.com> wrote:
> 
> > Hello Baruch,
> >
> > On Fri, 15 Dec 2017 10:27:59 +0200
> > Baruch Siach <baruch@tkos.co.il> wrote:
> >  
> >> Hi Miquel
> >> 
> >> On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:  
> >> > +- marvell,thermal-zone-name: The name to identify the thermal
> >> > zone
> >> > +                             within the sysfs, useful when
> >> > multiple
> >> > +                             thermal zones are registered (AP,
> >> > CPx...).    
> >> 
> >> I don't think that would be acceptable. DT is about describing the
> >> hardware. sysfs is a Linux implementation detail which is not tied
> >> to any specific hardware. If this is accepted, the property should
> >> be named 'linux,thermal-zone-name'.  
> >
> > You are right the sysfs mention should not appear in the
> > description.

Actually, you are right for all of it, this property should not
exist, sorry for my too quick answer.

> >
> > Otherwise for the naming I'm not sure "linux," is a valid prefix in
> > that case.  

Thank you both for your explanations, I was also wrong about the prefix.

> 
> Actually the choice between linux or marvell make me realize that
> there is something wrong. Having a name associated to a device is
> something pretty usual with the device tree, however it is as the
> class device level, such as clock-names, line-name, or
> regulator-name. So in my opinion if we want to support naming from
> device tree it would be done for all the thermal device not just for
> the Marvell one.
> 
> However I don't think we need it. For example for the clocks we
> created the name dynamically using of the base address of the
> register to keep them unique.

I was convinced that dev_name's would be the same but after trying it on
a 8040-DB, using dev_name(&pdev->dev) gives:

    f06f808c.thermal
    f2400078.thermal
    f4400078.thermal

which I found meaningful enough.

I will drop the property and use dev_name instead. I still need your
help to solve one problem though: how to make the distinction between
using "armada_thermal" (the previous name) and dev_name() ? If I don't
it kind of breaks userspace, doesn't it ?

Thank you,
Miquèl
Rob Herring (Arm) Dec. 15, 2017, 11:28 p.m. UTC | #6
On Fri, Dec 15, 2017 at 11:52:30AM +0100, Miquel RAYNAL wrote:
> Hello Baruch and Gregory,
> 
> On Fri, 15 Dec 2017 09:44:19 +0100
> Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
> 
> > Hi Miquel,
> >  
> >  On ven., déc. 15 2017, Miquel RAYNAL
> > <miquel.raynal@free-electrons.com> wrote:
> > 
> > > Hello Baruch,
> > >
> > > On Fri, 15 Dec 2017 10:27:59 +0200
> > > Baruch Siach <baruch@tkos.co.il> wrote:
> > >  
> > >> Hi Miquel
> > >> 
> > >> On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal wrote:  
> > >> > +- marvell,thermal-zone-name: The name to identify the thermal
> > >> > zone
> > >> > +                             within the sysfs, useful when
> > >> > multiple
> > >> > +                             thermal zones are registered (AP,
> > >> > CPx...).    
> > >> 
> > >> I don't think that would be acceptable. DT is about describing the
> > >> hardware. sysfs is a Linux implementation detail which is not tied
> > >> to any specific hardware. If this is accepted, the property should
> > >> be named 'linux,thermal-zone-name'.  
> > >
> > > You are right the sysfs mention should not appear in the
> > > description.
> 
> Actually, you are right for all of it, this property should not
> exist, sorry for my too quick answer.
> 
> > >
> > > Otherwise for the naming I'm not sure "linux," is a valid prefix in
> > > that case.  
> 
> Thank you both for your explanations, I was also wrong about the prefix.
> 
> > 
> > Actually the choice between linux or marvell make me realize that
> > there is something wrong. Having a name associated to a device is
> > something pretty usual with the device tree, however it is as the
> > class device level, such as clock-names, line-name, or
> > regulator-name. So in my opinion if we want to support naming from
> > device tree it would be done for all the thermal device not just for
> > the Marvell one.
> > 
> > However I don't think we need it. For example for the clocks we
> > created the name dynamically using of the base address of the
> > register to keep them unique.
> 
> I was convinced that dev_name's would be the same but after trying it on
> a 8040-DB, using dev_name(&pdev->dev) gives:
> 
>     f06f808c.thermal
>     f2400078.thermal
>     f4400078.thermal
> 
> which I found meaningful enough.
> 
> I will drop the property and use dev_name instead. I still need your
> help to solve one problem though: how to make the distinction between
> using "armada_thermal" (the previous name) and dev_name() ? If I don't
> it kind of breaks userspace, doesn't it ?

No. The /sys/devices/... or /sys/bus/platform/... paths and names are 
not guaranteed to be stable. These changed for every platform converted 
to DT for example. Userspace should be accessing things through 
/sys/class/... (or deal with changes).

Rob
Miquel Raynal Dec. 16, 2017, 12:50 p.m. UTC | #7
Hello Rob,

On Fri, 15 Dec 2017 17:28:54 -0600
Rob Herring <robh@kernel.org> wrote:

> On Fri, Dec 15, 2017 at 11:52:30AM +0100, Miquel RAYNAL wrote:
> > Hello Baruch and Gregory,
> > 
> > On Fri, 15 Dec 2017 09:44:19 +0100
> > Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
> >   
> > > Hi Miquel,
> > >  
> > >  On ven., déc. 15 2017, Miquel RAYNAL
> > > <miquel.raynal@free-electrons.com> wrote:
> > >   
> > > > Hello Baruch,
> > > >
> > > > On Fri, 15 Dec 2017 10:27:59 +0200
> > > > Baruch Siach <baruch@tkos.co.il> wrote:
> > > >    
> > > >> Hi Miquel
> > > >> 
> > > >> On Thu, Dec 14, 2017 at 11:30:01AM +0100, Miquel Raynal
> > > >> wrote:    
> > > >> > +- marvell,thermal-zone-name: The name to identify the
> > > >> > thermal zone
> > > >> > +                             within the sysfs, useful when
> > > >> > multiple
> > > >> > +                             thermal zones are registered
> > > >> > (AP, CPx...).      
> > > >> 
> > > >> I don't think that would be acceptable. DT is about describing
> > > >> the hardware. sysfs is a Linux implementation detail which is
> > > >> not tied to any specific hardware. If this is accepted, the
> > > >> property should be named 'linux,thermal-zone-name'.    
> > > >
> > > > You are right the sysfs mention should not appear in the
> > > > description.  
> > 
> > Actually, you are right for all of it, this property should not
> > exist, sorry for my too quick answer.
> >   
> > > >
> > > > Otherwise for the naming I'm not sure "linux," is a valid
> > > > prefix in that case.    
> > 
> > Thank you both for your explanations, I was also wrong about the
> > prefix. 
> > > 
> > > Actually the choice between linux or marvell make me realize that
> > > there is something wrong. Having a name associated to a device is
> > > something pretty usual with the device tree, however it is as the
> > > class device level, such as clock-names, line-name, or
> > > regulator-name. So in my opinion if we want to support naming from
> > > device tree it would be done for all the thermal device not just
> > > for the Marvell one.
> > > 
> > > However I don't think we need it. For example for the clocks we
> > > created the name dynamically using of the base address of the
> > > register to keep them unique.  
> > 
> > I was convinced that dev_name's would be the same but after trying
> > it on a 8040-DB, using dev_name(&pdev->dev) gives:
> > 
> >     f06f808c.thermal
> >     f2400078.thermal
> >     f4400078.thermal
> > 
> > which I found meaningful enough.
> > 
> > I will drop the property and use dev_name instead. I still need your
> > help to solve one problem though: how to make the distinction
> > between using "armada_thermal" (the previous name) and dev_name() ?
> > If I don't it kind of breaks userspace, doesn't it ?  
> 
> No. The /sys/devices/... or /sys/bus/platform/... paths and names are 
> not guaranteed to be stable. These changed for every platform
> converted to DT for example. Userspace should be accessing things
> through /sys/class/... (or deal with changes).

Ok, thanks for the explanation.

I will sent a v4 early next week about all the changes requested.

Thank you all for reviewing.
Miquèl
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/thermal/armada-thermal.txt b/Documentation/devicetree/bindings/thermal/armada-thermal.txt
index 24aacf8948c5..1602dc2ee220 100644
--- a/Documentation/devicetree/bindings/thermal/armada-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/armada-thermal.txt
@@ -7,17 +7,36 @@  Required properties:
 		marvell,armada375-thermal
 		marvell,armada380-thermal
 		marvell,armadaxp-thermal
+		marvell,armada-ap806-thermal
+		marvell,armada-cp110-thermal
 
 - reg:		Device's register space.
 		Two entries are expected, see the examples below.
-		The first one is required for the sensor register;
-		the second one is required for the control register
-		to be used for sensor initialization (a.k.a. calibration).
+		The first one points to the status register (4B).
+		The second one points to the control registers (8B).
+		Note: with legacy bindings, the second entry pointed
+		only on the so called "control MSB" ("control 1"), was
+		4B wide and did not let the possibility to reach the
+		"control LSB" ("control 0") register.
 
-Example:
+Optional properties:
 
+- marvell,thermal-zone-name: The name to identify the thermal zone
+                             within the sysfs, useful when multiple
+                             thermal zones are registered (AP, CPx...).
+
+Examples:
+
+	/* Legacy bindings */
 	thermal@d0018300 {
 		compatible = "marvell,armada370-thermal";
-                reg = <0xd0018300 0x4
+		reg = <0xd0018300 0x4
 		       0xd0018304 0x4>;
 	};
+
+	ap_thermal: thermal@6f8084 {
+		compatible = "marvell,armada-ap806-thermal";
+		reg = <0x6f808C 0x4>,
+		      <0x6f8084 0x8>;
+		marvell,thermal-zone-name = "ap_thermal_zone";
+	};