mbox series

[0/7] Add support for IPQ5018 tsens

Message ID 1693250307-8910-1-git-send-email-quic_srichara@quicinc.com
Headers show
Series Add support for IPQ5018 tsens | expand

Message

Sricharan Ramabadhran Aug. 28, 2023, 7:18 p.m. UTC
IPQ5018 has tsens V1.0 IP with 4 sensors and 1 interrupt.
There is no RPM present in the soc to do tsens early enable.
Adding support for the same here.

Sricharan Ramabadhran (7):
  dt-bindings: thermal: qcom-tsens: Add ipq5018 compatible
  thermal/drivers/qcom: Add new feat for soc without rpm
  thermal/drivers/qcom/tsens: Add support for IPQ5018 tsens.
  thermal/drivers/qcom: Add IPQ5018 compatible.
  dt-bindings: nvmem: Add compatible for IPQ5018
  arm64: dts: qcom: ipq5018: Add tsens node
  arm64: dts: qcom: ipq5018: Add thermal zones

 .../bindings/nvmem/qcom,qfprom.yaml           |   1 +
 .../bindings/thermal/qcom-tsens.yaml          |  19 +++
 arch/arm64/boot/dts/qcom/ipq5018.dtsi         |  81 ++++++++++++
 drivers/thermal/qcom/tsens-v1.c               | 115 ++++++++++++++++++
 drivers/thermal/qcom/tsens.c                  |   5 +-
 drivers/thermal/qcom/tsens.h                  |   5 +-
 6 files changed, 224 insertions(+), 2 deletions(-)

Comments

Krzysztof Kozlowski Aug. 28, 2023, 7:34 p.m. UTC | #1
On 28/08/2023 21:18, Sricharan Ramabadhran wrote:
> IPQ5018 has 4 thermal sensors (zones). With the
> critical temperature being 120'C and action is to reboot.
> Adding all the 4 zones here.
> 

Not much benefit of having it separate patch... You added the
thermal-sensor for this purpose.

Best regards,
Krzysztof
Dmitry Baryshkov Aug. 28, 2023, 9:17 p.m. UTC | #2
On Mon, 28 Aug 2023 at 22:20, Sricharan Ramabadhran
<quic_srichara@quicinc.com> wrote:
>
> Some of the tsens IP like the one in IPQ5018 does not have a
> RPM in the soc. Hence the early init to enable tsens would not

Tsens IP doesn't have RPM. Please rephrase this.

> be done. So add a flag for that in feat and skip enable checks.
>
> Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
> ---
>  drivers/thermal/qcom/tsens.c | 2 +-
>  drivers/thermal/qcom/tsens.h | 3 +++
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 98c356acfe98..f39495b61952 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -974,7 +974,7 @@ int __init init_common(struct tsens_priv *priv)
>         ret = regmap_field_read(priv->rf[TSENS_EN], &enabled);
>         if (ret)
>                 goto err_put_device;
> -       if (!enabled) {
> +       if (!enabled && !(priv->feat->no_early_init)) {
>                 dev_err(dev, "%s: device not enabled\n", __func__);
>                 ret = -ENODEV;
>                 goto err_put_device;
> diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
> index 2805de1c6827..fb73e3dd0de9 100644
> --- a/drivers/thermal/qcom/tsens.h
> +++ b/drivers/thermal/qcom/tsens.h
> @@ -505,6 +505,8 @@ enum regfield_ids {
>   * @srot_split: does the IP neatly splits the register space into SROT and TM,
>   *              with SROT only being available to secure boot firmware?
>   * @has_watchdog: does this IP support watchdog functionality?
> + * @no_early_init: does this IP reside in a soc that does not have rpm to
> + *                 do pre-init.
>   * @max_sensors: maximum sensors supported by this version of the IP
>   * @trip_min_temp: minimum trip temperature supported by this version of the IP
>   * @trip_max_temp: maximum trip temperature supported by this version of the IP
> @@ -516,6 +518,7 @@ struct tsens_features {
>         unsigned int adc:1;
>         unsigned int srot_split:1;
>         unsigned int has_watchdog:1;
> +       unsigned int no_early_init:1;

s/no_early_init/ignore_enable/

>         unsigned int max_sensors;
>         int trip_min_temp;
>         int trip_max_temp;
> --
> 2.34.1
>
Sricharan Ramabadhran Aug. 29, 2023, 6:01 a.m. UTC | #3
Hi Dmitry,

On 8/29/2023 2:47 AM, Dmitry Baryshkov wrote:
> On Mon, 28 Aug 2023 at 22:20, Sricharan Ramabadhran
> <quic_srichara@quicinc.com> wrote:
>>
>> Some of the tsens IP like the one in IPQ5018 does not have a
>> RPM in the soc. Hence the early init to enable tsens would not
> 
> Tsens IP doesn't have RPM. Please rephrase this.
> 

  ok.

>> be done. So add a flag for that in feat and skip enable checks.
>>
>> Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
>> ---
>>   drivers/thermal/qcom/tsens.c | 2 +-
>>   drivers/thermal/qcom/tsens.h | 3 +++
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
>> index 98c356acfe98..f39495b61952 100644
>> --- a/drivers/thermal/qcom/tsens.c
>> +++ b/drivers/thermal/qcom/tsens.c
>> @@ -974,7 +974,7 @@ int __init init_common(struct tsens_priv *priv)
>>          ret = regmap_field_read(priv->rf[TSENS_EN], &enabled);
>>          if (ret)
>>                  goto err_put_device;
>> -       if (!enabled) {
>> +       if (!enabled && !(priv->feat->no_early_init)) {
>>                  dev_err(dev, "%s: device not enabled\n", __func__);
>>                  ret = -ENODEV;
>>                  goto err_put_device;
>> diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
>> index 2805de1c6827..fb73e3dd0de9 100644
>> --- a/drivers/thermal/qcom/tsens.h
>> +++ b/drivers/thermal/qcom/tsens.h
>> @@ -505,6 +505,8 @@ enum regfield_ids {
>>    * @srot_split: does the IP neatly splits the register space into SROT and TM,
>>    *              with SROT only being available to secure boot firmware?
>>    * @has_watchdog: does this IP support watchdog functionality?
>> + * @no_early_init: does this IP reside in a soc that does not have rpm to
>> + *                 do pre-init.
>>    * @max_sensors: maximum sensors supported by this version of the IP
>>    * @trip_min_temp: minimum trip temperature supported by this version of the IP
>>    * @trip_max_temp: maximum trip temperature supported by this version of the IP
>> @@ -516,6 +518,7 @@ struct tsens_features {
>>          unsigned int adc:1;
>>          unsigned int srot_split:1;
>>          unsigned int has_watchdog:1;
>> +       unsigned int no_early_init:1;
> 
> s/no_early_init/ignore_enable/
> 

  ok, will change.

Regards,
  Sricharan
Sricharan Ramabadhran Aug. 29, 2023, 6:05 a.m. UTC | #4
On 8/29/2023 1:04 AM, Krzysztof Kozlowski wrote:
> On 28/08/2023 21:18, Sricharan Ramabadhran wrote:
>> IPQ5018 has 4 thermal sensors (zones). With the
>> critical temperature being 120'C and action is to reboot.
>> Adding all the 4 zones here.
>>
> 
> Not much benefit of having it separate patch... You added the
> thermal-sensor for this purpose.

  ok, will squash.

Regards,
  Sricharan