Skip to content

Commit

Permalink
hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.
Browse files Browse the repository at this point in the history
TI's TMP512/513 are I2C/SMBus system monitor chips. These chips
monitor the supply voltage, supply current, power consumption
and provide one local and up to three (TMP513) remote temperature sensors.

It has been tested using a TI TMP513 development kit (TMP513EVM)

Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
Link: https://lore.kernel.org/r/20191112223001.20844-3-etremblay@distech-controls.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Eric Tremblay authored and groeck committed Nov 22, 2019
1 parent 17fe298 commit 59dfa75
Show file tree
Hide file tree
Showing 6 changed files with 894 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/hwmon/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Hardware Monitoring Kernel Drivers
tmp108
tmp401
tmp421
tmp513
tps40422
twl4030-madc-hwmon
ucd9000
Expand Down
103 changes: 103 additions & 0 deletions Documentation/hwmon/tmp513.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.. SPDX-License-Identifier: GPL-2.0
Kernel driver tmp513
====================

Supported chips:

* Texas Instruments TMP512

Prefix: 'tmp512'

Datasheet: http://www.ti.com/lit/ds/symlink/tmp512.pdf

* Texas Instruments TMP513

Prefix: 'tmp513'

Datasheet: http://www.ti.com/lit/ds/symlink/tmp513.pdf

Authors:

Eric Tremblay <etremblay@distech-controls.com>

Description
-----------

This driver implements support for Texas Instruments TMP512, and TMP513.
The TMP512 (dual-channel) and TMP513 (triple-channel) are system monitors
that include remote sensors, a local temperature sensor, and a high-side current
shunt monitor. These system monitors have the capability of measuring remote
temperatures, on-chip temperatures, and system voltage/power/current
consumption.

The temperatures are measured in degrees Celsius with a range of
-40 to + 125 degrees with a resolution of 0.0625 degree C.

For hysteresis value, only the first channel is writable. Writing to it
will affect all other values since each channels are sharing the same
hysteresis value. The hysteresis is in degrees Celsius with a range of
0 to 127.5 degrees with a resolution of 0.5 degree.

The driver exports the temperature values via the following sysfs files:

**temp[1-4]_input**

**temp[1-4]_crit**

**temp[1-4]_crit_alarm**

**temp[1-4]_crit_hyst**

The driver read the shunt voltage from the chip and convert it to current.
The readable range depends on the "ti,pga-gain" property (default to 8) and the
shunt resistor value. The value resolution will be equal to 10uV/Rshunt.

The driver exports the shunt currents values via the following sysFs files:

**curr1_input**

**curr1_lcrit**

**curr1_lcrit_alarm**

**curr1_crit**

**curr1_crit_alarm**

The bus voltage range is read from the chip with a resolution of 4mV. The chip
can be configurable in two different range (32V or 16V) using the
ti,bus-range-microvolt property in the devicetree.

The driver exports the bus voltage values via the following sysFs files:

**in0_input**

**in0_lcrit**

**in0_lcrit_alarm**

**in0_crit**

**in0_crit_alarm**

The bus power and bus currents range and resolution depends on the calibration
register value. Those values are calculate by the hardware using those
formulas:

Current = (ShuntVoltage * CalibrationRegister) / 4096
Power = (Current * BusVoltage) / 5000

The driver exports the bus current and bus power values via the following
sysFs files:

**curr2_input**

**power1_input**

**power1_crit**

**power1_crit_alarm**

The calibration process follow the procedure of the datasheet (without overflow)
and depend on the shunt resistor value and the pga_gain value.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -16385,6 +16385,13 @@ S: Maintained
F: Documentation/hwmon/tmp401.rst
F: drivers/hwmon/tmp401.c

TMP513 HARDWARE MONITOR DRIVER
M: Eric Tremblay <etremblay@distech-controls.com>
L: linux-hwmon@vger.kernel.org
S: Maintained
F: Documentation/hwmon/tmp513.rst
F: drivers/hwmon/tmp513.c

TMPFS (SHMEM FILESYSTEM)
M: Hugh Dickins <hughd@google.com>
L: linux-mm@kvack.org
Expand Down
10 changes: 10 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,16 @@ config SENSORS_TMP421
This driver can also be built as a module. If so, the module
will be called tmp421.

config SENSORS_TMP513
tristate "Texas Instruments TMP513 and compatibles"
depends on I2C
help
If you say yes here you get support for Texas Instruments TMP512,
and TMP513 temperature and power supply sensor chips.

This driver can also be built as a module. If so, the module
will be called tmp513.

config SENSORS_VEXPRESS
tristate "Versatile Express"
depends on VEXPRESS_CONFIG
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ obj-$(CONFIG_SENSORS_TMP103) += tmp103.o
obj-$(CONFIG_SENSORS_TMP108) += tmp108.o
obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
obj-$(CONFIG_SENSORS_TMP513) += tmp513.o
obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
Expand Down

0 comments on commit 59dfa75

Please sign in to comment.