summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
AgeCommit message (Collapse)Author
2013-01-25hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck
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>
2012-11-28hwmon: remove use of __devinitBill Pemberton
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-09-23hwmon: (f71882fg) Convert to use devm_ functionsGuenter Roeck
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-09-23hwmon: (f71882fg) Fix build warningGuenter Roeck
Fix: warning: 'address' may be used uninitialized in this function [-Wuninitialized] While this is a false warning, the patch reduces module size on x86_64 by approximately 175 bytes, so it is still worth the effort. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Hans de Goede <hdegoede@redhat.com>
2012-03-18hwmon: (f71882fg) Fix multi-line commentsGuenter Roeck
Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-18hwmon: (f71882fg) fix checkpatch issuesFrans Meulenbroeks
fixed: WARNING: static const char * array should probably be static const char * const +static const char *f71882fg_names[] = { Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks
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-10-24hwmon/f71882fg: Make the decision wether to register fan attr. per fanHans de Goede
Before this patch the f71882fg driver completely fails to initialize on systems which have reserved settings in the pwm enable register, and it disables all auto pwm sysfs attributes if any fan is controlled by a digital sensor reading. This patch changes the fail to initialize into don't register any attributes for the fan for which there are reserved settings in the pwm enable register and also makes the not registering of auto pwm sysfs attributes a per fan thing. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-24hwmon/f71882fg: Add a f71882fg_create_fan_sysfs_files helper functionHans de Goede
This is a preparation patch for not registering fan/pwm attributes for some fans (rather then register them for all or for none). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-24hwmon/f71882fg: Make all fan/pwm attr tables 2 dimensionalHans de Goede
This is a preparation patch for not registering fan/pwm attributes for some fans (rather then register them for all or for none). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-07-03hwmon: (f71882fg) Add support for the F71869AHans de Goede
The F71869A is almost the same as the F71869F/E, except that it has the normal number of temp and pwm zones for a F71882FG derived chip, rather then the limited number of the F71869F/E. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Max Baldwin <archerseven@gmail.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-07-03hwmon: Use <> rather than () around my e-mail addressHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25hwmon: (f71882fg) Add support for F71808AHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25hwmon: (f71882fg) Split has_beep in fan_has_beep and temp_has_beepHans de Goede
Needed for upcoming support of the F71808A. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-03-26hwmon: (f71882fg) Add support for the F71889AHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-03-26hwmon: (f71882fg) Add support for the F81865FJean Delvare
Add support for the Fintek F81865F. It's essentially compatible with the F71882FG, but has fewer inputs: 7 voltage, 2 temperature and 2 fan inputs only. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-26hwmon: (f71882fg) Document all supported devicesJean Delvare
The list of supported devices was not always well documented in all places. Clarify and list all devices in documentation, Kconfig and the driver itself. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-26hwmon: (f71882fg) Per-chip fan/temperature input count tablesJean Delvare
Use tables to list the count of fan and temperature inputs for all supported chips, almost similar to (but more simple than) what is already done for voltage inputs. This avoids repeating the same tests in different functions, and will make it easier to add support for chips with a different count of fan or temperature inputs. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-26hwmon: (f71882fg) Secure chip property definition arraysJean Delvare
Using C99-style array initialization will ensure definitions won't drift if the chips enum gets new values added. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Add support for f71808eHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Jonathan Michalon <johndescs@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Add support for f71869f and f71869eHans de Goede
Note that these 2 are register compatible and report the same superio id, but they are 2 distinct chips / models! Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Thomas Faber <thfabba@gmx.de> Tested-by: Alexey Sychev <owl@umail.ru> Tested-by: Dieter Bloms <dieter@bloms.de> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Add support for f71889edHans de Goede
Note that this patch also makes 2 changes to the code paths for the f71889fg to keep the code unified between the 2 (for simplicities sake). Both of these are harmless for then f71889fg: 1) The first change is to always set the FAN_PROG_SEL bit to 0. This influences accesses to some banked fan / pwm registers. On the f71889fg no registers which we use are banked. On the f71889ed however some more fan registers have been banked including one which we use, by making the FAN_PROG_SEL bit 0, address 0x96 will point to the right register. 2) The second change is to see a FANx_TEMP_SEL value of 0 as pointing to a PECI / AMDSI value, and thus disable our pwm related sysfs attr. This is correct for the f71889ed and on the f71889fg 0 is a reserved value, so we should never see it and if we do, disabling the pwm related sysfs attr is a sane thing to do. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Thomas Greve <tg42@gmx.net> Tested-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Break out test for auto pwm's controlled by digital readingsHans de Goede
Putting this check in its own switch case rather then in the switch case for adding pwm auto point sysfs attr is cleaner. This is a preparation patch for adding support for more different models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Separate temp beep sysfs attr from the other temp sysfs attrHans de Goede
This is a preparation patch for adding support for more different models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Remove bogus temp2_type for certain modelsHans de Goede
Remove the temp2_type sysfs files for f8000 / f71858fg models, this got in accidentally and is wrong as these models don't have a Temperature Sensor Type Register at all. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Make number of temps configurableHans de Goede
Make the temp sysattr array for the standard models a 2d array, which allows to use it for models with less temperatures too. This is a preparation patch for adding support for more different models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Make creation of in sysfs attributes more genericHans de Goede
This is a preparation patch for adding support for more different models, some of which have a sparse list of used voltage pins. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Only allow negative auto point temps if fan_neg_temp is enabledHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-14hwmon/f71882fg: Fix temp1 sensor type reportingHans de Goede
The code for determining a sensort type for temp1 was based on me misreading the datasheet, the tested registers do not determine what kind of sensor is actually reported as temp1. Instead the enable / disable certain additional digital sensor readouts throug PECI / AMDSI, etc. Independent of these settings temp1 is still reading an external BJT or thermistor as configured by the Temperature Sensor Type Register (0x6b). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-13hwmon/f71882fg: Set platform drvdata to NULL laterHans de Goede
This avoids a possible race leading to trying to dereference NULL. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-03-13hwmon/f71882fg: Fix a typo in a commentHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-01-08hwmon: (f71882fg) Use pr_fmt and pr_<level>Joe Perches
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-10-03hwmon: f71882fg: use a muxed resource lock for the Super I/O portGiel van Schijndel
Sleep while acquiring a resource lock on the Super I/O port. This should prevent collisions from causing the hardware probe to fail with -EBUSY. Signed-off-by: Giel van Schijndel <me@mortis.eu> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-20revert "hwmon: f71882fg: add support for the Fintek F71808E"Andrew Morton
Revert commit 7721fea3d0fd93fb4d000eb737b444369358d6d3 ("hwmon: f71882fg: add support for the Fintek F71808E"). Hans said: : A second review after I've received a data sheet for this device from : Fintek has turned up a few bugs. : : Unfortunately Giel (nor I) have time to fix this in time for the 2.6.36 : cycle. Therefor I would like to see this patch reverted as not having any : support for the hwmon function of this superio chip is better then having : unreliable support. Cc: Giel van Schijndel <me@mortis.eu> Cc: Jean Delvare <khali@linux-fr.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-09hwmon: f71882fg: add support for the Fintek F71808EGiel van Schijndel
Allow device probing to recognise the Fintek F71808E. Sysfs interface: * Fan/pwm control is the same as for F71889FG * Temperature and voltage sensor handling is largely the same as for the F71889FG - Has one temperature sensor less (doesn't have temp3) - Misses one voltage sensor (doesn't have V6, thus in6_input refers to what in7_input refers for F71889FG) For the purpose of the sysfs interface fxxxx_in_temp_attr[] is split up such that it can largely be reused. Signed-off-by: Giel van Schijndel <me@mortis.eu> Cc: Jean Delvare <khali@linux-fr.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27hwmon: (f71882fg) Acquire I/O regions while we're working with themGiel van Schijndel
Acquire the I/O region for the Super I/O chip while we're working on it. Signed-off-by: Giel van Schijndel <me@mortis.eu> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-27hwmon: (f71882fg) Code cleanupGiel van Schijndel
Some code cleanup: properly use previously defined functions, rather than duplicating their code. Signed-off-by: Giel van Schijndel <me@mortis.eu> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-27hwmon: (f71882fg) Use strict_stro(l|ul) instead of simple_strto$1Giel van Schijndel
Use the strict_strol and strict_stroul functions instead of simple_strol and simple_stroul respectively in sysfs functions. Signed-off-by: Giel van Schijndel <me@mortis.eu> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-27hwmon: (f71882fg) Fixed braces coding style issuesGiel van Schijndel
Fixed several coding style issues. Signed-off-by: Giel van Schijndel <me@mortis.eu> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-09hwmon: (f71882fg) Add support for the f71889fg (version 2)Hans de Goede
This adds support for the Fintek f71889fg to the f71882fg driver, many thanks to Gerd v. Egidy for providing (remote) access to a machine which such an ic. Note that this bit of the patch: - val = SENSORS_LIMIT(val, 0, 255); + + if (data->type == f71889fg) + val = SENSORS_LIMIT(val, -128, 127); + else + val = SENSORS_LIMIT(val, 0, 127); Changes behaviour for already supported models, the new behaviour is correct as the already supported models have bit 7 of the involved registers fixed at 0, so the previous behaviour which allowed setting temp zone limits > 127 was not correct. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-09hwmon: (f71882fg) Fix sysfs file removalHans de Goede
There is a bug in the old sysfs file removal, as it uses fxxxx_in_temp_attr to remove the in and temp sysfs attributes, but fxxxx_in_temp_attr has temp#_alarm, where as f71858fg_in_temp_attr has temp#_max_alarm, so the temp#_max_alarm attributes for the f71858fg never get removed. This patch fixes this by doing the sysfs removal exactly the same way as the creation instead of being (too) clever, this will also avoid similar bugs in the future. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-09hwmon: (f71882fg) Cleanup sysfs attr creation 2/2Hans de Goede
This patch merges the f71882fg_auto_pwm_attr array into the fxxxx_fan_attr resp. fxxxx_auto_pwm_attr array, as the f71882fg_auto_pwm_attr array was merely extending these 2 with entries for a 4th fan, it also makes these 2 arrays 2 dimensional so that the rest of the code can choose to add attr for 3 or 4 fans without needing to know the nr of attr per fan. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-09hwmon: (f71882fg) Cleanup sysfs attr creation 1/2Hans de Goede
This patch makes a number of cleanups to the sysfs attr creation in the f71882fg driver, this is a preparation patch for adding f71889fg support: * Add some comments to explain why some models need separate sysfs attr arrays for in / temp / fan / pwm * Rename a number of sysfs attr arrays to make their function clearer * Move the pwm#_auto_channels_temp attribute from the common to all models fan attr array to the per model auto mode pwm attr arrays, so that all the auto mode pwm attr are grouped together, and thus can be left out on models where we don't support auto pwm mode * Put fan_beep attr in their own array, so that only auto mode pwm attr remain in the per model pwm sysfs attr arrays. * Put the 4th special fan input for the f8000 in its own array, so that only auto mode pwm attr remain in the per model pwm sysfs attr arrays. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (f71882fg) Add support for the F71858FHans de Goede
Add support for the hwmon part of the Fintek F71858FG superio IC to the f71882fg driver. Many thanks to Jelle de Jong for lending me a motherboard with this superio on it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (f71882fg) Add temp#_fault sysfs attr for f8000Hans de Goede
While working on f71852fg support I noticed that the f8000 sysfs attr table was missing entries for temp#_fault, which the f8000 does have and which we were already reading. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (f71882fg) Sanity check f8000 pwm settingsHans de Goede
We depend up on the pwm_enable register (0x96) not containing any reserved settings in various places. We were already checking to make sure there were no reserved settings in the register for the f71862fg, this patch adds the same checking for the f8000, while at it it also moves the code to a more apropriate place so we don't need to check if the fan/pwm part of the IC is enabled twice. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (f71882fg) Cleanup f8000 pwm handlingHans de Goede
Currently we are using separate per model sysfs attr for the 3th pwm, because the 3th pwm of the f8000 only has automatic mode and not manual mode. Doing things this way was getting in the way for adding f71858fg support, so this patch makes the pwm attr identical for all models, and instead adds a check to store_pwm_enable() disallowing setting the 3th pwm to manual mode on a f8000 IC. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: Fix more __devexit_p glitchesJean Delvare
Make sure __devexit and devexit_p() match in all hwmon drivers. Suggested by a similar fix from Mike Frysinger. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
2009-02-17hwmon: Fix ACPI resource check error handlingHans de Goede
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-02-17hwmon: (f71882fg) Hide misleading error messageJean Delvare
If the F71882FG chip is at address 0x4e, then the probe at 0x2e will fail with the following message in the logs: f71882fg: Not a Fintek device This is misleading because there is a Fintek device, just at a different address. So I propose to degrade this message to a debug message. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <hdegoede@redhat.com>