Wiki

This version (20 Aug 2019 17:49) was approved by nsa.

Fan Control HDL CORE driver

Supported Devices

Supported boards

Description

This is a Hardware Monitor subsystem driver. The Hwmon subsystem provides a unified framework for drivers doing hardware monitoring. It exposes a set of sysfs files that should follow the sysfs-interface.

Source Code

Status

Files

Function File
driver drivers/hwmon/axi_fan_control.c

Example platform device initialization

The AXI FAN CONTROL driver is a platform driver and can currently only be instantiated via device tree.

Required devicetree properties:

  • compatible: Should always be one of these:
    • adi,axi-fan-control-1.00.a
  • reg: Base address and register area size. This parameter expects a register range.
  • clocks: Reference clock.
  • interrupts: Interrupt line.
  • adi,pulses-per-revolution: Number of pulses per revolution
&fpga_axi {
	axi_fan_control: axi-fan-control@80000000 {
		compatible = "adi,axi-fan-control-1.00.a";
		reg = <0x0 0x80000000 0x10000>;
		clocks = <&clk 71>;
		interrupts = <0 110 0>;
		adi,pulses-per-revolution = <2>;
};

Enabling Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

Adding Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

Linux Kernel Configuration
	Device Drivers  --->
        <*>     Hardware Monitoring support --->
            --- Hardware Monitoring support
        [--snip--]
            <*> Analog Devices FAN Control HDL Core driver
        [--snip--]

Hardware configuration

Driver testing

HWMON device files

Each and every HWMON device has a device folder under /sys/class/hwmon/hwmonX, where X is the hwmon device index. Under every of these directory folders there are a set of files, depending on what kind of hardware monitoring is supported (temperature, voltage). In order to determine which hwmon device corresponds to which hardware chip, the user can read the name file under /sys/class/hwmon/hwmonX/name.

This specifies any shell prompt running on the target

root:/> cd /sys/class/hwmon/
root:/sys/class/hwmon> ls
hwmon0  hwmon1
root:/sys/class/hwmon> cd hwmon0
root:/sys/class/hwmon/hwmon0> ls -l
total 0
drwxr-xr-x 3 root root    0 Nov 16 11:17 .
drwxr-xr-x 3 root root    0 Nov 16 11:17 ..
lrwxrwxrwx 1 root root    0 Nov 16 11:17 device -> ../../../axi-fan-control@80000000
-r--r--r-- 1 root root 4096 Nov 16 11:17 fan1_fault
-r--r--r-- 1 root root 4096 Nov 16 11:17 fan1_input
-r--r--r-- 1 root root 4096 Nov 16 11:17 fan1_label
-r--r--r-- 1 root root 4096 Nov 16 11:17 name
lrwxrwxrwx 1 root root    0 Nov 16 11:17 of_node -> ../../../../../firmware/devicetree/base/axi-fan-control@80000000
drwxr-xr-x 2 root root    0 Nov 16 11:17 power
-rw-r--r-- 1 root root 4096 Nov 16 11:17 pwm1
lrwxrwxrwx 1 root root    0 Nov 16 11:17 subsystem -> ../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Nov 16 11:17 temp1_input
-r--r--r-- 1 root root 4096 Nov 16 11:17 temp1_label
-rw-r--r-- 1 root root 4096 Nov 16 11:17 uevent
root:/sys/class/hwmon/hwmon0>

For more information on the files format and accepted values, take a look to sysfs-interface.

Show device name

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat name
axi_fan_control

Show FAN input (in RPM)

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat fan1_input
3600

Show FAN label

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat fan1_label
SOM FAN

Show PWM input

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat pwm1
200

Show Temperature input (in milliC)

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat temp1_input
32000

Show Temperature label

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat temp1_label
SYSMON4

Show fault

When reading fan1_fault returns 1, that means that either the FAN is physically not working/broken or the tacho signal fails to stay within its designated frequency interval.

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> cat fan1_fault
0

Set PWM value

This specifies any shell prompt running on the target

root:/sys/class/hwmon/hwmon0> echo 250 > pwm1

More Information

HWMON pointers

31 Jul 2012 17:53 · larsc
resources/tools-software/linux-drivers/hwmon/axi_fan_control.txt · Last modified: 20 Aug 2019 17:49 by nsa