Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  ...
  • Loading branch information
Linus Torvalds committed Aug 14, 2010
2 parents c29c08b + f279941 commit d310ad0
Show file tree
Hide file tree
Showing 21 changed files with 2,085 additions and 133 deletions.
33 changes: 33 additions & 0 deletions Documentation/hwmon/emc2103
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Kernel driver emc2103
======================

Supported chips:
* SMSC EMC2103
Addresses scanned: I2C 0x2e
Prefix: 'emc2103'
Datasheet: Not public

Authors:
Steve Glendinning <steve.glendinning@smsc.com>

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

The Standard Microsystems Corporation (SMSC) EMC2103 chips
contain up to 4 temperature sensors and a single fan controller.

Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
triggered if the rotation speed has dropped below a programmable limit. Fan
readings can be divided by a programmable divider (1, 2, 4 or 8) to give
the readings more range or accuracy. Not all RPM values can accurately be
represented, so some rounding is done. With a divider of 1, the lowest
representable value is 480 RPM.

This driver supports RPM based control, to use this a fan target
should be written to fan1_target and pwm1_enable should be set to 3.

The 2103-2 and 2103-4 variants have a third temperature sensor, which can
be connected to two anti-parallel diodes. These values can be read
as temp3 and temp4. If only one diode is attached to this channel, temp4
will show as "fault". The module parameter "apd=0" can be used to suppress
this 4th channel when anti-parallel diodes are not fitted.
24 changes: 23 additions & 1 deletion Documentation/hwmon/ltc4245
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,31 @@ 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
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.
27 changes: 24 additions & 3 deletions Documentation/hwmon/pc87427
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ Description

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

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

The driver assumes that no more than one chip is present, which seems
reasonable.
Expand All @@ -36,3 +37,23 @@ signal. Speeds down to 83 RPM can be measured.
An alarm is triggered if the rotation speed drops below a programmable
limit. Another alarm is triggered if the speed is too low to be measured
(including stalled or missing fan).


Fan Speed Control
-----------------

Fan speed can be controlled by PWM outputs. There are 4 possible modes:
always off, always on, manual and automatic. The latter isn't supported
by the driver: you can only return to that mode if it was the original
setting, and the configuration interface is missing.


Temperature Monitoring
----------------------

The PC87427 relies on external sensors (following the SensorPath
standard), so the resolution and range depend on the type of sensor
connected. The integer part can be 8-bit or 9-bit, and can be signed or
not. I couldn't find a way to figure out the external sensor data
temperature format, so user-space adjustment (typically by a factor 2)
may be required.
29 changes: 24 additions & 5 deletions Documentation/hwmon/sysfs-interface
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,24 @@ in[0-*]_min Voltage min value.
Unit: millivolt
RW

in[0-*]_lcrit Voltage critical min value.
Unit: millivolt
RW
If voltage drops to or below this limit, the system may
take drastic action such as power down or reset. At the very
least, it should report a fault.

in[0-*]_max Voltage max value.
Unit: millivolt
RW

in[0-*]_crit Voltage critical max value.
Unit: millivolt
RW
If voltage reaches or exceeds this limit, the system may
take drastic action such as power down or reset. At the very
least, it should report a fault.

in[0-*]_input Voltage input value.
Unit: millivolt
RO
Expand Down Expand Up @@ -284,7 +298,7 @@ temp[1-*]_input Temperature input value.
Unit: millidegree Celsius
RO

temp[1-*]_crit Temperature critical value, typically greater than
temp[1-*]_crit Temperature critical max value, typically greater than
corresponding temp_max values.
Unit: millidegree Celsius
RW
Expand All @@ -296,6 +310,11 @@ temp[1-*]_crit_hyst
from the critical value.
RW

temp[1-*]_lcrit Temperature critical min value, typically lower than
corresponding temp_min values.
Unit: millidegree Celsius
RW

temp[1-*]_offset
Temperature offset which is added to the temperature reading
by the chip.
Expand Down Expand Up @@ -344,9 +363,6 @@ Also see the Alarms section for status flags associated with temperatures.
* Currents *
************

Note that no known chip provides current measurements as of writing,
so this part is theoretical, so to say.

curr[1-*]_max Current max value
Unit: milliampere
RW
Expand Down Expand Up @@ -471,6 +487,7 @@ limit-related alarms, not both. The driver should just reflect the hardware
implementation.

in[0-*]_alarm
curr[1-*]_alarm
fan[1-*]_alarm
temp[1-*]_alarm
Channel alarm
Expand All @@ -482,6 +499,8 @@ OR

in[0-*]_min_alarm
in[0-*]_max_alarm
curr[1-*]_min_alarm
curr[1-*]_max_alarm
fan[1-*]_min_alarm
fan[1-*]_max_alarm
temp[1-*]_min_alarm
Expand All @@ -497,7 +516,6 @@ to notify open diodes, unconnected fans etc. where the hardware
supports it. When this boolean has value 1, the measurement for that
channel should not be trusted.

in[0-*]_fault
fan[1-*]_fault
temp[1-*]_fault
Input fault condition
Expand All @@ -513,6 +531,7 @@ beep_enable Master beep enable
RW

in[0-*]_beep
curr[1-*]_beep
fan[1-*]_beep
temp[1-*]_beep
Channel beep
Expand Down
15 changes: 10 additions & 5 deletions Documentation/hwmon/w83627ehf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Supported chips:
Prefix: 'w83667hg'
Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: not available
* Winbond W83667HG-B
Prefix: 'w83667hg'
Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: Available from Nuvoton upon request

Authors:
Jean Delvare <khali@linux-fr.org>
Expand All @@ -32,8 +36,8 @@ Description
-----------

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

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

/sys files
----------

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

pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
0 (stop) to 255 (full)
Expand Down
14 changes: 14 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4402,6 +4402,13 @@ M: Jim Cromie <jim.cromie@gmail.com>
S: Maintained
F: drivers/char/pc8736x_gpio.c

PC87427 HARDWARE MONITORING DRIVER
M: Jean Delvare <khali@linux-fr.org>
L: lm-sensors@lm-sensors.org
S: Maintained
F: Documentation/hwmon/pc87427
F: drivers/hwmon/pc87427.c

PCA9532 LED DRIVER
M: Riku Voipio <riku.voipio@iki.fi>
S: Maintained
Expand Down Expand Up @@ -5279,6 +5286,13 @@ S: Maintained
F: Documentation/hwmon/smm665
F: drivers/hwmon/smm665.c

SMSC EMC2103 HARDWARE MONITOR DRIVER
M: Steve Glendinning <steve.glendinning@smsc.com>
L: lm-sensors@lm-sensors.org
S: Supported
F: Documentation/hwmon/emc2103
F: drivers/hwmon/emc2103.c

SMSC47B397 HARDWARE MONITOR DRIVER
M: "Mark M. Hoffman" <mhoffman@lightlink.com>
L: lm-sensors@lm-sensors.org
Expand Down
14 changes: 13 additions & 1 deletion drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ config SENSORS_JZ4740

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

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

config SENSORS_EMC2103
tristate "SMSC EMC2103"
depends on I2C
help
If you say yes here you get support for the temperature
and fan sensors of the SMSC EMC2103 chips.

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

config SENSORS_SMSC47M1
tristate "SMSC LPC47M10x and compatibles"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_PKGTEMP) += pkgtemp.o
obj-$(CONFIG_SENSORS_DME1737) += dme1737.o
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o
obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o
obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o
obj-$(CONFIG_SENSORS_F75375S) += f75375s.o
Expand Down
9 changes: 2 additions & 7 deletions drivers/hwmon/asc7621.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,9 +1150,6 @@ static int asc7621_detect(struct i2c_client *client,
{
struct i2c_adapter *adapter = client->adapter;
int company, verstep, chip_index;
struct device *dev;

dev = &client->dev;

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

if (company == asc7621_chips[chip_index].company_id &&
verstep == asc7621_chips[chip_index].verstep_id) {
strlcpy(client->name, asc7621_chips[chip_index].name,
I2C_NAME_SIZE);
strlcpy(info->type, asc7621_chips[chip_index].name,
I2C_NAME_SIZE);

dev_info(&adapter->dev, "Matched %s\n",
asc7621_chips[chip_index].name);
dev_info(&adapter->dev, "Matched %s at 0x%02x\n",
asc7621_chips[chip_index].name, client->addr);
return 0;
}
}
Expand Down
33 changes: 33 additions & 0 deletions drivers/hwmon/emc1403.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,35 @@ static ssize_t store_temp(struct device *dev,
return count;
}

static ssize_t store_bit(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct thermal_data *data = i2c_get_clientdata(client);
struct sensor_device_attribute_2 *sda = to_sensor_dev_attr_2(attr);
unsigned long val;
int retval;

if (strict_strtoul(buf, 10, &val))
return -EINVAL;

mutex_lock(&data->mutex);
retval = i2c_smbus_read_byte_data(client, sda->nr);
if (retval < 0)
goto fail;

retval &= ~sda->index;
if (val)
retval |= sda->index;

retval = i2c_smbus_write_byte_data(client, sda->index, retval);
if (retval == 0)
retval = count;
fail:
mutex_unlock(&data->mutex);
return retval;
}

static ssize_t show_hyst(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -200,6 +229,9 @@ static SENSOR_DEVICE_ATTR_2(temp3_crit_alarm, S_IRUGO,
static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO | S_IWUSR,
show_hyst, store_hyst, 0x1A);

static SENSOR_DEVICE_ATTR_2(power_state, S_IRUGO | S_IWUSR,
show_bit, store_bit, 0x03, 0x40);

static struct attribute *mid_att_thermal[] = {
&sensor_dev_attr_temp1_min.dev_attr.attr,
&sensor_dev_attr_temp1_max.dev_attr.attr,
Expand All @@ -225,6 +257,7 @@ static struct attribute *mid_att_thermal[] = {
&sensor_dev_attr_temp3_max_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_crit_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
&sensor_dev_attr_power_state.dev_attr.attr,
NULL
};

Expand Down
Loading

0 comments on commit d310ad0

Please sign in to comment.