hwmon: (adt7462) Add settings for manual fan control.
Subsystems (2)
PATCH 1/1 hwmon: (adt7462) Add settings for manual fan control.
ADT7462 can operate in manual mode for fan control. Currently if we want to read fan speed,
there is a check if TACH measurement is enabled for a fan. (In fan_enabled function).
There is no way to enable TACH measurement currently. This is addressed in this commit.
Along with the above support few more features are enabled
- Support for setting fan presence.
- Support for setting low and high frequency mode.
- Support for setting easy config option.
- Support for setting the duration of the fan startup timeout.
- Once the setting is done, there is a setup complete bit in cfg1 register. Settings this bit will start the monitoring of all selected channels. Added support for that.
Based on this, below is the flow to set/get fan speed (example:pwm1)
echo 1 > pwm1_enable #Set to manual mode echo 1 > pwm_freq_mode #High freq mode (optional.newly added) echo 1 > fan1_presence #Set fan 1 as present(newly added) echo 1 > fan1_tach_enable #Start TACH measurement-fan1(newly added) echo 1 > setup_complete #Mark as setup complete (newly added) cat fan1_input #Read Fan1 RPM. echo 192 > pwm1 #Change PWM1(has fan1) to 75%(192/255).
This is tested on x86 CPU which connects via PCIE to FGPA which has I2C Controller. ADT7462 is connected to the I2C controller(on FPGA).
--- Documentation/hwmon/adt7462.rst | 22 ++- drivers/hwmon/adt7462.c | 308 ++++++++++++++++++++++++++++++++ 2 files changed, 329 insertions(+), 1 deletion(-)
Documentation/hwmon/adt7462.rst +21 -1
@@ -56,7 +56,7 @@ Configuration Notes Besides standard interfaces driver adds the following: -* PWM Control +* PWM Auto Control * pwm#_auto_point1_pwm and temp#_auto_point1_temp and * pwm#_auto_point2_pwm and temp#_auto_point2_temp -
@@ -68,3 +68,23 @@ The ADT7462 will scale the pwm between the lower and higher pwm speed when the temperature is between the two temperature boundaries. PWM values range from 0 (off) to 255 (full speed). Fan speed will be set to maximum when the temperature sensor associated with the PWM control exceeds temp#_max. + +* PWM Manual Control +The ADT7462 can operate in manual mode for PWM control. +Below is the typical flow to contol PWM manually. +(Example for PWM1 which controls fan1) + + - Set PWM to manual mode + - echo 1 > pwm1_enable + - Enable High Freq Mode (optional) + - echo 1 > pwm_freq_mode + - Set fan1 as present + - echo 1 > fan1_presence + - Start TACH measurement for fan1 + - echo 1 > fan1_tach_enable + - Mark as setup complete. This will start monitoring of all enabled channels. + - echo 1 > setup_complete + - Read fan1 RPM + - cat fan1_input + - Change PWM1 to 75% (192/255) + - echo 192 > pwm1
drivers/hwmon/adt7462.c +308 -0
400 lines not on this page · raw message
Signature · 1 line
2.31.1
Guenter Roeck
maintainerQuoted 16 lines · Ashwin H
ADT7462 can operate in manual mode for fan control. Currently if we want to read fan speed,
there is a check if TACH measurement is enabled for a fan. (Infan_enabledfunction).
There is no way to enable TACH measurement currently. This is addressed in this commit.Along with the above support few more features are enabled
- Support for setting fan presence.
- Support for setting low and high frequency mode.
- Support for setting easy config option.
- Support for setting the duration of the fan startup timeout.
- Once the setting is done, there is a setup complete bit in cfg1 register. Settings this bit will start the monitoring of all selected channels. Added support for that.
Quoted 7 lines
Based on this, below is the flow to set/get fan speed (example:pwm1)
echo 1 > pwm1_enable #Set to manual mode echo 1 > pwm_freq_mode #High freq mode (optional.newly added) echo 1 > fan1_presence #Set fan 1 as present(newly added) echo 1 > fan1_tach_enable #Start TACH measurement-fan1(newly added) echo 1 > setup_complete #Mark as setup complete (newly added)
Please refrain from adding non-standard attributes. Several of the above non-standard attributes can be expressed as standard attributes, which is even less acceptable.
Also, please follow Documentation/process/submitting-patches.rst, which clearly states
Separate each **logical change** into a separate patch.
Guenter