Skip to content

Commit d310ad0

Browse files
committed
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (22 commits) hwmon: (via-cputemp) Remove bogus "SHOW" global variable hwmon: jc42 depends on I2C hwmon: (pc87427) Add a maintainer hwmon: (pc87427) Move sysfs file removal to a separate function hwmon: (pc87427) Add temperature monitoring support hwmon: (pc87427) Add support for the second logical device hwmon: (pc87427) Add support for manual fan speed control hwmon: (pc87427) Minor style cleanups hwmon: (pc87427) Handle disabled fan inputs properly hwmon: (w83627ehf) Add support for W83667HG-B hwmon: (w83627ehf) Driver cleanup hwmon: Add driver for SMSC EMC2103 temperature monitor and fan controller hwmon: Remove in[0-*]_fault from sysfs-interface hwmon: Add 4 current alarm/beep attributes to sysfs-interface hwmon: Add 3 critical limit attributes to sysfs-interface hwmon: (asc7621) Clean up and improve detect function hwmon: (it87) Export labels for internal sensors hwmon: (lm75) Add suspend/resume feature hwmon: (emc1403) Add power support hwmon: (ltc4245) Expose all GPIO pins as analog voltages ...
2 parents c29c08b + f279941 commit d310ad0

21 files changed

Lines changed: 2085 additions & 133 deletions

File tree

‎Documentation/hwmon/emc2103‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Kernel driver emc2103
2+
======================
3+
4+
Supported chips:
5+
* SMSC EMC2103
6+
Addresses scanned: I2C 0x2e
7+
Prefix: 'emc2103'
8+
Datasheet: Not public
9+
10+
Authors:
11+
Steve Glendinning <steve.glendinning@smsc.com>
12+
13+
Description
14+
-----------
15+
16+
The Standard Microsystems Corporation (SMSC) EMC2103 chips
17+
contain up to 4 temperature sensors and a single fan controller.
18+
19+
Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
20+
triggered if the rotation speed has dropped below a programmable limit. Fan
21+
readings can be divided by a programmable divider (1, 2, 4 or 8) to give
22+
the readings more range or accuracy. Not all RPM values can accurately be
23+
represented, so some rounding is done. With a divider of 1, the lowest
24+
representable value is 480 RPM.
25+
26+
This driver supports RPM based control, to use this a fan target
27+
should be written to fan1_target and pwm1_enable should be set to 3.
28+
29+
The 2103-2 and 2103-4 variants have a third temperature sensor, which can
30+
be connected to two anti-parallel diodes. These values can be read
31+
as temp3 and temp4. If only one diode is attached to this channel, temp4
32+
will show as "fault". The module parameter "apd=0" can be used to suppress
33+
this 4th channel when anti-parallel diodes are not fitted.

‎Documentation/hwmon/ltc4245‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,31 @@ in6_min_alarm 5v output undervoltage alarm
7272
in7_min_alarm 3v output undervoltage alarm
7373
in8_min_alarm Vee (-12v) output undervoltage alarm
7474

75-
in9_input GPIO voltage data
75+
in9_input GPIO voltage data (see note 1)
76+
in10_input GPIO voltage data (see note 1)
77+
in11_input GPIO voltage data (see note 1)
7678

7779
power1_input 12v power usage (mW)
7880
power2_input 5v power usage (mW)
7981
power3_input 3v power usage (mW)
8082
power4_input Vee (-12v) power usage (mW)
83+
84+
85+
Note 1
86+
------
87+
88+
If you have NOT configured the driver to sample all GPIO pins as analog
89+
voltages, then the in10_input and in11_input sysfs attributes will not be
90+
created. The driver will sample the GPIO pin that is currently connected to the
91+
ADC as an analog voltage, and report the value in in9_input.
92+
93+
If you have configured the driver to sample all GPIO pins as analog voltages,
94+
then they will be sampled in round-robin fashion. If userspace reads too
95+
slowly, -EAGAIN will be returned when you read the sysfs attribute containing
96+
the sensor reading.
97+
98+
The LTC4245 chip can be configured to sample all GPIO pins with two methods:
99+
1) platform data -- see include/linux/i2c/ltc4245.h
100+
2) OF device tree -- add the "ltc4245,use-extra-gpios" property to each chip
101+
102+
The default mode of operation is to sample a single GPIO pin.

‎Documentation/hwmon/pc87427‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Description
1818

1919
The National Semiconductor Super I/O chip includes complete hardware
2020
monitoring capabilities. It can monitor up to 18 voltages, 8 fans and
21-
6 temperature sensors. Only the fans are supported at the moment.
21+
6 temperature sensors. Only the fans and temperatures are supported at
22+
the moment, voltages aren't.
2223

23-
This chip also has fan controlling features, which are not yet supported
24-
by this driver either.
24+
This chip also has fan controlling features (up to 4 PWM outputs),
25+
which are partly supported by this driver.
2526

2627
The driver assumes that no more than one chip is present, which seems
2728
reasonable.
@@ -36,3 +37,23 @@ signal. Speeds down to 83 RPM can be measured.
3637
An alarm is triggered if the rotation speed drops below a programmable
3738
limit. Another alarm is triggered if the speed is too low to be measured
3839
(including stalled or missing fan).
40+
41+
42+
Fan Speed Control
43+
-----------------
44+
45+
Fan speed can be controlled by PWM outputs. There are 4 possible modes:
46+
always off, always on, manual and automatic. The latter isn't supported
47+
by the driver: you can only return to that mode if it was the original
48+
setting, and the configuration interface is missing.
49+
50+
51+
Temperature Monitoring
52+
----------------------
53+
54+
The PC87427 relies on external sensors (following the SensorPath
55+
standard), so the resolution and range depend on the type of sensor
56+
connected. The integer part can be 8-bit or 9-bit, and can be signed or
57+
not. I couldn't find a way to figure out the external sensor data
58+
temperature format, so user-space adjustment (typically by a factor 2)
59+
may be required.

‎Documentation/hwmon/sysfs-interface‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,24 @@ in[0-*]_min Voltage min value.
107107
Unit: millivolt
108108
RW
109109

110+
in[0-*]_lcrit Voltage critical min value.
111+
Unit: millivolt
112+
RW
113+
If voltage drops to or below this limit, the system may
114+
take drastic action such as power down or reset. At the very
115+
least, it should report a fault.
116+
110117
in[0-*]_max Voltage max value.
111118
Unit: millivolt
112119
RW
113120

121+
in[0-*]_crit Voltage critical max value.
122+
Unit: millivolt
123+
RW
124+
If voltage reaches or exceeds this limit, the system may
125+
take drastic action such as power down or reset. At the very
126+
least, it should report a fault.
127+
114128
in[0-*]_input Voltage input value.
115129
Unit: millivolt
116130
RO
@@ -284,7 +298,7 @@ temp[1-*]_input Temperature input value.
284298
Unit: millidegree Celsius
285299
RO
286300

287-
temp[1-*]_crit Temperature critical value, typically greater than
301+
temp[1-*]_crit Temperature critical max value, typically greater than
288302
corresponding temp_max values.
289303
Unit: millidegree Celsius
290304
RW
@@ -296,6 +310,11 @@ temp[1-*]_crit_hyst
296310
from the critical value.
297311
RW
298312

313+
temp[1-*]_lcrit Temperature critical min value, typically lower than
314+
corresponding temp_min values.
315+
Unit: millidegree Celsius
316+
RW
317+
299318
temp[1-*]_offset
300319
Temperature offset which is added to the temperature reading
301320
by the chip.
@@ -344,9 +363,6 @@ Also see the Alarms section for status flags associated with temperatures.
344363
* Currents *
345364
************
346365

347-
Note that no known chip provides current measurements as of writing,
348-
so this part is theoretical, so to say.
349-
350366
curr[1-*]_max Current max value
351367
Unit: milliampere
352368
RW
@@ -471,6 +487,7 @@ limit-related alarms, not both. The driver should just reflect the hardware
471487
implementation.
472488

473489
in[0-*]_alarm
490+
curr[1-*]_alarm
474491
fan[1-*]_alarm
475492
temp[1-*]_alarm
476493
Channel alarm
@@ -482,6 +499,8 @@ OR
482499

483500
in[0-*]_min_alarm
484501
in[0-*]_max_alarm
502+
curr[1-*]_min_alarm
503+
curr[1-*]_max_alarm
485504
fan[1-*]_min_alarm
486505
fan[1-*]_max_alarm
487506
temp[1-*]_min_alarm
@@ -497,7 +516,6 @@ to notify open diodes, unconnected fans etc. where the hardware
497516
supports it. When this boolean has value 1, the measurement for that
498517
channel should not be trusted.
499518

500-
in[0-*]_fault
501519
fan[1-*]_fault
502520
temp[1-*]_fault
503521
Input fault condition
@@ -513,6 +531,7 @@ beep_enable Master beep enable
513531
RW
514532

515533
in[0-*]_beep
534+
curr[1-*]_beep
516535
fan[1-*]_beep
517536
temp[1-*]_beep
518537
Channel beep

‎Documentation/hwmon/w83627ehf‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Supported chips:
2020
Prefix: 'w83667hg'
2121
Addresses scanned: ISA address retrieved from Super I/O registers
2222
Datasheet: not available
23+
* Winbond W83667HG-B
24+
Prefix: 'w83667hg'
25+
Addresses scanned: ISA address retrieved from Super I/O registers
26+
Datasheet: Available from Nuvoton upon request
2327

2428
Authors:
2529
Jean Delvare <khali@linux-fr.org>
@@ -32,8 +36,8 @@ Description
3236
-----------
3337

3438
This driver implements support for the Winbond W83627EHF, W83627EHG,
35-
W83627DHG, W83627DHG-P and W83667HG super I/O chips. We will refer to them
36-
collectively as Winbond chips.
39+
W83627DHG, W83627DHG-P, W83667HG and W83667HG-B super I/O chips.
40+
We will refer to them collectively as Winbond chips.
3741

3842
The chips implement three temperature sensors, five fan rotation
3943
speed sensors, ten analog voltage sensors (only nine for the 627DHG), one
@@ -68,14 +72,15 @@ follows:
6872
temp1 -> pwm1
6973
temp2 -> pwm2
7074
temp3 -> pwm3
71-
prog -> pwm4 (not on 667HG; the programmable setting is not supported by
72-
the driver)
75+
prog -> pwm4 (not on 667HG and 667HG-B; the programmable setting is not
76+
supported by the driver)
7377

7478
/sys files
7579
----------
7680

7781
name - this is a standard hwmon device entry. For the W83627EHF and W83627EHG,
78-
it is set to "w83627ehf" and for the W83627DHG it is set to "w83627dhg"
82+
it is set to "w83627ehf", for the W83627DHG it is set to "w83627dhg",
83+
and for the W83667HG it is set to "w83667hg".
7984

8085
pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
8186
0 (stop) to 255 (full)

‎MAINTAINERS‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4402,6 +4402,13 @@ M: Jim Cromie <jim.cromie@gmail.com>
44024402
S: Maintained
44034403
F: drivers/char/pc8736x_gpio.c
44044404

4405+
PC87427 HARDWARE MONITORING DRIVER
4406+
M: Jean Delvare <khali@linux-fr.org>
4407+
L: lm-sensors@lm-sensors.org
4408+
S: Maintained
4409+
F: Documentation/hwmon/pc87427
4410+
F: drivers/hwmon/pc87427.c
4411+
44054412
PCA9532 LED DRIVER
44064413
M: Riku Voipio <riku.voipio@iki.fi>
44074414
S: Maintained
@@ -5279,6 +5286,13 @@ S: Maintained
52795286
F: Documentation/hwmon/smm665
52805287
F: drivers/hwmon/smm665.c
52815288

5289+
SMSC EMC2103 HARDWARE MONITOR DRIVER
5290+
M: Steve Glendinning <steve.glendinning@smsc.com>
5291+
L: lm-sensors@lm-sensors.org
5292+
S: Supported
5293+
F: Documentation/hwmon/emc2103
5294+
F: drivers/hwmon/emc2103.c
5295+
52825296
SMSC47B397 HARDWARE MONITOR DRIVER
52835297
M: "Mark M. Hoffman" <mhoffman@lightlink.com>
52845298
L: lm-sensors@lm-sensors.org

‎drivers/hwmon/Kconfig‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ config SENSORS_JZ4740
465465

466466
config SENSORS_JC42
467467
tristate "JEDEC JC42.4 compliant temperature sensors"
468+
depends on I2C
468469
help
469470
If you say yes here you get support for Jedec JC42.4 compliant
470471
temperature sensors. Support will include, but not be limited to,
@@ -711,7 +712,8 @@ config SENSORS_PC87427
711712
functions of the National Semiconductor PC87427 Super-I/O chip.
712713
The chip has two distinct logical devices, one for fan speed
713714
monitoring and control, and one for voltage and temperature
714-
monitoring. Only fan speed monitoring is supported right now.
715+
monitoring. Fan speed monitoring and control are supported, as
716+
well as temperature monitoring. Voltages aren't supported yet.
715717

716718
This driver can also be built as a module. If so, the module
717719
will be called pc87427.
@@ -804,6 +806,16 @@ config SENSORS_EMC1403
804806
Threshold values can be configured using sysfs.
805807
Data from the different diodes are accessible via sysfs.
806808

809+
config SENSORS_EMC2103
810+
tristate "SMSC EMC2103"
811+
depends on I2C
812+
help
813+
If you say yes here you get support for the temperature
814+
and fan sensors of the SMSC EMC2103 chips.
815+
816+
This driver can also be built as a module. If so, the module
817+
will be called emc2103.
818+
807819
config SENSORS_SMSC47M1
808820
tristate "SMSC LPC47M10x and compatibles"
809821
help

‎drivers/hwmon/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_PKGTEMP) += pkgtemp.o
4343
obj-$(CONFIG_SENSORS_DME1737) += dme1737.o
4444
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
4545
obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o
46+
obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o
4647
obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
4748
obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o
4849
obj-$(CONFIG_SENSORS_F75375S) += f75375s.o

‎drivers/hwmon/asc7621.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,9 +1150,6 @@ static int asc7621_detect(struct i2c_client *client,
11501150
{
11511151
struct i2c_adapter *adapter = client->adapter;
11521152
int company, verstep, chip_index;
1153-
struct device *dev;
1154-
1155-
dev = &client->dev;
11561153

11571154
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
11581155
return -ENODEV;
@@ -1169,13 +1166,11 @@ static int asc7621_detect(struct i2c_client *client,
11691166

11701167
if (company == asc7621_chips[chip_index].company_id &&
11711168
verstep == asc7621_chips[chip_index].verstep_id) {
1172-
strlcpy(client->name, asc7621_chips[chip_index].name,
1173-
I2C_NAME_SIZE);
11741169
strlcpy(info->type, asc7621_chips[chip_index].name,
11751170
I2C_NAME_SIZE);
11761171

1177-
dev_info(&adapter->dev, "Matched %s\n",
1178-
asc7621_chips[chip_index].name);
1172+
dev_info(&adapter->dev, "Matched %s at 0x%02x\n",
1173+
asc7621_chips[chip_index].name, client->addr);
11791174
return 0;
11801175
}
11811176
}

‎drivers/hwmon/emc1403.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,35 @@ static ssize_t store_temp(struct device *dev,
8989
return count;
9090
}
9191

92+
static ssize_t store_bit(struct device *dev,
93+
struct device_attribute *attr, const char *buf, size_t count)
94+
{
95+
struct i2c_client *client = to_i2c_client(dev);
96+
struct thermal_data *data = i2c_get_clientdata(client);
97+
struct sensor_device_attribute_2 *sda = to_sensor_dev_attr_2(attr);
98+
unsigned long val;
99+
int retval;
100+
101+
if (strict_strtoul(buf, 10, &val))
102+
return -EINVAL;
103+
104+
mutex_lock(&data->mutex);
105+
retval = i2c_smbus_read_byte_data(client, sda->nr);
106+
if (retval < 0)
107+
goto fail;
108+
109+
retval &= ~sda->index;
110+
if (val)
111+
retval |= sda->index;
112+
113+
retval = i2c_smbus_write_byte_data(client, sda->index, retval);
114+
if (retval == 0)
115+
retval = count;
116+
fail:
117+
mutex_unlock(&data->mutex);
118+
return retval;
119+
}
120+
92121
static ssize_t show_hyst(struct device *dev,
93122
struct device_attribute *attr, char *buf)
94123
{
@@ -200,6 +229,9 @@ static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO,
200229
static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO | S_IWUSR,
201230
show_hyst, store_hyst, 0x1A);
202231

232+
static SENSOR_DEVICE_ATTR_2(power_state, S_IRUGO | S_IWUSR,
233+
show_bit, store_bit, 0x03, 0x40);
234+
203235
static struct attribute *mid_att_thermal[] = {
204236
&sensor_dev_attr_temp1_min.dev_attr.attr,
205237
&sensor_dev_attr_temp1_max.dev_attr.attr,
@@ -225,6 +257,7 @@ static struct attribute *mid_att_thermal[] = {
225257
&sensor_dev_attr_temp3_max_alarm.dev_attr.attr,
226258
&sensor_dev_attr_temp3_crit_alarm.dev_attr.attr,
227259
&sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
260+
&sensor_dev_attr_power_state.dev_attr.attr,
228261
NULL
229262
};
230263

0 commit comments

Comments
 (0)