2022-02-24 07:47:32

by Armin Wolf

[permalink] [raw]
Subject: [PATCH v2 0/2] hwmon: (sch5627) Add pwmX_auto_channels_temp attributes

After doing some research, i found out that Fujitsu's hardware
mointoring solution inside the SCH5627 exports data thru
registers 0xA0 - 0xA3 regarding the mapping between temperature
sensors and fans. If those registers are set to 0, the fans
are forced to full speed.
The first patch adds support for pwmX_auto_channels_temp
attributes to the hwmon core, while the second patch does
extend the sch5627 driver.

Both patches have been tested on a Fujitsu Esprimo P720.

---
Changes in v2:
- acquire mutex before doing register reads/writes

Armin Wolf (2):
hwmon: (core) Add support for pwm auto channels attribute
hwmon: (sch5627) Add pwmX_auto_channels_temp support

Documentation/hwmon/sch5627.rst | 4 +++
drivers/hwmon/hwmon.c | 1 +
drivers/hwmon/sch5627.c | 61 +++++++++++++++++++++++++++++++++
include/linux/hwmon.h | 2 ++
4 files changed, 68 insertions(+)

--
2.30.2


2022-02-24 09:00:11

by Armin Wolf

[permalink] [raw]
Subject: [PATCH v2 1/2] hwmon: (core) Add support for pwm auto channels attribute

pwm[1-*]_auto_channels_temp is documented as an official
hwmon sysfs attribute, yet there is no support for it in
the new with_info-API. Fix that.

Signed-off-by: Armin Wolf <[email protected]>
---
drivers/hwmon/hwmon.c | 1 +
include/linux/hwmon.h | 2 ++
2 files changed, 3 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 0d6c6809f26c..989e2c8496dd 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -604,6 +604,7 @@ static const char * const hwmon_pwm_attr_templates[] = {
[hwmon_pwm_enable] = "pwm%d_enable",
[hwmon_pwm_mode] = "pwm%d_mode",
[hwmon_pwm_freq] = "pwm%d_freq",
+ [hwmon_pwm_auto_channels_temp] = "pwm%d_auto_channels_temp",
};

static const char * const hwmon_intrusion_attr_templates[] = {
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index fad1f1df26df..eba380b76d15 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -332,12 +332,14 @@ enum hwmon_pwm_attributes {
hwmon_pwm_enable,
hwmon_pwm_mode,
hwmon_pwm_freq,
+ hwmon_pwm_auto_channels_temp,
};

#define HWMON_PWM_INPUT BIT(hwmon_pwm_input)
#define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
#define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
#define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
+#define HWMON_PWM_AUTO_CHANNELS_TEMP BIT(hwmon_pwm_auto_channels_temp)

enum hwmon_intrusion_attributes {
hwmon_intrusion_alarm,
--
2.30.2

2022-02-25 05:17:34

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] hwmon: (core) Add support for pwm auto channels attribute

On Thu, Feb 24, 2022 at 07:12:09AM +0100, Armin Wolf wrote:
> pwm[1-*]_auto_channels_temp is documented as an official
> hwmon sysfs attribute, yet there is no support for it in
> the new with_info-API. Fix that.
>
> Signed-off-by: Armin Wolf <[email protected]>

Applied to hwmon-next.

Thanks,
Guenter

> ---
> drivers/hwmon/hwmon.c | 1 +
> include/linux/hwmon.h | 2 ++
> 2 files changed, 3 insertions(+)
>
> --
> 2.30.2
>
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 0d6c6809f26c..989e2c8496dd 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -604,6 +604,7 @@ static const char * const hwmon_pwm_attr_templates[] = {
> [hwmon_pwm_enable] = "pwm%d_enable",
> [hwmon_pwm_mode] = "pwm%d_mode",
> [hwmon_pwm_freq] = "pwm%d_freq",
> + [hwmon_pwm_auto_channels_temp] = "pwm%d_auto_channels_temp",
> };
>
> static const char * const hwmon_intrusion_attr_templates[] = {
> diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
> index fad1f1df26df..eba380b76d15 100644
> --- a/include/linux/hwmon.h
> +++ b/include/linux/hwmon.h
> @@ -332,12 +332,14 @@ enum hwmon_pwm_attributes {
> hwmon_pwm_enable,
> hwmon_pwm_mode,
> hwmon_pwm_freq,
> + hwmon_pwm_auto_channels_temp,
> };
>
> #define HWMON_PWM_INPUT BIT(hwmon_pwm_input)
> #define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
> #define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
> #define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
> +#define HWMON_PWM_AUTO_CHANNELS_TEMP BIT(hwmon_pwm_auto_channels_temp)
>
> enum hwmon_intrusion_attributes {
> hwmon_intrusion_alarm,