EMCFAN(4)

EMCFAN(4) | Device Drivers Manual | EMCFAN(4)

# NAME

`emcfan` — Driver for the Microchip Technology EMC210x and EMC230x fan controllers via I2C bus

# SYNOPSIS

`emcfan* at iic? addr 0x2c`
`emcfan* at iic? addr 0x2d`
`emcfan* at iic? addr 0x2e`
`emcfan* at iic? addr 0x2f`
`emcfan* at iic? addr 0x4c`
`emcfan* at iic? addr 0x4d`

# DESCRIPTION

The `emcfan` driver supports the EMC210x family with the following models: EMC2101, EMC2101-R, EMC2103-1, EMC2103-2, EMC2103-4, EMC2104, and EMC2106 and for the EMC230x family with the following models: EMC2301, EMC2302, EMC2303, and EMC2305. All chips have one or more tachometers, and some of the chips have a number of temperature sensors and GPIO. The `emcfan` driver provides envsys(4) framework measurements for the RPM as determined by the tachometers. If the chip has temperature sensors, the envsys(4) framework will provide an entry for every possible temperature sensor that a particular chip can support. GPIO support is provided by gpio(4) framework and the pins can be accessed with the gpioctl(8) command.

The EMC fan controllers are arranged as a set of registers. These registers are accessed by a /dev device per attached chip. The program emcfanctl(8) makes use of this device and allows all valid registers for particular chip to be read or written and provides some higher level commands that allow the drive level and frequency divider for a particular fan to be adjusted.

# GPIO

The EMC2103-2, EMC2103-4, EMC2104 and EMC2106 chips have gpio pins. For the EMC2103-2 and EMC2103-4, these pins are only gpio and are not shared with any other function. For the EMC2104 and EMC2106, the following is how the pins maps to the `alt`N flags in the gpio(4) framework.

Pin | ALT0 | ALT1
GPIO1 | CLK_IN | -
GPIO2 | TACH2 | -
GPIO3 | PWM2 | -
GPIO4 | OVERT2# | PWM3
GPIO5 | OVERT3# | PWM4
GPIO6 | - | -

# SYSCTL VARIABLES

The following sysctl(8) variables are provided:

`hw.emcfan0.debug`
  If the driver is compiled with `EMCFAN_DEBUG`, this node will appear and can be used to set the debugging level.
`hw.emcfan0.poles<n>`
  For a number of the chips in the two chip families, the tachometer calcuation algorithm needs to know the number of poles that the tachometer has in order to calculate the RPM correctly. Usually this will be 2, but if the situation is otherwise, set this node to the number of poles that the particular fan has. The calculation is also effected by the number of edges present in the tachometer signal. The number of edges is set with the emcfanctl(8) command.
`hw.emcfan0.ftach`
  Many of the chips in the two famlies have a pin that can be used to drive an alternative 32.767 kHz clock for the tachometers. The EMC2103-1, EMC2103-2 and EMC2103-4 does not have this alternative clock pin, and while it is likely that the chip is running at the default 32.000 kHz, it might not be. This variable lets one set an alternative clock. The units for this node are in Hz.
`hw.emcfan0.vin4_temp_zone`
  The EMC2104 and EMC2106 have a special temperature sensor pin called VIN4, if this sensor is wired up, then this variable can be set to 1 and meaningful values will appear in the envsys(4) framework.

# FILES

/dev/emcfanu
  The device unit u file.

# SEE ALSO

emcfanctl(8), envsys(4), iic(4), envstat(8), sysctl(8)

# HISTORY

The `emcfan` driver first appeared in NetBSD 11.0.

# AUTHORS

The `emcfan` driver was written by Brad Spencer <brad@anduin.eldar.org>.

# BUGS

The driver does not support the EMC2105 chip.

While not exactly a bug, the driver does nothing with the alert interrupts that can be generated from many of the chips. It would be more typical for this to be tied to a GPIO pin which can interrupt using CPU interrupts.

Feburary 19, 2025 | NetBSD 11.0