mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 20:16:41 +07:00
5950ec8d3e
Add support for exposing all GPIO pins as analog voltages. Though this is not an ideal use of the chip, some hardware engineers may decide that the LTC4245 meets their design requirements when studying the datasheet. The GPIO pins are sampled in round-robin fashion, meaning that a slow reader will see stale data. A userspace application can detect this, because it will get -EAGAIN when reading from a sysfs file which contains stale data. Users can choose to use this feature on a per-chip basis by using either platform data or the OF device tree (where applicable). Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Jean Delvare <khali@linux-fr.org>
103 lines
3.2 KiB
Plaintext
103 lines
3.2 KiB
Plaintext
Kernel driver ltc4245
|
|
=====================
|
|
|
|
Supported chips:
|
|
* Linear Technology LTC4245
|
|
Prefix: 'ltc4245'
|
|
Addresses scanned: 0x20-0x3f
|
|
Datasheet:
|
|
http://www.linear.com/pc/downloadDocument.do?navId=H0,C1,C1003,C1006,C1140,P19392,D13517
|
|
|
|
Author: Ira W. Snyder <iws@ovro.caltech.edu>
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
The LTC4245 controller allows a board to be safely inserted and removed
|
|
from a live backplane in multiple supply systems such as CompactPCI and
|
|
PCI Express.
|
|
|
|
|
|
Usage Notes
|
|
-----------
|
|
|
|
This driver does not probe for LTC4245 devices, due to the fact that some
|
|
of the possible addresses are unfriendly to probing. You will have to
|
|
instantiate the devices explicitly.
|
|
|
|
Example: the following will load the driver for an LTC4245 at address 0x23
|
|
on I2C bus #1:
|
|
$ modprobe ltc4245
|
|
$ echo ltc4245 0x23 > /sys/bus/i2c/devices/i2c-1/new_device
|
|
|
|
|
|
Sysfs entries
|
|
-------------
|
|
|
|
The LTC4245 has built-in limits for over and under current warnings. This
|
|
makes it very likely that the reference circuit will be used.
|
|
|
|
This driver uses the values in the datasheet to change the register values
|
|
into the values specified in the sysfs-interface document. The current readings
|
|
rely on the sense resistors listed in Table 2: "Sense Resistor Values".
|
|
|
|
in1_input 12v input voltage (mV)
|
|
in2_input 5v input voltage (mV)
|
|
in3_input 3v input voltage (mV)
|
|
in4_input Vee (-12v) input voltage (mV)
|
|
|
|
in1_min_alarm 12v input undervoltage alarm
|
|
in2_min_alarm 5v input undervoltage alarm
|
|
in3_min_alarm 3v input undervoltage alarm
|
|
in4_min_alarm Vee (-12v) input undervoltage alarm
|
|
|
|
curr1_input 12v current (mA)
|
|
curr2_input 5v current (mA)
|
|
curr3_input 3v current (mA)
|
|
curr4_input Vee (-12v) current (mA)
|
|
|
|
curr1_max_alarm 12v overcurrent alarm
|
|
curr2_max_alarm 5v overcurrent alarm
|
|
curr3_max_alarm 3v overcurrent alarm
|
|
curr4_max_alarm Vee (-12v) overcurrent alarm
|
|
|
|
in5_input 12v output voltage (mV)
|
|
in6_input 5v output voltage (mV)
|
|
in7_input 3v output voltage (mV)
|
|
in8_input Vee (-12v) output voltage (mV)
|
|
|
|
in5_min_alarm 12v output undervoltage alarm
|
|
in6_min_alarm 5v output undervoltage alarm
|
|
in7_min_alarm 3v output undervoltage alarm
|
|
in8_min_alarm Vee (-12v) output undervoltage alarm
|
|
|
|
in9_input GPIO voltage data (see note 1)
|
|
in10_input GPIO voltage data (see note 1)
|
|
in11_input GPIO voltage data (see note 1)
|
|
|
|
power1_input 12v power usage (mW)
|
|
power2_input 5v power usage (mW)
|
|
power3_input 3v power usage (mW)
|
|
power4_input Vee (-12v) power usage (mW)
|
|
|
|
|
|
Note 1
|
|
------
|
|
|
|
If you have NOT configured the driver to sample all GPIO pins as analog
|
|
voltages, then the in10_input and in11_input sysfs attributes will not be
|
|
created. The driver will sample the GPIO pin that is currently connected to the
|
|
ADC as an analog voltage, and report the value in in9_input.
|
|
|
|
If you have configured the driver to sample all GPIO pins as analog voltages,
|
|
then they will be sampled in round-robin fashion. If userspace reads too
|
|
slowly, -EAGAIN will be returned when you read the sysfs attribute containing
|
|
the sensor reading.
|
|
|
|
The LTC4245 chip can be configured to sample all GPIO pins with two methods:
|
|
1) platform data -- see include/linux/i2c/ltc4245.h
|
|
2) OF device tree -- add the "ltc4245,use-extra-gpios" property to each chip
|
|
|
|
The default mode of operation is to sample a single GPIO pin.
|