]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: core: Add support for negative temperature readout
authorVadim Pasternak <vadimp@mellanox.com>
Mon, 24 Jun 2019 10:32:03 +0000 (13:32 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jun 2019 15:15:42 +0000 (08:15 -0700)
commitb8b2e59abb87fb2b07a2908ea1f3a8bc705ba710
tree87de5d9acc99112976a5bbe45ac7c28035a6a174
parentd67b5b7ce0435cbc5f609dc74fdc0ceabf10b6cb
mlxsw: core: Add support for negative temperature readout

Extend macros MLXSW_REG_MTMP_TEMP_TO_MC() to allow support of negative
temperature readout, since chip and others thermal components are
capable of operating within the negative temperature.
With no such support negative temperature will be consider as very high
temperature and it will cause wrong readout and thermal shutdown.
For negative values 2`s complement is used.
Tested in chamber.
Example of chip ambient temperature readout with chamber temperature:
-10 Celsius:
temp1:             -6.0C  (highest =  -5.0C)
-5 Celsius:
temp1:             -1.0C  (highest =  -1.0C)

v2 (Andrew Lunn):
* Replace '%u' with '%d' in mlxsw_hwmon_module_temp_show()

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
drivers/net/ethernet/mellanox/mlxsw/reg.h