Re: [PATCH v2 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 02:48:46PM -0700, Doug Anderson wrote:
> Hi,
> 
> On Fri, Mar 12, 2021 at 10:32 AM Matthias Kaehlcke  wrote:
> >
> > Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
> > thermal zone for lazor") disables the charger thermal zone for
> > specific lazor revisions due to an unsupported thermistor type.
> > The initial idea was to disable the thermal zone for older
> > revisions and leave it enabled for newer ones that use a
> > supported thermistor. Finally the thermistor won't be changed
> > on newer revisions, hence the thermal zone should be disabled
> > for all lazor (and limozeen) revisions. Instead of disabling
> > it per revision do it once in the shared .dtsi for lazor.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> > Changes in v2:
> > - none
> >
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
> >  4 files changed, 9 insertions(+), 27 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > index 5c997cd90069..30e3e769d2b4 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev0", "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -&charger_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  &pp3300_hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > index d9fbcc7bc5bd..c2ef06367baf 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev1", "google,lazor-rev2", 
> > "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -&charger_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  &pp3300_hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > index ea8c2ee09741..b474df47cd70 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > @@ -14,12 +14,3 @@ / {
> > model = "Google Lazor (rev3+)";
> > compatible = "google,lazor", "qcom,sc7180";
> >  };
> > -
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -&charger_thermal {
> > -   status = "disabled";
> > -};
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > index 6b10b96173e8..6d540321b4a5 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > @@ -41,6 +41,15 @@ ap_ts: touchscreen@10 {
> > };
> >  };
> >
> > +/*
> > + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > + * to avoid using bogus temperature values.
> > + */
> > +&charger_thermal {
> > +   status = "disabled";
> > +};
> 
> So this always confuses me too, but the sort order is wrong.  :(
> 
> While it _looks_like the node above you is "ap_ts", I believe the
> convention for sorting is not to use labels added in this file. Yeah,
> we gotta document this somewhere. Thus, this node should be sorted as
> "charger_thermal" (using a label not defined in this file) and the
> node above should be sorted as "touchscreen@10" and thus we should go
> above it.

"ap_ts" is a sub-node of "ap_ts_pen_1v8" (aka "i2c4"), so I think it is
irrelevant here. However IIUC the sort order should still change, since
"charger_thermal" should be before "i2c4" (ignoring "ap_ts_pen_1v8"
defined in this file).

> In general I think the reason we tend to use the node name and not any
> labels is that it ke

Re: [PATCH v2 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-15 Thread Doug Anderson
Hi,

On Fri, Mar 12, 2021 at 10:32 AM Matthias Kaehlcke  wrote:
>
> Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
> thermal zone for lazor") disables the charger thermal zone for
> specific lazor revisions due to an unsupported thermistor type.
> The initial idea was to disable the thermal zone for older
> revisions and leave it enabled for newer ones that use a
> supported thermistor. Finally the thermistor won't be changed
> on newer revisions, hence the thermal zone should be disabled
> for all lazor (and limozeen) revisions. Instead of disabling
> it per revision do it once in the shared .dtsi for lazor.
>
> Signed-off-by: Matthias Kaehlcke 
> ---
>
> Changes in v2:
> - none
>
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
>  4 files changed, 9 insertions(+), 27 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> index 5c997cd90069..30e3e769d2b4 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> @@ -14,15 +14,6 @@ / {
> compatible = "google,lazor-rev0", "qcom,sc7180";
>  };
>
> -/*
> - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> - * to avoid using bogus temperature values.
> - */
> -&charger_thermal {
> -   status = "disabled";
> -};
> -
>  &pp3300_hub {
> /* pp3300_l7c is used to power the USB hub */
> /delete-property/regulator-always-on;
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> index d9fbcc7bc5bd..c2ef06367baf 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> @@ -14,15 +14,6 @@ / {
> compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
>  };
>
> -/*
> - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> - * to avoid using bogus temperature values.
> - */
> -&charger_thermal {
> -   status = "disabled";
> -};
> -
>  &pp3300_hub {
> /* pp3300_l7c is used to power the USB hub */
> /delete-property/regulator-always-on;
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> index ea8c2ee09741..b474df47cd70 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> @@ -14,12 +14,3 @@ / {
> model = "Google Lazor (rev3+)";
> compatible = "google,lazor", "qcom,sc7180";
>  };
> -
> -/*
> - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> - * to avoid using bogus temperature values.
> - */
> -&charger_thermal {
> -   status = "disabled";
> -};
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> index 6b10b96173e8..6d540321b4a5 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> @@ -41,6 +41,15 @@ ap_ts: touchscreen@10 {
> };
>  };
>
> +/*
> + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> + * to avoid using bogus temperature values.
> + */
> +&charger_thermal {
> +   status = "disabled";
> +};

So this always confuses me too, but the sort order is wrong.  :(

While it _looks_like the node above you is "ap_ts", I believe the
convention for sorting is not to use labels added in this file. Yeah,
we gotta document this somewhere. Thus, this node should be sorted as
"charger_thermal" (using a label not defined in this file) and the
node above should be sorted as "touchscreen@10" and thus we should go
above it.

In general I think the reason we tend to use the node name and not any
labels is that it keeps us from having to redo the sort ordering if we
give something a new label. It also helps keep the i2c busses
together, the SPI busses together, etc.

That's just a sort order nit, though, so:

Reviewed-by: Douglas Anderson 


-Doug


[PATCH v2 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-12 Thread Matthias Kaehlcke
Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
thermal zone for lazor") disables the charger thermal zone for
specific lazor revisions due to an unsupported thermistor type.
The initial idea was to disable the thermal zone for older
revisions and leave it enabled for newer ones that use a
supported thermistor. Finally the thermistor won't be changed
on newer revisions, hence the thermal zone should be disabled
for all lazor (and limozeen) revisions. Instead of disabling
it per revision do it once in the shared .dtsi for lazor.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- none

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..30e3e769d2b4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-&charger_thermal {
-   status = "disabled";
-};
-
 &pp3300_hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..c2ef06367baf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-&charger_thermal {
-   status = "disabled";
-};
-
 &pp3300_hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index ea8c2ee09741..b474df47cd70 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -14,12 +14,3 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
-
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-&charger_thermal {
-   status = "disabled";
-};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
index 6b10b96173e8..6d540321b4a5 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
@@ -41,6 +41,15 @@ ap_ts: touchscreen@10 {
};
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+&charger_thermal {
+   status = "disabled";
+};
+
 &panel {
compatible = "boe,nv133fhm-n62";
 };
-- 
2.31.0.rc2.261.g7f71774620-goog