History log of /drivers/hwmon/f71882fg.c
Revision Date Author Comments
522928a87fb98f0d6c99a5d66d2049768be6935b 14-Sep-2013 Guenter Roeck <linux@roeck-us.net> hwmon: (f71882fg) Remove extra return statement

Leftover from commit 33cd66e3 (hwmon: (f71882fg) Convert to use
devm_ functions).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
a8b3a3a53f9a814e9938ea9cc179086ff5c0a387 30-Jul-2013 Jingoo Han <jg1.han@samsung.com> hwmon: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2a844c148e1f714ebf42cb96e1b172ce394c36c9 09-Jan-2013 Guenter Roeck <linux@roeck-us.net> hwmon: Replace SENSORS_LIMIT with clamp_val

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>
6c931ae1c09a9618852c9619dac71f1f77776e3b 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> hwmon: remove use of __devinit

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>
33cd66e3c8048f03b9cc107b7a21c29cfd700ab7 02-Jun-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (f71882fg) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
0038389add7388954d74985ce7e631076216cf02 04-Aug-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (f71882fg) Fix build warning

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>
20eaf7247ed9ea15c0e117cf58206f3b64219382 19-Jan-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (f71882fg) Fix multi-line comments

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1dc370899f97ae281ff2a63df39b8d574dd67cc0 08-Jan-2012 Frans Meulenbroeks <fransmeulenbroeks@gmail.com> hwmon: (f71882fg) fix checkpatch issues

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>
179c4fdb565dd2157e5dfe89318b74868e3b523d 04-Jan-2012 Frans Meulenbroeks <fransmeulenbroeks@gmail.com> hwmon: replaced strict_str* with kstr*

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>
6543439f19b829f94a37e1ea277ead76e93b917f 09-Sep-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Make the decision wether to register fan attr. per fan

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>
9af0794c63ab1fbced7aa6f9d918ee0f7e7c45e5 09-Sep-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Add a f71882fg_create_fan_sysfs_files helper function

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>
5584014256f704e1031d10d0bd291bc52fab5c40 09-Sep-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Make all fan/pwm attr tables 2 dimensional

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>
5da556e33fc53179a5bec10b5698e262cf68e26d 03-Jul-2011 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for the F71869A

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>
7958e3b45dd03bf4bc35b3ec97b8a9a4d6c616a5 03-Jul-2011 Hans de Goede <hdegoede@redhat.com> hwmon: Use <> rather than () around my e-mail address

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
629c58bac082ae091e518187d63249fa7e9f796f 25-May-2011 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for F71808A

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
4d53811a28090b7583bb68fda294e0f009679770 25-May-2011 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Split has_beep in fan_has_beep and temp_has_beep

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>
a66c10887ad2a99e172111cc94087ba4bed8fa92 26-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for the F71889A

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>
383586b12d89ba4297c49898645658cdb324b918 26-Mar-2011 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Add support for the F81865F

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>
5d7f77bf66bfa986754b3e12073bef0ab8cd61bd 26-Mar-2011 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Document all supported devices

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>
f27def07bfb296d5eb441cd5777d351c7afcb4a1 26-Mar-2011 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Per-chip fan/temperature input count tables

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>
2740c60c4ab9a8c6169d7925014f57440361f698 26-Mar-2011 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Secure chip property definition arrays

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>
e5e713cbe812e8b9ef2099694be7c587c51438c4 10-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Add support for f71808e

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>
c11bb993629078264f72f8de8d48d7c3286c4c3e 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Add support for f71869f and f71869e

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>
3cad402281607d4db0d99d88fbd67cabb7c5b9f1 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Add support for f71889ed

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>
e48a7f1a719b258ee8bd2e809205d6d0f9d66aed 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Break out test for auto pwm's controlled by digital readings

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>
78aa4f72b30e4f2c631f6f550a911aad24769cfd 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Separate temp beep sysfs attr from the other temp sysfs attr

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>
2a91946ac94765d22ebdc4afdeb2bf7028bfe623 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Remove bogus temp2_type for certain models

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>
60d2b378bb7ad1624d1332821da750d1eec50c53 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Make number of temps configurable

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>
0bae640088b5bd6c7a2a691ad20543d69c2b9b2c 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Make creation of in sysfs attributes more generic

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>
98f7ba197f9ef366856b5cc9ef4f46e852f3d1c8 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Only allow negative auto point temps if fan_neg_temp is enabled

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
44c4dc521e99c0b2946973090b27c9bd4eb81b63 09-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Fix temp1 sensor type reporting

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>
d9ebaa45472c92704f4814682eec21455edcfa1f 13-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Set platform drvdata to NULL later

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>
14a4019de88111d26ba444495fd14833ddb2d65e 13-Mar-2011 Hans de Goede <hdegoede@redhat.com> hwmon/f71882fg: Fix a typo in a comment

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>
22d3b41281b4c1a55086fa4dff7abb4f0c36403e 20-Oct-2010 Joe Perches <joe@perches.com> hwmon: (f71882fg) Use pr_fmt and pr_<level>

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>
cadb86570c41fe52a0ea741f1f9775e3412f0167 03-Oct-2010 Giel van Schijndel <me@mortis.eu> hwmon: f71882fg: use a muxed resource lock for the Super I/O port

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>
f2e41e910320197d55b52e28d99a07130f2ae738 19-Aug-2010 Andrew Morton <akpm@linux-foundation.org> revert "hwmon: f71882fg: add support for the Fintek F71808E"

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>
7721fea3d0fd93fb4d000eb737b444369358d6d3 10-Aug-2010 Giel van Schijndel <me@mortis.eu> hwmon: f71882fg: add support for the Fintek F71808E

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>
729d273aa7c86eb1406ade4eadf249cff188bf9a 27-May-2010 Giel van Schijndel <me@mortis.eu> hwmon: (f71882fg) Acquire I/O regions while we're working with them

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>
bd328acdc6160b95f5d7127a9df3172892f35627 27-May-2010 Giel van Schijndel <me@mortis.eu> hwmon: (f71882fg) Code cleanup

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>
e8a4eacaa93853f977b0420ca42c471d528f93af 27-May-2010 Giel van Schijndel <me@mortis.eu> hwmon: (f71882fg) Use strict_stro(l|ul) instead of simple_strto$1

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>
162bb59e498a15e27717bcc0831b97d393f2290d 27-May-2010 Giel van Schijndel <me@mortis.eu> hwmon: (f71882fg) Fixed braces coding style issues

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>
7669896f499e1bce5cfb38f2685ff583ecdb24dd 09-Dec-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for the f71889fg (version 2)

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>
fc16c56e694d361388bae701894fd719dbc0f7eb 09-Dec-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Fix sysfs file removal

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>
b69b039922673dfabe0b5774f2e313f2a2297d01 09-Dec-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Cleanup sysfs attr creation 2/2

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>
66344aa6adc4397f79f134ad122072dbe5abcb48 09-Dec-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Cleanup sysfs attr creation 1/2

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>
09475d32e652fe60901fe8c9cd50f3f6db0c4933 15-Jun-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for the F71858F

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>
b6858bca8d7bf52e2564cba5a5ed87e1019d3fd9 15-Jun-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add temp#_fault sysfs attr for f8000

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>
996cadb2bf3787adcf4e164e1b351966c9e787f6 15-Jun-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Sanity check f8000 pwm settings

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>
3fc7838a20cdd9aab0077f355b8c44135cd4b6bd 15-Jun-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Cleanup f8000 pwm handling

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>
cd659fd0d7c91b7830d1fea0c76a640e171d2d43 15-Jun-2009 Jean Delvare <khali@linux-fr.org> hwmon: Fix more __devexit_p glitches

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>
18632f84fac770125c0982dfadec6b551e82144e 17-Feb-2009 Hans de Goede <hdegoede@redhat.com> hwmon: Fix ACPI resource check error handling

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>
603eaa1bdd3e0402085e815cc531bb0a32827a9e 17-Feb-2009 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Hide misleading error message

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>
b9acb64a385c5b26fc392e0d58ac7b8e0a2cd812 07-Jan-2009 Jean Delvare <jdelvare@suse.de> hwmon: Check for ACPI resource conflicts

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>
2f650631b3710622666367474b5475ff81ba486e 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Fix fan_to/from_reg prototypes

The RPM after conversion from / before conversion to a register value can be
much more than 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
28ba858798d5c70513cd8b9742841fd1bd49a074 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Printout fan modes

Print the mode (duty-cycle or RPM) of each fan on driver load.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
30453018655a3acd5f59e793da55a2f969ed9c32 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Fix auto_channels_temp temp numbering with f8000

Adjust auto_channels_temp show and store functions for different numbering of
temps between f8000 and other supported models.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
4901062f78401f09ef0296466172905c93575ddd 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add missing pwm3 attr for f71862fg

For some reason the fan_attr array for the f71862fg was missing the attr for
the 3th pwm output. This patch fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
ed4f7c20b346294959a16d35443def922e5e1e59 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add F8000 support

And (finally) the patch actually adding f8000 support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
4c82c38ae29a01338b5104b0111cecefaf3a1025 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Remove the fan_mode module option

Remove the fan_mode module option it was a monstrosity to begin with, and
when adding support for the F8000 it becomes a real pain!

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
754a5907b01687089382e362753dcceaca58ee66 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Separate max and crit alarm and beep

While studying the datasheets for adding F8000 support, I noticed that the
F718x2 has separate alarms (and beep control) for its max and crit limits.

We keep the temp#_alarm attributes as they are, even though it would be more
logical to rename them to temp#_max_alarm. Because lm_sensors v2 depends
on them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
12d66e840b605265d6adf4b800cc3fc5fb410903 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Check for hwmon powerdown state

More F8000 prep work. Take over the checking if the hwmon part is not
powered down from the standalone f8000 driver.

This check is valid for all supported models.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
bc27490f9164281b9e1768a5df8e0951541f90a1 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Cleanup fan and temp hyst functions

Simplify fan and temp hyst. handling by treating the registers as an array of
nibbles instead of using switch cases. Also unify the way hysts are handled
between temp and fans, the temp code was storing the actual per temp hyst
values in 4 u8's, where as the fan code was storing actual register values.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
ce0bfa5ee25ddbe4072b16054e809f552bf72320 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Fix various sysfs callback function issues

While working on adding F8000 support I noticed that various of the
store sysfs functions (and a few of the show also) had issues.

This patch fixes the following issues in these functions:
* store: storing the result of strto[u]l in an int, resulting in a possible
overflow before boundary checking
* store: use of f71882fg_update_device(), we don't want to read the whole
device in store functions, just the registers we need
* store: use of cached register values instead of reading the needed regs
in the store function, including cases where f71882fg_update_device() was
not used, this could cause real isues
* show: shown value is a calculation of 2 or more cached register reads,
without locking the data struct.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
7567a0435520fe61420ff2cdc4cec1b5399a5134 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Prepare for adding F8000 support

This patch is a preparation patch for adding F8000 support to the f71882fg
driver. If you look at the register addresses and esp, the bits used for
the temperature channels, then you will notice that it appears that they
start at 1 in a system meant to start at 0. As the F8000 actually uses the 0
addresses and bits, this patch changes the f71882fg driver to take 4
temperatures numbered 0-3 in to account, using 1-3 in this new scheme for
the temperatures actually present in the F718x2FG.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
3cc74758a667c5ad46fa5d6810ce701095370d35 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Move some io access from the detect to the probe function

The f71882fg driver did some io to ioports it hadn't reserved yet in its
find (detect) function, this patches moves this io to the probe function
where these ports are reserved and this io belongs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
498be96834bf88a44db2f4a3115688c882e6f3e3 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Add support for the F71862FG superio sensors

This patch adds support for the Fintek f71862fg superio monitoring
functions to the f71882fg driver.

This support has been tested without problems on a Jetway J9F2 by
Tony McConnell.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
c13548c531ff40501aee1c1dd6f474c3c6adfcd5 07-Jan-2009 Hans de Goede <hdegoede@redhat.com> hwmon: (f71882fg) Style cleanups and put some repeating code into functions

Various small cleanups as preparation for adding f71862fg support to the
f71882fg driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
9ab796ebe185257013f0ac505ecbe7abf068a608 07-Jan-2009 Mark van Doesburg <mark.vandoesburg@hetnet.nl> hwmon: (f71882fg) Add PWM support

Add PWM (fan speed control) support to the f71882fg driver. Both
manual control and automatic (temperature-based) modes are supported.
Additionally, each mode has a PWM-based and an RPM-based variant. By
default we use the mode set by the BIOS.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: Mark van Doesburg <mark.vandoesburg@hetnet.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
77a4a3e2a36aea5896f86653f6b77168d578c962 07-Jan-2009 Mark van Doesburg <mark.vandoesburg@hetnet.nl> hwmon: (f71882fg) Misc cleanups

A few cleanups that were originally part of a larger patch but are
better submitted separately.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: Mark van Doesburg <mark.vandoesburg@hetnet.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
bc37ae71207ca899efb93be1fe6b000366debc3a 07-Jan-2009 Mark van Doesburg <mark.vandoesburg@hetnet.nl> hwmon: (f71882fg) Use sensor_device_attribute_2

Convert f71882fg driver from SENSOR_ATTR to SENSOR_ATTR2 use, this is a
preparation patch for adding pwm support, which is broken out to make what
changes really in the pwm support patch clear.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: Mark van Doesburg <mark.vandoesburg@hetnet.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
05a5e477687ac7a22c0791b3e899ed7d539f7b95 06-Aug-2008 Jean Delvare <khali@linux-fr.org> hwmon: (f71882fg) Delete needless forward declarations

These functions aren't used before being defined, so there's no point
in forward-declaring them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
67b671bceb4a8340a30929e9642620d99ed5ad76 06-Dec-2007 Jean Delvare <khali@linux-fr.org> hwmon: Let the user override the detected Super-I/O device ID

While it is possible to force SMBus-based hardware monitoring chip
drivers to drive a not officially supported device, we do not have this
possibility for Super-I/O-based drivers. That's unfortunate because
sometimes newer chips are fully compatible and just forcing the driver
to load would work. Instead of that we have to tell the users to
recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based
hardware monitoring drivers, letting advanced users force the driver
to load on their machine. The user has to provide the device ID of a
supposedly compatible device. This requires looking at the source code or
a datasheet, so I am confident that users can't randomly force a driver
without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and
unintrusive.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
1beeffe43311f64df8dd0ab08ff6b1858c58363f 20-Aug-2007 Tony Jones <tonyj@suse.de> hwmon: Convert from class_device to device

Convert from class_device to device for hwmon_device_register/unregister

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
8afb10490b18e916e33707baa7d1cfc615d545ea 22-Aug-2007 Mark M. Hoffman <mhoffman@lightlink.com> hwmon: (f71882fg) trivial whitespace cleanup

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
45fb366940d51c309581813ef35bb70a9e34b17d 13-Jul-2007 Hans de Goede <j.w.r.degoede@hhs.nl> hwmon: add support for Fintek F71882FG and F71883FG

This is the second version of a new driver for the hardware monitoring features
of the Fintek F71882FG and F71883FG Super-I/O chips. This version has several
small fixes for flaws discovered during the review of the first version.

This version of the driver does not support the pwm part of these chips (yet).
I'll first design a sysfs api for this and post that for discussion, and then
implement pwm support as an incremental patch over this one.

This driver supports all sensors of this chip, except for the vid inputs. The
vid inputs are somewhat documented in the datasheet, but I know nothing about
vid/vrm stuff. Help with this would be much appreciated.

Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>