Skip to content

Commit

Permalink
hwmon: (mlxreg-fan) Add support for Mellanox FAN driver
Browse files Browse the repository at this point in the history
Driver obtains PWM and tachometers registers location according to the
system configuration and creates FAN/PWM hwmon objects and a cooling
device. PWM and tachometers are controlled through the on-board
programmable device, which exports its register map. This device could be
attached to any bus type, for which register mapping is supported. Single
instance is created with one PWM control, up to 12 tachometers and one
cooling device. It could be as many instances as programmable device
supports.

Currently driver will be activated from the Mellanox platform driver:
drivers/platform/x86/mlx-platform.c.
For the future ARM based systems it could be activated from the ARM
platform module.

Signed-off-by: Vadim Pasternak <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
mellanoxbmc authored and groeck committed Jul 9, 2018
1 parent ffb3243 commit 65afb4c
Show file tree
Hide file tree
Showing 4 changed files with 562 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Documentation/hwmon/mlxreg-fan
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Kernel driver mlxreg-fan
========================

Provides FAN control for the next Mellanox systems:
QMB700, equipped with 40x200GbE InfiniBand ports;
MSN3700, equipped with 32x200GbE or 16x400GbE Ethernet ports;
MSN3410, equipped with 6x400GbE plus 48x50GbE Ethernet ports;
MSN3800, equipped with 64x1000GbE Ethernet ports;
These are the Top of the Rack systems, equipped with Mellanox switch
board with Mellanox Quantum or Spectrume-2 devices.
FAN controller is implemented by the programmable device logic.

The default registers offsets set within the programmable device is as
following:
- pwm1 0xe3
- fan1 (tacho1) 0xe4
- fan2 (tacho2) 0xe5
- fan3 (tacho3) 0xe6
- fan4 (tacho4) 0xe7
- fan5 (tacho5) 0xe8
- fan6 (tacho6) 0xe9
- fan7 (tacho7) 0xea
- fan8 (tacho8) 0xeb
- fan9 (tacho9) 0xec
- fan10 (tacho10) 0xed
- fan11 (tacho11) 0xee
- fan12 (tacho12) 0xef
This setup can be re-programmed with other registers.

Author: Vadim Pasternak <[email protected]>

Description
-----------

The driver implements a simple interface for driving a fan connected to
a PWM output and tachometer inputs.
This driver obtains PWM and tachometers registers location according to
the system configuration and creates FAN/PWM hwmon objects and a cooling
device. PWM and tachometers are sensed through the on-board programmable
device, which exports its register map. This device could be attached to
any bus type, for which register mapping is supported.
Single instance is created with one PWM control, up to 12 tachometers and
one cooling device. It could be as many instances as programmable device
supports.
The driver exposes the fan to the user space through the hwmon's and
thermal's sysfs interfaces.

/sys files in hwmon subsystem
-----------------------------

fan[1-12]_fault - RO files for tachometers TACH1-TACH12 fault indication
fan[1-12]_input - RO files for tachometers TACH1-TACH12 input (in RPM)
pwm1 - RW file for fan[1-12] target duty cycle (0..255)

/sys files in thermal subsystem
-------------------------------

cur_state - RW file for current cooling state of the cooling device
(0..max_state)
max_state - RO file for maximum cooling state of the cooling device
12 changes: 12 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,18 @@ config SENSORS_MCP3021
This driver can also be built as a module. If so, the module
will be called mcp3021.

config SENSORS_MLXREG_FAN
tristate "Mellanox Mellanox FAN driver"
depends on MELLANOX_PLATFORM
imply THERMAL
select REGMAP
help
This option enables support for the FAN control on the Mellanox
Ethernet and InfiniBand switches. The driver can be activated by the
platform device add call. Say Y to enable these. To compile this
driver as a module, choose 'M' here: the module will be called
mlxreg-fan.

config SENSORS_TC654
tristate "Microchip TC654/TC655 and compatibles"
depends on I2C
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ obj-$(CONFIG_SENSORS_MAX31790) += max31790.o
obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
obj-$(CONFIG_SENSORS_TC654) += tc654.o
obj-$(CONFIG_SENSORS_MLXREG_FAN) += mlxreg-fan.o
obj-$(CONFIG_SENSORS_MENF21BMC_HWMON) += menf21bmc_hwmon.o
obj-$(CONFIG_SENSORS_NCT6683) += nct6683.o
obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o
Expand Down
Loading

0 comments on commit 65afb4c

Please sign in to comment.