summaryrefslogtreecommitdiff
path: root/drivers/hwmon
AgeCommit message (Collapse)Author
2014-03-05hwmon: (max1668) Fix writing the minimum temperatureGuenter Roeck
commit 500a91571f0a5d0d3242d83802ea2fd1faccc66e upstream. When trying to set the minimum temperature, the driver was erroneously writing the maximum temperature into the chip. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2014-02-22hwmon: (ntc_thermistor) Avoid math overflowDoug Anderson
commit d3d89c468ceebbcf9423d1a3d66c5bf91f569570 upstream. The ntc thermistor code was doing math whose temporary result might have overflowed 32-bits. We need some casts in there to make it safe. In one example I found: - pullup_uV: 1800000 - result of iio_read_channel_raw: 3226 - 1800000 * 3226 => 0x15a1cbc80 Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06hwmon: (k10temp) Add support for Kaveri CPUsPhil Pokorny
commit d303b1b5fbb688282bbf72a534b9dfed7af9fe4f upstream. Add new PCI ID to support new model "Kaveri" family. Signed-off-by: Philip Pokorny <ppokorny@penguincomputing.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-25hwmon: (coretemp) Fix truncated name of alarm attributesJean Delvare
commit 3f9aec7610b39521c7c69d754de7265f6994c194 upstream. When the core number exceeds 9, the size of the buffer storing the alarm attribute name is insufficient and the attribute name is truncated. This causes libsensors to skip these attributes as the truncated name is not recognized. Reported-by: Andreas Hollmann <hollmann@in.tum.de> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20hwmon: (w83l768ng) Fix fan speed control rangeJean Delvare
commit 33a7ab91d509fa33b4bcd3ce0038cc80298050da upstream. The W83L786NG stores the fan speed on 4 bits while the sysfs interface uses a 0-255 range. Thus the driver should scale the user input down to map it to the device range, and scale up the value read from the device before presenting it to the user. The reserved register nibble should be left unchanged. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20hwmon: (w83l786ng) Fix fan speed control mode setting and reportingBrian Carnes
commit cf7559bc053471f32373d71d04a9aa19e0b48d59 upstream. The wrong mask is used, which causes some fan speed control modes (pwmX_enable) to be incorrectly reported, and some modes to be impossible to set. [JD: add subject and description.] Signed-off-by: Brian Carnes <bmcarnes@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICKJosé Miguel Gonçalves
commit efabcc2123f0ed47870033b8d6fc73b50d76d635 upstream. Some I2C bus drivers do not allow zero-length data transfers which are required to start a measurement with the HIH6130/1 sensor. Nevertheless, we can overcome this limitation by writing a zero dummy byte. This byte is ignored by the sensor and was verified to be working with the OMAP I2C bus driver in a BeagleBone board. Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt> [Guenter Roeck: Simplified complexity of write_length initialization] Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20hwmon: Prevent some divide by zeros in FAN_TO_REG()Dan Carpenter
commit 3806b45ba4655147a011df03242cc197ab986c43 upstream. The "rpm * div" operations can overflow here, so this patch adds an upper limit to rpm to prevent that. Jean Delvare helped me with this patch. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-29hwmon: (lm90) Fix max6696 alarm handlingGuenter Roeck
commit e41fae2b1ed8c78283d73651cd65be0228c0dd1c upstream. Bit 2 of status register 2 on MAX6696 (external diode 2 open) sets ALERT; the bit thus has to be listed in alert_alarms. Also display a message in the alert handler if the condition is encountered. Even though not all overtemperature conditions cause ALERT to be set, we should not ignore them in the alert handler. Display messages for all out-of-range conditions. Reported-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-09hwmon: (applesmc) Always read until end of dataHenrik Rydberg
The crash reported and investigated in commit 5f4513 turned out to be caused by a change to the read interface on newer (2012) SMCs. Tests by Chris show that simply reading the data valid line is enough for the problem to go away. Additional tests show that the newer SMCs no longer wait for the number of requested bytes, but start sending data right away. Apparently the number of bytes to read is no longer specified as before, but instead found out by reading until end of data. Failure to read until end of data confuses the state machine, which eventually causes the crash. As a remedy, assuming bit0 is the read valid line, make sure there is nothing more to read before leaving the read function. Tested to resolve the original problem, and runtested on MBA3,1, MBP4,1, MBP8,2, MBP10,1, MBP10,2. The patch seems to have no effect on machines before 2012. Tested-by: Chris Murphy <chris@cmurf.com> Cc: stable@vger.kernel.org Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-26hwmon: (applesmc) Check key count before proceedingHenrik Rydberg
After reports from Chris and Josh Boyer of a rare crash in applesmc, Guenter pointed at the initialization problem fixed below. The patch has not been verified to fix the crash, but should be applied regardless. Reported-by: <jwboyer@fedoraproject.org> Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-12hwmon: (k10temp) remove unnecessary pci_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11hwmon: (tmp421) Fix return valueSachin Kamat
Propagate return value obtained from i2c_smbus_read_byte_data() instead of hardcoding. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Andre Prendel <andre.prendel@gmx.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11hwmon: (amc6821) Remove redundant breakSachin Kamat
'break' after return or goto has no effect. Remove it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: T. Mertelj <tomaz.mertelj@guest.arnes.si> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11hwmon: (amc6821) Fix return valueSachin Kamat
Propagate return value obtained from i2c_smbus_read_byte_data() instead of hardcoding. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: T. Mertelj <tomaz.mertelj@guest.arnes.si> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11hwmon: (ibmaem) Fix return valueSachin Kamat
Propagate appropriate error code obtained from ipmi_create_user() instead of hardcoding. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Darrick J. Wong <darrick.wong@oracle.com> Acked-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11hwmon: (emc2103) Fix return valueSachin Kamat
kstrtol() returns appropriate error values. Use those instead of hardcoding. Silences several sparse messages of following type: "why not propagate 'result' from kstrtol() instead of (-22)?" Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Steve Glendinning <steve.glendinning@shawell.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-10hwmon: (ina2xx) Remove casting the return value which is a void pointerJingoo Han
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-10hwmon: (hwmon-vid) Add __maybe_unused attribute to dummy variableGuenter Roeck
This gets rid of this warning: drivers/hwmon/hwmon-vid.c: In function 'get_via_model_d_vrm': drivers/hwmon/hwmon-vid.c:249:27: warning: variable 'dummy' set but not used [-Wunused-but-set-variable] Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-09-07Merge branch 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging Pull hwmon fixes from Jean Delvare. * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: hwmon: (emc6w201) Do not declare enum variable hwmon: (w83792d) Update module author
2013-09-06hwmon: (emc6w201) Do not declare enum variableGuenter Roeck
Fix the following smatch warning: emc6w201.c:52:26: warning: symbol 'subfeature' was not declared. Should it be static? 'enum { } subtype' declares an enum as (global) variable which we don't want. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-09-06hwmon: (w83792d) Update module authorShane Huang
w83792d was written by me in 2004, I'd like to update my first name into my current one to keep consistent, and delete invalid address. Signed-off-by: Shane Huang <shane.huang@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-09-03Merge tag 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: - new driver for HTU21D (humidity sensor) - add support for Fam16h (Kabini) to k10temp - add support for NCT6102D/6106D and NCT6791D to nct6775 driver - add support for ADS1115 to ads1015 driver - add support for hibernate to w83627ehf and nct6775 drivers - some minor cleanups * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (htu21) Add Measurement Specialties HTU21D support hwmon: Change my email address. hwmon: (k10temp) Add support for Fam16h (Kabini) hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0 hwmon: (ads1015) Add support for ADS1115 hwmon: (w83627ehf) Add support for hibernate hwmon: (nct6775) Add support for hibernate hwmon: use dev_get_platdata() hwmon: (nct6775) Fix size of data->temp array hwmon: (nct6775) Avoid using device platform data outside probe function hwmon: (nct6775) Add support for NCT6791D hwmon: (nct6775) Add support for beep attributes hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106 hwmon: (nct6775) Add support for NCT6102D/6106D hwmon: (nct6775) Support two SuperIO chips in the same system hwmon: (nct6775) Allocate attributes dynamically from templates hwmon: (coretemp) Atom CPUs don't support TjMax; no warning needed
2013-09-01Merge remote-tracking branch 'regulator/topic/optional' into regulator-nextMark Brown
2013-08-29hwmon: (htu21) Add Measurement Specialties HTU21D supportWilliam Markezana
Signed-off-by: William Markezana <william.markezana@meas-spec.com> [Guenter Roeck - minor formatting changes] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27hwmon: Change my email address.Darrick J. Wong
I've changed employers, so change the email addresses to match. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27hwmon: (k10temp) Add support for Fam16h (Kabini)Wei Hu
The temperature reporting interface stays the same, so we just add the PCI-ID to the list. Verified on AMD Olive Hill. Signed-off-by: Wei Hu <wei@aristanetworks.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0Dan Carpenter
The callers never check for negative but they sometimes check for zero returns: int reg = ADT7462_REG_VOLT_MAX(data, i); data->volt_max[i] = (reg ? i2c_smbus_read_byte_data(client, reg) : 0); Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-19hwmon: (sht15) Use devm_regulator_get_optional()Mark Brown
Since the sht15 driver supports operation without an external vref regulator the driver should use the new devm_regulator_get_optional() to indicate that a stub regulator should not be provided. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (ads1015) Add support for ADS1115Evgeniy Dushistov
This patch adds support for ads1115 device to ads1015 driver. Based on work of Emiliano Carnati <carnatiatebneuro.com>. Tested on ARM CPU based board. Signed-off-by: Evgeniy A. Dushistov <dushistov@mail.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (w83627ehf) Add support for hibernateHarald Judt
Hibernation uses its own set of callback functions, even if the code is the same as the code used for suspend/restore. Signed-off-by: Harald Judt <h.judt@gmx.at> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Add support for hibernateHarald Judt
Hibernation uses its own set of callback functions, even if the code is the same as the code used for suspend/restore. Signed-off-by: Harald Judt <h.judt@gmx.at> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: use dev_get_platdata()Jingoo Han
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>
2013-08-12hwmon: (nct6775) Fix size of data->temp arrayDan Carpenter
Smatch complains that we have a array overflow: drivers/hwmon/nct6775.c:1456 nct6775_update_device() error: buffer overflow 'data->temp' 4 <= 4 Guenter Roeck says that the array should have been made larger in 7cbbd6aee6 (Add support for critical low/high temperature limits on NCT6106). This patch does that. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Avoid using device platform data outside probe functionGuenter Roeck
Plan going forward is to attach all device attributes to the hwmon device and no longer to the platform device. With that change, accessing platform data outside the probe function will be more difficult. To avoid the problem, change code to no longer rely on it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Add support for NCT6791DDavid Bartley
Signed-off-by: David Bartley <andareed@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Add support for beep attributesGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Add support for NCT6102D/6106DGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Support two SuperIO chips in the same systemGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (nct6775) Allocate attributes dynamically from templatesGuenter Roeck
Static attribute allocation is large and very repetitive. Allocate attributes and attribute groups dynamically instead. This reduces the size of the driver source by more than 600 lines, and object size by more than 20k (more than 30%). Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-12hwmon: (coretemp) Atom CPUs don't support TjMax; no warning neededGuenter Roeck
Display warning "Unable to read TjMax from CPU x" only if the CPU is supposed to support it. This is not the case for the various Atom CPUs. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-08hwmon: (adt7470) Fix incorrect return code checkCurt Brune
In adt7470_write_word_data(), which writes two bytes using i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed together when they should be OR-ed together. The return code of i2c_smbus_write_byte_data() is zero for success. The upshot is only the first byte was ever written to the hardware. The 2nd byte was never written out. I noticed that trying to set the fan speed limits was not working correctly on my system. Setting the fan speed limits is the only code that uses adt7470_write_word_data(). After making the change the limit settings work and the alarms work also. Signed-off-by: Curt Brune <curt@cumulusnetworks.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-03hwmon: (max6697) fix MAX6581 idealityVivien Didelot
Without this patch, the values for ideality (register 0x4b) and ideality selection mask (register 0x4c) are inverted. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Cc: stable@vger.kernel.org # 3.9+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-07-18Merge tag 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fix from Guenter Roeck: "Single patch to staticize a local variable" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (abx500) Staticize abx500_temp_attributes
2013-07-14hwmon: delete __cpuinit usage from all hwmon filesPaul Gortmaker
The __cpuinit type of throwaway sections might have made sense some time ago when RAM was more constrained, but now the savings do not offset the cost and complications. For example, the fix in commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time") is a good example of the nasty type of bugs that can be created with improper use of the various __init prefixes. After a discussion on LKML[1] it was decided that cpuinit should go the way of devinit and be phased out. Once all the users are gone, we can then finally remove the macros themselves from linux/init.h. This removes all the drivers/hwmon uses of the __cpuinit macros from all C files. [1] https://lkml.org/lkml/2013/5/20/589 Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: lm-sensors@lm-sensors.org Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-07-14hwmon: (abx500) Staticize abx500_temp_attributesSachin Kamat
abx500_temp_attributes is used only in this file. Make it static. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-07-08hwmon: (lm63) Drop redundant safety on cache lifetimeJean Delvare
time_after (as opposed to time_after_equal) already ensures that the cache lifetime is at least as much as requested. There is no point in manually adding another jiffy to that value, and this can confuse the reader into wrong interpretation. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Imre Deak <imre.deak@intel.com>
2013-07-08hwmon: (lm90) Drop redundant safety on cache lifetimeJean Delvare
time_after (as opposed to time_after_equal) already ensures that the cache lifetime is at least as much as requested. There is no point in manually adding another jiffy to that value, and this can confuse the reader into wrong interpretation. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Imre Deak <imre.deak@intel.com>
2013-07-04Merge tag 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: - new driver to support GMT G762/G763 pwm fan controllers - add support for DS1631, DS1721, and DS1731 to ds1621 driver - remove detect function from ds1621 driver as unreliable - bug fixes in nct6775, iio_hwmon, and adm1021 drivers - remove redundant platform_set_drvdata in various drivers - add device tree support to ina2xx driver * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (ds1621) Fix temperature rounding operations hwmon: (nct6775) Drop unsupported fan alarm attributes for NCT6775 hwmon: (nct6775) Fix temperature alarm attributes Add support for GMT G762/G763 PWM fan controllers hwmon: (ina2xx) Add device tree support to pass the shunt resistor hwmon: (ds1621) Update documentation hwmon: (ds1621) Add DS1731 chip support to ds1621 driver hwmon: (iio_hwmon) add alias table hwmon: (adm1021) Do not create min sysfs attributes for LM84 hwmon: (ds1621) Remove detect function hwmon: (ds1621) Add ds1631 chip support to ds1621 driver and documentation hwmon: (ds1621) Add ds1721 update interval sysfs attribute hwmon: (ds1621) Add ds1721 chip support hwmon: (w83627ehf) Remove redundant platform_set_drvdata() hwmon: (ntc_thermistor) Remove redundant platform_set_drvdata() hwmon: (i5k_amb) Remove redundant platform_set_drvdata() hwmon: (coretemp) Remove redundant platform_set_drvdata() hwmon: (abituguru3) Remove redundant platform_set_drvdata()