Message ID | 20220114095529.1754065-1-dmitry.baryshkov@linaro.org |
---|---|
State | Accepted |
Commit | 8556e19d4939fbdb15aee9391f035453c5b2255a |
Headers | show |
Series | thermal/drivers/tsens: register thermal zones as hwmon sensors | expand |
On Fri, Jan 14, 2022 at 3:25 PM Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote: > > Register thermal zones as hwmon sensors to let userspace read > temperatures using standard hwmon interface. What is the usecase for this? Simply to use existing hwmon tools to read temperatures of the various thermal zones? > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > drivers/thermal/qcom/tsens.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > index 99a8d9f3e03c..c13093e8a642 100644 > --- a/drivers/thermal/qcom/tsens.c > +++ b/drivers/thermal/qcom/tsens.c > @@ -19,6 +19,7 @@ > #include <linux/slab.h> > #include <linux/thermal.h> > #include "tsens.h" > +#include "../thermal_hwmon.h" > > /** > * struct tsens_irq_data - IRQ status and temperature violations > @@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv) > priv->sensor[i].tzd = tzd; > if (priv->ops->enable) > priv->ops->enable(priv, i); > + > + if (devm_thermal_add_hwmon_sysfs(tzd)) > + dev_warn(priv->dev, > + "Failed to add hwmon sysfs attributes\n"); > } > > /* VER_0 require to set MIN and MAX THRESH > -- > 2.34.1 >
On Thu, 20 Jan 2022 at 10:12, Amit Kucheria <amitk@kernel.org> wrote: > > On Fri, Jan 14, 2022 at 3:25 PM Dmitry Baryshkov > <dmitry.baryshkov@linaro.org> wrote: > > > > Register thermal zones as hwmon sensors to let userspace read > > temperatures using standard hwmon interface. > > What is the usecase for this? Simply to use existing hwmon tools to > read temperatures of the various thermal zones? Yes. To be able to monitor CPU temperatures using the common sensor interface (like we do on e.g. x86). Several other thermal drivers also register their thermal zones as hwmon (QorIQ, Mediatek, Allwinner, Tegra30, etc). > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > --- > > drivers/thermal/qcom/tsens.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > > index 99a8d9f3e03c..c13093e8a642 100644 > > --- a/drivers/thermal/qcom/tsens.c > > +++ b/drivers/thermal/qcom/tsens.c > > @@ -19,6 +19,7 @@ > > #include <linux/slab.h> > > #include <linux/thermal.h> > > #include "tsens.h" > > +#include "../thermal_hwmon.h" > > > > /** > > * struct tsens_irq_data - IRQ status and temperature violations > > @@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv) > > priv->sensor[i].tzd = tzd; > > if (priv->ops->enable) > > priv->ops->enable(priv, i); > > + > > + if (devm_thermal_add_hwmon_sysfs(tzd)) > > + dev_warn(priv->dev, > > + "Failed to add hwmon sysfs attributes\n"); > > } > > > > /* VER_0 require to set MIN and MAX THRESH > > -- > > 2.34.1 > >
On Fri, Jan 14, 2022 at 3:25 PM Dmitry Baryshkov <dmitry.baryshkov@linaro.org> 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/tsens.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > index 99a8d9f3e03c..c13093e8a642 100644 > --- a/drivers/thermal/qcom/tsens.c > +++ b/drivers/thermal/qcom/tsens.c > @@ -19,6 +19,7 @@ > #include <linux/slab.h> > #include <linux/thermal.h> > #include "tsens.h" > +#include "../thermal_hwmon.h" Just a nit, but can you move this above the tsen.h along with other system headers? With that, feel free to add Acked-by: Amit Kucheria <amitk@kernel.org> > > /** > * struct tsens_irq_data - IRQ status and temperature violations > @@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv) > priv->sensor[i].tzd = tzd; > if (priv->ops->enable) > priv->ops->enable(priv, i); > + > + if (devm_thermal_add_hwmon_sysfs(tzd)) > + dev_warn(priv->dev, > + "Failed to add hwmon sysfs attributes\n"); > } > > /* VER_0 require to set MIN and MAX THRESH > -- > 2.34.1 >
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 99a8d9f3e03c..c13093e8a642 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -19,6 +19,7 @@ #include <linux/slab.h> #include <linux/thermal.h> #include "tsens.h" +#include "../thermal_hwmon.h" /** * struct tsens_irq_data - IRQ status and temperature violations @@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv) priv->sensor[i].tzd = tzd; if (priv->ops->enable) priv->ops->enable(priv, i); + + if (devm_thermal_add_hwmon_sysfs(tzd)) + dev_warn(priv->dev, + "Failed to add hwmon sysfs attributes\n"); } /* VER_0 require to set MIN and MAX THRESH
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/tsens.c | 5 +++++ 1 file changed, 5 insertions(+)