diff mbox series

[2/2] thermal/drivers/qcom/spmi-adc-tm5: register thermal zones as hwmon sensors

Message ID 20220719054940.755907-2-dmitry.baryshkov@linaro.org (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series [1/2] thermal/drivers/qcom/temp-alarm: register thermal zones as hwmon sensors | expand

Commit Message

Dmitry Baryshkov July 19, 2022, 5:49 a.m. UTC
Register thermal zones as hwmon sensors to let userspace read
temperatures using standard hwmon interface.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bhupesh Sharma July 19, 2022, 6:01 a.m. UTC | #1
On 7/19/22 11:19 AM, Dmitry Baryshkov wrote:
> Register thermal zones as hwmon sensors to let userspace read
> temperatures using standard hwmon interface.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> index d9c9c975f931..073943cbcc2b 100644
> --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> @@ -20,6 +20,8 @@
>   #include <linux/thermal.h>
>   #include <asm-generic/unaligned.h>
>   
> +#include "../thermal_hwmon.h"
> +
>   /*
>    * Thermal monitoring block consists of 8 (ADC_TM5_NUM_CHANNELS) channels. Each
>    * channel is programmed to use one of ADC channels for voltage comparison.
> @@ -687,6 +689,9 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
>   			return PTR_ERR(tzd);
>   		}
>   		adc_tm->channels[i].tzd = tzd;
> +		if (devm_thermal_add_hwmon_sysfs(tzd))
> +			dev_warn(adc_tm->dev,
> +				 "Failed to add hwmon sysfs attributes\n");
>   	}
>   
>   	return 0;

LGTM, so:

Reviewed-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
diff mbox series

Patch

diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
index d9c9c975f931..073943cbcc2b 100644
--- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
@@ -20,6 +20,8 @@ 
 #include <linux/thermal.h>
 #include <asm-generic/unaligned.h>
 
+#include "../thermal_hwmon.h"
+
 /*
  * Thermal monitoring block consists of 8 (ADC_TM5_NUM_CHANNELS) channels. Each
  * channel is programmed to use one of ADC channels for voltage comparison.
@@ -687,6 +689,9 @@  static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
 			return PTR_ERR(tzd);
 		}
 		adc_tm->channels[i].tzd = tzd;
+		if (devm_thermal_add_hwmon_sysfs(tzd))
+			dev_warn(adc_tm->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	return 0;