2022-09-10 17:30:21

by Tilki, Ibrahim

[permalink] [raw]
Subject: [PATCH v9 0/4] hwmon: Add max31760 fan speed controller

changes in v9:
- return -EINVAL when writing fan_enable and pwm_enable
- fix dt-bindings errors

changes in v8:
- use sizeof(*)
- use DEFINE_SIMPLE_DEV_PM_OPS
- remove __maybe_unused
- remove of_match_ptr
- dt-bindings: style fixes

changes in v7:
- make max31760_read_string static

changes in v6:
- update description of hwmon documentation
- add hwmon documentation to index.rst

changes in v5:
- add dt-bindings documentation
- add maintainer

changes in v4:
- use sysfs_emit instead of sprintf
- use kstrtou8 for pwm
- use closest match for pwm1_auto_point_temp_hyst

changes in v3:
- add regmap cache
- remove pwm1_auto_point[1-48]_{temp,temp_hyst} attributes
- add pwm1_auto_point_temp_hyst attribute

changes in v2:
- remove pulse_per_rev variable in tach_to_rpm
- remove temperature max_hyst and crit_hyst
- strict value checking for fan_enable and pwm_enable
- do not clamp pwm value for Look-up table
- add sysfs_attr_init call
- add documentation


Ibrahim Tilki (4):
drivers: hwmon: Add max31760 fan speed controller driver
docs: hwmon: add max31760 documentation
dt-bindings: hwmon: Add bindings for max31760
MAINTAINERS: Add maintainer for hwmon/max31760

.../bindings/hwmon/adi,max31760.yaml | 42 ++
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/max31760.rst | 77 +++
MAINTAINERS | 9 +
drivers/hwmon/Kconfig | 12 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/max31760.c | 596 ++++++++++++++++++
7 files changed, 738 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
create mode 100644 Documentation/hwmon/max31760.rst
create mode 100644 drivers/hwmon/max31760.c

--
2.36.1


2022-09-10 17:37:33

by Tilki, Ibrahim

[permalink] [raw]
Subject: [PATCH v9 2/4] docs: hwmon: add max31760 documentation

Adding documentation for max31760 fan speed controller

Signed-off-by: Ibrahim Tilki <[email protected]>
---
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/max31760.rst | 77 ++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
create mode 100644 Documentation/hwmon/max31760.rst

diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index f7113b0f8..dba260013 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -133,6 +133,7 @@ Hardware Monitoring Kernel Drivers
max20751
max31722
max31730
+ max31760
max31785
max31790
max34440
diff --git a/Documentation/hwmon/max31760.rst b/Documentation/hwmon/max31760.rst
new file mode 100644
index 000000000..b1b55fb84
--- /dev/null
+++ b/Documentation/hwmon/max31760.rst
@@ -0,0 +1,77 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Kernel driver max31760
+======================
+
+Supported chips:
+ * Analog Devices MAX31760
+
+ Prefix: 'max31760'
+
+ Addresses scanned: none
+
+ Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX31760.pdf
+
+
+Author: Ibrahim Tilki <[email protected]>
+
+Description
+-----------
+
+The MAX31760 integrates temperature sensing along with precision PWM fan
+control. It accurately measures its local die temperature and the remote
+temperature of a discrete diode-connected transistor, such as a 2N3906,
+or a thermal diode commonly found on CPUs, graphics processor units (GPUs),
+and other ASICs. Multiple temperature thresholds, such as local
+high/overtemperature (OT) and remote high/overtemperature, can be set by an
+I2C-compatible interface. Fan speed is controlled based on the temperature
+reading as an index to a 48-byte lookup table (LUT) containing
+user-programmed PWM values. The flexible LUT-based architecture enables
+the user to program a smooth nonlinear fan speed vs. temperature transfer
+function to minimize acoustic fan noise. Two tachometer inputs allow
+measuring the speeds of two fans independently. When the local or remote
+OT threshold is exceeded, the SHDN pin is asserted low and can be used to
+shut down the system. A dedicated ALERT pin reports that either a local or
+remote high-temperature threshold has been exceeded.
+
+Temperature measurement range: from -55°C to 125°C
+
+Temperature Resolution: 11 Bits, ±0.125°C
+
+Please refer how to instantiate this driver: Documentation/i2c/instantiating-devices.rst
+
+Lookup table for auto fan control
+---------------------------------
+
+========= =================================
+LUT Index Name
+========= =================================
+1 PWM value for T < +18°C
+2 PWM value for +18°C ≤ T < +20°C
+3 PWM value for +20°C ≤ T < +22°C
+... ...
+47 PWM value for +108°C ≤ T < +110°C
+48 PWM value for T ≥ +110°C
+========= =================================
+
+Sysfs entries
+-------------
+
+=============================== =================================================================================
+fan[1-2]_input Fan speed (in RPM)
+fan[1-2]_enable Enable fan readings and fan fault alarms
+fan[1-2]_fault Fan fault status
+temp[1-2]_label "Remote" and "Local" temperature channel labels
+temp[1-2]_input Temperature sensor readings (in millidegrees Celsius)
+temp1_fault Remote temperature sensor fault status
+temp[1-2]_max Temperature max value. Asserts "ALERT" pin when exceeded
+temp[1-2]_max_alarm Temperature max alarm status
+temp[1-2]_crit Temperature critical value. Asserts "SHDN" pin when exceeded
+temp[1-2]_crit_alarm Temperature critical alarm status
+pwm1 PWM value for direct fan control
+pwm1_enable 1: direct fan control, 2: temperature based auto fan control
+pwm1_freq PWM frequency in hertz
+pwm1_auto_channels_temp Temperature source for auto fan control. 1: temp1, 2: temp2, 3: max(temp1, temp2)
+pwm1_auto_point[1-48]_pwm PWM value for LUT point
+pwm1_auto_point_temp_hyst Temperature hysteresis for auto fan control. Can be either 2000mC or 4000mC
+=============================== =================================================================================
--
2.36.1

2022-09-10 17:39:38

by Tilki, Ibrahim

[permalink] [raw]
Subject: [PATCH v9 4/4] MAINTAINERS: Add maintainer for hwmon/max31760

Add maintainer for hwmon/max31760 driver

Signed-off-by: Ibrahim Tilki <[email protected]>
---
MAINTAINERS | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f1390b827..78ab41c92 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1334,6 +1334,15 @@ F: drivers/iio/amplifiers/hmc425a.c
F: drivers/staging/iio/*/ad*
X: drivers/iio/*/adjd*

+ANALOG DEVICES INC MAX31760 DRIVER
+M: Ibrahim Tilki <[email protected]>
+S: Maintained
+W: http://wiki.analog.com/
+W: https://ez.analog.com/linux-software-drivers
+F: Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
+F: Documentation/hwmon/max31760.rst
+F: drivers/hwmon/max31760.c
+
ANALOGBITS PLL LIBRARIES
M: Paul Walmsley <[email protected]>
S: Supported
--
2.36.1

2022-09-20 14:46:57

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v9 0/4] hwmon: Add max31760 fan speed controller

On 9/10/22 10:19, Ibrahim Tilki wrote:
> changes in v9:
> - return -EINVAL when writing fan_enable and pwm_enable
> - fix dt-bindings errors
>
> changes in v8:
> - use sizeof(*)
> - use DEFINE_SIMPLE_DEV_PM_OPS
> - remove __maybe_unused
> - remove of_match_ptr
> - dt-bindings: style fixes
>
> changes in v7:
> - make max31760_read_string static
>
> changes in v6:
> - update description of hwmon documentation
> - add hwmon documentation to index.rst
>
> changes in v5:
> - add dt-bindings documentation
> - add maintainer
>
> changes in v4:
> - use sysfs_emit instead of sprintf
> - use kstrtou8 for pwm
> - use closest match for pwm1_auto_point_temp_hyst
>
> changes in v3:
> - add regmap cache
> - remove pwm1_auto_point[1-48]_{temp,temp_hyst} attributes
> - add pwm1_auto_point_temp_hyst attribute
>
> changes in v2:
> - remove pulse_per_rev variable in tach_to_rpm
> - remove temperature max_hyst and crit_hyst
> - strict value checking for fan_enable and pwm_enable
> - do not clamp pwm value for Look-up table
> - add sysfs_attr_init call
> - add documentation
>
>
> Ibrahim Tilki (4):
> drivers: hwmon: Add max31760 fan speed controller driver
> docs: hwmon: add max31760 documentation
> dt-bindings: hwmon: Add bindings for max31760
> MAINTAINERS: Add maintainer for hwmon/max31760
>
> .../bindings/hwmon/adi,max31760.yaml | 42 ++
> Documentation/hwmon/index.rst | 1 +
> Documentation/hwmon/max31760.rst | 77 +++
> MAINTAINERS | 9 +
> drivers/hwmon/Kconfig | 12 +
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/max31760.c | 596 ++++++++++++++++++
> 7 files changed, 738 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
> create mode 100644 Documentation/hwmon/max31760.rst
> create mode 100644 drivers/hwmon/max31760.c
>

Series applied to hwmon-next.

Thanks,
Guenter