hw/misc: Add NPCM7XX MFT Module
commit380a37e49891f8d9462124f593516a9ced58343a
authorHao Wu <wuhaotsh@google.com>
Thu, 11 Mar 2021 18:08:52 +0000 (11 10:08 -0800)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 12 Mar 2021 12:48:56 +0000 (12 12:48 +0000)
tree1c84cd2ebbbd97b42c713a58935724a7cf4170ce
parent71b50b9d1ca2f5e8ae65678294ceacbd7b6520c8
hw/misc: Add NPCM7XX MFT Module

This patch implements Multi Function Timer (MFT) module for NPCM7XX.
This module is mainly used to configure PWM fans. It has just enough
functionality to make the PWM fan kernel module work.

The module takes two input, the max_rpm of a fan (modifiable via QMP)
and duty cycle (a GPIO from the PWM module.) The actual measured RPM
is equal to max_rpm * duty_cycle / NPCM7XX_PWM_MAX_DUTY. The RPM is
measured as a counter compared to a prescaled input clock. The kernel
driver reads this counter and report to user space.

Refs:
https://github.com/torvalds/linux/blob/master/drivers/hwmon/npcm750-pwm-fan.c

Reviewed-by: Doug Evans <dje@google.com>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Message-id: 20210311180855.149764-3-wuhaotsh@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/misc/meson.build
hw/misc/npcm7xx_mft.c [new file with mode: 0644]
hw/misc/trace-events
include/hw/misc/npcm7xx_mft.h [new file with mode: 0644]