History log of /linux-master/drivers/hwmon/lm85.c
Revision Date Author Comments
# 8d84910a 10-Aug-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

hwmon: (lm85) fix Wvoid-pointer-to-enum-cast warning

'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

lm85.c:1562:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810093157.94244-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 39f03438 14-Jul-2023 Rob Herring <robh@kernel.org>

hwmon: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230714174607.4057185-1-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 1975d167 05-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

hwmon: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230505131718.1210071-1-u.kleine-koenig@pengutronix.de
[groeck: Added missing change in pmbus/acbel-fsg032.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# f2f394db 18-Aug-2022 Wolfram Sang <wsa+renesas@sang-engineering.com>

hwmon: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210014.6769-1-wsa+renesas@sang-engineering.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 952a11ca 24-Sep-2021 Paul Fertser <fercerpav@gmail.com>

hwmon: cleanup non-bool "valid" data fields

We have bool so use it consistently in all the drivers.

The following Coccinelle script was used:

@@
identifier T;
type t = { char, int };
@@
struct T {
...
- t valid;
+ bool valid;
...
}

@@
identifier v;
@@
(
- v->valid = 0
+ v->valid = false
|
- v->valid = 1
+ v->valid = true
)

followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'

Few whitespace changes were fixed manually. All modified drivers were
compile-tested.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com
[groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 67487038 13-Aug-2020 Stephen Kitt <steve@sk2.org>

hwmon: use simple i2c probe function

Many hwmon drivers don't use the id information provided by the old
i2c probe function, and the remainder can easily be adapted to the new
form ("probe_new") by calling i2c_match_id explicitly.

This avoids scanning the identifier tables during probes.

Drivers which didn't use the id are converted as-is; drivers which did
are modified as follows:

* if the information in i2c_client is sufficient, that's used instead
(client->name);
* anything else is handled by calling i2c_match_id() with the same
level of error-handling (if any) as before.

A few drivers aren't included in this patch because they have a
different set of maintainers. They will be covered by other patches.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20200813160222.1503401-1-steve@sk2.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 74ba9207 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
675 mass ave cambridge ma 02139 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 441 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7bc85e49 22-Jan-2019 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 20b497ab 04-Apr-2019 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/lm85.c:1645:34: warning:
‘lm85_of_match’ defined but not used

Mark lm85_of_match as __maybe_unused to ix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# e9b95485 04-Feb-2019 Jeremy Gebben <jgebben@sweptlaser.com>

hwmon: (lm85) add support for LM96000 high frequencies

The LM96000 expands the freqency field from 3 to 4 bits, to
add more frequencies in the 22.5 to 30 kHz ranges.

Signed-off-by: Jeremy Gebben <jgebben@sweptlaser.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 11650cf0 04-Feb-2019 Jeremy Gebben <jgebben@sweptlaser.com>

hwmon: (lm85) support the LM96000

It has been supported as a generic lm85 for quite some time.

Signed-off-by: Jeremy Gebben <jgebben@sweptlaser.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 57bc3019 04-Feb-2019 Jeremy Gebben <jgebben@sweptlaser.com>

hwmon: (lm85) remove freq_map size hardcodes

Allow support for chips that support more than 8 frequencies.

Signed-off-by: Jeremy Gebben <jgebben@sweptlaser.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 00c0f9d3 24-Feb-2017 Javier Martinez Canillas <javier@osg.samsung.com>

hwmon: (lm85) Add OF device ID table

The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# d0ed69d5 22-Dec-2016 Julia Lawall <Julia.Lawall@lip6.fr>

hwmon: (lm85) use permission-specific DEVICE_ATTR variants

Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for
read/write attributes. This simplifies the source code, improves
readbility, and reduces the chance of inconsistencies.

The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
[groeck: Update description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 67b20034 04-Dec-2016 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) Fix overflows seen when writing voltage limit attributes

Writes into voltage limit attributes can overflow due to an unbound
multiplication.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 0f3721c5 16-Apr-2015 Bartosz Golaszewski <bgolaszewski@baylibre.com>

hwmon: (lm85) use find_closest() in x_TO_REG() functions

Replace RANGE_TO_REG() and FREQ_TO_REG() implementations with
calls to find_closest().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 746f6884 22-Jul-2014 Axel Lin <axel.lin@ingics.com>

hwmon: (lm85) Convert to devm_hwmon_device_register_with_groups

Use devm_hwmon_device_register_with_groups() to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 6fd5dd58 22-Jul-2014 Axel Lin <axel.lin@ingics.com>

hwmon: (lm85) Avoid forward declaration

Reorder functions to avoid forward declaration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 3248c3b7 29-Jul-2014 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) Fix various errors on attribute writes

Temperature limit register writes did not account for negative numbers.
As a result, writing -127000 resulted in -126000 written into the
temperature limit register. This problem affected temp[1-3]_min,
temp[1-3]_max, temp[1-3]_auto_temp_crit, and temp[1-3]_auto_temp_min.

When writing pwm[1-3]_freq, a long variable was auto-converted into an int
without range check. Wiring values larger than MAXINT resulted in unexpected
register values.

When writing temp[1-3]_auto_temp_max, an unsigned long variable was
auto-converted into an int without range check. Writing values larger than
MAXINT resulted in unexpected register values.

vrm is an u8, so the written value needs to be limited to [0, 255].

Cc: Axel Lin <axel.lin@ingics.com>
Cc: stable@vger.kernel.org
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 590e8534 11-Jun-2014 Jean Delvare <jdelvare@suse.de>

hwmon: (lm85) Drop generic detection

Generic detection leads to too many false positives, so drop it. FWIW
sensors-detect does not have such generic detection. If the user wants
to force the driver to bind to a not yet supported chip, he/she can
still do so using sysfs attribute new_device.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 7c81c60f 29-Jan-2014 Jean Delvare <khali@linux-fr.org>

Update Jean Delvare's e-mail address

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# b55f3757 10-Jan-2013 Guenter Roeck <linux@roeck-us.net>

hwmon: Fix checkpatch warning 'quoted string split across lines'

Cc: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
Cc: Rudolf Marek <r.marek@assembler.cz>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Cc: Marc Hulsman <m.hulsman@tudelft.nl>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 2a844c14 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>


# 747e5d62 02-Jun-2012 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) 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>
Acked-by: Jean Delvare <khali@linux-fr.org>


# 09770b26 14-Jan-2012 Guenter Roeck <linux@roeck-us.net>

hwmon: (lm85) Fix checkpatch issues

Fixed:
ERROR: code indent should use tabs where possible
ERROR: do not use assignment in if condition
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead

Modify multi-line comments to follow Documentation/CodingStyle.

Also: s/#define^I/#define /

Not fixed (false positive):
ERROR: Macros with multiple statements should be enclosed in a do - while loop

Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# f0967eea 20-Jan-2012 Axel Lin <axel.lin@gmail.com>

hwmon: convert drivers/hwmon/* to use module_i2c_driver()

This patch converts the drivers in drivers/hwmon/* to use the
module_i2c_driver() macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Steve Glendinning <steve.glendinning@smsc.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com>
Cc: David George <david.george@ska.ac.za>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Marc Hulsman <m.hulsman@tudelft.nl>
Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>


# bc4d45f1 29-Apr-2011 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Fix error paths in probe function

We must remove all files we created, even in error cases.

Fixes second part of kernel bug #34072:
https://bugzilla.kernel.org/show_bug.cgi?id=34072

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>


# 5f441e22 29-Apr-2011 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Add missing list terminators

Fixes kernel bug #34072:
https://bugzilla.kernel.org/show_bug.cgi?id=34072

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 06923f84 19-Feb-2011 Guenter Roeck <guenter.roeck@ericsson.com>

hwmon: (lm85) Add support for EMC6D103S

EMC6D103S is similar to EMC6D103, only it does not support registers 62[5:7],
6D[0:7], and 6E[0:7]. Register respective sysfs attributes and update affected
registers for all other chips only.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>


# 4f8ab430 25-Feb-2011 Guenter Roeck <guenter.roeck@ericsson.com>

hwmon: (lm85) Do not update hysteresis and temp_auto_off if auto_temp_min is changed

So far, the driver updates temp_auto_hyst and temp_auto_off if temp_auto_min changes.
This may cause problems if temp_auto_off was not configured before configuring
temp_auto_min, because one of the variables used (off_desired) is not initialized
in this case.

To simplify the code, and for consistency with other drivers, no longer update the delta
between "min" and "off" until the user sets the "off" value again.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>


# bc6db2b5 25-Feb-2011 Guenter Roeck <guenter.roeck@ericsson.com>

hwmon: (lm85) Use function to remove sysfs attribute files

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>


# de248805 25-Feb-2011 Guenter Roeck <guenter.roeck@ericsson.com>

hwmon: (lm85) Use boolean to determine if VID5 is configured

ADT7463 and ADT7468 optionally support VID5 instead of the standard +12V
measurement input. Use a boolean to identify the chip configuration instead of
hardcoding it several times.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>


# f065a93e 18-Feb-2011 Jan Beulich <JBeulich@novell.com>

hwmon: (lm85) extend to support EMC6D103 chips

The interface is identical EMC6D102, so all that needs to be added are
some definitions and their uses.

Registers apparently missing in EMC6D103S/EMC6D103:A2 compared to EMC6D103:A0,
EMC6D103:A1, and EMC6D102 (according to the data sheets), but used
unconditionally in the driver: 62[5:7], 6D[0:7], and 6E[0:7]. For that
reason, EMC6D103S chips don't get enabled for the time being.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
(Guenter Roeck: Replaced EMC6D103_A2 with EMC6D103S per EMC6D103S datasheet)
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: stable@kernel.org


# f6c61cff 28-Oct-2010 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Add support for ADT7468 high-frequency PWM mode

The ADT7468 supports a high-frequency PWM output mode where all PWM
outputs are driven by a 22.5 kHz clock. Add support for this mode, and
document it, as it may surprise the user that setting one PWM output
frequency also affects the other PWM outputs.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>


# fa7a5797 28-Oct-2010 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Fix ADT7468 frequency table

The ADT7468 uses the same frequency table as the ADT7463.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>


# e5e9f44c 14-Dec-2009 Jean Delvare <khali@linux-fr.org>

i2c: Drop I2C_CLIENT_INSMOD_2 to 8

These macros simply declare an enum, so drivers might as well declare
it themselves. This puts an end to the arbitrary limit of 8 chip types
per i2c driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>


# c3813d6a 14-Dec-2009 Jean Delvare <khali@linux-fr.org>

i2c: Get rid of struct i2c_client_address_data

Struct i2c_client_address_data only contains one field at this point,
which makes its usefulness questionable. Get rid of it and pass simple
address lists around instead.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>


# 310ec792 14-Dec-2009 Jean Delvare <khali@linux-fr.org>

i2c: Drop the kind parameter from detect callbacks

The "kind" parameter always has value -1, and nobody is using it any
longer, so we can remove it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>


# d42a2eb5 09-Dec-2009 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Clean up detect function

As kind is now hard-coded to -1, there is room for code clean-ups.

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 5cfaf338 15-Sep-2009 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Don't bind to Winbond/Nuvoton WPCD377I

The Winbond/Nuvoton WPCD377I is the reduced version of a Super-I/O
which emulates the National Semiconductor LM96000 hardware monitoring
chips, but without the hardware monitoring part. Instead of plain
disabling the emulation, the vendor left the emulated chip visible,
but all monitored values are always zero. This is rather confusing for
the users. So detect this case and refuse to bind to such fake chips.

This fixes lm-sensors ticket #2182:
http://www.lm-sensors.org/ticket/2182

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 8ef1f029 10-Mar-2009 Darrick J. Wong <djwong@us.ibm.com>

lm85: add VRM10 support for adt7468 chip

The adt7468 chip supports VRM10 sensors just like the adt7463; add a
missing check for it.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c15ade65 10-Mar-2009 Darrick J. Wong <djwong@us.ibm.com>

lm85: fix the version check that broke adt7468 probing

The verstep check in the lm85 driver fails because the upper nibble of
the version register is 0x7, not 0x6, on the adt7468 chip. Probing of
all adt7468s was broken by 69fc1feba2d5856ff74dedb6ae9d8c490210825c
("hwmon: (lm85) Rework the device detection"), and this patch fixes
that. Also add in a missing i2c_device_id that accidentally got dropped
from the original patch.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 79b92f2b 12-Nov-2008 Darrick J. Wong <djwong@us.ibm.com>

lm85: support adt7468 chips

The adt7468 is a follow-on to the adt7463, so plumb in adt7468 support
along the same code paths.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# f908037a 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Better label names

Label names ERROR1 and ERROR3 aren't exactly explicit. Change them for
better names that indicate what we are up to.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 1b92adad 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Simplify RANGE_TO_REG

Function RANGE_TO_REG can easily be simplified. Credits go to Herbert
Poetzl for indirectly suggesting this to me. I tested that the new
implementation returns the same result as the original implementation
for all input values.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 67712d01 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Convert to a new-style i2c driver

The new-style lm85 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 8a0795d9 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Support different PWM frequency tables

The Analog Devices and SMSC devices supported by the lm85 driver do
not have the same PWM frequency table as the National Semiconductor
devices. Add support for per-device frequency tables.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 86010c98 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Select the closest PWM frequency

The LM85 and compatible chips only support 8 arbitrary PWM frequencies.
The algorithm to pick one of them based on the user input is not
optimum. Improve it to always pick the closest supported frequency.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 34e7dc6c 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Implement the standard PWM frequency interface

Implement the standard PWM frequency interface: pwm[1-*]_freq in
units of 1 Hz, instead of the non-standard pwm[1-*]_auto_pwm_freq
in units of 0.1 Hz. The old naming was not only non-standard, it was
also confusing, because it suggested that the frequency value only
applied in automatic fan speed mode, which isn't true.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 69fc1feb 17-Oct-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Rework the device detection

Rework the device detection to make it clearer and faster in the
general case (when a known device is found.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>


# 5f4475947 25-Jun-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Simplify device initialization function

Clean up and simplify the device initialization function:
* Degrade error messages to warnings - what they really are.
* Stop warning about VxI mode, we don't really care.
* Drop comment about lack of limit initialization - that's the standard
way, all hardware monitoring drivers do that.
* Only read the configuration register once.
* Only write back to the configuration register if needed.
* Don't attempt to clear the lock bit, it locks itself to 1.
* Move the function to before it's called, so that we no longer need to
forware declare it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# e89e22b2 25-Jun-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Misc cleanups

Misc cleanups to the lm85 hardware monitoring driver:
* Mark constant arrays as const.
* Remove useless masks.
* Have lm85_write_value return void - nobody is checking the returned
value anyway and in some cases it was plain wrong.
* Remove useless initializations.
* Rename new_client to client in lm85_detect.
* Replace cascaded if/else with a switch/case in lm85_detect.
* Group similar loops in lm85_update_device.
* Remove legacy comments.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 7133e56f 12-Apr-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Don't write back cached values

In set_pwm_auto_pwm_minctl, we write cached register bits back to the
chip. This is a bad idea as we have no guarantee that the cache is
up-to-date. Better read a fresh register value from the chip, it's
safer and in fact it is also more simple.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# dd1ac538 01-May-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Drop dead code

Drop a lot of useless register defines, conversion macros, data structure
members and update code. All these register values were read from the
device but nothing is done out of them, so this is all dead code in
practice.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 1f44809a 29-Apr-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Coding-style cleanups

Fix most style issues reported by checkpatch, including:
* Trailing, missing and extra whitespace
* Extra parentheses, curly braces and semi-colons
* Broken indentation
* Lines too long

I verified that the generated code is the same before and after
these changes.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# d38b1497 03-Apr-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Fix function RANGE_TO_REG()

Function RANGE_TO_REG() is broken. For a requested range of 2000 (2
degrees C), it will return an index value of 15, i.e. 80.0 degrees C,
instead of the expected index value of 0. All other values are handled
properly, just 2000 isn't.

The bug was introduced back in November 2004 by this patch:
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commit;h=1c28d80f1992240373099d863e4996cdd5d646d0

While this can be fixed easily with the current code, I'd rather
rewrite the whole function in a way which is more obviously correct.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Justin Thiessen <jthiessen@penguincomputing.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 25e9c86d 17-Feb-2008 Mark M. Hoffman <mhoffman@lightlink.com>

hwmon: normal_i2c arrays should be const

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 8f74efe8 01-Dec-2007 Jean Delvare <khali@linux-fr.org>

hwmon: VRM is not written to registers

What was true of reading the VRM value is also true of writing it: not
being a register value, it doesn't need hardware access, so we don't
need a reference to the i2c client. This allows for a minor code
cleanup. As gcc appears to be smart enough to simplify the generated
code by itself, this cleanup only affects the source code, the
generated binaries are unchanged.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 7b501b1f 03-Jan-2008 Jean Delvare <khali@linux-fr.org>

hwmon: Discard useless I2C driver IDs

Many I2C hwmon drivers define a driver ID but no other code references
these, meaning that they are useless. Discard them, along with a few
IDs which are defined but never used at all.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 455f791e 03-Dec-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Make the pwmN_enable files writable

Make the pwmN_enable files writable. This makes it possible to use
standard fan speed control tools (pwmconfig, fancontrol) with the lm85
driver.

I left the non-standard pwmN_auto_channels files in place, as they
give additional control for the automatic mode, and some users might
be used to them by now.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 4b4df95d 03-Dec-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Return standard values in pwmN_enable

The values returned by the lm85 driver in pwmN_enable sysfs files do
not match the standard. Fix that.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 90d6619a 08-Oct-2007 Jean Delvare <khali@linux-fr.org>

hwmon: VRM is not read from registers

The VRM value is not read from chip registers, so there's no need
to update the device data cache before exporting the VRM value to
user-space.

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>


# 63f281a6 05-Jul-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Let the user set the fan min limit to 0

Trying to set the fan min limit to 0 currently writes 0 to the
register, which is an invalid value. It's read back as -1 and the
alarm flag is raised. Instead we should write 0xffff (maximum
value), which reads back as 0 and no alarm flag is raised.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 5a4d3ef3 05-Jul-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Clean up the handling of additional resolution bits

The way the lm85 driver currently handles the additional resolution
bits some chips have for the voltage and temperature measurements is
quite complex. This is my attempt to make it simpler.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# bf76e9d3 05-Jul-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Add individual alarm files

The future libsensors needs these individual alarm and fault files.

Also delete old and unused alarm defines.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 6b9aad2d 05-Jul-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Export in5, in6 and in7 voltage channels

The SMSC EMC6D100 supports 3 additional voltage channels. The lm85
driver reads the register values for these, but doesn't create the
corresponding sysfs files, so the user can't read the values nor write
the limits. Create the missing sysfs files.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# b353a487 05-Jul-2007 Jean Delvare <khali@linux-fr.org>

hwmon: (lm85) Use dynamic sysfs callbacks

This lets us get rid of macro-generated functions and shrinks the
driver size by about 10%. I used a new style suggested by Mark M.
Hoffman to retrieve the channel number. Instead of:

struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
int nr = sda->index;

I do:

int nr = to_sensor_dev_attr(attr)->index;

This looks better, and even allows the compiler to do some minor
optimizations.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 1beeffe4 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>


# ed6bafbf 14-Feb-2007 Jean Delvare <khali@linux-fr.org>

hwmon: Cleanup a bogus legacy comment

Cleanup a bogus legacy comment that has been replicated to many
hardware monitoring drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 6a0b1013 14-Feb-2007 Jean Delvare <khali@linux-fr.org>

hwmon: Drop unused mutexes in two drivers

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 0501a381 24-Sep-2006 Mark M. Hoffman <mhoffman@lightlink.com>

hwmon: Fix unchecked return status, batch 2

hwmon: Fix unchecked return status, batch 2

Fix up some hwmon drivers so that they no longer ignore return status
from device_create_file().

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f6c27fc1 27-Feb-2006 Darren Jenkins <darrenrjenkins@gmail.com>

[PATCH] I2C: hwmon: Rename register parameters

"register" is a reserved keyword so using it as a parameter name
can confuse some compilers, most notably ICC.

The patch below just renames all occurences to reg which fits the actual
function declarations.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9a61bf63 18-Jan-2006 Ingo Molnar <mingo@elte.hu>

[PATCH] hwmon: Semaphore to mutex conversions

convert drivers/hwmon/*.c semaphore use to mutexes.

the conversion was generated via scripts, and the result was validated
automatically via a script as well.

all affected hwmon drivers were build-tested.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2b48716d 06-Dec-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer needed

Now that i2c_add_driver() doesn't need the module owner to be set by
hand, we can delete it from the drivers. This patch catches all of the
drivers that I found in the current tree (if a driver sets the .owner by
hand, it's not a problem, just not needed.)

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jean Delvare <khali@linux-fr.org>


# cdaf7934 26-Nov-2005 Laurent Riffard <laurent.riffard@free.fr>

[PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11

We should use the i2c_driver.driver's .name and .owner fields
instead of the i2c_driver's ones.

This patch updates the hwmon drivers.

Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 8a994755 26-Nov-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] i2c: Drop i2c_driver.flags, 2 of 3

Just about every i2c chip driver sets the I2C_DF_NOTIFY flag, so we
can simply make it the default and drop the flag. If any driver really
doesn't want to be notified when i2c adapters are added, that driver
can simply omit to set .attach_adapter. This approach is also more
robust as it prevents accidental NULL pointer dereferences.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9c516ef4 26-Nov-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] hwmon: Support the VRM 10 mode of the ADT7463

Support the VRM 10 mode of the ADT7463.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d8d20615 26-Oct-2005 Ben Dooks <ben-linux@fluff.org>

[PATCH] hwmon: Static function fixes, 2 of 4

lm78.c and lm85.c have a number of items declared static
then implemented without the static on them. The following
patch fixes these sparse errors.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ba9c2e8d 17-Oct-2005 Deepak Saxena <dsaxena@plexity.net>

[PATCH] hwmon: kzalloc conversion

Use kzalloc instead of kmalloc+memset in all hardware monitoring
drivers.

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 303760b4 31-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] hwmon: hwmon vs i2c, second round (07/11)

The only part left in i2c-sensor is the VRM/VRD/VID handling code.
This is in no way related to i2c, so it doesn't belong there. Move
the code to hwmon, where it belongs.

Note that not all hardware monitoring drivers do VRM/VRD/VID
operations, so less drivers depend on hwmon-vid than there were
depending on i2c-sensor.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f4b50261 31-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] hwmon: hwmon vs i2c, second round (06/11)

The only thing left in i2c-sensor.h are module parameter definition
macros. It's only an extension of what i2c.h offers, and this extension
is not sensors-specific. As a matter of fact, a few non-sensors drivers
use them. So we better merge them in i2c.h, and get rid of i2c-sensor.h
altogether.

Signed-off-by: Jean Delvare <khali@linux-fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2ed2dc3c 31-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] hwmon: hwmon vs i2c, second round (04/11)

i2c_probe and i2c_detect now do the exact same thing and operate on
the same data structure, so we can have everyone call i2c_probe.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5cb80229 29-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] hwmon: lm85: trivial cleanups

Remove an unused macro and an outdated comment from the lm85 driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 02ff982c 19-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9)

Kill all uses of i2c_is_isa_adapter except for the hybrid drivers (it87,
lm78, w83781d). The i2c-isa adapter not being registered with the i2c
core anymore, drivers don't have to fear being erroneously attached to
it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5071860a 19-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)

Kill normal_isa in header files, documentation and all chip drivers, as
it is no more used.

normal_i2c could be renamed to normal, but I decided not to do so at the
moment, so as to limit the number of changes. This might be done later
as part of the i2c_probe/i2c_detect merge.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 943b0830 15-Jul-2005 Mark M. Hoffman <mhoffman@lightlink.com>

[PATCH] I2C hwmon: add hwmon sysfs class to drivers

This patch modifies sensors chip drivers to make use of the new
sysfs class "hwmon".

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 8d5d45fb 02-Jul-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Move hwmon drivers (2/3)

Part 2: Move the driver files themselves.

Note that the patch "adds trailing whitespace", because it does move the
files as-is, and some files happen to have trailing whitespace.

From: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>