summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: Fix CamelCase checkpatch warningsGuenter Roeck2013-04-071-12/+12
| | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8771E and IT8772EGuenter Roeck2013-02-061-4/+35
| | | | | | | | | Assume that IT8771E and IT8772E are fully compatible with IT8728F. IT8771E support contributed by Kelly Anderson. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org>
* hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck2013-01-251-7/+6
| | | | | | | | | | | | SENSORS_LIMIT and the generic clamp_val have the same functionality, and clamp_val is more efficient. This patch reduces text size by 9052 bytes and bss size by 11624 bytes for x86_64 builds. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: George Joseph <george.joseph@fairview5.com> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Support PECI for additional chipsGuenter Roeck2012-12-191-10/+38
| | | | | | | | | | Extend support for reporting and selecting PECI temperature sensors to IT8718, IT8720, IT8782, and IT8783. For IT8721, report the sensor type for temp2 as Intel PECI (6) if the chip is configured to report the PCH temperature. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Report thermal sensor type as Intel PECI if appropriateGuenter Roeck2012-12-191-3/+17
| | | | | | | | | | | | IT8721 and IT8728 support Intel PECI temperature reporting. Each sensor can be programmed to display the temperature reported on the PECI interface. If configured for Intel PECI, the driver reported the wrong sensor type for the respective thermal sensor. Fix the code to correctly report it as "Intel PECI (6)". Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Manage device specific features with tableGuenter Roeck2012-12-191-74/+81
| | | | | | | | | This simplifies the code, improves runtime performance, reduces code size (about 280 bytes on x86_64), and makes it easier to add support for new devices. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Replace pwm group macro with direct attribute definitionsGuenter Roeck2012-12-191-41/+74
| | | | | | | | | Fix checkpatch error: ERROR: Macros with multiple statements should be enclosed in a do - while loop Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Avoid quoted string splits across linesGuenter Roeck2012-12-191-14/+13
| | | | | | | Fix the respective checkpatch warnings. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Save fan registers in 2-dimensional arrayGuenter Roeck2012-12-191-159/+104
| | | | | | | | | Also unify fan functions to use the same code for 8 and 16 bit fans. This patch reduces code size by approximately 1,200 bytes on x86_64. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Introduce support for tempX_offset sysfs attributeGuenter Roeck2012-12-191-5/+61
| | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Replace macro defining tempX_type sensors with direct definitionsGuenter Roeck2012-12-191-10/+11
| | | | | | | | | | | The macro name show_sensor_offset is confusing since it related to the sensor type, not an offset - even more so when we introduce offset attributes later on. Replace it with direct definitions, and replace the show_sensor/set_sensor function names with show_temp_type/set_temp_type. This also resolves a checkpatch error. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Save voltage register values in 2-dimensional arrayGuenter Roeck2012-12-191-81/+66
| | | | | | | | Reduces code size (more than 600 bytes on x86_64), and gets rid of some checkpatch errors. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Save temperature registers in 2-dimensional arrayGuenter Roeck2012-12-191-63/+35
| | | | | | | | Cleaner code, fewer checkpatch errors, and reduced code size (saves more than 500 bytes on x86-64). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: remove use of __devexitBill Pemberton2012-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devexit 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>
* hwmon: remove use of __devinitBill Pemberton2012-11-281-3/+3
| | | | | | | | | | | | | | | | | | | | | 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>
* hwmon: remove use of __devexit_pBill Pemberton2012-11-281-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>
* hwmon: (it87) Preserve configuration register bits on initJean Delvare2012-07-121-1/+1
| | | | | | | | | | | | We were accidentally losing one bit in the configuration register on device initialization. It was reported to freeze one specific system right away. Properly preserve all bits we don't explicitly want to change in order to prevent that. Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Make temp3 attribute conditional for IT8782FGuenter Roeck2012-05-221-20/+61
| | | | | | | On IT8782F, temp3 is only supported if UART6 is disabled. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Convert to use devm_kzalloc and devm_request_regionGuenter Roeck2012-05-221-34/+20
| | | | | | | This makes the code a bit simpler and smaller. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Create voltage attributes only if voltage is enabledGuenter Roeck2012-05-201-38/+124
| | | | | | | | On IT8782F and IT8783F, some voltage input pins may be disabled. Don't create sysfs attribute files if that is the case. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Add support for IT8782F and IT8783E/FGuenter Roeck2012-05-201-26/+99
| | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Constify fixed string arraysGuenter Roeck2012-03-181-3/+3
| | | | | | | | Make checkpatch happy by constifying fixed string arrays. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Fix multi-line commentsGuenter Roeck2012-03-181-62/+108
| | | | | | | | Fix multi-line comments, and clean up some of the affected comments. Cc: Jean Delvare <khali@linux-fr.org> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add IT8728F supportJean Delvare2012-01-161-15/+46
| | | | | | | | | | Until we get a datasheet for the IT8728F, treat it as fully compatible with the IT8721F, as it seems to work reasonably well. This closes kernel bug #27262. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
* module_param: make bool parameters really bool (drivers & misc)Rusty Russell2012-01-131-2/+2
| | | | | | | | | | | | module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* hwmon: replaced strict_str* with kstr*Frans Meulenbroeks2012-01-051-17/+17
| | | | | | | | | | | 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>
* hwmon: (it87) Add chassis intrusion detection supportJean Delvare2011-07-251-0/+29
| | | | | | | Add chassis intrusion detection support for all supported devices, using the standard interface. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Fix label group removalJean Delvare2011-07-171-1/+1
| | | | | | | | | | | A copy-and-paste error caused it87_attributes_vid to be referenced where it87_attributes_label should be. Thankfully the group is only used for attribute removal, not attribute creation, so the effects of this bug are limited, but let's fix it still. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (it87) Use request_muxed_regionNat Gurumoorthy2011-05-251-12/+19
| | | | | | | | | | | | Serialize access to the hardware by using "request_muxed_region" macro defined by Alan Cox. Call to this macro will hold off the requestor if the resource is currently busy. "superio_enter" will return an error if call to "request_muxed_region" fails. Rest of the code change is to ripple an error return from superio_enter to the top level. Signed-off-by: Nat Gurumoorthy <natg@google.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Use pr_fmt and pr_<level>Joe Perches2011-01-121-16/+14
| | | | | | | | | | 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: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Fix manual fan speed control on IT8721FJean Delvare2010-12-081-16/+45
| | | | | | | | 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>
* hwmon: (it87) Add support for the IT8721F/IT8758EJean Delvare2010-10-281-22/+94
| | | | | | | | | | | | | | 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>
* hwmon: (it87) Move conversion functionsJean Delvare2010-10-281-50/+52
| | | | | | | | 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>
* hwmon: (it87) Export labels for internal sensorsJean Delvare2010-08-141-2/+44
| | | | | | | | Some voltage sensors can be wired internally to the IT87xxF chip's own power supply channels. In that case, we can inform user-space that the wiring is known by exporting proper labels for these sensors. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Fix in7 on IT8720FJean Delvare2010-07-091-0/+22
| | | | | | | | | | | | | | | | | | The IT8720F has no VIN7 pin, so VCCH should always be routed internally to VIN7 with an internal divider. Curiously, there still is a configuration bit to control this, which means it can be set incorrectly. And even more curiously, many boards out there are improperly configured, even though the IT8720F datasheet claims that the internal routing of VCCH to VIN7 is the default setting. So we force the internal routing in this case. It turns out that all boards with the wrong setting are from Gigabyte, so I suspect a BIOS bug. But it's easy enough to workaround in the driver, so let's do it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jean-Marc Spaggiari <jean-marc@spaggiari.org> Cc: stable@kernel.org
* hwmon: (it87) Invalidate cache on temperature sensor changeJean Delvare2010-04-141-0/+1
| | | | | | | | | When any temperature sensor type is changed, the corresponding temperature value needs to be updated. The register caching mechanism may delay this update, so we want to invalidate the cache to force an immediate update. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Properly handle wrong sensor type requestsJean Delvare2010-04-141-10/+10
| | | | | | | | | | Currently, if someone tries to set the thermal sensor type to an unsupported value, subsequent accesses to the chip may temporarily show the sensor in question as disabled. Use a temporary variable and only update the cached value on success, to prevent such confusion. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Don't arbitrarily enable temperature channelsJean Delvare2010-04-141-8/+5
| | | | | | | | | | Temperature channels can be used in 2 different modes (thermistor and thermal diode) and we don't know which one, if any, is correct for every given board. So don't arbitrarily choose one. Instead, leave the temperature channels untouched. They can be configured from user-space if needed anyway. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Validate auto pwm settingsJean Delvare2010-03-051-0/+32
| | | | | | | | Before switching to automatic fan control mode, make sure that all the trip points make sense. Otherwise, the control loop could lead to weird fan behavior. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Add support for old automatic fan speed controlJean Delvare2010-03-051-2/+180
| | | | | | | | | | | | | | Add support for the automatic fan speed control interface as implemented by IT8705F chips up to revision F and IT8712F chips up to revision G. This implementation fits very well in our standard sysfs interface. I implemented the old and not the new interface because the only chip I have at hand is an old one, and the new interface is more difficult to map to the standard sysfs interface. Adding support later should be possible though, if someone with a supported chip is interested. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Use strict_strtol instead of simple_strtolJean Delvare2010-03-051-15/+44
| | | | | | | For consistency and robustness, use strict_strtol instead of simple_strtol. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Fix many checkpatch errors and warningsJean Delvare2010-03-051-75/+87
| | | | | | | | Fix 20 errors and 11 warnings reported by the checkpatch script. The remainining errors would require more work. The remaining warnings will be addressed later. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Add support for beep on alarmJean Delvare2010-03-051-0/+122
| | | | | | | | The IT87xxF chips support beeping on alarm, if properly wired and configured. There is one control bit for each input type (temperature, fan, voltage.) Let the user see and change them. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Create vid attributes by groupJean Delvare2010-03-051-8/+7
| | | | | | | | Only VID-related attributes are left in it87_attributes_opt, so we might as well rename it to it87_attributes_vid and use this group to create all attributes at once. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Refactor attributes creation and removalJean Delvare2010-03-051-130/+103
| | | | | | | | | | | | There is a lot of code redundancy in the creation of the fan and pwm attributes. Move these attributes to arrays so that the code can be simplified. This in turns makes the attributes removal code larger, so move it to a separate function that can be called in both the standard removal case and the error path during probing. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Expose the PWM/temperature mappingsJean Delvare2010-03-051-4/+69
| | | | | | | | | Let the user read the PWM-to-temperature mappings. Until the trip points are also exposed, this is essentially a way to know how the BIOS has set things up. The ability to change the settings will be added later, together with the trip points. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Display fan outputs in automatic mode as suchJean Delvare2010-03-051-38/+61
| | | | | | | | | The it87 driver doesn't yet support automatic fan control. Let it at least tell the user when a fan output is in automatic mode. Also let the user switch from automatic mode (possibly set by the BIOS) to manual mode and back without losing the settings. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Check for fan2 and fan3 availabilityJean Delvare2009-12-091-3/+24
| | | | | | | | The fan2 and fan3 input and output pins can be used as GPIOs. Check their function before exposing their sysfs attributes and accessing their registers. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (it87) Verify the VID pin usageJean Delvare2009-12-091-4/+16
| | | | | | | | | The VID input pins can alternatively be used as GPIOs. Make sure we have at least 4 pins used for VID, otherwise don't bother reading and exposing VID. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Adam Nielsen <a.nielsen@shikadi.net>
* hwmon: (it87) Fix VID reading on IT8718F/IT8720FJean Delvare2009-10-241-3/+2
| | | | | | | | | | | Comparing apples to bananas doesn't seem right. Consistently use the chips enum for chip type comparisons, to avoid such bugs in the future. The bug has been there since support for the IT8718F was added, so VID never worked for this chip nor for the similar IT8720F. Signed-off-by: Jean Delvare <khali@linux-fr.org>