aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-16 00:44:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-16 00:44:47 -0400
commitf0718cea471265fe69017191429979ba1a54b9e0 (patch)
tree6ddc525a4229c0106bf0dafae345c3a4d11d2be3
parent555f8160b2c36dfa071c043b54d4b1edca7e07b4 (diff)
parent630300d5fcb6ee9c32c75d8b576c100fbb794159 (diff)
Merge tag 'hwmon-for-linus-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck: - New drivers for NSA320 and LTC2990 - Added support for ADM1278 to adm1275 driver - Added support for ncpXXxh103 to ntc_thermistor driver - Renamed vexpress hwmon implementation - Minor cleanups and improvements * tag 'hwmon-for-linus-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: Create an NSA320 hardware monitoring driver hwmon: Define binding for the nsa320-hwmon driver hwmon: (adm1275) Add support for ADM1278 hwmon: (ntc_thermistor) Add support for ncpXXxh103 Doc: hwmon: Fix typo "montoring" in hwmon ARM: dts: vfxxx: Add iio_hwmon node for ADC temperature channel ARM: dts: Change iio_hwmon nodes to use hypen in node names hwmon: (iio_hwmon) Allow the driver to accept hypen in device tree node names hwmon: Add LTC2990 sensor driver hwmon: (vexpress) rename vexpress hwmon implementation
-rw-r--r--Documentation/devicetree/bindings/hwmon/nsa320-mcu.txt20
-rw-r--r--Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt1
-rw-r--r--Documentation/devicetree/bindings/iio/iio-bindings.txt2
-rw-r--r--Documentation/hwmon/adm127529
-rw-r--r--Documentation/hwmon/lm250662
-rw-r--r--Documentation/hwmon/ltc299043
-rw-r--r--Documentation/hwmon/max160642
-rw-r--r--Documentation/hwmon/max344402
-rw-r--r--Documentation/hwmon/max86882
-rw-r--r--Documentation/hwmon/nsa32053
-rw-r--r--Documentation/hwmon/ntc_thermistor4
-rw-r--r--Documentation/hwmon/pmbus2
-rw-r--r--Documentation/hwmon/zl61002
-rw-r--r--arch/arm/boot/dts/imx23.dtsi2
-rw-r--r--arch/arm/boot/dts/imx28.dtsi2
-rw-r--r--arch/arm/boot/dts/vfxxx.dtsi5
-rw-r--r--drivers/hwmon/Kconfig31
-rw-r--r--drivers/hwmon/Makefile4
-rw-r--r--drivers/hwmon/iio_hwmon.c11
-rw-r--r--drivers/hwmon/ltc2990.c161
-rw-r--r--drivers/hwmon/nsa320-hwmon.c215
-rw-r--r--drivers/hwmon/ntc_thermistor.c44
-rw-r--r--drivers/hwmon/pmbus/Kconfig4
-rw-r--r--drivers/hwmon/pmbus/adm1275.c56
-rw-r--r--drivers/hwmon/vexpress-hwmon.c (renamed from drivers/hwmon/vexpress.c)0
-rw-r--r--include/linux/platform_data/ntc_thermistor.h1
26 files changed, 677 insertions, 23 deletions
diff --git a/Documentation/devicetree/bindings/hwmon/nsa320-mcu.txt b/Documentation/devicetree/bindings/hwmon/nsa320-mcu.txt
new file mode 100644
index 000000000000..0863e067c85b
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/nsa320-mcu.txt
@@ -0,0 +1,20 @@
1Bindings for the fan / temperature monitor microcontroller used on
2the Zyxel NSA 320 and several subsequent models.
3
4Required properties:
5- compatible : "zyxel,nsa320-mcu"
6- data-gpios : The GPIO pin connected to the data line on the MCU
7- clk-gpios : The GPIO pin connected to the clock line on the MCU
8- act-gpios : The GPIO pin connected to the active line on the MCU
9
10Example:
11
12 hwmon {
13 compatible = "zyxel,nsa320-mcu";
14 pinctrl-0 = <&pmx_mcu_data &pmx_mcu_clk &pmx_mcu_act>;
15 pinctrl-names = "default";
16
17 data-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
18 clk-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
19 act-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
20 };
diff --git a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
index a04a80f9cc70..c3b9c4cfe8df 100644
--- a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
+++ b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
@@ -10,6 +10,7 @@ Requires node properties:
10 "murata,ncp03wb473" 10 "murata,ncp03wb473"
11 "murata,ncp15wl333" 11 "murata,ncp15wl333"
12 "murata,ncp03wf104" 12 "murata,ncp03wf104"
13 "murata,ncp15xh103"
13 14
14/* Usage of vendor name "ntc" is deprecated */ 15/* Usage of vendor name "ntc" is deprecated */
15<DEPRECATED> "ntc,ncp15wb473" 16<DEPRECATED> "ntc,ncp15wb473"
diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt
index 0b447d9ad196..68d6f8ce063b 100644
--- a/Documentation/devicetree/bindings/iio/iio-bindings.txt
+++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt
@@ -82,7 +82,7 @@ vdd channel is connected to output 0 of the &ref device.
82 82
83 ... 83 ...
84 84
85 iio_hwmon { 85 iio-hwmon {
86 compatible = "iio-hwmon"; 86 compatible = "iio-hwmon";
87 io-channels = <&adc 0>, <&adc 1>, <&adc 2>, 87 io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
88 <&adc 3>, <&adc 4>, <&adc 5>, 88 <&adc 3>, <&adc 4>, <&adc 5>,
diff --git a/Documentation/hwmon/adm1275 b/Documentation/hwmon/adm1275
index d697229e3c18..791bc0bd91e6 100644
--- a/Documentation/hwmon/adm1275
+++ b/Documentation/hwmon/adm1275
@@ -14,6 +14,10 @@ Supported chips:
14 Prefix: 'adm1276' 14 Prefix: 'adm1276'
15 Addresses scanned: - 15 Addresses scanned: -
16 Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1276.pdf 16 Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1276.pdf
17 * Analog Devices ADM1278
18 Prefix: 'adm1278'
19 Addresses scanned: -
20 Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1278.pdf
17 * Analog Devices ADM1293/ADM1294 21 * Analog Devices ADM1293/ADM1294
18 Prefix: 'adm1293', 'adm1294' 22 Prefix: 'adm1293', 'adm1294'
19 Addresses scanned: - 23 Addresses scanned: -
@@ -25,13 +29,15 @@ Author: Guenter Roeck <linux@roeck-us.net>
25Description 29Description
26----------- 30-----------
27 31
28This driver supports hardware montoring for Analog Devices ADM1075, ADM1275, 32This driver supports hardware monitoring for Analog Devices ADM1075, ADM1275,
29ADM1276, ADM1293, and ADM1294 Hot-Swap Controller and Digital Power Monitors. 33ADM1276, ADM1278, ADM1293, and ADM1294 Hot-Swap Controller and Digital
34Power Monitors.
30 35
31ADM1075, ADM1275, ADM1276, ADM1293, and ADM1294 are hot-swap controllers that 36ADM1075, ADM1275, ADM1276, ADM1278, ADM1293, and ADM1294 are hot-swap
32allow a circuit board to be removed from or inserted into a live backplane. 37controllers that allow a circuit board to be removed from or inserted into
33They also feature current and voltage readback via an integrated 12 38a live backplane. They also feature current and voltage readback via an
34bit analog-to-digital converter (ADC), accessed using a PMBus interface. 39integrated 12 bit analog-to-digital converter (ADC), accessed using a
40PMBus interface.
35 41
36The driver is a client driver to the core PMBus driver. Please see 42The driver is a client driver to the core PMBus driver. Please see
37Documentation/hwmon/pmbus for details on PMBus client drivers. 43Documentation/hwmon/pmbus for details on PMBus client drivers.
@@ -96,3 +102,14 @@ power1_reset_history Write any value to reset history.
96 102
97 Power attributes are supported on ADM1075, ADM1276, 103 Power attributes are supported on ADM1075, ADM1276,
98 ADM1293, and ADM1294. 104 ADM1293, and ADM1294.
105
106temp1_input Chip temperature.
107 Temperature attributes are only available on ADM1278.
108temp1_max Maximum chip temperature.
109temp1_max_alarm Temperature alarm.
110temp1_crit Critical chip temperature.
111temp1_crit_alarm Critical temperature high alarm.
112temp1_highest Highest observed temperature.
113temp1_reset_history Write any value to reset history.
114
115 Temperature attributes are supported on ADM1278.
diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066
index b34c3de5c1bc..2cb20ebb234d 100644
--- a/Documentation/hwmon/lm25066
+++ b/Documentation/hwmon/lm25066
@@ -36,7 +36,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
36Description 36Description
37----------- 37-----------
38 38
39This driver supports hardware montoring for National Semiconductor / TI LM25056, 39This driver supports hardware monitoring for National Semiconductor / TI LM25056,
40LM25063, LM25066, LM5064, and LM5066 Power Management, Monitoring, Control, and 40LM25063, LM25066, LM5064, and LM5066 Power Management, Monitoring, Control, and
41Protection ICs. 41Protection ICs.
42 42
diff --git a/Documentation/hwmon/ltc2990 b/Documentation/hwmon/ltc2990
new file mode 100644
index 000000000000..c25211e90bdc
--- /dev/null
+++ b/Documentation/hwmon/ltc2990
@@ -0,0 +1,43 @@
1Kernel driver ltc2990
2=====================
3
4Supported chips:
5 * Linear Technology LTC2990
6 Prefix: 'ltc2990'
7 Addresses scanned: -
8 Datasheet: http://www.linear.com/product/ltc2990
9
10Author: Mike Looijmans <mike.looijmans@topic.nl>
11
12
13Description
14-----------
15
16LTC2990 is a Quad I2C Voltage, Current and Temperature Monitor.
17The chip's inputs can measure 4 voltages, or two inputs together (1+2 and 3+4)
18can be combined to measure a differential voltage, which is typically used to
19measure current through a series resistor, or a temperature.
20
21This driver currently uses the 2x differential mode only. In order to support
22other modes, the driver will need to be expanded.
23
24
25Usage Notes
26-----------
27
28This driver does not probe for PMBus devices. You will have to instantiate
29devices explicitly.
30
31
32Sysfs attributes
33----------------
34
35The "curr*_input" measurements actually report the voltage drop across the
36input pins in microvolts. This is equivalent to the current through a 1mOhm
37sense resistor. Divide the reported value by the actual sense resistor value
38in mOhm to get the actual value.
39
40in0_input Voltage at Vcc pin in millivolt (range 2.5V to 5V)
41temp1_input Internal chip temperature in millidegrees Celcius
42curr1_input Current in mA across v1-v2 assuming a 1mOhm sense resistor.
43curr2_input Current in mA across v3-v4 assuming a 1mOhm sense resistor.
diff --git a/Documentation/hwmon/max16064 b/Documentation/hwmon/max16064
index d59cc7829bec..265370f5cb82 100644
--- a/Documentation/hwmon/max16064
+++ b/Documentation/hwmon/max16064
@@ -13,7 +13,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
13Description 13Description
14----------- 14-----------
15 15
16This driver supports hardware montoring for Maxim MAX16064 Quad Power-Supply 16This driver supports hardware monitoring for Maxim MAX16064 Quad Power-Supply
17Controller with Active-Voltage Output Control and PMBus Interface. 17Controller with Active-Voltage Output Control and PMBus Interface.
18 18
19The driver is a client driver to the core PMBus driver. 19The driver is a client driver to the core PMBus driver.
diff --git a/Documentation/hwmon/max34440 b/Documentation/hwmon/max34440
index 37cbf472a19d..f5b1fcaa9e4e 100644
--- a/Documentation/hwmon/max34440
+++ b/Documentation/hwmon/max34440
@@ -33,7 +33,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
33Description 33Description
34----------- 34-----------
35 35
36This driver supports hardware montoring for Maxim MAX34440 PMBus 6-Channel 36This driver supports hardware monitoring for Maxim MAX34440 PMBus 6-Channel
37Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager 37Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager
38and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logger. 38and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logger.
39It also supports the MAX34460 and MAX34461 PMBus Voltage Monitor & Sequencers. 39It also supports the MAX34460 and MAX34461 PMBus Voltage Monitor & Sequencers.
diff --git a/Documentation/hwmon/max8688 b/Documentation/hwmon/max8688
index e78078638b91..ca233bec7a8a 100644
--- a/Documentation/hwmon/max8688
+++ b/Documentation/hwmon/max8688
@@ -13,7 +13,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
13Description 13Description
14----------- 14-----------
15 15
16This driver supports hardware montoring for Maxim MAX8688 Digital Power-Supply 16This driver supports hardware monitoring for Maxim MAX8688 Digital Power-Supply
17Controller/Monitor with PMBus Interface. 17Controller/Monitor with PMBus Interface.
18 18
19The driver is a client driver to the core PMBus driver. Please see 19The driver is a client driver to the core PMBus driver. Please see
diff --git a/Documentation/hwmon/nsa320 b/Documentation/hwmon/nsa320
new file mode 100644
index 000000000000..fdbd6947799b
--- /dev/null
+++ b/Documentation/hwmon/nsa320
@@ -0,0 +1,53 @@
1Kernel driver nsa320_hwmon
2==========================
3
4Supported chips:
5 * Holtek HT46R065 microcontroller with onboard firmware that configures
6 it to act as a hardware monitor.
7 Prefix: 'nsa320'
8 Addresses scanned: none
9 Datasheet: Not available, driver was reverse engineered based upon the
10 Zyxel kernel source
11
12Author:
13 Adam Baker <linux@baker-net.org.uk>
14
15Description
16-----------
17
18This chip is known to be used in the Zyxel NSA320 and NSA325 NAS Units and
19also in some variants of the NSA310 but the driver has only been tested
20on the NSA320. In all of these devices it is connected to the same 3 GPIO
21lines which are used to provide chip select, clock and data lines. The
22interface behaves similarly to SPI but at much lower speeds than are normally
23used for SPI.
24
25Following each chip select pulse the chip will generate a single 32 bit word
26that contains 0x55 as a marker to indicate that data is being read correctly,
27followed by an 8 bit fan speed in 100s of RPM and a 16 bit temperature in
28tenths of a degree.
29
30
31sysfs-Interface
32---------------
33
34temp1_input - temperature input
35fan1_input - fan speed
36
37Notes
38-----
39
40The access timings used in the driver are the same as used in the Zyxel
41provided kernel. Testing has shown that if the delay between chip select and
42the first clock pulse is reduced from 100 ms to just under 10ms then the chip
43will not produce any output. If the duration of either phase of the clock
44is reduced from 100 us to less than 15 us then data pulses are likely to be
45read twice corrupting the output. The above analysis is based upon a sample
46of one unit but suggests that the Zyxel provided delay values include a
47reasonable tolerance.
48
49The driver incorporates a limit that it will not check for updated values
50faster than once a second. This is because the hardware takes a relatively long
51time to read the data from the device and when it does it reads both temp and
52fan speed. As the most likely case for two accesses in quick succession is
53to read both of these values avoiding a second read delay is desirable.
diff --git a/Documentation/hwmon/ntc_thermistor b/Documentation/hwmon/ntc_thermistor
index 1d4cc847c6fe..8b9ff23edc32 100644
--- a/Documentation/hwmon/ntc_thermistor
+++ b/Documentation/hwmon/ntc_thermistor
@@ -3,9 +3,9 @@ Kernel driver ntc_thermistor
3 3
4Supported thermistors from Murata: 4Supported thermistors from Murata:
5* Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, 5* Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473,
6 NCP15WL333, NCP03WF104 6 NCP15WL333, NCP03WF104, NCP15XH103
7 Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 7 Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473',
8 'ncp15wl333', 'ncp03wf104' 8 'ncp15wl333', 'ncp03wf104', 'ncp15xh103'
9 Datasheet: Publicly available at Murata 9 Datasheet: Publicly available at Murata
10 10
11Supported thermistors from EPCOS: 11Supported thermistors from EPCOS:
diff --git a/Documentation/hwmon/pmbus b/Documentation/hwmon/pmbus
index b397675e876d..dfd9c65996c0 100644
--- a/Documentation/hwmon/pmbus
+++ b/Documentation/hwmon/pmbus
@@ -43,7 +43,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
43Description 43Description
44----------- 44-----------
45 45
46This driver supports hardware montoring for various PMBus compliant devices. 46This driver supports hardware monitoring for various PMBus compliant devices.
47It supports voltage, current, power, and temperature sensors as supported 47It supports voltage, current, power, and temperature sensors as supported
48by the device. 48by the device.
49 49
diff --git a/Documentation/hwmon/zl6100 b/Documentation/hwmon/zl6100
index 33908a4d68ff..477a94b131ae 100644
--- a/Documentation/hwmon/zl6100
+++ b/Documentation/hwmon/zl6100
@@ -60,7 +60,7 @@ Author: Guenter Roeck <linux@roeck-us.net>
60Description 60Description
61----------- 61-----------
62 62
63This driver supports hardware montoring for Intersil / Zilker Labs ZL6100 and 63This driver supports hardware monitoring for Intersil / Zilker Labs ZL6100 and
64compatible digital DC-DC controllers. 64compatible digital DC-DC controllers.
65 65
66The driver is a client driver to the core PMBus driver. Please see 66The driver is a client driver to the core PMBus driver. Please see
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 1c6c07538a78..302d1168f424 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -569,7 +569,7 @@
569 }; 569 };
570 }; 570 };
571 571
572 iio_hwmon { 572 iio-hwmon {
573 compatible = "iio-hwmon"; 573 compatible = "iio-hwmon";
574 io-channels = <&lradc 8>; 574 io-channels = <&lradc 8>;
575 }; 575 };
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index fae7b9069fc4..f637ec900cc8 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -1256,7 +1256,7 @@
1256 }; 1256 };
1257 }; 1257 };
1258 1258
1259 iio_hwmon { 1259 iio-hwmon {
1260 compatible = "iio-hwmon"; 1260 compatible = "iio-hwmon";
1261 io-channels = <&lradc 8>; 1261 io-channels = <&lradc 8>;
1262 }; 1262 };
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index a9ceb5bac40e..4539f8d909a5 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -629,5 +629,10 @@
629 status = "disabled"; 629 status = "disabled";
630 }; 630 };
631 }; 631 };
632
633 iio-hwmon {
634 compatible = "iio-hwmon";
635 io-channels = <&adc0 16>, <&adc1 16>;
636 };
632 }; 637 };
633}; 638};
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 60fb80bd353d..5c2d13a687aa 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -685,6 +685,20 @@ config SENSORS_LTC2945
685 This driver can also be built as a module. If so, the module will 685 This driver can also be built as a module. If so, the module will
686 be called ltc2945. 686 be called ltc2945.
687 687
688config SENSORS_LTC2990
689 tristate "Linear Technology LTC2990 (current monitoring mode only)"
690 depends on I2C
691 help
692 If you say yes here you get support for Linear Technology LTC2990
693 I2C System Monitor. The LTC2990 supports a combination of voltage,
694 current and temperature monitoring, but in addition to the Vcc supply
695 voltage and chip temperature, this driver currently only supports
696 reading two currents by measuring two differential voltages across
697 series resistors.
698
699 This driver can also be built as a module. If so, the module will
700 be called ltc2990.
701
688config SENSORS_LTC4151 702config SENSORS_LTC4151
689 tristate "Linear Technology LTC4151" 703 tristate "Linear Technology LTC4151"
690 depends on I2C 704 depends on I2C
@@ -1127,7 +1141,7 @@ config SENSORS_NTC_THERMISTOR
1127 1141
1128 Currently, this driver supports 1142 Currently, this driver supports
1129 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333, 1143 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333,
1130 and NCP03WF104 from Murata and B57330V2103 from EPCOS. 1144 NCP03WF104 and NCP15XH103 from Murata and B57330V2103 from EPCOS.
1131 1145
1132 This driver can also be built as a module. If so, the module 1146 This driver can also be built as a module. If so, the module
1133 will be called ntc-thermistor. 1147 will be called ntc-thermistor.
@@ -1176,6 +1190,21 @@ config SENSORS_NCT7904
1176 This driver can also be built as a module. If so, the module 1190 This driver can also be built as a module. If so, the module
1177 will be called nct7904. 1191 will be called nct7904.
1178 1192
1193config SENSORS_NSA320
1194 tristate "ZyXEL NSA320 and compatible fan speed and temperature sensors"
1195 depends on GPIOLIB && OF
1196 depends on MACH_KIRKWOOD || COMPILE_TEST
1197 help
1198 If you say yes here you get support for hardware monitoring
1199 for the ZyXEL NSA320 Media Server and other compatible devices
1200 (probably the NSA325 and some NSA310 variants).
1201
1202 The sensor data is taken from a Holtek HT46R065 microcontroller
1203 connected to GPIO lines.
1204
1205 This driver can also be built as a module. If so, the module
1206 will be called nsa320-hwmon.
1207
1179config SENSORS_PCF8591 1208config SENSORS_PCF8591
1180 tristate "Philips PCF8591 ADC/DAC" 1209 tristate "Philips PCF8591 ADC/DAC"
1181 depends on I2C 1210 depends on I2C
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 30c94df31465..58cc3acba7e7 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_SENSORS_LM95234) += lm95234.o
100obj-$(CONFIG_SENSORS_LM95241) += lm95241.o 100obj-$(CONFIG_SENSORS_LM95241) += lm95241.o
101obj-$(CONFIG_SENSORS_LM95245) += lm95245.o 101obj-$(CONFIG_SENSORS_LM95245) += lm95245.o
102obj-$(CONFIG_SENSORS_LTC2945) += ltc2945.o 102obj-$(CONFIG_SENSORS_LTC2945) += ltc2945.o
103obj-$(CONFIG_SENSORS_LTC2990) += ltc2990.o
103obj-$(CONFIG_SENSORS_LTC4151) += ltc4151.o 104obj-$(CONFIG_SENSORS_LTC4151) += ltc4151.o
104obj-$(CONFIG_SENSORS_LTC4215) += ltc4215.o 105obj-$(CONFIG_SENSORS_LTC4215) += ltc4215.o
105obj-$(CONFIG_SENSORS_LTC4222) += ltc4222.o 106obj-$(CONFIG_SENSORS_LTC4222) += ltc4222.o
@@ -123,6 +124,7 @@ obj-$(CONFIG_SENSORS_NCT6683) += nct6683.o
123obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o 124obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o
124obj-$(CONFIG_SENSORS_NCT7802) += nct7802.o 125obj-$(CONFIG_SENSORS_NCT7802) += nct7802.o
125obj-$(CONFIG_SENSORS_NCT7904) += nct7904.o 126obj-$(CONFIG_SENSORS_NCT7904) += nct7904.o
127obj-$(CONFIG_SENSORS_NSA320) += nsa320-hwmon.o
126obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o 128obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o
127obj-$(CONFIG_SENSORS_PC87360) += pc87360.o 129obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
128obj-$(CONFIG_SENSORS_PC87427) += pc87427.o 130obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
@@ -149,7 +151,7 @@ obj-$(CONFIG_SENSORS_TMP103) += tmp103.o
149obj-$(CONFIG_SENSORS_TMP401) += tmp401.o 151obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
150obj-$(CONFIG_SENSORS_TMP421) += tmp421.o 152obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
151obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o 153obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
152obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress.o 154obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
153obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o 155obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
154obj-$(CONFIG_SENSORS_VIA686A) += via686a.o 156obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
155obj-$(CONFIG_SENSORS_VT1211) += vt1211.o 157obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
index 17ae2eb26ce2..b550ba5fa58a 100644
--- a/drivers/hwmon/iio_hwmon.c
+++ b/drivers/hwmon/iio_hwmon.c
@@ -67,6 +67,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
67 enum iio_chan_type type; 67 enum iio_chan_type type;
68 struct iio_channel *channels; 68 struct iio_channel *channels;
69 const char *name = "iio_hwmon"; 69 const char *name = "iio_hwmon";
70 char *sname;
70 71
71 if (dev->of_node && dev->of_node->name) 72 if (dev->of_node && dev->of_node->name)
72 name = dev->of_node->name; 73 name = dev->of_node->name;
@@ -144,7 +145,15 @@ static int iio_hwmon_probe(struct platform_device *pdev)
144 145
145 st->attr_group.attrs = st->attrs; 146 st->attr_group.attrs = st->attrs;
146 st->groups[0] = &st->attr_group; 147 st->groups[0] = &st->attr_group;
147 st->hwmon_dev = hwmon_device_register_with_groups(dev, name, st, 148
149 sname = devm_kstrdup(dev, name, GFP_KERNEL);
150 if (!sname) {
151 ret = -ENOMEM;
152 goto error_release_channels;
153 }
154
155 strreplace(sname, '-', '_');
156 st->hwmon_dev = hwmon_device_register_with_groups(dev, sname, st,
148 st->groups); 157 st->groups);
149 if (IS_ERR(st->hwmon_dev)) { 158 if (IS_ERR(st->hwmon_dev)) {
150 ret = PTR_ERR(st->hwmon_dev); 159 ret = PTR_ERR(st->hwmon_dev);
diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
new file mode 100644
index 000000000000..8f8fe059ab48
--- /dev/null
+++ b/drivers/hwmon/ltc2990.c
@@ -0,0 +1,161 @@
1/*
2 * Driver for Linear Technology LTC2990 power monitor
3 *
4 * Copyright (C) 2014 Topic Embedded Products
5 * Author: Mike Looijmans <mike.looijmans@topic.nl>
6 *
7 * License: GPLv2
8 *
9 * This driver assumes the chip is wired as a dual current monitor, and
10 * reports the voltage drop across two series resistors. It also reports
11 * the chip's internal temperature and Vcc power supply voltage.
12 */
13
14#include <linux/err.h>
15#include <linux/hwmon.h>
16#include <linux/hwmon-sysfs.h>
17#include <linux/i2c.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20
21#define LTC2990_STATUS 0x00
22#define LTC2990_CONTROL 0x01
23#define LTC2990_TRIGGER 0x02
24#define LTC2990_TINT_MSB 0x04
25#define LTC2990_V1_MSB 0x06
26#define LTC2990_V2_MSB 0x08
27#define LTC2990_V3_MSB 0x0A
28#define LTC2990_V4_MSB 0x0C
29#define LTC2990_VCC_MSB 0x0E
30
31#define LTC2990_CONTROL_KELVIN BIT(7)
32#define LTC2990_CONTROL_SINGLE BIT(6)
33#define LTC2990_CONTROL_MEASURE_ALL (0x3 << 3)
34#define LTC2990_CONTROL_MODE_CURRENT 0x06
35#define LTC2990_CONTROL_MODE_VOLTAGE 0x07
36
37/* convert raw register value to sign-extended integer in 16-bit range */
38static int ltc2990_voltage_to_int(int raw)
39{
40 if (raw & BIT(14))
41 return -(0x4000 - (raw & 0x3FFF)) << 2;
42 else
43 return (raw & 0x3FFF) << 2;
44}
45
46/* Return the converted value from the given register in uV or mC */
47static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, int *result)
48{
49 int val;
50
51 val = i2c_smbus_read_word_swapped(i2c, reg);
52 if (unlikely(val < 0))
53 return val;
54
55 switch (reg) {
56 case LTC2990_TINT_MSB:
57 /* internal temp, 0.0625 degrees/LSB, 13-bit */
58 val = (val & 0x1FFF) << 3;
59 *result = (val * 1000) >> 7;
60 break;
61 case LTC2990_V1_MSB:
62 case LTC2990_V3_MSB:
63 /* Vx-Vy, 19.42uV/LSB. Depends on mode. */
64 *result = ltc2990_voltage_to_int(val) * 1942 / (4 * 100);
65 break;
66 case LTC2990_VCC_MSB:
67 /* Vcc, 305.18μV/LSB, 2.5V offset */
68 *result = (ltc2990_voltage_to_int(val) * 30518 /
69 (4 * 100 * 1000)) + 2500;
70 break;
71 default:
72 return -EINVAL; /* won't happen, keep compiler happy */
73 }
74
75 return 0;
76}
77
78static ssize_t ltc2990_show_value(struct device *dev,
79 struct device_attribute *da, char *buf)
80{
81 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
82 int value;
83 int ret;
84
85 ret = ltc2990_get_value(dev_get_drvdata(dev), attr->index, &value);
86 if (unlikely(ret < 0))
87 return ret;
88
89 return snprintf(buf, PAGE_SIZE, "%d\n", value);
90}
91
92static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, ltc2990_show_value, NULL,
93 LTC2990_TINT_MSB);
94static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc2990_show_value, NULL,
95 LTC2990_V1_MSB);
96static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, ltc2990_show_value, NULL,
97 LTC2990_V3_MSB);
98static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ltc2990_show_value, NULL,
99 LTC2990_VCC_MSB);
100
101static struct attribute *ltc2990_attrs[] = {
102 &sensor_dev_attr_temp1_input.dev_attr.attr,
103 &sensor_dev_attr_curr1_input.dev_attr.attr,
104 &sensor_dev_attr_curr2_input.dev_attr.attr,
105 &sensor_dev_attr_in0_input.dev_attr.attr,
106 NULL,
107};
108ATTRIBUTE_GROUPS(ltc2990);
109
110static int ltc2990_i2c_probe(struct i2c_client *i2c,
111 const struct i2c_device_id *id)
112{
113 int ret;
114 struct device *hwmon_dev;
115
116 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
117 I2C_FUNC_SMBUS_WORD_DATA))
118 return -ENODEV;
119
120 /* Setup continuous mode, current monitor */
121 ret = i2c_smbus_write_byte_data(i2c, LTC2990_CONTROL,
122 LTC2990_CONTROL_MEASURE_ALL |
123 LTC2990_CONTROL_MODE_CURRENT);
124 if (ret < 0) {
125 dev_err(&i2c->dev, "Error: Failed to set control mode.\n");
126 return ret;
127 }
128 /* Trigger once to start continuous conversion */
129 ret = i2c_smbus_write_byte_data(i2c, LTC2990_TRIGGER, 1);
130 if (ret < 0) {
131 dev_err(&i2c->dev, "Error: Failed to start acquisition.\n");
132 return ret;
133 }
134
135 hwmon_dev = devm_hwmon_device_register_with_groups(&i2c->dev,
136 i2c->name,
137 i2c,
138 ltc2990_groups);
139
140 return PTR_ERR_OR_ZERO(hwmon_dev);
141}
142
143static const struct i2c_device_id ltc2990_i2c_id[] = {
144 { "ltc2990", 0 },
145 {}
146};
147MODULE_DEVICE_TABLE(i2c, ltc2990_i2c_id);
148
149static struct i2c_driver ltc2990_i2c_driver = {
150 .driver = {
151 .name = "ltc2990",
152 },
153 .probe = ltc2990_i2c_probe,
154 .id_table = ltc2990_i2c_id,
155};
156
157module_i2c_driver(ltc2990_i2c_driver);
158
159MODULE_DESCRIPTION("LTC2990 Sensor Driver");
160MODULE_AUTHOR("Topic Embedded Products");
161MODULE_LICENSE("GPL v2");
diff --git a/drivers/hwmon/nsa320-hwmon.c b/drivers/hwmon/nsa320-hwmon.c
new file mode 100644
index 000000000000..0517a265741f
--- /dev/null
+++ b/drivers/hwmon/nsa320-hwmon.c
@@ -0,0 +1,215 @@
1/*
2 * drivers/hwmon/nsa320-hwmon.c
3 *
4 * ZyXEL NSA320 Media Servers
5 * hardware monitoring
6 *
7 * Copyright (C) 2016 Adam Baker <linux@baker-net.org.uk>
8 * based on a board file driver
9 * Copyright (C) 2012 Peter Schildmann <linux@schildmann.info>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License v2 as published by the
13 * Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 */
20
21#include <linux/bitops.h>
22#include <linux/delay.h>
23#include <linux/err.h>
24#include <linux/gpio/consumer.h>
25#include <linux/hwmon.h>
26#include <linux/hwmon-sysfs.h>
27#include <linux/jiffies.h>
28#include <linux/module.h>
29#include <linux/mutex.h>
30#include <linux/of.h>
31#include <linux/of_device.h>
32#include <linux/of_platform.h>
33#include <linux/platform_device.h>
34
35/* Tests for error return values rely upon this value being < 0x80 */
36#define MAGIC_NUMBER 0x55
37
38/*
39 * The Zyxel hwmon MCU is a Holtek HT46R065 that is factory programmed
40 * to perform temperature and fan speed monitoring. It is read by taking
41 * the active pin low. The 32 bit output word is then clocked onto the
42 * data line. The MSB of the data word is a magic nuber to indicate it
43 * has been read correctly, the next byte is the fan speed (in hundreds
44 * of RPM) and the last two bytes are the temperature (in tenths of a
45 * degree)
46 */
47
48struct nsa320_hwmon {
49 struct mutex update_lock; /* lock GPIO operations */
50 unsigned long last_updated; /* jiffies */
51 unsigned long mcu_data;
52 struct gpio_desc *act;
53 struct gpio_desc *clk;
54 struct gpio_desc *data;
55};
56
57enum nsa320_inputs {
58 NSA320_TEMP = 0,
59 NSA320_FAN = 1,
60};
61
62static const char * const nsa320_input_names[] = {
63 [NSA320_TEMP] = "System Temperature",
64 [NSA320_FAN] = "Chassis Fan",
65};
66
67/*
68 * Although this protocol looks similar to SPI the long delay
69 * between the active (aka chip select) signal and the shorter
70 * delay between clock pulses are needed for reliable operation.
71 * The delays provided are taken from the manufacturer kernel,
72 * testing suggest they probably incorporate a reasonable safety
73 * margin. (The single device tested became unreliable if the
74 * delay was reduced to 1/10th of this value.)
75 */
76static s32 nsa320_hwmon_update(struct device *dev)
77{
78 u32 mcu_data;
79 u32 mask;
80 struct nsa320_hwmon *hwmon = dev_get_drvdata(dev);
81
82 mutex_lock(&hwmon->update_lock);
83
84 mcu_data = hwmon->mcu_data;
85
86 if (time_after(jiffies, hwmon->last_updated + HZ) || mcu_data == 0) {
87 gpiod_set_value(hwmon->act, 1);
88 msleep(100);
89
90 mcu_data = 0;
91 for (mask = BIT(31); mask; mask >>= 1) {
92 gpiod_set_value(hwmon->clk, 0);
93 usleep_range(100, 200);
94 gpiod_set_value(hwmon->clk, 1);
95 usleep_range(100, 200);
96 if (gpiod_get_value(hwmon->data))
97 mcu_data |= mask;
98 }
99
100 gpiod_set_value(hwmon->act, 0);
101 dev_dbg(dev, "Read raw MCU data %08x\n", mcu_data);
102
103 if ((mcu_data >> 24) != MAGIC_NUMBER) {
104 dev_dbg(dev, "Read invalid MCU data %08x\n", mcu_data);
105 mcu_data = -EIO;
106 } else {
107 hwmon->mcu_data = mcu_data;
108 hwmon->last_updated = jiffies;
109 }
110 }
111
112 mutex_unlock(&hwmon->update_lock);
113
114 return mcu_data;
115}
116
117static ssize_t show_label(struct device *dev,
118 struct device_attribute *attr, char *buf)
119{
120 int channel = to_sensor_dev_attr(attr)->index;
121
122 return sprintf(buf, "%s\n", nsa320_input_names[channel]);
123}
124
125static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
126 char *buf)
127{
128 s32 mcu_data = nsa320_hwmon_update(dev);
129
130 if (mcu_data < 0)
131 return mcu_data;
132
133 return sprintf(buf, "%d\n", (mcu_data & 0xffff) * 100);
134}
135
136static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
137 char *buf)
138{
139 s32 mcu_data = nsa320_hwmon_update(dev);
140
141 if (mcu_data < 0)
142 return mcu_data;
143
144 return sprintf(buf, "%d\n", ((mcu_data & 0xff0000) >> 16) * 100);
145}
146
147static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP);
148static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
149static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN);
150static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL);
151
152static struct attribute *nsa320_attrs[] = {
153 &sensor_dev_attr_temp1_label.dev_attr.attr,
154 &dev_attr_temp1_input.attr,
155 &sensor_dev_attr_fan1_label.dev_attr.attr,
156 &dev_attr_fan1_input.attr,
157 NULL
158};
159
160ATTRIBUTE_GROUPS(nsa320);
161
162static const struct of_device_id of_nsa320_hwmon_match[] = {
163 { .compatible = "zyxel,nsa320-mcu", },
164 { },
165};
166
167static int nsa320_hwmon_probe(struct platform_device *pdev)
168{
169 struct nsa320_hwmon *hwmon;
170 struct device *classdev;
171
172 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL);
173 if (!hwmon)
174 return -ENOMEM;
175
176 /* Look up the GPIO pins to use */
177 hwmon->act = devm_gpiod_get(&pdev->dev, "act", GPIOD_OUT_LOW);
178 if (IS_ERR(hwmon->act))
179 return PTR_ERR(hwmon->act);
180
181 hwmon->clk = devm_gpiod_get(&pdev->dev, "clk", GPIOD_OUT_HIGH);
182 if (IS_ERR(hwmon->clk))
183 return PTR_ERR(hwmon->clk);
184
185 hwmon->data = devm_gpiod_get(&pdev->dev, "data", GPIOD_IN);
186 if (IS_ERR(hwmon->data))
187 return PTR_ERR(hwmon->data);
188
189 mutex_init(&hwmon->update_lock);
190
191 classdev = devm_hwmon_device_register_with_groups(&pdev->dev,
192 "nsa320", hwmon, nsa320_groups);
193
194 return PTR_ERR_OR_ZERO(classdev);
195
196}
197
198/* All allocations use devres so remove() is not needed. */
199
200static struct platform_driver nsa320_hwmon_driver = {
201 .probe = nsa320_hwmon_probe,
202 .driver = {
203 .name = "nsa320-hwmon",
204 .of_match_table = of_match_ptr(of_nsa320_hwmon_match),
205 },
206};
207
208module_platform_driver(nsa320_hwmon_driver);
209
210MODULE_DEVICE_TABLE(of, of_nsa320_hwmon_match);
211MODULE_AUTHOR("Peter Schildmann <linux@schildmann.info>");
212MODULE_AUTHOR("Adam Baker <linux@baker-net.org.uk>");
213MODULE_DESCRIPTION("NSA320 Hardware Monitoring");
214MODULE_LICENSE("GPL v2");
215MODULE_ALIAS("platform:nsa320-hwmon");
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index feed30646d91..faa6e8dfbaaf 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -54,6 +54,7 @@ static const struct platform_device_id ntc_thermistor_id[] = {
54 { "ncp15wl333", TYPE_NCPXXWL333 }, 54 { "ncp15wl333", TYPE_NCPXXWL333 },
55 { "b57330v2103", TYPE_B57330V2103}, 55 { "b57330v2103", TYPE_B57330V2103},
56 { "ncp03wf104", TYPE_NCPXXWF104 }, 56 { "ncp03wf104", TYPE_NCPXXWF104 },
57 { "ncp15xh103", TYPE_NCPXXXH103 },
57 { }, 58 { },
58}; 59};
59 60
@@ -173,6 +174,43 @@ static const struct ntc_compensation ncpXXwf104[] = {
173 { .temp_c = 125, .ohm = 2522 }, 174 { .temp_c = 125, .ohm = 2522 },
174}; 175};
175 176
177static const struct ntc_compensation ncpXXxh103[] = {
178 { .temp_c = -40, .ohm = 247565 },
179 { .temp_c = -35, .ohm = 181742 },
180 { .temp_c = -30, .ohm = 135128 },
181 { .temp_c = -25, .ohm = 101678 },
182 { .temp_c = -20, .ohm = 77373 },
183 { .temp_c = -15, .ohm = 59504 },
184 { .temp_c = -10, .ohm = 46222 },
185 { .temp_c = -5, .ohm = 36244 },
186 { .temp_c = 0, .ohm = 28674 },
187 { .temp_c = 5, .ohm = 22878 },
188 { .temp_c = 10, .ohm = 18399 },
189 { .temp_c = 15, .ohm = 14910 },
190 { .temp_c = 20, .ohm = 12169 },
191 { .temp_c = 25, .ohm = 10000 },
192 { .temp_c = 30, .ohm = 8271 },
193 { .temp_c = 35, .ohm = 6883 },
194 { .temp_c = 40, .ohm = 5762 },
195 { .temp_c = 45, .ohm = 4851 },
196 { .temp_c = 50, .ohm = 4105 },
197 { .temp_c = 55, .ohm = 3492 },
198 { .temp_c = 60, .ohm = 2985 },
199 { .temp_c = 65, .ohm = 2563 },
200 { .temp_c = 70, .ohm = 2211 },
201 { .temp_c = 75, .ohm = 1915 },
202 { .temp_c = 80, .ohm = 1666 },
203 { .temp_c = 85, .ohm = 1454 },
204 { .temp_c = 90, .ohm = 1275 },
205 { .temp_c = 95, .ohm = 1121 },
206 { .temp_c = 100, .ohm = 990 },
207 { .temp_c = 105, .ohm = 876 },
208 { .temp_c = 110, .ohm = 779 },
209 { .temp_c = 115, .ohm = 694 },
210 { .temp_c = 120, .ohm = 620 },
211 { .temp_c = 125, .ohm = 556 },
212};
213
176/* 214/*
177 * The following compensation table is from the specification of EPCOS NTC 215 * The following compensation table is from the specification of EPCOS NTC
178 * Thermistors Datasheet 216 * Thermistors Datasheet
@@ -260,6 +298,8 @@ static const struct of_device_id ntc_match[] = {
260 .data = &ntc_thermistor_id[5]}, 298 .data = &ntc_thermistor_id[5]},
261 { .compatible = "murata,ncp03wf104", 299 { .compatible = "murata,ncp03wf104",
262 .data = &ntc_thermistor_id[6] }, 300 .data = &ntc_thermistor_id[6] },
301 { .compatible = "murata,ncp15xh103",
302 .data = &ntc_thermistor_id[7] },
263 303
264 /* Usage of vendor name "ntc" is deprecated */ 304 /* Usage of vendor name "ntc" is deprecated */
265 { .compatible = "ntc,ncp15wb473", 305 { .compatible = "ntc,ncp15wb473",
@@ -609,6 +649,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
609 data->comp = ncpXXwf104; 649 data->comp = ncpXXwf104;
610 data->n_comp = ARRAY_SIZE(ncpXXwf104); 650 data->n_comp = ARRAY_SIZE(ncpXXwf104);
611 break; 651 break;
652 case TYPE_NCPXXXH103:
653 data->comp = ncpXXxh103;
654 data->n_comp = ARRAY_SIZE(ncpXXxh103);
655 break;
612 default: 656 default:
613 dev_err(&pdev->dev, "Unknown device type: %lu(%s)\n", 657 dev_err(&pdev->dev, "Unknown device type: %lu(%s)\n",
614 pdev_id->driver_data, pdev_id->name); 658 pdev_id->driver_data, pdev_id->name);
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 7e5cc3d025ef..054d3d863802 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -31,8 +31,8 @@ config SENSORS_ADM1275
31 default n 31 default n
32 help 32 help
33 If you say yes here you get hardware monitoring support for Analog 33 If you say yes here you get hardware monitoring support for Analog
34 Devices ADM1075, ADM1275, ADM1276, ADM1293, and ADM1294 Hot-Swap 34 Devices ADM1075, ADM1275, ADM1276, ADM1278, ADM1293, and ADM1294
35 Controller and Digital Power Monitors. 35 Hot-Swap Controller and Digital Power Monitors.
36 36
37 This driver can also be built as a module. If so, the module will 37 This driver can also be built as a module. If so, the module will
38 be called adm1275. 38 be called adm1275.
diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
index 188af4c89f40..3baa4f4a8c5e 100644
--- a/drivers/hwmon/pmbus/adm1275.c
+++ b/drivers/hwmon/pmbus/adm1275.c
@@ -24,7 +24,7 @@
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include "pmbus.h" 25#include "pmbus.h"
26 26
27enum chips { adm1075, adm1275, adm1276, adm1293, adm1294 }; 27enum chips { adm1075, adm1275, adm1276, adm1278, adm1293, adm1294 };
28 28
29#define ADM1275_MFR_STATUS_IOUT_WARN2 BIT(0) 29#define ADM1275_MFR_STATUS_IOUT_WARN2 BIT(0)
30#define ADM1293_MFR_STATUS_VAUX_UV_WARN BIT(5) 30#define ADM1293_MFR_STATUS_VAUX_UV_WARN BIT(5)
@@ -41,6 +41,10 @@ enum chips { adm1075, adm1275, adm1276, adm1293, adm1294 };
41#define ADM1075_IRANGE_25 BIT(3) 41#define ADM1075_IRANGE_25 BIT(3)
42#define ADM1075_IRANGE_MASK (BIT(3) | BIT(4)) 42#define ADM1075_IRANGE_MASK (BIT(3) | BIT(4))
43 43
44#define ADM1278_TEMP1_EN BIT(3)
45#define ADM1278_VIN_EN BIT(2)
46#define ADM1278_VOUT_EN BIT(1)
47
44#define ADM1293_IRANGE_25 0 48#define ADM1293_IRANGE_25 0
45#define ADM1293_IRANGE_50 BIT(6) 49#define ADM1293_IRANGE_50 BIT(6)
46#define ADM1293_IRANGE_100 BIT(7) 50#define ADM1293_IRANGE_100 BIT(7)
@@ -54,6 +58,7 @@ enum chips { adm1075, adm1275, adm1276, adm1293, adm1294 };
54 58
55#define ADM1293_VAUX_EN BIT(1) 59#define ADM1293_VAUX_EN BIT(1)
56 60
61#define ADM1278_PEAK_TEMP 0xd7
57#define ADM1275_IOUT_WARN2_LIMIT 0xd7 62#define ADM1275_IOUT_WARN2_LIMIT 0xd7
58#define ADM1275_DEVICE_CONFIG 0xd8 63#define ADM1275_DEVICE_CONFIG 0xd8
59 64
@@ -80,6 +85,7 @@ struct adm1275_data {
80 bool have_iout_min; 85 bool have_iout_min;
81 bool have_pin_min; 86 bool have_pin_min;
82 bool have_pin_max; 87 bool have_pin_max;
88 bool have_temp_max;
83 struct pmbus_driver_info info; 89 struct pmbus_driver_info info;
84}; 90};
85 91
@@ -113,6 +119,13 @@ static const struct coefficients adm1276_coefficients[] = {
113 [4] = { 2115, 0, -1 }, /* power, vrange not set */ 119 [4] = { 2115, 0, -1 }, /* power, vrange not set */
114}; 120};
115 121
122static const struct coefficients adm1278_coefficients[] = {
123 [0] = { 19599, 0, -2 }, /* voltage */
124 [1] = { 800, 20475, -1 }, /* current */
125 [2] = { 6123, 0, -2 }, /* power */
126 [3] = { 42, 31880, -1 }, /* temperature */
127};
128
116static const struct coefficients adm1293_coefficients[] = { 129static const struct coefficients adm1293_coefficients[] = {
117 [0] = { 3333, -1, 0 }, /* voltage, vrange 1.2V */ 130 [0] = { 3333, -1, 0 }, /* voltage, vrange 1.2V */
118 [1] = { 5552, -5, -1 }, /* voltage, vrange 7.4V */ 131 [1] = { 5552, -5, -1 }, /* voltage, vrange 7.4V */
@@ -196,6 +209,11 @@ static int adm1275_read_word_data(struct i2c_client *client, int page, int reg)
196 return -ENXIO; 209 return -ENXIO;
197 ret = pmbus_read_word_data(client, 0, ADM1276_PEAK_PIN); 210 ret = pmbus_read_word_data(client, 0, ADM1276_PEAK_PIN);
198 break; 211 break;
212 case PMBUS_VIRT_READ_TEMP_MAX:
213 if (!data->have_temp_max)
214 return -ENXIO;
215 ret = pmbus_read_word_data(client, 0, ADM1278_PEAK_TEMP);
216 break;
199 case PMBUS_VIRT_RESET_IOUT_HISTORY: 217 case PMBUS_VIRT_RESET_IOUT_HISTORY:
200 case PMBUS_VIRT_RESET_VOUT_HISTORY: 218 case PMBUS_VIRT_RESET_VOUT_HISTORY:
201 case PMBUS_VIRT_RESET_VIN_HISTORY: 219 case PMBUS_VIRT_RESET_VIN_HISTORY:
@@ -204,6 +222,10 @@ static int adm1275_read_word_data(struct i2c_client *client, int page, int reg)
204 if (!data->have_pin_max) 222 if (!data->have_pin_max)
205 return -ENXIO; 223 return -ENXIO;
206 break; 224 break;
225 case PMBUS_VIRT_RESET_TEMP_HISTORY:
226 if (!data->have_temp_max)
227 return -ENXIO;
228 break;
207 default: 229 default:
208 ret = -ENODATA; 230 ret = -ENODATA;
209 break; 231 break;
@@ -245,6 +267,9 @@ static int adm1275_write_word_data(struct i2c_client *client, int page, int reg,
245 ret = pmbus_write_word_data(client, 0, 267 ret = pmbus_write_word_data(client, 0,
246 ADM1293_PIN_MIN, 0); 268 ADM1293_PIN_MIN, 0);
247 break; 269 break;
270 case PMBUS_VIRT_RESET_TEMP_HISTORY:
271 ret = pmbus_write_word_data(client, 0, ADM1278_PEAK_TEMP, 0);
272 break;
248 default: 273 default:
249 ret = -ENODATA; 274 ret = -ENODATA;
250 break; 275 break;
@@ -312,6 +337,7 @@ static const struct i2c_device_id adm1275_id[] = {
312 { "adm1075", adm1075 }, 337 { "adm1075", adm1075 },
313 { "adm1275", adm1275 }, 338 { "adm1275", adm1275 },
314 { "adm1276", adm1276 }, 339 { "adm1276", adm1276 },
340 { "adm1278", adm1278 },
315 { "adm1293", adm1293 }, 341 { "adm1293", adm1293 },
316 { "adm1294", adm1294 }, 342 { "adm1294", adm1294 },
317 { } 343 { }
@@ -329,6 +355,7 @@ static int adm1275_probe(struct i2c_client *client,
329 const struct i2c_device_id *mid; 355 const struct i2c_device_id *mid;
330 const struct coefficients *coefficients; 356 const struct coefficients *coefficients;
331 int vindex = -1, voindex = -1, cindex = -1, pindex = -1; 357 int vindex = -1, voindex = -1, cindex = -1, pindex = -1;
358 int tindex = -1;
332 359
333 if (!i2c_check_functionality(client->adapter, 360 if (!i2c_check_functionality(client->adapter,
334 I2C_FUNC_SMBUS_READ_BYTE_DATA 361 I2C_FUNC_SMBUS_READ_BYTE_DATA
@@ -386,6 +413,7 @@ static int adm1275_probe(struct i2c_client *client,
386 info->format[PSC_VOLTAGE_OUT] = direct; 413 info->format[PSC_VOLTAGE_OUT] = direct;
387 info->format[PSC_CURRENT_OUT] = direct; 414 info->format[PSC_CURRENT_OUT] = direct;
388 info->format[PSC_POWER] = direct; 415 info->format[PSC_POWER] = direct;
416 info->format[PSC_TEMPERATURE] = direct;
389 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; 417 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT;
390 418
391 info->read_word_data = adm1275_read_word_data; 419 info->read_word_data = adm1275_read_word_data;
@@ -460,6 +488,27 @@ static int adm1275_probe(struct i2c_client *client,
460 info->func[0] |= 488 info->func[0] |=
461 PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT; 489 PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
462 break; 490 break;
491 case adm1278:
492 data->have_vout = true;
493 data->have_pin_max = true;
494 data->have_temp_max = true;
495
496 coefficients = adm1278_coefficients;
497 vindex = 0;
498 cindex = 1;
499 pindex = 2;
500 tindex = 3;
501
502 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT;
503 if (config & ADM1278_TEMP1_EN)
504 info->func[0] |=
505 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
506 if (config & ADM1278_VIN_EN)
507 info->func[0] |= PMBUS_HAVE_VIN;
508 if (config & ADM1278_VOUT_EN)
509 info->func[0] |=
510 PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
511 break;
463 case adm1293: 512 case adm1293:
464 case adm1294: 513 case adm1294:
465 data->have_iout_min = true; 514 data->have_iout_min = true;
@@ -537,6 +586,11 @@ static int adm1275_probe(struct i2c_client *client,
537 info->b[PSC_POWER] = coefficients[pindex].b; 586 info->b[PSC_POWER] = coefficients[pindex].b;
538 info->R[PSC_POWER] = coefficients[pindex].R; 587 info->R[PSC_POWER] = coefficients[pindex].R;
539 } 588 }
589 if (tindex >= 0) {
590 info->m[PSC_TEMPERATURE] = coefficients[tindex].m;
591 info->b[PSC_TEMPERATURE] = coefficients[tindex].b;
592 info->R[PSC_TEMPERATURE] = coefficients[tindex].R;
593 }
540 594
541 return pmbus_do_probe(client, id, info); 595 return pmbus_do_probe(client, id, info);
542} 596}
diff --git a/drivers/hwmon/vexpress.c b/drivers/hwmon/vexpress-hwmon.c
index 8ba419d343f8..8ba419d343f8 100644
--- a/drivers/hwmon/vexpress.c
+++ b/drivers/hwmon/vexpress-hwmon.c
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
index aed170588b74..698d0d59db76 100644
--- a/include/linux/platform_data/ntc_thermistor.h
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -28,6 +28,7 @@ enum ntc_thermistor_type {
28 TYPE_NCPXXWL333, 28 TYPE_NCPXXWL333,
29 TYPE_B57330V2103, 29 TYPE_B57330V2103,
30 TYPE_NCPXXWF104, 30 TYPE_NCPXXWF104,
31 TYPE_NCPXXXH103,
31}; 32};
32 33
33struct ntc_thermistor_platform_data { 34struct ntc_thermistor_platform_data {