diff mbox series

[v6,3/5] thermal: drivers: qcom: Add new feat for soc without rpm

Message ID DS7PR19MB88837D7AE30CE306B8F71F3E9DC02@DS7PR19MB8883.namprd19.prod.outlook.com (mailing list archive)
State New
Headers show
Series Add support for IPQ5018 tsens | expand

Commit Message

George Moussalem Feb. 24, 2025, 6:12 a.m. UTC
From: Sricharan Ramabadhran <quic_srichara@quicinc.com>

In IPQ5018, Tsens IP doesn't have RPM. Hence the early init to
enable tsens would not be done. So add a flag for that in feat
and skip enable checks. Without this, tsens probe fails.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
Signed-off-by: George Moussalem <george.moussalem@outlook.com>
---
 drivers/thermal/qcom/tsens.c | 2 +-
 drivers/thermal/qcom/tsens.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Manikanta Mylavarapu Feb. 24, 2025, 9:08 a.m. UTC | #1
On 2/24/2025 11:42 AM, George Moussalem wrote:
> From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
> 
> In IPQ5018, Tsens IP doesn't have RPM. Hence the early init to
> enable tsens would not be done. So add a flag for that in feat
> and skip enable checks. Without this, tsens probe fails.
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
> Signed-off-by: George Moussalem <george.moussalem@outlook.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 3aa3736181aa..a25ca17adf1a 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -975,7 +975,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->ignore_enable)) {

Please drop 'ignore_enable' and use 'VER_2_X_NO_RPM' instead.

>  		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 7b36a0318fa6..90bf11fba563 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?
> + * @ignore_enable: does this IP reside in a soc that does not have rpm to
> + *                 do pre-init.

Drop 'ignore_enable'.

>   * @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 ignore_enable:1;

Drop 'ignore_enable'.

Thanks & Regards,
Manikanta.
George Moussalem Feb. 24, 2025, 10:33 a.m. UTC | #2
On 2/24/25 13:08, Manikanta Mylavarapu wrote:
>
> On 2/24/2025 11:42 AM, George Moussalem wrote:
>> From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
>>
>> In IPQ5018, Tsens IP doesn't have RPM. Hence the early init to
>> enable tsens would not be done. So add a flag for that in feat
>> and skip enable checks. Without this, tsens probe fails.
>>
>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
>> Signed-off-by: George Moussalem <george.moussalem@outlook.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 3aa3736181aa..a25ca17adf1a 100644
>> --- a/drivers/thermal/qcom/tsens.c
>> +++ b/drivers/thermal/qcom/tsens.c
>> @@ -975,7 +975,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->ignore_enable)) {
> Please drop 'ignore_enable' and use 'VER_2_X_NO_RPM' instead.

couldn't find it, but found it was recently added in:
https://lore.kernel.org/all/5dc4bbb7-71b5-4389-9e99-099e1c93d1c9@linaro.org/
Will change to 'VER_2_NO_RPM'

>
>>  		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 7b36a0318fa6..90bf11fba563 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?
>> + * @ignore_enable: does this IP reside in a soc that does not have rpm to
>> + *                 do pre-init.
> Drop 'ignore_enable'.

will do

>
>>   * @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 ignore_enable:1;
> Drop 'ignore_enable'.

will do

>
> Thanks & Regards,
> Manikanta.
Dmitry Baryshkov Feb. 24, 2025, 1:45 p.m. UTC | #3
On Mon, Feb 24, 2025 at 02:38:24PM +0530, Manikanta Mylavarapu wrote:
> 
> 
> On 2/24/2025 11:42 AM, George Moussalem wrote:
> > From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
> > 
> > In IPQ5018, Tsens IP doesn't have RPM. Hence the early init to
> > enable tsens would not be done. So add a flag for that in feat
> > and skip enable checks. Without this, tsens probe fails.
> > 
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
> > Signed-off-by: George Moussalem <george.moussalem@outlook.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 3aa3736181aa..a25ca17adf1a 100644
> > --- a/drivers/thermal/qcom/tsens.c
> > +++ b/drivers/thermal/qcom/tsens.c
> > @@ -975,7 +975,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->ignore_enable)) {
> 
> Please drop 'ignore_enable' and use 'VER_2_X_NO_RPM' instead.

It is not possible, since IPQ5018 is 1.x. But I agree, a similar concept
should be used.

> 
> >  		dev_err(dev, "%s: device not enabled\n", __func__);
> >  		ret = -ENODEV;
> >  		goto err_put_device;
diff mbox series

Patch

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 3aa3736181aa..a25ca17adf1a 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -975,7 +975,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->ignore_enable)) {
 		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 7b36a0318fa6..90bf11fba563 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?
+ * @ignore_enable: 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 ignore_enable:1;
 	unsigned int max_sensors;
 	int trip_min_temp;
 	int trip_max_temp;