summaryrefslogtreecommitdiff
path: root/drivers/hwmon/w83627ehf.c
AgeCommit message (Collapse)AuthorFilesLines
2012-11-28hwmon: remove use of __devinitBill Pemberton1-4/+4
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06hwmon: (w83627ehf) Force initial bank selectionJean Delvare1-0/+1
Don't assume bank 0 is selected at device probe time. This may not be the case. Force bank selection at first register access to guarantee that we read the right registers upon driver loading. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org
2012-07-22hwmon: (w83627ehf) Add missing break statementGuenter Roeck1-0/+1
A case statement in nct6775_write_fan_div() is missing a break. Fix it. This patch addresses Coverity #141439: Missing break in switch. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-04-01hwmon: (w83627ehf) mark const init data with __initconst instead of __initdataUwe Kleine-König1-9/+9
As long as there is no other non-const variable marked __initdata in the same compilation unit it doesn't hurt. If there were one however compilation would fail with error: $variablename causes a section type conflict because a section containing const variables is marked read only and so cannot contain non-const variables. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: lm-sensors@lm-sensors.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-19hwmon: (w83627ehf) Add support for temperature offset registersGuenter Roeck1-0/+73
Add support for temperature offset registers for CPUTIN, SYSTIN, and AUXTIN temperatures. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (w83627ehf) Fix multi-line commentsGuenter Roeck1-82/+106
Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-13hwmon: (w83627ehf) Fix temp2 source for W83627UHGJean Delvare1-4/+4
Properly set the source of temp2 for the W83627UHG. Also fix a comment right before that, and document the W83627UHG as reporting up to 3 temperatures. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-12hwmon: (w83627ehf) Fix memory leak in probe functionGuenter Roeck1-4/+3
The driver probe function leaked memory if creating the cpu0_vid attribute file failed. Fix by converting the driver to use devm_kzalloc. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 2.6.32+ Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-12hwmon: (w83627ehf) Fix writing into fan_stop_time for NCT6775F/NCT6776FGuenter Roeck1-1/+1
NCT6775F and NCT6776F have their own set of registers for FAN_STOP_TIME. The correct registers were used to read FAN_STOP_TIME, but writes used the wrong registers. Fix it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.0+ Acked-by: Jean Delvare <khali@linux-fr.org>
2012-02-09hwmon: (w83627ehf) Remove duplicate codeGuenter Roeck1-5/+0
Commit ec3e5a16446fef1891611fe3bdfa5954d1ddf5e4 slipped in some duplicate code. Remove it. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-02-05hwmon: (w83627ehf) Fix number of fans for NCT6776FGuenter Roeck1-3/+20
NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of chip register bits. Check that second set of bits in addition to the first set to detect if fans 3..5 are monitored. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.0+ Acked-by: Jean Delvare <khali@linux-fr.org>
2012-01-30hwmon: (w83627ehf) Disable setting DC mode for pwm2, pwm3 on NCT6776FGuenter Roeck1-0/+6
NCT6776F only supports pwm mode for pwm2 and pwm3. Return error if an attempt is made to set those pwm channels to DC mode. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org> Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks1-11/+11
replaced strict_strtol with kstrtol and replaced strict_strtuol with kstrtuol This satisfies checkpatch -f Compile tested only: no warnings or errors given Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-11-06hwmon: (w83627ehf) Fix broken driver initGuenter Roeck1-3/+6
Commit 2265cef2 (hwmon: (w83627ehf) Properly report PECI and AMD-SI sensor types) results in kernel panic if data->temp_label was not initialized. The problem was found with chip W83627DHG-P. Add check if data->temp->label was set before use. Based on incomplete patch by Alexander Beregalov. Reported-by: Alexander Beregalov <a.beregalov@gmail.com> Tested-by: Alexander Beregalov <a.beregalov@gmail.com> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-11-04hwmon: (w83627ehf) Add support for the W83627UHGJean Delvare1-26/+122
This is essentially a stripped down version of the W83627DHG. Noticeable difference is that it is still powered with +5V, as older models, even though the ADC resolution is 8 mV as newer models have. Thanks to Ulf Bruman (Saab Group) for doing all the testing. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-11-04hwmon: (w83627ehf) Clean up probe functionJean Delvare1-21/+32
The probe function has grown pretty large, I think it's time for some cleanups, starting with these two simple ones: * Move temp3/in6 check for the W83667HG later in the function, where it is done for all other chip types. * Move temperature register setting to a separate function, to avoid code duplication. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-11-04hwmon: (w83627ehf) Properly report PECI and AMD-SI sensor typesJean Delvare1-1/+8
When temperature sources are PECI or AMD-SI agents, it makes no sense to report their type as diode or thermistor. Instead we must report their digital nature. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-24hwmon: (w83627ehf) Better fix for negative temperature valuesJean Delvare1-25/+26
It is more efficient to left-align 8-bit temperature values, so that 8-bit and 9-bit temperature values can be handled exactly the same way in the rest of the code. 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>
2011-10-24hwmon: (w83627ehf) Uninline is_word_sizedJean Delvare1-1/+1
Helper function is_word_sized has grown too much to be kept inline. It was OK when there were only 6 word-sized registers but support for new devices have made the list much longer. The function is also called from more places than before. 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>
2011-10-24hwmon: (w83627ehf) Move fan pins check to a separate functionJean Delvare1-53/+67
Move the check of fan pin usage to a separate function. This improves readability, and will make it easier to integrate chip-specific conditions. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-24hwmon: (w83627ehf) Skip reading unused voltage registersJean Delvare1-0/+3
When in6 is missing, don't read the corresponding registers, it's a waste of time. The logic is similar to what we do for fans and temperatures. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-24hwmon: (w83627ehf) add caseopen detectionDmitry Artamonow1-0/+62
Export caseopen alarm status into userspace for Winbond W83627* and Nuvoton NCT677[56] chips and implement alarm clear attribute. Second caseopen alarm on NCT6776 is also supported. Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-20hwmon: (w83627ehf) Fix negative 8-bit temperature valuesJean Delvare1-2/+3
Since 8-bit temperature values are now handled in 16-bit struct members, values have to be cast to s8 for negative temperatures to be properly handled. This is broken since kernel version 2.6.39 (commit bce26c58df86599c9570cee83eac58bdaae760e4.) Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: stable@kernel.org # 2.6.39+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-14hwmon: (w83627ehf) Properly report thermal diode sensorsJean Delvare1-4/+11
The w83627ehf driver is improperly reporting thermal diode sensors as type 2, instead of 3. This caused "sensors" and possibly other monitoring tools to report these sensors as "transistor" instead of "thermal diode". Furthermore, diode subtype selection (CPU vs. external) is only supported by the original W83627EHF/EHG. All later models only support CPU diode type, and some (NCT6776F) don't even have the register in question so we should avoid reading from it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-15hwmon: (w83627ehf) Display correct temperature sensor labels for systems ↵Guenter Roeck1-2/+3
with NCT6775F Systems with NCT6775F reported temperature sensor labels for systems with NCT6776F. This patch fixes the problem. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-15hwmon: (w83627ehf) Add fan debounce support for NCT6775F and NCT6776FIan Dobson1-0/+21
NCT6776F and NCT6775F support debouncing the fan RPM signal. This can help improve the stability of th RPM signal for some fans (Arctic cooling fans for example). This patch adds a module parameter fan_debounce, which when set to 1 enables debounce for all fans that the chip supports. Signed-off-by: Ian Dobson <i.dobson@planet-ian.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-15hwmon: (w83627ehf) Store rpm instead of raw fan speed dataGuenter Roeck1-18/+9
Since the fan speed value can be above 0xff, we can no longer use that value to determine if the fan speed reading is valid. This makes it difficult to manipulate the stored fan speed register value. If we store rpm instead of the fan speed register value, we do not need to correct it if the fan divisor value is changed, and the above mentioned problem no longer exists. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Use 16 bit fan count registers if supportedGuenter Roeck1-27/+59
Some of the chips supported by this driver have 13 bit or 16 bit fan count registers. This patch improves support for those registers, specifically for NCT6775F. With the changes in this patch, fan speed is reported correctly even if the fan divider is set to a low value, which results in a fan speed reading above 0xff. With this patch, the width of fan count registers is no longer used to determine if the chip has fan divider register(s) or not. A dedicated flag is used instead to determine if this is the case. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Add support for Nuvoton NCT6775F and NCT6776FGuenter Roeck1-139/+652
This patch adds support for NCT6775F and NCT6776F to the w83627ehf driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Tested-by: Ian Dobson <i.dobson@planet-ian.com> (NCT6776F) Tested-by: Zachary Marzec <zmarzec@gmail.com> (ASUS P8P67 PRO/NCT6776F) Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Permit enabling SmartFan IV mode if configured at startupGuenter Roeck1-2/+10
If SmartFan IV mode was configured at startup, it should be possible to re-enable it later on. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Convert register arrays to 16 bit, and convert access to ↵Guenter Roeck1-24/+36
pointers For newer chips, several registers are banked and thus need to be 16 bit. Also, register addresses change. To prepare for those chips, convert affected register arrays to 16 bit, and change access to those registers to array pointers in struct w83627ehf_data. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Improve support for W83667HG-BGuenter Roeck1-31/+124
Add support for 4th temperature sensor on W83677HG-B. Display temperature labels on W83677HG-B to report temperature sources. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Optimize multi-bank register accessGuenter Roeck1-15/+11
Assume that each register is banked, and set the bank for each access. Cache the bank number so it only needs to be set if it changes. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Fixed most checkpatch warnings and errorsGuenter Roeck1-64/+85
This cleanup fixes most of the checkpatch warnings and errors in the w83627ehf driver. Remaining warnings and errors are left untouched on purpose to avoid making the code less readable. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-03-15hwmon: (w83627ehf) Unify temperature register access, and use strict string ↵Guenter Roeck1-106/+113
conversions This patch unifies temperature register access, and replaces simple_strtoXXX with strict_strtoXXX throughout the driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Ian Dobson <i.dobson@planet-ian.com>
2011-01-08hwmon: (w83627ehf) Use pr_fmt and pr_<level>Joe Perches1-13/+10
Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-09-17hwmon: (w83627ehf) Use proper exit sequenceJonas Jonsson1-0/+1
According to the datasheet for Winbond W83627DHG the proper way to exit the Extended Function Mode is to write 0xaa to the EFER(0x2e or 0x4e). Signed-off-by: Jonas Jonsson <jonas@ludd.ltu.se> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-08-14hwmon: (w83627ehf) Add support for W83667HG-BGuenter Roeck1-9/+33
Add support for W83667HG-B (very similar to the W83667HG). Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-08-14hwmon: (w83627ehf) Driver cleanupGuenter Roeck1-3/+56
- Moved fan pwm register array pointers into per-instance data. - Only read fan pwm data for installed/supported fans. - Update fan max output and fan step output information from data in registers. - Create max_output and step_output attribute files only if respective fan pwm registers exist. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-15hwmon: w83627ehf updatesDaniel J Blueman1-19/+53
Add control of fan minimum turn-on output levels, decoupling it from the fan turn-off output level. Add control of rate of change of fan output level. These in turn allow lower turn-off rotor speed and smoother transitions for better thermal and acoustic control authority. Add support for constant fan speed and proportional-response operations modes. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: David Hubbard <david.c.hubbard@gmail.com> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-15hwmon: Include <linux/io.h> instead of <asm/io.h>H Hartley Sweeten1-1/+1
Drivers should be including <linux/io.h> instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Nicolas Boichat <nicolas@boichat.ch> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Frank Seidel <frank@f-seidel.de> Acked-by: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (w83627ehf) Add W83627DHG-P supportJean Delvare1-1/+9
Add support for the new incarnation of the Winbond/Nuvoton W83627DHG chip known as W83627DHG-P. It is basically the same as the original W83627DHG with an additional automatic can speed control mode (not supported by the driver yet.) Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Madhu <madhu.chinakonda@gmail.com>
2009-03-30hwmon: (w83627ehf) Only expose in6 or temp3 on the W83667HGGong Jun1-6/+54
The pin for in6 and temp3 is shared on the W83667HG, so only one of these features can be supported on any given system. Let the driver select which one depending on the temp3 disabled bit. Signed-off-by: Gong Jun <JGong@nuvoton.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-30hwmon: (w83627ehf) Add support for W83667HGGong Jun1-37/+69
Add initial support for the Nuvoton W83667HG chip to the w83627ehf driver. It has been tested on ASUS P5QL PRO by Gong Jun. At the moment there is still a usability issue which is that only in6 or temp3 can be present on the W83667HG, so the driver shouldn't expose both. This will be addressed later. Signed-off-by: Gong Jun <JGong@nuvoton.com> Acked-by: David Hubbard <david.c.hubbard@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-30hwmon: (w83627ehf) Invert fan pin variables logicJean Delvare1-4/+4
Use positive logic for fan pin variables (variable is set if pin is used for fan), instead of negative logic which is error prone. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Gong Jun <JGong@nuvoton.com>
2009-02-17hwmon: Fix ACPI resource check error handlingHans de Goede1-1/+1
This patch fixes a number of cases where things were not properly cleaned up when acpi_check_resource_conflict() returned an error, causing oopses such as the one reported here: https://bugzilla.redhat.com/show_bug.cgi?id=483208 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-07hwmon: Fix various typosJean Delvare1-1/+1
Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: David Hubbard <david.c.hubbard@gmail.com>
2009-01-07hwmon: Check for ACPI resource conflictsJean Delvare1-0/+6
Check for ACPI resource conflicts in hwmon drivers. I've included all Super-I/O and PCI drivers. I've voluntarily left out: * Vendor-specific drivers: if they conflicted on any system, this would pretty much mean that they conflict on all systems, and we would know by now. * Legacy ISA drivers (lm78 and w83781d): they only support chips found on old designs were ACPI either wasn't supported or didn't deal with thermal management. * Drivers accessing the I/O resources indirectly (e.g. through SMBus): the checks are already done where they belong, i.e. in the bus drivers. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: David Hubbard <david.c.hubbard@gmail.com>
2008-02-08hwmon: (w83627ehf) The W83627DHG has 8 VID pinsJean Delvare1-10/+8
While the W83627EHF/EHG has only 6 VID pins, the W83627DHG has 8 VID pins, to support VRD 11.0. Add support for this. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>