Commit graph

1144 commits

Author SHA1 Message Date
Jean Delvare 80646b9586 hwmon: (w83795) Only start monitoring if needed
This saves an SMBus write if monitoring was already enabled.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare 86ef4d2fd5 hwmon: (w83795) Add const markers
Attribute structures can be made const. Same for the I2C address
list.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare b2cc528e58 hwmon: (w83795) Only create fan[1-8]_target files when needed
Only create fan[1-8]_target files when the fan in question can be
controlled (PWM output is present.) Also name these files according
to the standard.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare b5f6a90a0b hwmon: (w83795) Move PWM attributes to a dedidated array
Use a dedicated 2D array for PWM attributes. This way, PWM attributes
are handled the same way as other attributes, this is more consistent.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare 87df0dad3e hwmon: (w83795) Use 2D arrays for many device attributes
Use 2D arrays for in, fan, temp and dts device attributes. Using
linear arrays is too risky as we have to skip some groups depending
on the device model and configuration. Adding or removing an
attribute would let the driver build silently but then it would crash
at runtime. With 2D arrays, the consistency checking happens at build
time, which is much safer.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 6f3dcde9c6 hwmon: (w83795) Merge w83795_create_files and w83795_remove_files
Functions w83795_create_files and w83795_remove_files iterate over
the same set of files, just calling a different function. Merge them
into a single function which takes the action as a parameter. This
saves code, and also ensure that file creation and deletion are in
sync.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 892514a637 hwmon: (w83795) Move file creation to a separate function too
Function w83795_probe() is way too big, move file creation to a separate
function to make it more readable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 2fa09878ba hwmon: (w83795) Move files removal to a separate function
Sysfs files must be removed on device removal but also when device
registration fails. Move the code to a separate function to avoid
code redundancy.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 2be381de0f hwmon: (w83795) Improve detection routine
Check for additional identification registers. Improve debugging
messages on failed detection.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare b2469f422f hwmon: (w83795) Refactor bank selection
Move the bank selection code to a separate function, to avoid
duplicating it in read and write functions. Improve error reporting
on register access error.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 093d1a4794 hwmon: (w83795) Drop duplicate enum
Enum chips and chip_types are redundant, get rid of the former. Fix
the detection code to properly identify the chip variant and name the
client accordingly.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare 315bacfdbe hwmon: (w83795) Misc cleanups
* Improve driver description.
* Drop unused macro.
* Drop unreachable code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Wei Song 792d376b4f hwmon: New driver for the W83795G/ADG monitoring chips
There is still much work needed, but I wanted to give Wei the credit
he deserves. I've merged some of my own fixes already, to make
gcc and checkpatch happy. Individual fixes and improvements from me
will follow.

[JD: Fix build errors]
[JD: Coding style cleanups]
[JD: Get rid of forward declarations]
[JD: Drop VID support]
[JD: Drop fault output control feature]
[JD: Use lowercase for inline function names]
[JD: Use strict variants of the strtol/ul functions]
[JD: Shorten the read and write function names]

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Maurus Cuelenaere 62991f7ab3 hwmon: (s3c-hwmon) Depend on S3C_ADC
This way we don't need to modify Kconfig every time a new SoC comes along to
make this driver support it. Also fix some typos while I'm at it.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Thomas Gleixner 9c627e3be3 hwmon: (s3c-hwmon) Use a real mutex
The semaphore which protects the ADC is semantically a mutex. Use a
real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Shubhrajyoti D caaa0f36c3 hwmon: (lm75) Trivial changes to pacify the checkpatch
Some trivial changes to pacify the checkpatch.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Shubhrajyoti D e3cd9528af hwmon: (lm75) Make the writing to sysfs more robust
Currently we get the checkpatch warning
consider using strict_strtol in preference to simple_strtol.
Also we should not allow any partially numeric values.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Jean Delvare c4f99a2b8f hwmon: (lm90) Add support for the W83L771W/G
I was wondering if that chip ever existed publicly... Apparently yes,
so add support for it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:44 +02:00
Guenter Roeck 0c01b644f7 hwmon: (lm90) Add support for update_interval sysfs attribute
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Guenter Roeck 1179324c41 hwmon: (lm90) Introduce capability flag to indicate broken ALERT functionality
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Guenter Roeck 4667bcb8d8 hwmon: (lm90) Introduce chip parameter structure
Instead of using switch/case and if statements in probe, define chip specific
functionality in a parameter structure array.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 15b66ab690 hwmon: (lm90) Rearrange code to no longer require forward declarations
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 06e1c0a216 hwmon: (lm90) Add support for max6695 and max6696
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 6948708dd0 hwmon: (lm90) Add support for extra features of max6659
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 13c84951a3 hwmon: (lm90) Add explicit support for max6659
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 96512861c3 hwmon: (lm90) Simplify set_temp11 register calculations
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck b6fc1bacc7 hwmon: (lm90) Introduce function to delete sysfs files
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 88073bb1ba hwmon: (lm90) Introduce device feature bits
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck 11e578129a hwmon: (lm90) Fix checkpatch errors
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:42 +02:00
Andreas Herrmann 628b4504cf hwmon: (k8temp) Remove superfluous CPU family check
The family check in k8temp is not required because the driver is
already bound to a northbridge device only used with K8 CPUs.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:42 +02:00
Samu Onkalo b11e7b3f3b hwmon: lis3: Release resources in case of failure
If lis3lv02d_init_device fails, HW resources were not released
properly. In case of failure call release_resources if available.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:44:59 -07:00
Samu Onkalo 029756d0b8 hwmon: lis3: Enhance lis3 selftest with IRQ line test
Configure chip to data ready mode in selftest and count received
interrupts to see that interrupt line(s) are working.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:39 -07:00
Samu Onkalo f10a5407b5 hwmon: lis3: use block read to access data registers
Add optional blockread function to interface driver. If available
the chip driver uses it for data register access. For 12 bit device
it reads 6 bytes to get 3*16bit data. For 8 bit device it reads out
5 bytes since every second byte is dummy.
This optimizes bus usage and reduces number of operations and
interrupts needed for one data update.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:39 -07:00
Samu Onkalo 477bc918c2 hwmon: lis3: Adjust fuzziness for 8 bit device
Default fuziness is set smaller for 8 device.
In 12 bit device LSB is quite close to 1 mg
(mg = 1 / 1000 of earth gravity).
In 8bit device LSB is about 18 mg.
Set fuziness to 1 for 8 bit device.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:39 -07:00
Samu Onkalo cc23aa1ce2 hwmon: lis3: New parameters to platform data
Added default output data rate setting to platform data.
If default rate is 0, reset default value is used.
Added control for duration via platform data.
Added possibility to configure interrupts to trig on
both rising and falling edge. The lis3 WU unit can be
configured quite many ways and with some configurations it
is quite handy to get coordinate refresh when some
event trigs and when it reason goes away.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo ed37d7f619 hwmon: lis3: restore axis enabled bits
All axis enable bits are set to 0 at module remove.
Restore reset default value at init.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo 2a7fade7e0 hwmon: lis3: Power on corrections
Sometimes lis3 chip seems to fail to setup factory tuning at boot up.
This probably happens if there is some odd power ramp down ramp up sequence
for example in device restart. Set boot bit in control2 register to
trig boot sequence manually and wait until it is finished.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo 821f664644 hwmon: lis3: Update coordinates at polled device open
Call input device poll function at device open to refresh coordinates
immediately. This is needed for the case where poll interval is set to
zero and coordinate updates happens purely under interrupt control.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo e726111f95 hwmon: lis3: Cleanup interrupt handling
Irqcfg moved to chip data instead of platform data.
This simplifies access in interrupt handler little bit.

Input device open and close functions set status for
interrupt threaded handler once.

Unnecessary check for interrupt source removed since
it is enough that active interrupt line indicates that
there was an interrupt.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo f9deb41f91 hwmon: lis3: regulator control
Based on pm_runtime control, turn lis3 regulators on and off.
Perform context save and restore on transitions.

Feature is optional and must be enabled in platform data.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Samu Onkalo 2a34699662 hwmon: lis3: pm_runtime support
Add pm_runtime support to lis3 core driver.
Add pm_runtime support to lis3 i2c driver.

spi and hp_accel drivers are not yet supported. Old always
on functionality remains for those.

For sysfs there is 5 second delay before turning off the
chip to avoid long ramp up delay.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:38 -07:00
Simon Guinot d6fe1360f4 hwmon: add generic GPIO fan driver
This patch adds hwmon support for fans connected to GPIO lines.

Platform specific information such as GPIO pinout and speed conversion array
(rpm from/to GPIO value) are passed to the driver via platform_data.

Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:37 -07:00
Jan Beulich 3247800676 hwmon: (coretemp) fix reading of microcode revision (v2)
According to the documentation, simply reading the respective MSR
isn't sufficient: It should be written with zeros, cpuid(1) be
executed, and then read (see arch/x86/kernel/cpu/intel.c for an
example).

v2: Fail probe when microcode revision cannot be determined, but is
needed to check for proper operation.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Chen Gong <gong.chen@linux.intel.com>
Cc: Jean Delvare <khali@linux-fr.org>
Acked-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:21 -07:00
Chen Gong 17c10d61c7 hwmon: ({core, pkg, via-cpu}temp) remove unnecessary CONFIG_HOTPLUG_CPU ifdefs
CONFIG_HOTPLUG_CPU is used too much in some drivers.
This patch clean them up.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:21 -07:00
Chen Gong fd53d08465 hwmon: (pkgtemp) align driver initialization style with coretemp
pkgtemp is derived from coretemp, so some reasonable
logics should be applied onto pkgtemp, too. Such as
the init logic here.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00
Guenter Roeck e5f5c99a39 hwmon: LTC4261 Hardware monitoring driver
This driver adds support for Linear Technology LTC4261 I2C Negative
Voltage Hot Swap Controller.

Reviewed-by: Ira W. Snyder <iws@ovro.caltech.edu>
Reviewed-by: Tom Grennan <tom.grennan@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00
Takashi Iwai 2ee321440e hwmon: (lis3) add axes module parameter for custom axis-mapping
The axis-mapping of lis3dev device on many (rather most) HP machines
doesn't follow the standard.  When each new model appears, users need to
adjust again.  Testing this requires the rebuild of kernel, thus it's not
trivial for end-users.

This patch adds a module parameter "axes" to allow a custom axis-mapping
without patching and recompiling the kernel driver.  User can pass the
parameter such as axes=3,2,1.  Also it can be changed via sysfs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00
Masanari Iida 37394050b5 hwmon: (hp_accel) Add HP Mini 510x family support
This patch is an enhanced version of Takashi Iwai's
[PATCH] hp_accel: Add quirks for HP ProBook 532x and HP Mini 5102
My HP Mini 5101 works fine with this patch.
Confirmed with Tux Racer.

Signed-off by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Eric Piel <eric.piel@tremplin-utc.net>

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00
Takashi Iwai 78537c3b6f hwmon: (lis3) Add support for new LIS3DC / HP3DC chip
A new version of LIS3 chip has slight incompatibilities from former
versions.  This patch adds the minimal support for it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00
Jan Beulich 9401ba1328 x86/hwmon: remove inclusion of unnecessary headers from {core, pkg, via-cpu}temp.c
These likely originate from these drivers being clones of one another
and/or other drivers which actually needed these includes.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25 14:11:20 -07:00