summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (smsc47m192) Fix temperature limit and vrm write operationsGuenter Roeck2014-07-241-1/+3
| | | | | | | | | | | | | | | Temperature limit clamps are applied after converting the temperature from milli-degrees C to degrees C, so either the clamp limit needs to be specified in degrees C, not milli-degrees C, or clamping must happen before converting to degrees C. Use the latter method to avoid overflows. 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 Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
* hwmon: (adt7470) Fix writes to temperature limit registersGuenter Roeck2014-07-161-3/+3
| | | | | | | | | | | | | Temperature limit registers are signed. Limits therefore need to be clamped to (-128, 127) degrees C and not to (0, 255) degrees C. Without this fix, writing a limit of 128 degrees C sets the actual limit to -128 degrees C. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org Reviewed-by: Axel Lin <axel.lin@ingics.com>
* hwmon: (da9055) Don't use dash in the name attributeAxel Lin2014-07-141-1/+1
| | | | | | | | | Dashes are not allowed in hwmon name attributes. Use "da9055" instead of "da9055-hwmon". Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (da9052) Don't use dash in the name attributeAxel Lin2014-07-141-1/+1
| | | | | | | | | Dashes are not allowed in hwmon name attributes. Use "da9052" instead of "da9052-hwmon". Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adc128d818) Drop write support on inX_input attributesGuenter Roeck2014-07-071-14/+14
| | | | | | | | | | Writes into input registers doesn't make sense, even more so since the writes actually ended up writing into the maximum limit registers. Drop it. Cc: stable@vger.kernel.org Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (emc2103) Clamp limits instead of bailing outGuenter Roeck2014-07-071-10/+5
| | | | | | | | | | | It is customary to clamp limits instead of bailing out with an error if a configured limit is out of the range supported by the driver. This simplifies limit configuration, since the user will not typically know chip and/or driver specific limits. Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1031) Fix writes to limit registersGuenter Roeck2014-07-071-3/+5
| | | | | | | | | | | | | | | | | | | Upper limit for write operations to temperature limit registers was clamped to a fractional value. However, limit registers do not support fractional values. As a result, upper limits of 127.5 degrees C or higher resulted in a rounded limit of 128 degrees C. Since limit registers are signed, this was stored as -128 degrees C. Clamp limits to (-55, +127) degrees C to solve the problem. Value on writes to auto_temp[12]_min and auto_temp[12]_max were not clamped at all, but masked. As a result, out-of-range writes resulted in a more or less arbitrary limit. Clamp those attributes to (0, 127) degrees C for more predictable results. Cc: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1021) Fix cache problem when writing temperature limitsAxel Lin2014-07-031-6/+8
| | | | | | | | | | | The module test script for the adm1021 driver exposes a cache problem when writing temperature limits. temp_min and temp_max are expected to be stored in milli-degrees C but are stored in degrees C. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_divAxel Lin2014-07-031-0/+3
| | | | | | | | | | | | | Writing to fanX_div does not clear the cache. As a result, reading from fanX_div may return the old value for up to two seconds after writing a new value. This patch ensures the fan_div cache is updated in set_fan_div(). Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (amc6821) Fix permissions for temp2_inputAxel Lin2014-07-031-1/+1
| | | | | | | | | temp2_input should not be writable, fix it. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Correct information printed during probeNaveen Krishna Chatradhi2014-06-291-1/+1
| | | | | | | | | | Currently, dev_info() at the end of the probe says "type:%s ". But, prints pdev->name. This patch uses "pdev_id->name" which prints the thermistor type. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (gpio-fan) Change name used in hwmon_device_register_with_groupsJulien D'Ascenzio2014-06-251-1/+1
| | | | | | | | | | Since commit 648cd48c9e566f53c5df30d79857e0937ae13b09 The hwmon name attributes must not include '-' so the name must be rename from gpio-fan to gpio_fan Signed-off-by: Julien D'Ascenzio <jdascenzio@yahoo.fr> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (emc1403) Fix missing 'select REGMAP_I2C' in KconfigJosef Gajdusek2014-06-251-0/+1
| | | | | | | | In commit 4cab259f, the emc1403 driver was converted to use regmap but the necessary Kconfig option was not added. Signed-off-by: Josef Gajdusek <atx@atx.name> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Use the manufacturer name properlyNaveen Krishna Chatradhi2014-06-252-3/+16
| | | | | | | | | | | | | | | | | Murata Manufacturing Co., Ltd is the vendor for NTC (Negative Temperature coefficient) based Thermistors. But, the driver extensively uses "NTC" as the vendor name. This patch corrects the vendor name also updates the compatibility strings according to the vendor-prefix.txt Note: Drivers continue to support the previous compatible strings but further addition of these compatible strings in device tree is deprecated. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (w83l786ng) Report correct minimum fan speedAxel Lin2014-06-251-1/+1
| | | | | | | | | Current code is buggy, it shows the current fan speed as minimum fan speed. Fix up show_fan_reg macro to correctly report fan and fan_min speed. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Kevin Lo <kevlo@kevlo.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: vexpress: Use devm helper for hwmon device registrationPawel Moll2014-06-121-54/+28
| | | | | | | | | | | Use devm_hwmon_device_register_with_groups instead of the old-style manual attributes and hwmon device registration. Also, unroll the attribute group macros for better code readability. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (atxp1) Avoid forward declarationAxel Lin2014-06-121-24/+18
| | | | | | | Move atxp1_id and atxp1_driver to proper place to avoid forward declaration. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: add support for Sensirion SHTC1 sensorTomas Pop2014-06-123-0/+262
| | | | | | | | Add support for Sensirion SHTC1 and compatible temperature and humidity sensors. Signed-off-by: Tomas Pop <tomas.pop@sensirion.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ltc4151) Convert to devm_hwmon_device_register_with_groupsAxel Lin2014-06-121-38/+13
| | | | | | | | | Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Per Dalén <per.dalen@appeartv.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm85) Drop generic detectionJean Delvare2014-06-121-23/+10
| | | | | | | | | | 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>
* hwmon: (ina2xx) Cast to s16 on shunt and current regsFabio Baltieri2014-06-121-3/+4
| | | | | | | | | | | | | | | All devices supported by ina2xx are bidirectional and report the measured shunt voltage and power values as a signed 16 bit, but the current driver implementation caches all registers as u16, leading to an incorrect sign extension when reporting to userspace in ina2xx_get_value(). This patch fixes the problem by casting the signed registers to s16. Tested on an INA219. Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Merge tag 'hwmon-for-linus' of ↵Linus Torvalds2014-06-0329-1408/+2633
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging into next Pull hwmon updates from Guenter Roeck: "New driver for NCT6683D New chip support to existing drivers: - add support for STTS2004 and AT30TSE004 to jc42 driver - add support for EMC1402/EMC1412/EMC1422 to emc1403 driver Other notable changes: - document hwmon kernel API - convert jc42, lm70, lm75, lm77, lm83, lm92, max1619, tmp421, and tmp102 drivers to use new hwmon API functions - replace function macros in lm80, lm92, and jc42 drivers with real code - convert emc1403 driver to use regmap, add support for additional attributes, and add device IDs for EMC1412, EMC1413, and EMC1414 - various additional cleanup and minor bug fixes in several drivers" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (60 commits) hwmon: (nct6775) Fix probe unwind paths to properly unregister platform devices hwmon: (nct6683) Fix probe unwind paths to properly unregister platform devices hwmon: (ultra45_env) Introduce managed version of kzalloc hwmon: Driver for NCT6683D hwmon: (lm80) Rearrange code to avoid forward declarations hwmon: (lm80) Convert fan display function macros into functions hwmon: (lm80) Convert voltage display function macros into functions hwmon: (lm80) Convert temperature display function macros into functions hwmon: (lm80) Normalize all temperature values to 16 bit hwmon: (lm80) Simplify TEMP_FROM_REG hwmon: (lm83) Convert to use devm_hwmon_device_register_with_groups hwmon: (lm83) Rearange code to avoid forward declarations hwmon: (lm83) Drop FSF address hwmon: (max1619) Convert to use devm_hwmon_device_register_with_groups hwmon: (max1619) Drop function macros hwmon: (max1619) Rearrange code to avoid forward declarations hwmon: (max1619) Drop FSF address hwmon: (max1619) Fix critical alarm display hwmon: (jc42) Add support for STTS2004 and AT30TSE004 hwmon: (jc42) Convert function macros into functions ...
| * hwmon: (nct6775) Fix probe unwind paths to properly unregister platform devicesAxel Lin2014-05-241-3/+5
| | | | | | | | | | | | | | | | Call platform_device_unregister() rather than platform_device_put() to unregister successfully registered platform devices. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (nct6683) Fix probe unwind paths to properly unregister platform devicesAxel Lin2014-05-241-3/+5
| | | | | | | | | | | | | | | | Call platform_device_unregister() rather than platform_device_put() to unregister successfully registered platform devices. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ultra45_env) Introduce managed version of kzallocHimangi Saraogi2014-05-211-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, the unnecessary label out_free is removed. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: Driver for NCT6683DGuenter Roeck2014-05-213-0/+1466
| | | | | | | | | | | | Nuvoton NCT6683D is an eSIO with hardware monitoring capabilities. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Rearrange code to avoid forward declarationsGuenter Roeck2014-05-211-151/+139
| | | | | | | | | | | | | | | | Avoid need for forward declarations by rearranging code. No functional change. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Convert fan display function macros into functionsGuenter Roeck2014-05-211-34/+41
| | | | | | | | | | | | | | | | | | Convert fan display function macros into functions to reduce code size and improve code readability. Code size reduction is about 200 bytes on x86_64. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Convert voltage display function macros into functionsGuenter Roeck2014-05-211-72/+76
| | | | | | | | | | | | | | | | | | Convert voltage display function macros into functions to reduce code size and improve code readability. Code size reduction is about 600 bytes on x86_64. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Convert temperature display function macros into functionsGuenter Roeck2014-05-211-75/+59
| | | | | | | | | | | | | | | | | | Convert temperature display function macros into functions to reduce code size and improve code readability. Code size reduction is about 2k on x86_64. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Normalize all temperature values to 16 bitGuenter Roeck2014-05-211-18/+14
| | | | | | | | | | | | | | Normalize all stored temperature values to 16 bit to simplify temperature calculations. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Simplify TEMP_FROM_REGGuenter Roeck2014-05-211-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | TEMP_FROM_REG gets 12 bits of temperature data in the upper 12 bit of a signed 16 bit parameter, with the integer part (including sign) in the upper 8 bit and the remainder in bit 4..7. The lower 4 bit of the 16 bit data is always 0. We can use that information to convert the temperature directly into display data (1/1000th of degree C). Note that the stored temperature data is not shifted right as the comment claimed, so remove that misleading comment. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm83) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck2014-05-211-43/+16
| | | | | | | | | | | | | | Use devm_hwmon_device_register_with_groups API to attach attributes to hwmon device, simplify code, and reduce code size. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm83) Rearange code to avoid forward declarationsGuenter Roeck2014-05-211-61/+50
| | | | | | | | | | | | | | Avoid forward declarations by rearranging code. No functional change. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm83) Drop FSF addressGuenter Roeck2014-05-211-4/+0
| | | | | | | | | | | | The FSF address changes over time, so drop it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck2014-05-211-39/+14
| | | | | | | | | | | | | | Use devm_hwmon_device_register_with_groups API to attach attributes to hwmon device, simplify code, and reduce code size. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619) Drop function macrosGuenter Roeck2014-05-211-68/+73
| | | | | | | | | | | | | | Function macros make the code larger and difficult ro read. Drop them and reduce code size (on x86_64) by ~1800 bytes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619) Rearrange code to avoid forward declarationsGuenter Roeck2014-05-211-89/+69
| | | | | | | | | | | | | | | | | | Forward declarations are unnecessary and easy to avoid, so rearrange code and drop them. No functional change. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619) Drop FSF addressGuenter Roeck2014-05-211-5/+0
| | | | | | | | | | | | The FSF address may chance over time, so drop it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619) Fix critical alarm displayGuenter Roeck2014-05-211-0/+5
| | | | | | | | | | | | | | | | | | The overtemperature status bit, which is used to display critical alarm status, matches the output of the OVERT signal 1:1. If that signal is active-low, the bit will read 1 if there is no alarm. It is therefore necessary to reverse the bit in this case. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (jc42) Add support for STTS2004 and AT30TSE004Guenter Roeck2014-05-211-0/+9
| | | | | | | | | | | | | | Also fix links to datasheets for other supported sensors from ST Microelectronics, and add links to several Atmel datasheets. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (jc42) Convert function macros into functionsGuenter Roeck2014-05-211-110/+72
| | | | | | | | | | | | | | Convert function macros into functions to make the code easier to read and reduce code size. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (jc42) Rearrange code to avoid forward declarationsGuenter Roeck2014-05-211-97/+89
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Add device IDs for EMC1412, EMC1413, and EMC1414Guenter Roeck2014-05-211-0/+3
| | | | | | | | | | | | | | | | | | EMC1412, EMC1413, and EMC1414 are fully compatible to EMC1402, EMC1403, and EMC1404, and even report the same chip ID. Add to device ID table to enable instantiation with correct chip names. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Add support for min_hyst attributesGuenter Roeck2014-05-211-3/+24
| | | | | | | | | | | | | | The hysteresis value applies to all limits, so add support for tempX_min_hyst. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Add support for max_hyst attributesGuenter Roeck2014-05-211-0/+8
| | | | | | | | | | | | | | The hysteresis value applies to all limits, so add support for tempX_max_hyst. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Relax hysteresis limit write checksGuenter Roeck2014-05-211-6/+1
| | | | | | | | | | | | | | | | | | Writing the hysteresis limit returned -ERANGE if the written hysteresis was too high or too low. Relax error check and adjust the hysteresis value to its valid range. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Make all hyst attributes except for temp1_crit_hyst read-onlyGuenter Roeck2014-05-211-6/+3
| | | | | | | | | | | | | | | | | | | | All chips in this chip series only support a single hysteresis value. Having multiple writable hysteresis attributes is therefore confusing, since a single write affects all hysteresis temperatures. Make all but one (temp1_crit_hyst) read-only. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Add support for alarm and diode fault status on EMC14x2Guenter Roeck2014-05-211-0/+36
| | | | | | | | | | | | | | Alarm and fault status register on EMC1402, EMC1412, and EMC1422 is reported in a different register than with other chips. Add support for it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (emc1403) Report external diode fault statusGuenter Roeck2014-05-211-0/+6
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
OpenPOWER on IntegriCloud