hwmon: Add Baikal-T1 PVT sensor driver
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>
Thu, 28 May 2020 14:28:05 +0000 (17:28 +0300)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 28 May 2020 14:59:45 +0000 (07:59 -0700)
commit87976ce2825d9f1ca2e70ee7d38dec490ad5a6e2
tree9dd5f7ba31b6164bc2927692adbaa485058542e4
parent1597b374af22266266e1e20612208c4b11359ad4
hwmon: Add Baikal-T1 PVT sensor driver

Baikal-T1 SoC provides an embedded process, voltage and temperature
sensor to monitor an internal SoC environment (chip temperature, supply
voltage and process monitor) and on time detect critical situations,
which may cause the system instability and even damages. The IP-block
is based on the Analog Bits PVT sensor, but is equipped with a
dedicated control wrapper, which provides a MMIO registers-based access
to the sensor core functionality (APB3-bus based) and exposes an
additional functions like thresholds/data ready interrupts, its status
and masks, measurements timeout. All of these is used to create a hwmon
driver being added to the kernel by this commit.

The driver implements support for the hardware monitoring capabilities
of Baikal-T1 process, voltage and temperature sensors. PVT IP-core
consists of one temperature and four voltage sensors, each of which is
implemented as a dedicated hwmon channel config.

The driver can optionally provide the hwmon alarms for each sensor the
PVT controller supports. The alarms functionality is made compile-time
configurable due to the hardware interface implementation peculiarity,
which is connected with an ability to convert data from only one sensor
at a time. Additional limitation is that the controller performs the
thresholds checking synchronously with the data conversion procedure.
Due to these limitations in order to have the hwmon alarms
automatically detected the driver code must switch from one sensor to
another, read converted data and manually check the threshold status
bits. Depending on the measurements timeout settings this design may
cause additional burden on the system performance. By default if the
alarms kernel config is disabled the data conversion is performed by
the driver on demand when read operation is requested via corresponding
_input-file.

Co-developed-by: Maxim Kaurkin <maxim.kaurkin@baikalelectronics.ru>
Signed-off-by: Maxim Kaurkin <maxim.kaurkin@baikalelectronics.ru>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: devicetree@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/bt1-pvt.rst [new file with mode: 0644]
Documentation/hwmon/index.rst
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/bt1-pvt.c [new file with mode: 0644]
drivers/hwmon/bt1-pvt.h [new file with mode: 0644]