Commit graph

1203 commits

Author SHA1 Message Date
Maurus Cuelenaere
b518a64983 hwmon: (s3c-hwmon) Fix compilation
The owner field was removed from struct attribute in
6fd69dc578, so don't assign it anymore.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-01-02 15:31:11 -08:00
Linus Torvalds
dc99bf7823 Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (ltc4215) make sysfs file match the alarm cause
2010-12-14 13:36:26 -08:00
Ira W. Snyder
0a6bf658c3 hwmon: (ltc4215) make sysfs file match the alarm cause
The ltc4215 driver used the chip's "power good" status bit to provide
the power1_alarm file. This is wrong: the chip is really reporting the
status of one of the monitored voltages.

Change the sysfs file from power1_alarm to in2_min_alarm instead. This
matches the voltage that the chip is raising an alarm for.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-12-13 09:54:50 -08:00
Gabriele Gorla
8b0f1840a4 hwmon: (adm1026) Allow 1 as a valid divider value
Allow 1 as a valid div value as specified in the ADM1026 datasheet.

Signed-off-by: Gabriele Gorla <gorlik@penguintown.net>
Cc: stable@kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-12-08 16:27:22 +01:00
Gabriele Gorla
52bc9802ce hwmon: (adm1026) Fix setting fan_div
Prevent setting fan_div from stomping on other fans that share the
same I2C register.

Signed-off-by: Gabriele Gorla <gorlik@penguintown.net>
Cc: stable@kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-12-08 16:27:22 +01:00
Jean Delvare
6229cdb236 hwmon: (it87) Fix manual fan speed control on IT8721F
The manual fan speed control logic of the IT8721F is much different
from what older devices had. Update the code to properly support that.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-12-08 16:27:22 +01:00
Guenter Roeck
32292f49f9 hwmon: (lis3lv02d_i2c) Fix compile warnings
This commit fixes the following compile warnings.

From v2.6.37-rc2/m68k/m68k-allmodconfig, v2.6.37-rc2/powerpc/powerpc-randconfig:
drivers/hwmon/lis3lv02d_i2c.c:222: warning: 'lis3_i2c_runtime_suspend' defined but not used
drivers/hwmon/lis3lv02d_i2c.c:231: warning: 'lis3_i2c_runtime_resume' defined but not used

Seen if CONFIG_PM_RUNTIME is not set.

From v2.6.37-rc2/sh4/sh-allyesconfig:
drivers/hwmon/lis3lv02d_i2c.c:191: warning: 'lis3lv02d_i2c_suspend' defined but not used
drivers/hwmon/lis3lv02d_i2c.c:201: warning: 'lis3lv02d_i2c_resume' defined but not used

Seen if CONFIG_PM is set but CONFIG_PM_SLEEP is not.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
2010-11-22 12:23:39 -08:00
Guenter Roeck
c48a291635 hwmon: (i5k_amb) Fix compile warning
This patch fixes the following compile warning.

drivers/hwmon/i5k_amb.c:500: warning: 'i5k_amb_ids' defined but not used

The warning is seen if the driver is built into the kernel (not as module).

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
2010-11-22 12:23:39 -08:00
Jean Delvare
52d159eecc hwmon: (w83795) Check for BEEP pin availability
On the W83795ADG, there's a single pin for BEEP and OVT#, so you
can't have both. Check the configuration and don't create beep
attributes when BEEP pin is not available.

The W83795G has a dedicated BEEP pin so the functionality is always
available there.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:57 +01:00
Jean Delvare
793c51d5fd hwmon: (w83795) Clear intrusion alarm immediately
When asked to clear the intrusion alarm, do so immediately. We have to
invalidate the cache to make sure the new status will be read. But we
also have to read from the status register once to clear the pending
alarm, as writing to CLR_CHS surprising won't clear it automatically.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:57 +01:00
Jean Delvare
cf6b9ea661 hwmon: (w83795) Read the intrusion state properly
We can't read the intrusion state from the real-time alarm registers
as we do for all other alarm flags, because real-time alarm bits don't
stick (by definition) and the intrusion state has to stick until
explicitly cleared (otherwise it has little value.)

So we have to use the interrupt status register instead, which is read
from the same address but with a configuration bit flipped in another
register.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:56 +01:00
Jean Delvare
2a2d27da00 hwmon: (w83795) Print the actual temperature channels as sources
Don't expose raw register values to user-space. Decode and encode
temperature channels selected as temperature sources as needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:56 +01:00
Jean Delvare
edff2f8d81 hwmon: (w83795) List all usable temperature sources
Temperature sources are not correlated directly with temperature
channels. A look-up table is required to find out which temperature
sources can be used depending on which temperature channels (both
analog and digital) are enabled.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:56 +01:00
Jean Delvare
d5ab845a13 hwmon: (w83795) Expose fan control method
Expose fan control method (DC vs. PWM) using the standard sysfs
attributes. I've made it read-only as the board should be wired for
a given mode, the BIOS should have set up the chip for this mode, and
you shouldn't have to change it. But it would be easy enough to make
it changeable if someone comes up with a use case.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:56 +01:00
Jean Delvare
ae51cd9bcd hwmon: (w83795) Fix fan control mode attributes
There were two bugs:
* Speed cruise mode was improperly reported for all fans but fan1.
* Fan control method (PWM vs. DC) was mixed with the control mode.
  It will be added back as a separate attribute, as per the standard
  sysfs interface.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-15 21:38:56 +01:00
Jean Delvare
61ec2da506 hwmon: (lm95241) Check validity of input values
This clears the following build-time warnings I was seeing:

drivers/hwmon/lm95241.c: In function "set_interval":
drivers/hwmon/lm95241.c:132:15: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_max2":
drivers/hwmon/lm95241.c:278:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_max1":
drivers/hwmon/lm95241.c:277:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_min2":
drivers/hwmon/lm95241.c:249:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_min1":
drivers/hwmon/lm95241.c:248:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_type2":
drivers/hwmon/lm95241.c:220:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result
drivers/hwmon/lm95241.c: In function "set_type1":
drivers/hwmon/lm95241.c:219:1: warning: ignoring return value of "strict_strtol", declared with attribute warn_unused_result

This also fixes a small race in set_interval() as a side effect: by
working with a temporary local variable we prevent data->interval from
being accessed at a time it contains the interval value in the wrong
unit.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Davide Rizzo <elpa.rizzo@gmail.com>
2010-11-15 21:38:56 +01:00
Hans J. Koch
2aa25c22c4 hwmon: Change mail address of Hans J. Koch
My old mail address doesn't exist anymore. This changes all occurrences
to my new address.

Signed-off-by: Hans J. Koch <hjk@hansjkoch.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-11-15 21:38:56 +01:00
Axel Lin
4f5b7994f0 hwmon: (gpio-fan) Fix fan_ctrl_init error path
In current implementation, the sysfs entries is not removed before return -ENODEV.

Creating the sysfs attribute should be the last thing done by the function,
after all the rest has been successful.
Otherwise there is a small window during which user-space can access the attribute
but the driver isn't ready to deal with the requests.

Fix it by moving sysfs_create_group to be the last thing done by the function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-11 09:43:51 -08:00
Axel Lin
f0030d87be hwmon: (ad7414) Return proper error code for ad7414_probe()
Return proper error if i2c_check_functionality reports
the adapter does not support the capability we need.

Also remove unneeded initialization for err variable.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-11 09:32:07 -08:00
Axel Lin
f7334b4ca9 hwmon: (adt7470) Return proper error code for adt7470_probe()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-11 09:32:07 -08:00
Jean Delvare
475200c088 hwmon: (ltc4261) Fix error message format
adapter->id is deprecated and not set by any adapter driver, so this
was certainly not what the author wanted to use. adapter->nr maybe,
but as dev_err() already includes this value, as well as the client's
address, there's no point repeating them. Better print a simple error
message in plain English words.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-11-05 10:17:19 -07:00
Guenter Roeck
69f8b74193 hwmon: (ltc4261) Add missing newline in debug message
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
2010-11-05 10:17:19 -07:00
Jean Delvare
44c1bcd4bc hwmon: (it87) Add support for the IT8721F/IT8758E
Add support for the IT8721F/IT8758E. These new chips differ from the
older IT87xxF chips in the following ways:
* ADC LSB is 12 mV instead of 16 mV.
* PWM values are 8-bit instead of 7-bit.
There are other minor changes we don't have to care about in the
driver.

Another change is that we will handle internal voltage scaling in the
driver instead of delegating the work to user-space.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:51 +02:00
Jean Delvare
0df6454da9 hwmon: (it87) Move conversion functions
Move conversion functions until after structure defintions. This is
needed for future changes which make use of the structures in the
conversion funtcions.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:51 +02:00
Jean Delvare
0b22ce3b7d hwmon: Remove many EXPERIMENTAL flags
Remove the dependency on EXPERIMENTAL for all drivers which are in
the kernel tree for a long time, are known to work properly and for
which we have documentation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Juerg Haefliger <juergh@gmail.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare
f6c61cff8b hwmon: (lm85) Add support for ADT7468 high-frequency PWM mode
The ADT7468 supports a high-frequency PWM output mode where all PWM
outputs are driven by a 22.5 kHz clock. Add support for this mode, and
document it, as it may surprise the user that setting one PWM output
frequency also affects the other PWM outputs.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare
c36364dbf3 hwmon: (lm85) Document the ADT7468 as supported
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare
fa7a5797e5 hwmon: (lm85) Fix ADT7468 frequency table
The ADT7468 uses the same frequency table as the ADT7463.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare
918ee91c07 hwmon: I2C addresses are constant
We can mark normal_i2c const. Almost all drivers do that already, so
fix the 3 remaining ones before they are used as (bad) examples for
new drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: George Joseph <george.joseph@fairview5.com>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare
bd5f47ec96 Move ams driver to macintosh
The ams driver isn't a hardware monitoring driver, so it shouldn't
live under driver/hwmon. drivers/macintosh seems much more
appropriate, as the driver is only useful on PowerBooks and iBooks.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Stelian Pop <stelian@popies.net>
Cc: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
2010-10-28 20:31:50 +02:00
Jean Delvare
6dfee85397 hwmon: (pcf8591) Don't attempt to detect devices
The PCF8591 can't be detected, don't even try. There are plenty of
other means to instantiate i2c devices these days.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
2010-10-28 20:31:50 +02:00
Jean Delvare
4275fcd65d hwmon: (pcf8591) Register as a hwmon device
Register PCF8591 devices as hwmon devices. There's little point in
implementing the standard sysfs interface if we don't register it in
a way libsensors will pick it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
2010-10-28 20:31:49 +02:00
Jean Delvare
2437710102 hwmon: (w83795) Use standard attributes for chassis intrusion
Follow the standard attribute naming for the chassis intrusion
feature. I couldn't test the beeping (my board apparently doesn't do
that) but the alarm works fine.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:49 +02:00
Jean Delvare
00030af231 hwmon: (w83795) Exclude fan control feature by default
The fan control feature of the w83795 driver is insufficiently
reviewed and tested for public consumption at this time, so make it
optional and disabled by default. We will change the default when
review and testing is deemed sufficient. Ultimately the option will
go away.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:49 +02:00
Jean Delvare
e3760b432d hwmon: (w83795) Add myself as co-author and maintainer
I've made so many changes to the w83795 driver that it's only fair to
list myself as a co-author. I'll also maintain the driver for some
time. There's more work needed on the driver for sure.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:49 +02:00
Jean Delvare
eb02755a50 hwmon: (w83795) More style cleanups
Cleanups suggested by Guenter Roeck, falling into 4 categories:
* Swapping test orders, because if (var == CONSTANT) is much easier to
  read than if (CONSTANT == var).
* Simplifying comparisons with 0.
* Dropping unneeded masks.
* Dropping unneeded parentheses and curly braces.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:49 +02:00
Jean Delvare
5d2cd958f7 hwmon: (w83795) Fix LSB reading of voltage limits
Wrong index caused the wrong register value to be read, resulting in
random LSB for voltage limits.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:49 +02:00
Jean Delvare
21fc977551 hwmon: (w83795) Use dev_get_drvdata() where possible
When we don't need the client pointer, calling dev_get_drvdata() is
more efficient that calling to_i2c_client() and then
i2c_get_clientdata().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:49 +02:00
Jean Delvare
1bb3450ce5 hwmon: (w83795) Delay reading pwm config registers
Wait until we need the pwm config register values, instead of
pre-reading them. This saves over 1 second on modprobe on my test
system.

Obviously this time is added when first accessing pwm config
attributes, however not everybody will use them, so it seems unfair
to slow down driver loading (and thus boot) for an optional feature.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
2ae61de905 hwmon: (w83795) Delay reading limit registers
Wait until we need the limit register values, instead of pre-reading
them. This saves 544 ms on modprobe on my test system. Obviously this
time is added when first running "sensors" or any other monitoring
application, but I think it is better than slowing down the boot.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
0d7237bfd1 hwmon: (w83795) Move register reads to dedicated functions
Move initial register reads out of probe, to dedicated functions.
This makes the code clearer, and will be needed if we want to delay
calling these functions until they are needed, or want to call them
periodically.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:48 +02:00
Jean Delvare
476a4e5d37 hwmon: (w83795) Pack similar register reads
Pack similar register reads using for loops.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
fd7f82b8a3 hwmon: (w83795) Make W83795_REG_PWM more efficient
Cascaded conditionals are inefficient. Reorder the fields so that
PWM register addresses can be computed more efficiently.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:48 +02:00
Jean Delvare
5f7b77cbd4 hwmon: (w83795) Don't pre-read values we'll update later
There is no point in reading registers during initialization if we
will refresh the values in the update function later. This is only
slowing down the driver loading with no benefit, stop doing it.
This change saves 480 ms on driver load on my test system.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
39deb6993e hwmon: (w83795) Simplify temperature sensor type handling
All 3 temperature sensor type sysfs functions (show_temp_mode,
store_temp_mode and show_dts_mode) can be simplified. We don't
create these files when the correponding input isn't in temperature
monitoring mode, so there is no point in handling that case.
Likewise, we don't allow changing inputs from temperature to voltage,
so the code handling this case is dead and can be removed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
cd316df582 hwmon: (w83795) Drop _NUM constants
Consistently use ARRAY_SIZE() to control for loops.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
49c7347a44 hwmon: (w83795) Drop REST_VLT_BEGIN/END
Get rid of REST_VLT_BEGIN and REST_VLT_END, they don't make the code
more readable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
7eb8d508b5 hwmon: (w83795) Fix parity checks
x % 1 is obviously wrong, as it always evaluates to 0. You want
x % 2, or x & 1, for parity checking.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
a654b9d4e7 hwmon: (w83795) Get rid of VRLSB_SHIFT
VRLSB_SHIFT is a non-sense, the actual shift depends on the sensor
type (fans need 4, other sensors need 6). Get rid of it to prevent
any confusion. Also get rid of the useless masking, the meaningful
bits are always the MSb so there's nothing to mask out after
shifting.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
c1a792a6ee hwmon: (w83795) Avoid reading the same register twice
Shorten driver load time by avoiding duplicate register access during
initialization. This saves 112 ms on modprobe on my test system.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00