summaryrefslogtreecommitdiff
path: root/drivers/hwmon/dme1737.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-10hwmon: (dme1737) Fix overflows seen when writing into limit attributesGuenter Roeck1-12/+16
Writes into voltage limit, temperature limit, temperature hysteresis, and temperature zone attributes can overflow due to unclamped parameters to multiplications, additions, and subtractions. Cc: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (dme1737) use permission-specific DEVICE_ATTR variantsJulia Lawall1-9/+9
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: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-10-20hwmon: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-06hwmon: (dme1737) Prevent overflow problem when writing large limitsAxel Lin1-15/+18
On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from long to int to fix the problem. Voltage limits, fan minimum speed, pwm frequency, pwm ramp rate, and other attributes have the same problem, fix them as well. Zone temperature limits are signed, but were cached as u8, causing unepected values to be reported for negative temperatures. Cache as s8 to fix the problem. vrm is an u8, so the written value needs to be limited to [0, 255]. Signed-off-by: Axel Lin <axel.lin@ingics.com> [Guenter Roeck: Fix zone temperature cache] Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck1-34/+34
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>
2013-01-26hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck1-8/+7
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 __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-24hwmon: (dme1737) Convert to use devm_ functionsGuenter Roeck1-32/+13
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (dme1737) Fix checkpatch issuesGuenter Roeck1-216/+290
Fixed: WARNING: braces {} are not necessary for any arm of this statement WARNING: braces {} are not necessary for single statement blocks WARNING: simple_strtol is obsolete, use kstrtol 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: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-01-13module_param: make bool parameters really bool (drivers & misc)Rusty Russell1-2/+2
module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-04switch sysfs_chmod_file() to umode_tAl Viro1-3/+3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-01-12hwmon: (dme1737) Minor cleanupsJuerg Haefliger1-48/+73
Minor cleanups. Mostly removing assignments in if statements to get rid of checkpatch errors. Signed-off-by: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-01-12hwmon: (dme1737) Add support for in7 for SCH5127Juerg Haefliger1-15/+53
Add support for the 1.5V voltage monitoring input (in7) of the SMSC SCH5127 chip. Signed-off-by: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-01-08hwmon: (dme1737) Use pr_fmt and pr_<level>Joe Perches1-6/+6
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-05-27hwmon: (dme1737) Add SCH5127 supportJuerg Haefliger1-103/+225
Add support for the hardware monitoring capabilities of the SCH5127 chip to the dme1737 driver. Signed-off-by: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Jeff Rickman <jrickman@myamigos.us>
2009-12-14i2c: Drop I2C_CLIENT_INSMOD_2 to 8Jean Delvare1-5/+1
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>
2009-12-14i2c: Get rid of struct i2c_client_address_dataJean Delvare1-1/+1
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>
2009-12-14i2c: Drop the kind parameter from detect callbacksJean Delvare1-1/+1
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>
2009-12-09hwmon: Clean up detect functionsJean Delvare1-21/+11
As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Acked-by: "Hans J. Koch" <hjk@linutronix.de> Cc: Rudolf Marek <r.marek@assembler.cz>
2009-10-24hwmon: (dme1737) No vid attributes for SCH311xJean Delvare1-5/+24
The SCH311x chips do not have VID inputs, so the cpu0_vid and vrm attributes shouldn't be created for them. This fixes lm-sensors ticket #2353: http://www.lm-sensors.org/ticket/2353 Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Udo van den Heuvel <udovdh@xs4all.nl> Cc: Juerg Haefliger <juergh@gmail.com>
2009-09-23dme1737: Keep index within pwm_config[]Roel Kluin1-1/+1
The static code scanner "Parfait" reported this because pwm_config is only 3 bytes - pwm_config[3] is out of range. Since this code path is never called with ix == 3 (the device has no PWM4 output) this doesn't change anything in practice. But to encourage testing with Parfait, lets make the warning go away... Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-15hwmon: Include <linux/io.h> instead of <asm/io.h>H Hartley Sweeten1-1/+1
Drivers should be including <linux/io.h> instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Nicolas Boichat <nicolas@boichat.ch> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Frank Seidel <frank@f-seidel.de> Acked-by: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-07hwmon: Check for ACPI resource conflictsJean Delvare1-0/+5
Check for ACPI resource conflicts in hwmon drivers. I've included all Super-I/O and PCI drivers. I've voluntarily left out: * Vendor-specific drivers: if they conflicted on any system, this would pretty much mean that they conflict on all systems, and we would know by now. * Legacy ISA drivers (lm78 and w83781d): they only support chips found on old designs were ACPI either wasn't supported or didn't deal with thermal management. * Drivers accessing the I/O resources indirectly (e.g. through SMBus): the checks are already done where they belong, i.e. in the bus drivers. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: David Hubbard <david.c.hubbard@gmail.com>
2008-10-14hwmon: (dme1737) Convert to a new-style i2c driverJean Delvare1-58/+48
The new-style dme1737 driver implements the optional detect() callback to cover the use cases of the legacy driver. I don't actually expect any new-style device for that driver, but as the old i2c API is going away soon, we have to switch to the new one. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Juerg Haefliger <juergh@gmail.com>
2008-10-14hwmon: (dme1737) Be less i2c-centricJean Delvare1-115/+111
The dme1737 driver support both LPC (ISA) and SMBus devices. At the moment it's rather i2c-centric, and LPC variants use a fake i2c_client for some operations. In a near future, i2c_client will be allocated by i2c-core rather than by the device drivers, so non-i2c drivers will not have one. As a preparation step, change the driver code to no longer assume that an i2c_client structure is always available. No functional change. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Juerg Haefliger <juergh@gmail.com>
2008-08-07hwmon: (dme1737) Add support for the SMSC SCH5027Juerg Haefliger1-63/+130
Add support for the SCH5027. The differences to the DME1737 are: - No support for programmable temp offsets - In auto mode, PWM outputs stay on min value if temp goes below low threshold and can't be programmed to fully turn off - Different voltage scaling - No VID input Signed-off-by: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-08-07hwmon: (dme1737) Skip detection if forcedJuerg Haefliger1-6/+9
Skip the checking of the device ID register in the hwmon register block if the force_id option is used. Signed-off-by: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-08-07hwmon: (dme1737) CleanupsJuerg Haefliger1-47/+47
Fix names of attribute structs to make them more consistent with the rest of the code. Minor comment changes. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-08-01hwmon: (dme1737) fix voltage scalingJuerg Haefliger1-11/+21
This patch fixes a voltage scaling issue for the sch311x device. Signed-Off-By: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-08-01hwmon: (dme1737) probe all addressesJuerg Haefliger1-1/+9
This patch adds a module load parameter to enable probing of non-standard LPC addresses 0x162e and 0x164e when scanning for supported ISA chips. Signed-Off-By: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-08-01hwmon: (dme1737) demacrofy for readabilityJuerg Haefliger1-101/+154
This patch gets rid of a couple of macros previously used for sysfs attribute generation and manipulation. This makes the source a little bigger but a lot more readable and maintainable. It also fixes an issue with pwm5 & pwm6 attributes not being created read-only initially. Signed-Off-By: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-19hwmon: normal_i2c arrays should be constMark M. Hoffman1-1/+1
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-08hwmon: (dme1737) fix Super-IO device ID overrideJuerg Haefliger1-1/+1
The dme1737 has a second place where the Super-IO device ID is checked. This has been missed by Jean's initial patch that adds support for user-controlled Super-IO device ID override. This patch fixes this issue. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-08hwmon: (dme1737) fix divide-by-0Juerg Haefliger1-4/+11
This patch fixes a possible divide-by-0 and a minor bug in the FAN_FROM_REG macro (in TPC mode). Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-08hwmon: Let the user override the detected Super-I/O device IDJean Delvare1-1/+5
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>
2007-10-11hwmon: (dme1737) Add sch311x supportJuerg Haefliger1-41/+334
This patch adds support for the SMSC SCH3112, SCH3114, and SCH3116 Super-I/O chips. These chips feature identical hardware monitoring capabilites with the expection that some of the fan inputs and pmw outputs don't exist. The hardware monitoring features of the SCH311x chips can only be accessed via the ISA bus. The driver therefore registers as a platform driver, if such a chip is detected. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-11hwmon: (dme1737) Fix some merge conflictsMark M. Hoffman1-277/+312
class_dev -> hwmon_dev Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-11hwmon: (dme1737) group functions logicallyJuerg Haefliger1-48/+58
Move functions to group them logically. Device and I2C functions go in separate places. No functional changes (really!). Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-11hwmon: (dme1737) cleanupsJuerg Haefliger1-233/+258
This patch cleans up and prepares the dme1737 driver for support of the sch311x chips. (Almost) no functional changes. - Replaced whitespaces with tabs. - Removed empty lines. - Added _i2c_ to names of functions that are strictly I2C related. - Added 4 new functions: dme1737_create_files, dme1737_remove_files, dme1737_sio_enter, and dme1737_sio_exit. - Added error messages in case client attach/detach fails. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-10hwmon: Convert from class_device to deviceTony Jones1-5/+5
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>
2007-07-31hwmon: fix dme1737 temp fault attributeJuerg Haefliger1-1/+1
Fix temp?_fault attribute. The temp was incorrectly compared against 0x0800 rather than 0x8000. Only the upper 8 bits are compared as the datasheet doesn't specify what happens to the lower bits in case of a diode fault. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-07-19hwmon: New SMSC DME1737 driverJuerg Haefliger1-0/+2080
Add support for the hardware monitoring and fan control capabilities of the SMSC DME1737 and Asus A8000 Super-I/O chips. The hardware monitoring logic of this chip is similar to the LM85 but has some additional features that this driver supports. Even though it's a Super-I/O chip, the hardware monitoring logic can only be accessed via SMBus. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>