linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: sun8i: Add hwmon support
@ 2019-12-28 17:19 Yangtao Li
  2020-01-06  4:31 ` Chen-Yu Tsai
  0 siblings, 1 reply; 7+ messages in thread
From: Yangtao Li @ 2019-12-28 17:19 UTC (permalink / raw)
  To: rui.zhang, daniel.lezcano, amit.kucheria, mripard, wens, anarsoul
  Cc: linux-pm, linux-arm-kernel, linux-kernel, Yangtao Li

Expose sun8i thermal as a HWMON device.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 23a5f4aa4be4..619e75cb41b0 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM	4
 
 #define FT_TEMP_MASK				GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
 							     &ths_ops);
 		if (IS_ERR(tmdev->sensor[i].tzd))
 			return PTR_ERR(tmdev->sensor[i].tzd);
+
+		if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+			dev_warn(tmdev->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2019-12-28 17:19 [PATCH] thermal: sun8i: Add hwmon support Yangtao Li
@ 2020-01-06  4:31 ` Chen-Yu Tsai
  2020-01-06 16:14   ` Frank Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Chen-Yu Tsai @ 2020-01-06  4:31 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Maxime Ripard,
	Vasily Khoruzhick, open list:THERMAL, linux-arm-kernel,
	linux-kernel

On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
>
> Expose sun8i thermal as a HWMON device.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/thermal/sun8i_thermal.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 23a5f4aa4be4..619e75cb41b0 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -20,6 +20,8 @@
>  #include <linux/slab.h>
>  #include <linux/thermal.h>
>
> +#include "thermal_hwmon.h"
> +
>  #define MAX_SENSOR_NUM 4
>
>  #define FT_TEMP_MASK                           GENMASK(11, 0)
> @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
>                                                              &ths_ops);
>                 if (IS_ERR(tmdev->sensor[i].tzd))
>                         return PTR_ERR(tmdev->sensor[i].tzd);
> +
> +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
> +                       dev_warn(tmdev->dev,
> +                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

ChenYu

>         }
>
>         return 0;
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2020-01-06  4:31 ` Chen-Yu Tsai
@ 2020-01-06 16:14   ` Frank Lee
  2020-01-07  3:15     ` Chen-Yu Tsai
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Lee @ 2020-01-06 16:14 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Maxime Ripard,
	Vasily Khoruzhick, open list:THERMAL, linux-arm-kernel,
	linux-kernel

HI Chen-Yu.

On Mon, Jan 6, 2020 at 12:32 PM Chen-Yu Tsai <wens@csie.org> wrote:
>
> On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> >
> > Expose sun8i thermal as a HWMON device.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/thermal/sun8i_thermal.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> > index 23a5f4aa4be4..619e75cb41b0 100644
> > --- a/drivers/thermal/sun8i_thermal.c
> > +++ b/drivers/thermal/sun8i_thermal.c
> > @@ -20,6 +20,8 @@
> >  #include <linux/slab.h>
> >  #include <linux/thermal.h>
> >
> > +#include "thermal_hwmon.h"
> > +
> >  #define MAX_SENSOR_NUM 4
> >
> >  #define FT_TEMP_MASK                           GENMASK(11, 0)
> > @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
> >                                                              &ths_ops);
> >                 if (IS_ERR(tmdev->sensor[i].tzd))
> >                         return PTR_ERR(tmdev->sensor[i].tzd);
> > +
> > +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
> > +                       dev_warn(tmdev->dev,
> > +                                "Failed to add hwmon sysfs attributes\n");
>
> Maybe you want a hard failure instead?

I don't quite understand what you mean.
What do you think should be done?

MBR,
Yangtao

>
> ChenYu
>
> >         }
> >
> >         return 0;
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2020-01-06 16:14   ` Frank Lee
@ 2020-01-07  3:15     ` Chen-Yu Tsai
  2020-01-11 18:08       ` Frank Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Chen-Yu Tsai @ 2020-01-07  3:15 UTC (permalink / raw)
  To: Frank Lee
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Maxime Ripard,
	Vasily Khoruzhick, open list:THERMAL, linux-arm-kernel,
	linux-kernel

On Tue, Jan 7, 2020 at 12:14 AM Frank Lee <tiny.windzz@gmail.com> wrote:
>
> HI Chen-Yu.
>
> On Mon, Jan 6, 2020 at 12:32 PM Chen-Yu Tsai <wens@csie.org> wrote:
> >
> > On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> > >
> > > Expose sun8i thermal as a HWMON device.
> > >
> > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > ---
> > >  drivers/thermal/sun8i_thermal.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> > > index 23a5f4aa4be4..619e75cb41b0 100644
> > > --- a/drivers/thermal/sun8i_thermal.c
> > > +++ b/drivers/thermal/sun8i_thermal.c
> > > @@ -20,6 +20,8 @@
> > >  #include <linux/slab.h>
> > >  #include <linux/thermal.h>
> > >
> > > +#include "thermal_hwmon.h"
> > > +
> > >  #define MAX_SENSOR_NUM 4
> > >
> > >  #define FT_TEMP_MASK                           GENMASK(11, 0)
> > > @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
> > >                                                              &ths_ops);
> > >                 if (IS_ERR(tmdev->sensor[i].tzd))
> > >                         return PTR_ERR(tmdev->sensor[i].tzd);
> > > +
> > > +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
> > > +                       dev_warn(tmdev->dev,
> > > +                                "Failed to add hwmon sysfs attributes\n");
> >
> > Maybe you want a hard failure instead?
>
> I don't quite understand what you mean.
> What do you think should be done?

Return an error instead of just printing a warning.

ChenYu

> MBR,
> Yangtao
>
> >
> > ChenYu
> >
> > >         }
> > >
> > >         return 0;
> > > --
> > > 2.17.1
> > >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2020-01-07  3:15     ` Chen-Yu Tsai
@ 2020-01-11 18:08       ` Frank Lee
  2020-01-12 18:12         ` Frank Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Lee @ 2020-01-11 18:08 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Maxime Ripard,
	Vasily Khoruzhick, open list:THERMAL, linux-arm-kernel,
	linux-kernel

On Tue, Jan 7, 2020 at 11:15 AM Chen-Yu Tsai <wens@csie.org> wrote:
>
> On Tue, Jan 7, 2020 at 12:14 AM Frank Lee <tiny.windzz@gmail.com> wrote:
> >
> > HI Chen-Yu.
> >
> > On Mon, Jan 6, 2020 at 12:32 PM Chen-Yu Tsai <wens@csie.org> wrote:
> > >
> > > On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> > > >
> > > > Expose sun8i thermal as a HWMON device.
> > > >
> > > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > > ---
> > > >  drivers/thermal/sun8i_thermal.c | 6 ++++++
> > > >  1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> > > > index 23a5f4aa4be4..619e75cb41b0 100644
> > > > --- a/drivers/thermal/sun8i_thermal.c
> > > > +++ b/drivers/thermal/sun8i_thermal.c
> > > > @@ -20,6 +20,8 @@
> > > >  #include <linux/slab.h>
> > > >  #include <linux/thermal.h>
> > > >
> > > > +#include "thermal_hwmon.h"
> > > > +
> > > >  #define MAX_SENSOR_NUM 4
> > > >
> > > >  #define FT_TEMP_MASK                           GENMASK(11, 0)
> > > > @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
> > > >                                                              &ths_ops);
> > > >                 if (IS_ERR(tmdev->sensor[i].tzd))
> > > >                         return PTR_ERR(tmdev->sensor[i].tzd);
> > > > +
> > > > +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
> > > > +                       dev_warn(tmdev->dev,
> > > > +                                "Failed to add hwmon sysfs attributes\n");
> > >
> > > Maybe you want a hard failure instead?
> >
> > I don't quite understand what you mean.
> > What do you think should be done?
>
> Return an error instead of just printing a warning.

Sometimes, even if hwmon fails to add, it can still work as a thermal driver.
At this time, I don't really want to interrupt the registration of the
thermal driver.

Anyone else's opinion here?

Yours,
Ynagtao

>
> ChenYu
>
> > MBR,
> > Yangtao
> >
> > >
> > > ChenYu
> > >
> > > >         }
> > > >
> > > >         return 0;
> > > > --
> > > > 2.17.1
> > > >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2020-01-11 18:08       ` Frank Lee
@ 2020-01-12 18:12         ` Frank Lee
  2020-01-12 19:31           ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Lee @ 2020-01-12 18:12 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Maxime Ripard,
	Vasily Khoruzhick, open list:THERMAL, linux-arm-kernel,
	linux-kernel

HI Daniel:

On Sun, Jan 12, 2020 at 2:08 AM Frank Lee <tiny.windzz@gmail.com> wrote:
>
> On Tue, Jan 7, 2020 at 11:15 AM Chen-Yu Tsai <wens@csie.org> wrote:
> >
> > On Tue, Jan 7, 2020 at 12:14 AM Frank Lee <tiny.windzz@gmail.com> wrote:
> > >
> > > HI Chen-Yu.
> > >
> > > On Mon, Jan 6, 2020 at 12:32 PM Chen-Yu Tsai <wens@csie.org> wrote:
> > > >
> > > > On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> > > > >
> > > > > Expose sun8i thermal as a HWMON device.
> > > > >
> > > > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > > > ---
> > > > >  drivers/thermal/sun8i_thermal.c | 6 ++++++
> > > > >  1 file changed, 6 insertions(+)
> > > > >
> > > > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> > > > > index 23a5f4aa4be4..619e75cb41b0 100644
> > > > > --- a/drivers/thermal/sun8i_thermal.c
> > > > > +++ b/drivers/thermal/sun8i_thermal.c
> > > > > @@ -20,6 +20,8 @@
> > > > >  #include <linux/slab.h>
> > > > >  #include <linux/thermal.h>
> > > > >
> > > > > +#include "thermal_hwmon.h"
> > > > > +
> > > > >  #define MAX_SENSOR_NUM 4
> > > > >
> > > > >  #define FT_TEMP_MASK                           GENMASK(11, 0)
> > > > > @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
> > > > >                                                              &ths_ops);
> > > > >                 if (IS_ERR(tmdev->sensor[i].tzd))
> > > > >                         return PTR_ERR(tmdev->sensor[i].tzd);
> > > > > +
> > > > > +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
> > > > > +                       dev_warn(tmdev->dev,
> > > > > +                                "Failed to add hwmon sysfs attributes\n");
> > > >
> > > > Maybe you want a hard failure instead?
> > >
> > > I don't quite understand what you mean.
> > > What do you think should be done?
> >
> > Return an error instead of just printing a warning.
>
> Sometimes, even if hwmon fails to add, it can still work as a thermal driver.
> At this time, I don't really want to interrupt the registration of the
> thermal driver.
>
> Anyone else's opinion here?
>

What's your point? Can you choose this patch?

MBR,
Yangtao

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thermal: sun8i: Add hwmon support
  2020-01-12 18:12         ` Frank Lee
@ 2020-01-12 19:31           ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2020-01-12 19:31 UTC (permalink / raw)
  To: Frank Lee, Chen-Yu Tsai
  Cc: Zhang Rui, Amit Kucheria, Maxime Ripard, Vasily Khoruzhick,
	open list:THERMAL, linux-arm-kernel, linux-kernel

On 12/01/2020 19:12, Frank Lee wrote:
> HI Daniel:
> 
> On Sun, Jan 12, 2020 at 2:08 AM Frank Lee <tiny.windzz@gmail.com> wrote:
>>
>> On Tue, Jan 7, 2020 at 11:15 AM Chen-Yu Tsai <wens@csie.org> wrote:
>>>
>>> On Tue, Jan 7, 2020 at 12:14 AM Frank Lee <tiny.windzz@gmail.com> wrote:
>>>>
>>>> HI Chen-Yu.
>>>>
>>>> On Mon, Jan 6, 2020 at 12:32 PM Chen-Yu Tsai <wens@csie.org> wrote:
>>>>>
>>>>> On Sun, Dec 29, 2019 at 1:19 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
>>>>>>
>>>>>> Expose sun8i thermal as a HWMON device.
>>>>>>
>>>>>> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
>>>>>> ---
>>>>>>  drivers/thermal/sun8i_thermal.c | 6 ++++++
>>>>>>  1 file changed, 6 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
>>>>>> index 23a5f4aa4be4..619e75cb41b0 100644
>>>>>> --- a/drivers/thermal/sun8i_thermal.c
>>>>>> +++ b/drivers/thermal/sun8i_thermal.c
>>>>>> @@ -20,6 +20,8 @@
>>>>>>  #include <linux/slab.h>
>>>>>>  #include <linux/thermal.h>
>>>>>>
>>>>>> +#include "thermal_hwmon.h"
>>>>>> +
>>>>>>  #define MAX_SENSOR_NUM 4
>>>>>>
>>>>>>  #define FT_TEMP_MASK                           GENMASK(11, 0)
>>>>>> @@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
>>>>>>                                                              &ths_ops);
>>>>>>                 if (IS_ERR(tmdev->sensor[i].tzd))
>>>>>>                         return PTR_ERR(tmdev->sensor[i].tzd);
>>>>>> +
>>>>>> +               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
>>>>>> +                       dev_warn(tmdev->dev,
>>>>>> +                                "Failed to add hwmon sysfs attributes\n");
>>>>>
>>>>> Maybe you want a hard failure instead?
>>>>
>>>> I don't quite understand what you mean.
>>>> What do you think should be done?
>>>
>>> Return an error instead of just printing a warning.
>>
>> Sometimes, even if hwmon fails to add, it can still work as a thermal driver.
>> At this time, I don't really want to interrupt the registration of the
>> thermal driver.
>>
>> Anyone else's opinion here?
>>
> 
> What's your point? Can you choose this patch?

Applied, thanks


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-12 19:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28 17:19 [PATCH] thermal: sun8i: Add hwmon support Yangtao Li
2020-01-06  4:31 ` Chen-Yu Tsai
2020-01-06 16:14   ` Frank Lee
2020-01-07  3:15     ` Chen-Yu Tsai
2020-01-11 18:08       ` Frank Lee
2020-01-12 18:12         ` Frank Lee
2020-01-12 19:31           ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).