aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/dme1737.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-23hwmon: (dme1737) use simple i2c probeStephen Kitt1-4/+5
As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. Signed-off-by: Stephen Kitt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61Thomas Gleixner1-14/+1
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 <[email protected]> Reviewed-by: Michael Ellerman <[email protected]> (powerpc) Reviewed-by: Richard Fontana <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
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 <[email protected]> [groeck: Updated description] Signed-off-by: Guenter Roeck <[email protected]>
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 <[email protected]>
2014-08-05hwmon: (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 <[email protected]> [Guenter Roeck: Fix zone temperature cache] Cc: [email protected] Signed-off-by: Guenter Roeck <[email protected]>
2013-04-07hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck1-34/+34
Cc: Corentin Labbe <[email protected]> Cc: Mark M. Hoffman <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Rudolf Marek <[email protected]> Cc: Jim Cromie <[email protected]> Cc: Roger Lucas <[email protected]> Cc: Marc Hulsman <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2013-01-25hwmon: 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 <[email protected]> Acked-by: George Joseph <[email protected]> Acked-by: Jean Delvare <[email protected]>
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 <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Alistair John Strachan <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Clemens Ladisch <[email protected]> Cc: Rudolf Marek <[email protected]> Cc: Jim Cromie <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Roger Lucas <[email protected]> Acked-by: Guenter Roeck <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Alistair John Strachan <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Clemens Ladisch <[email protected]> Cc: Rudolf Marek <[email protected]> Cc: Jim Cromie <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Roger Lucas <[email protected]> Acked-by: Guenter Roeck <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Alistair John Strachan <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Clemens Ladisch <[email protected]> Cc: Rudolf Marek <[email protected]> Cc: Jim Cromie <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Roger Lucas <[email protected]> Acked-by: Guenter Roeck <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-23hwmon: (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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2012-03-18hwmon: (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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
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 <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
2012-01-03switch sysfs_chmod_file() to umode_tAl Viro1-3/+3
Signed-off-by: Al Viro <[email protected]>
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 <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
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 <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
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 <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Tested-by: Jeff Rickman <[email protected]>
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 <[email protected]> Tested-by: Wolfram Sang <[email protected]>
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 <[email protected]> Tested-by: Wolfram Sang <[email protected]>
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 <[email protected]> Tested-by: Wolfram Sang <[email protected]>
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 <[email protected]> Acked-by: Corentin Labbe <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Riku Voipio <[email protected]> Acked-by: "Hans J. Koch" <[email protected]> Cc: Rudolf Marek <[email protected]>
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 <[email protected]> Tested-by: Udo van den Heuvel <[email protected]> Cc: Juerg Haefliger <[email protected]>
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 <[email protected]> Acked-by: Jean Delvare <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
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 <[email protected]> Cc: Alistair John Strachan <[email protected]> Cc: Nicolas Boichat <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Frank Seidel <[email protected]> Acked-by: Jim Cromie <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Roger Lucas <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
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 <[email protected]> Acked-by: David Hubbard <[email protected]>
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 <[email protected]> Cc: Juerg Haefliger <[email protected]>
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 <[email protected]> Cc: Juerg Haefliger <[email protected]>
2008-08-06hwmon: (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 <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
2008-08-06hwmon: (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 <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
2008-08-06hwmon: (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 <[email protected]>
2008-07-31hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-07-31hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-07-31hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-18hwmon: normal_i2c arrays should be constMark M. Hoffman1-1/+1
Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: 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 <[email protected]> Acked-by: Hans de Goede <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-10hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-10hwmon: (dme1737) Fix some merge conflictsMark M. Hoffman1-277/+312
class_dev -> hwmon_dev Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-10hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-10hwmon: (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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-09hwmon: 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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kay Sievers <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-07-30hwmon: 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 <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
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 <[email protected]>