summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus
AgeCommit message (Collapse)Author
2013-04-08hwmon: (pmbus/lm25066) Add support for LM25056Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (pmbus/lm25066) Refactor device specific coefficientsGuenter Roeck
Initialize device specific coefficients from table instead of hard-coding it to simplify adding additional chips. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (pmbus/lm25066) Clamp limit attributesGuenter Roeck
Limits on all supported sensors and chips have to be within 0..0x0fff, and limits are always positive. Clamp written values in chip driver. Also clear value cache to ensure that the actually written value is read back and reported correctly. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (pmbus/lm25066) Report VAUX as vmonGuenter Roeck
So far the driver reported the voltage on VAUX as "vout2". This was not entirely appropriate as it is not an output voltage, and complicates the code. Use the new virtual "VMON" register set and report the voltage as "vmon" instead. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (pmbus/ltc2978) Add support for LTC2974 and LTC3883Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (pmbus/ltc2978) Code cleanupGuenter Roeck
Use u16 instead of int to store cached limit attributes. This reduces allocated data size per driver instance by 48 bytes. Use defines for the number of pages supported by individual chips. Use ARRAY_SIZE for loops to initialize array variables, and initialize all variables in the same code block. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-03-14hwmon: (pmbus/ltc2978) Fix temperature reportingGuenter Roeck
On LTC2978, only READ_TEMPERATURE is supported. It reports the internal junction temperature. This register is unpaged. On LTC3880, READ_TEMPERATURE and READ_TEMPERATURE2 are supported. READ_TEMPERATURE is paged and reports external temperatures. READ_TEMPERATURE2 is unpaged and reports the internal junction temperature. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.2+ Acked-by: Jean Delvare <khali@linux-fr.org>
2013-03-14hwmon: (pmbus) Fix krealloc() misuse in pmbus_add_attribute()David Woodhouse
If krealloc() returns NULL, it *doesn't* free the original. So any code of the form 'foo = krealloc(foo, …);' is almost certainly a bug. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-03-04hwmon: (pmbus/ltc2978) Use detected chip ID to select supported functionalityGuenter Roeck
We read the chip ID from the chip, use it to determine if the chip ID provided to the driver is correct, and report it if wrong. We should also use the correct chip ID to select supported functionality. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.2+ Acked-by: Jean Delvare <khali@linux-fr.org>
2013-03-04hwmon: (pmbus/ltc2978) Fix peak attribute handlingGuenter Roeck
Peak attributes were not initialized and cleared correctly. Also, temp2_max is only supported on page 0 and thus does not need to be an array. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.2+ Acked-by: Jean Delvare <khali@linux-fr.org>
2013-02-06hwmon: (pmbus) Clean up for code size reductionGuenter Roeck
Rearranged some data structures, and merged some common functions. Overall code and data size reduction by more than 900 bytes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus/max34440) Add support for MAX34460 and MAX34461Guenter Roeck
MAX34460 is a PMBus 12-Channel Voltage Monitor & Sequencer. MAX34461 is a PMBus 16-Channel Voltage Monitor & Sequencer. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Add support for word status registerGuenter Roeck
Not all PMBus devices support the byte status register at 0x78. Try to use the word status register at 0x79 instead if that is the case. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus/zl6100) Add support for VMON/VDRVGuenter Roeck
Some of the ZL6100 compatible chips support monitoring a separate voltage pin, VMON (ZL2004) or VDRV (ZL91xx). Report it as in2 / vmon. The chips support implicit warning limits for VMON/VDRV, as percentage of the respective critical voltage. Support by reading/writing the critical voltages and calculating the associated warning voltages. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Add function to clear sensor cacheGuenter Roeck
For PMBus chips, modifying one limit register may affect other limits. Since limits are all cached in the PMBus core driver, related changes are not reflected in reported limits. Introduce function to clear the attribute cache. After calling this function, the core pmbus driver re-reads all cached values. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Add support for additional voltage sensorGuenter Roeck
Some PMBus chips support monitoring an additional non-standard voltage. While this voltage can in many cases be supported by simulating an additional sensor page, this does not work in all cases. Specifically, it is problematic if the data format is linear and the voltage is reported in LINEAR11 format. Since output voltages use LINEAR16, and the exponent for LINEAR16 data is chip-wide and fixed, this can result in overflows. To solve this problem, add support for an additional virtual input voltage, call it 'vmon', and treat this voltage as input voltage (which, when the chip supports linear data format, uses LINEAR11). Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Use krealloc to allocate attribute memoryGuenter Roeck
So far, attribute memory was allocated by pre-calculating the maximum possible amount of attributes. Not only does this waste memory, it is also risky because the calculation might be wrong. It also requires a lot of defines to specify the maximum number of attributes per class. Allocate attribute memory using krealloc() instead. That means we have to use kfree(), since devm_krealloc() does not exist, but that is still less costly and less risky than trying to predict the number of attributes at the beginning. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Simplify memory allocation for sensor attributesGuenter Roeck
Since memory is now allocated with dev_ functions, we no longer need to keep track of allocated memory. Sensor memory allocation can therefore be simplified significantly. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Improve boolean handlingGuenter Roeck
Boolean handling depends on storing the sensor data index in sensor_device_attr as part of the index variable. This limits the number of sensor attributes to 256, and means the sensor sequence number actually has to be maintained to be able to access sensor data from boolean functions. Rework the code to store sensor pointers in the pmbus_boolean data structure directly. With this approach, the number of supportable sensors is now unlimited. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Simplify memory allocation for labels and booleansGuenter Roeck
Since memory is now allocated with dev_ functions, we no longer need to keep track of allocated memory. Memory allocation for booleans and labels can therefore be simplified substantially by allocating it only as needed. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Use dev variable to represent client->devGuenter Roeck
This simplifies the code and makes it a bit smaller. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Fix 'Macros with multiple statements' checkpatch errorGuenter Roeck
Fix: ERROR: Macros with multiple statements should be enclosed in a do - while loop by unwinding the problematic macros. As a side effect, this patch reduces code size on x86_64 by 160 bytes and bss size by 64 bytes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (pmbus) Drop unnecessary error messages in probe error pathGuenter Roeck
Drop error messages due to implementation errors and due to memory allocation errors. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-01-26hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck
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-10-14hwmon: (pmbus) remove CONFIG_EXPERIMENTALKees Cook
This config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it. CC: Guenter Roeck <linux@roeck-us.net> CC: Jean Delvare <khali@linux-fr.org> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-10-10hwmon: Drop needless includes of <linux/delay.h>Jean Delvare
These drivers use no sleep or delay functions so they don't need to include <linux/delay.h>. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Cc: Rudolf Marek <r.marek@assembler.cz>
2012-10-10hwmon: Add missing inclusions of <linux/jiffies.h>Jean Delvare
Many hwmon drivers use jiffies but omit the inclusion of the header file. Fix that, and also fix one driver which was including the header file but didn't need it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Luca Tettamanti <kronos.it@gmail.com> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Cc: Rudolf Marek <r.marek@assembler.cz>
2012-04-09hwmon: (pmbus_core) Fix compiler warningGuenter Roeck
Some configurations produce the following compiler warning: drivers/hwmon/pmbus/pmbus_core.c: In function 'pmbus_show_boolean': drivers/hwmon/pmbus/pmbus_core.c:752: warning: 'val' may be used uninitialized in this function While this is a false positive, it can easily be fixed by overloading the return value from pmbus_get_boolean with both val and error return code (val is a boolean and thus never negative). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-03-19hwmon: (zl6100) Add support for ZL9101M and ZL9117MGuenter Roeck
ZL9101M and ZL9117M are compatible to ZL6100. Add support to the zl6100 driver. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (adm1275) Add support for ADM1075Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (max34440) Add support for MAX34446Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (pmbus) Add more virtual registersGuenter Roeck
Add PMBUS_VIRT_READ_TEMP_AVG, PMBUS_VIRT_READ_TEMP2_AVG, PMBUS_VIRT_READ_POUT_AVG, PMBUS_VIRT_READ_POUT_MAX, and PMBUS_VIRT_RESET_POUT_HISTORY. We'll need those for MAX34446. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (pmbus) Add support for Lineage Power MDT040Guenter Roeck
MDT040 is supported by the generic PMBus driver. Add device ID and reference to datasheet. Also mention Lineage Power device support in Kconfig. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (pmbus) Add support for TI TPS40400 and TPS40422Guenter Roeck
TPS40400 and TPS40422 are supported by the generic PMBus driver. Add device IDs and data sheet references. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (max34440) Add support for 'lowest' output voltage attributeGuenter Roeck
MAX34440 and compatibles support reporting the lowest measured output voltage. Add support for it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (pmbus) Simplify remove functionsGuenter Roeck
Since devm_kzalloc() is now used to allocate driver memory, the client driver remove function has no purpose other than to call pmbus_do_remove(). This means we can get rid of it by redefining pmbus_do_remove() to use the same prototype, and pointing to it directly. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (pmbus) Convert pmbus drivers to use devm_kzallocGuenter Roeck
Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin
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>
2012-03-19hwmon: (pmbus) Replace strict_strtol with kstrtolGuenter Roeck
strict_strtol is deprecated and results in a checkpatch warning. Replace it with kstrtol. Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-14hwmon: (zl6100) Enable interval between chip accesses for all chipsGuenter Roeck
Intersil reports that all chips supported by the zl6100 driver require an interval between chip accesses, even ZL2004 and ZL6105 which were thought to be safe. Reported-by: Vivek Gani <vgani@intersil.com> Cc: stable@vger.kernel.org # 3.2+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-07hwmon: (zl6100) Maintain delay parameter in driver instance dataGuenter Roeck
A global delay parameter has the side effect of being overwritten with 0 if a single ZL2004 or ZL6105 is instantiated. If other chips supported by the same driver are in the system, this will result in access errors for those chips. To solve the problem, keep a per-instance copy of the delay parameter, and do not change the original parameter. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.1+ Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-07hwmon: (pmbus_core) Fix maximum number of POUT alarm attributesGuenter Roeck
There are up to three POUT alarm attributes, not two, since cap_alarm was added. Reported-by: Michele Petracca <mi.petracca@gmail.com> Cc: stable@vger.kernel.org # 3.0+ [3.0 will need backport] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-02-24hwmon: (max34440) Fix resetting temperature historyGuenter Roeck
Temperature history is reset by writing 0x8000 into the peak temperature register, not 0xffff. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-01-05hwmon: (pmbus/zl6100) Only instantiate external temperature sensor if enabledGuenter Roeck
BMR4xx devices don't have an external temperature sensor, and instantiating it does not provide value anyway if it is disabled. Only instantiate it if it is enabled. Also optimize wait time between I2C chip accesses in the probe function, and replace unnecessary check for support for I2C_FUNC_SMBUS_READ_BYTE_DATA with now required support for I2C_FUNC_SMBUS_READ_WORD_DATA. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-01-05hwmon: (pmbus/zl6100) Add support for Ericsson BMR45[0,1] and BMR46[2,3,4]Guenter Roeck
Add support for Ericsson BMR450, BMR451, BMR462, BMR463, and BMR464, which are based on ZL2005 and ZL2008, to zl6100 driver. Remove BMR450 and BMR451 device IDs from generic PMBus driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-01-05hwmon: (pmbus/zl6100) Add support for ZL2005Guenter Roeck
Add explicit support for ZL2005. Functionality is almost the same as with other Zilker Labs / Intersil chips, but limit register detection does not work reliably. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-01-05hwmon: (pmbus/adm1275) Validate device IDGuenter Roeck
Since manufacturer and device ID are known, read and validate it. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> [Dan Carpenter <dan.carpenter@oracle.com>: Fixed memory leak] Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2011-10-24hwmon: (pmbus_core) Simplify sign extensionsGuenter Roeck
Shift operations can be used for sign extensions. Use it. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2011-10-24hwmon: (pmbus) Add support for Lineage Power DC-DC convertersGuenter Roeck
Add device IDs and reference to datasheets for Lineage Power DC-DC converters. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2011-10-24hwmon: (pmbus/ltc2978) Add support for LTC3880 to LTC2978 driverGuenter Roeck
The LTC3880 PMBus command set is comparable to LTC2978. Add support for it to the LTC2978 driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>