monitor: Use host state to decide power state

phosphos-fan-monitor service is using pgood to decide the power state.
When power state is off, phosphor-fan-monitor should not check
functionality of fans. However, with Ampere's Softoff (e.g via power
cycle), it takes long for pgood to change state after the command to
power cycle host is taken, so phosphor-fan-monitor fails to detect the
power state is off, and continues to check functionality. This results
in fans being marked non-functional when host is off during power cycle.
This patch offers a package configuration option for choosing to use
CurrentHostState instead of pgood to decide the power state. When the
CurrentHostState is TransitioningToOff, which is set right after the
power cycle command, the power state will be considered as off.

Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I6f459384b1d536f61c5df787d696412acc04ba02
3 files changed