Skip to contentSkip to conversation

arm64: dts: qcom: pm8998: Add die temperature channel node to the ADC

PATCH Superseded Matthias Kaehlcke 5 participants 13 messages Oct 4, 2018 – Nov 2, 2018

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover arm64: dts: qcom: pm8998: Add die temperature channel node to the ADC

This series adds a channel for the die temperature to the QCOM SPMI PMIC5 ADC. It also fixes an example in the DT documentation.

The die temperature is going to be used by the temperature alarm driver
(https://lore.kernel.org/patchwork/project/lkml/list/?series=361416).

The former name of the series was "arm64: dts: qcom: pm8998: Add ADC node and die temperature channel"
(https://patchwork.kernel.org/project/linux-arm-msm/list/?series=17165),
2 of the 3 patches of this series already landed in Andy's tree, hence the new name.

Matthias Kaehlcke (2):
dt-bindings: iio: vadc: Update example to include unit address for
node 'usb-id-nopull'
arm64: dts: qcom: pm8998: Add die temperature channel node to the ADC

 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 arch/arm64/boot/dts/qcom/pm8998.dtsi                         | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.0.605.g01d371f741-goog
#1 lore raw

PATCH v5 1/2 dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

---
Changes in v4:
- patch added to the series

---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +1 -1
index d0c188e5c922..ff7aa5038ba6 100644
@@ -112,7 +112,7 @@ Example:
 		io-channel-ranges;
 
 		/* Channel node */
-		usb_id_nopull {
+		usb-id-nopull@VADC_LR_MUX10_USB_ID {
 			reg = <VADC_LR_MUX10_USB_ID>;
 			qcom,decimation = <512>;
 			qcom,ratiometric;
Signature · 1 line
2.19.0.605.g01d371f741-goog
#11 lore raw

PATCH v5 2/2 arm64: dts: qcom: pm8998: Add die temperature channel node to the ADC

In reply to Matthias Kaehlcke

Add a channel node for the die temperature to the ADC.

---
Changes in v4:
- added unit address to 'die-temp' node

---
 arch/arm64/boot/dts/qcom/pm8998.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/pm8998.dtsi +5 -0
index 048f19fa0150..32b141637d13 100644
@@ -75,6 +75,11 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			#io-channel-cells = <1>;
+
+			die-temp@ADC5_DIE_TEMP {
+				reg = <ADC5_DIE_TEMP>;
+				label = "die_temp";
+			};
 		};
 
 		rtc@6000 {
Signature · 1 line
2.19.0.605.g01d371f741-goog
Reviewed-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

In reply to Matthias Kaehlcke

Hi,

Quoted 20 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

---
Changes in v4:
- patch added to the series

---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +0 -0
index d0c188e5c922..ff7aa5038ba6 100644

Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt Example: · line 116

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +1 -1
@@ -112,7 +112,7 @@ Example:
                io-channel-ranges;
 
                /* Channel node */
-               usb_id_nopull {
+               usb-id-nopull@VADC_LR_MUX10_USB_ID {
                        reg = <VADC_LR_MUX10_USB_ID>;

This is my understanding of how it should be done and matches some existing examples I see in the tree. AKA "pd_hdcp@RK3399_PD_HDCP". Thanks for cleaning it up!

#12 lore raw
In reply to Matthias Kaehlcke

Hi,

Quoted 8 lines · Matthias Kaehlcke

Add a channel node for the die temperature to the ADC.

---
Changes in v4:
- added unit address to 'die-temp' node

This probably should have been "changes in v5"

Quoted 9 lines
---
 arch/arm64/boot/dts/qcom/pm8998.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/pm8998.dtsi +0 -0
index 048f19fa0150..32b141637d13 100644

arch/arm64/boot/dts/qcom/pm8998.dtsi line 80

Quoted 6 lines
arch/arm64/boot/dts/qcom/pm8998.dtsi +3 -0
@@ -75,6 +75,11 @@
                        #address-cells = <1>;
                        #size-cells = <0>;
                        #io-channel-cells = <1>;
+
+                       die-temp@ADC5_DIE_TEMP {
+                               reg = <ADC5_DIE_TEMP>;

Thanks for adding the unit address. Note to Andy that this ought to go into the queue for 4.20 since you'll have the ADC5_DIE_TEMP then.

-Doug

maintainer
#3 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

In reply to Matthias Kaehlcke
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Quoted 13 lines

---
Changes in v4:
- patch added to the series

---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +0 -0
index d0c188e5c922..ff7aa5038ba6 100644

Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt Example: · line 116

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +1 -1
@@ -112,7 +112,7 @@ Example:
 		io-channel-ranges;
 
 		/* Channel node */
-		usb_id_nopull {
+		usb-id-nopull@VADC_LR_MUX10_USB_ID {
 			reg = <VADC_LR_MUX10_USB_ID>;

Defines are generally used when there's not well defined numbering such as clock ids. Interrupts and addresses are generally well defined and don't need defines.

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +0 -0
 			qcom,decimation = <512>;
 			qcom,ratiometric;
Signature · 1 line
2.19.0.605.g01d371f741-goog
#4 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Hi Rob,

Quoted 8 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels?

yes

Quoted 1 line

If so, then DT convention would really be "adc@...".

ok, will update

Quoted 15 lines
Quoted 15 lines

---
Changes in v4:
- patch added to the series

---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +0 -0
index d0c188e5c922..ff7aa5038ba6 100644
@@ -112,7 +112,7 @@ Example:
 		io-channel-ranges;
 
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt Example: · line 116

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +1 -1
 		/* Channel node */
-		usb_id_nopull {
+		usb-id-nopull@VADC_LR_MUX10_USB_ID {
 			reg = <VADC_LR_MUX10_USB_ID>;

Defines are generally used when there's not well defined numbering such as clock ids. Interrupts and addresses are generally well defined and don't need defines.

ok, I'll update this to use literals

Thanks for the review!

Matthias

#5 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Quoted 42 lines · Matthias Kaehlcke

Hi Rob,

Quoted 8 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels?

yes

Quoted 1 line

If so, then DT convention would really be "adc@...".

ok, will update

Quoted 15 lines
Quoted 15 lines

---
Changes in v4:
- patch added to the series

---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +0 -0
index d0c188e5c922..ff7aa5038ba6 100644
@@ -112,7 +112,7 @@ Example:
 		io-channel-ranges;
 
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt Example: · line 116

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt +1 -1
 		/* Channel node */
-		usb_id_nopull {
+		usb-id-nopull@VADC_LR_MUX10_USB_ID {
 			reg = <VADC_LR_MUX10_USB_ID>;

Defines are generally used when there's not well defined numbering such as clock ids. Interrupts and addresses are generally well defined and don't need defines.

Quoted 1 line

ok, I'll update this to use literals

Actually I'm not convinced literals are the right answer here. It makes perfect sense for a standard ADC, with a 1:1 mapping of channel number and physical input. However in case of the VADC/ADC5 there can be multiple channel numbers per input pin, the different values are used to select a certain 'configuration' (eg. ADC5_BAT_THERM, ADC5_BAT_THERM_30K_PU, ADC5_BAT_THERM_100K_PU, ADC5_BAT_THERM_400K_PU). IMO using integer channel numbers here would be more error prone and obfuscating than using the defines.

#6 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

In reply to Rob Herring
Quoted 9 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Is it really? A grep for 'adc@' in arch/${ARCH}/boot/dts yields mostly ADC controller not channel nodes.

I'm totally fine with changing the name to 'adc@...' if that's the preference/convention, just want to reconfirm since the actual use is a bit ambiguous.

#7 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Quoted 11 lines · Matthias Kaehlcke
Quoted 9 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Quoted 6 lines

Is it really? A grep for 'adc@' in arch/${ARCH}/boot/dts yields mostly ADC controller not channel nodes.

I'm totally fine with changing the name to 'adc@...' if that's the preference/convention, just want to reconfirm since the actual use is a bit ambiguous.

Could we please reach a conclusion on this?

Summarizing the options on the table so far are:

1. usb-id-nopull@VADC_LR_MUX10_USB_ID
2. usb-id-nopull@57
3. adc@VADC_LR_MUX10_USB_ID
4. adc@57

My personal preference goes to something <node name>@<define> since the unit address doesn't just resolve to an ADC channel number but also includes configuation information. A literal like '57' conveys less information than the define, it's easier to introduce errors and these errors are harder to spot.

If 'adc@...' really was the convention (or should be) I'd be clearly in favor of following it. As mentioned above, in practice the use of the 'adc@...' node name seems to be more prevalent for ADC controllers than channels, so I'm more inclined towards 'usb-id-nopull@...' or similar.

All that said, these are just my preferences for the reasons outlined above, if DT maintainers really want it to be 'adc@57' or some variation of that, I'm fine with that too. Please let me know and we can move forward with this trivial series.

Thanks

Matthias

maintainer
#8 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Quoted 28 lines · On Thu, 18 Oct 2018 12:40:10 -0700 Matthias Kaehlcke <[email protected]> wrote:
Quoted 11 lines · Matthias Kaehlcke
Quoted 9 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Quoted 6 lines

Is it really? A grep for 'adc@' in arch/${ARCH}/boot/dts yields mostly ADC controller not channel nodes.

I'm totally fine with changing the name to 'adc@...' if that's the preference/convention, just want to reconfirm since the actual use is a bit ambiguous.

Could we please reach a conclusion on this?

Summarizing the options on the table so far are:

1. usb-id-nopull@VADC_LR_MUX10_USB_ID
2. usb-id-nopull@57
3. adc@VADC_LR_MUX10_USB_ID
4. adc@57

Quoted 5 lines

My personal preference goes to something <node name>@<define> since the unit address doesn't just resolve to an ADC channel number but also includes configuation information. A literal like '57' conveys less information than the define, it's easier to introduce errors and these errors are harder to spot.

I agree that to my mind this is the most sensible option.

Quoted 11 lines

If 'adc@...' really was the convention (or should be) I'd be clearly in favor of following it. As mentioned above, in practice the use of the 'adc@...' node name seems to be more prevalent for ADC controllers than channels, so I'm more inclined towards 'usb-id-nopull@...' or similar.

All that said, these are just my preferences for the reasons outlined above, if DT maintainers really want it to be 'adc@57' or some variation of that, I'm fine with that too. Please let me know and we can move forward with this trivial series.

Rob, what's your view on this?

Thanks,

Jonathan

Quoted 4 lines

Thanks

Matthias

maintainer
#9 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Quoted 32 lines · Jonathan Cameron
Quoted 28 lines · On Thu, 18 Oct 2018 12:40:10 -0700 Matthias Kaehlcke <[email protected]> wrote:
Quoted 11 lines · Matthias Kaehlcke
Quoted 9 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Quoted 6 lines

Is it really? A grep for 'adc@' in arch/${ARCH}/boot/dts yields mostly ADC controller not channel nodes.

I'm totally fine with changing the name to 'adc@...' if that's the preference/convention, just want to reconfirm since the actual use is a bit ambiguous.

Could we please reach a conclusion on this?

Summarizing the options on the table so far are:

1. usb-id-nopull@VADC_LR_MUX10_USB_ID
2. usb-id-nopull@57
3. adc@VADC_LR_MUX10_USB_ID
4. adc@57

Quoted 7 lines
Quoted 5 lines

My personal preference goes to something <node name>@<define> since the unit address doesn't just resolve to an ADC channel number but also includes configuation information. A literal like '57' conveys less information than the define, it's easier to introduce errors and these errors are harder to spot.

I agree that to my mind this is the most sensible option.

If you really want the defines, then fine. Of course, that only works if the function is fixed. It won't work if the function is defined per board.

Eventually, examples using defines will have to also include the headers. I plan to make the examples build-able.

Quoted 6 lines
Quoted 6 lines

If 'adc@...' really was the convention (or should be) I'd be clearly in favor of following it. As mentioned above, in practice the use of the 'adc@...' node name seems to be more prevalent for ADC controllers than channels, so I'm more inclined towards 'usb-id-nopull@...' or similar.

Quoted 6 lines
Quoted 4 lines

All that said, these are just my preferences for the reasons outlined above, if DT maintainers really want it to be 'adc@57' or some variation of that, I'm fine with that too. Please let me know and we can move forward with this trivial series.

Rob, what's your view on this?

I want node names that reflect the class of the node (not a specific model) and consistency across bindings. What that looks like for multi-channel ADCs is really up to you. There was another binding recently which mapped sub-nodes to inputs rather than channels. Maybe that's needed too if you have more inputs than simultaneous channels.

Also, if your goal is to just quiet dtc warnings, then I'd prefer you not. They often point to bigger issues even if they can be fixed with trivial changes. Of course, if not fixed someone else will come along and try the trivial fix again.

Rob

#10 lore raw

Re: [PATCH v5 1/2] dt-bindings: iio: vadc: Update example to include unit address for node 'usb-id-nopull'

Quoted 59 lines · On Tue, 30 Oct 2018 11:00:16 -0500 Rob Herring <[email protected]> wrote:
Quoted 32 lines · Jonathan Cameron
Quoted 28 lines · On Thu, 18 Oct 2018 12:40:10 -0700 Matthias Kaehlcke <[email protected]> wrote:
Quoted 11 lines · Matthias Kaehlcke
Quoted 9 lines · Rob Herring
Quoted 5 lines · Matthias Kaehlcke

The node has a reg property, therefore its name should include a unit address.

Also change the name from 'usb_id_nopull' to 'usb-id-nopull' to follow DT conventions.

This is ADC channels? If so, then DT convention would really be "adc@...".

Quoted 6 lines

Is it really? A grep for 'adc@' in arch/${ARCH}/boot/dts yields mostly ADC controller not channel nodes.

I'm totally fine with changing the name to 'adc@...' if that's the preference/convention, just want to reconfirm since the actual use is a bit ambiguous.

Could we please reach a conclusion on this?

Summarizing the options on the table so far are:

1. usb-id-nopull@VADC_LR_MUX10_USB_ID
2. usb-id-nopull@57
3. adc@VADC_LR_MUX10_USB_ID
4. adc@57

Quoted 7 lines
Quoted 5 lines

My personal preference goes to something <node name>@<define> since the unit address doesn't just resolve to an ADC channel number but also includes configuation information. A literal like '57' conveys less information than the define, it's easier to introduce errors and these errors are harder to spot.

I agree that to my mind this is the most sensible option.

If you really want the defines, then fine. Of course, that only works if the function is fixed. It won't work if the function is defined per board.

Eventually, examples using defines will have to also include the headers. I plan to make the examples build-able.

Quoted 11 lines
Quoted 10 lines

If 'adc@...' really was the convention (or should be) I'd be clearly in favor of following it. As mentioned above, in practice the use of the 'adc@...' node name seems to be more prevalent for ADC controllers than channels, so I'm more inclined towards 'usb-id-nopull@...' or similar.

All that said, these are just my preferences for the reasons outlined above, if DT maintainers really want it to be 'adc@57' or some variation of that, I'm fine with that too. Please let me know and we can move forward with this trivial series.

Quoted 8 lines
Quoted 1 line

Rob, what's your view on this?

I want node names that reflect the class of the node (not a specific model) and consistency across bindings. What that looks like for multi-channel ADCs is really up to you. There was another binding recently which mapped sub-nodes to inputs rather than channels. Maybe that's needed too if you have more inputs than simultaneous channels. From a DT point of view the simultaneous channels vs inputs isn't meant

to be currently visible. It's a userspace problem and from IIO point of view a 'channel' is an input (you just might not be able to enable all channels at once!)

channel@ would work for me, though that might then match other types of device where this has a different meaning. Perhaps adc_chan@ ?

Quoted 5 lines

Also, if your goal is to just quiet dtc warnings, then I'd prefer you not. They often point to bigger issues even if they can be fixed with trivial changes. Of course, if not fixed someone else will come along and try the trivial fix again.

Agreed. Would be good to have these consistent however as it is a fairly common thing to represent.

Jonathan

Quoted 2 lines

Rob