History log of /drivers/hwmon/pmbus/pmbus_core.c
Revision Date Author Comments
d7ee11157f1fce02632e2f3a56b99b2afd9e5f93 28-Mar-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus_core) Fix compiler warning

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>
60b873e3329891cd86cf5a2629157dc0022f8beb 24-Feb-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus) Add more virtual registers

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>
dd285ad7373bf5d21cceacb3b7a5eb8b72d37085 22-Feb-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus) Simplify remove functions

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>
8b313ca7f1b98263ce22519b25a9c2a362eeb898 22-Feb-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc

Marginally less code and eliminate the possibility of memory leaks.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
0117c3f24523166ca764575c0e486887b7e33c2b 16-Jan-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus) Replace strict_strtol with kstrtol

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>
7cb3c44fb1f7999e4c53b6a52de6bc25da6de079 04-Mar-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (pmbus_core) Fix maximum number of POUT alarm attributes

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>
1af1f5313cfea85a185c7bbb5258f7856fc8fea7 28-Sep-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus_core) Simplify sign extensions

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>
3d790287c4e6caa8790421737b1cf8f0a6531559 10-Sep-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Add support for TEMP2 peak attributes

At least one PMBus chip supports peak attributes for READ_TEMPERATURE2.
Add virtual registers to be able to report it to the user.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
da8e48ab483e1f54c1099bed91bfd2c302bc7ddf 30-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Always call _pmbus_read_byte in core driver

Always call _pmbus_read_byte() instead of pmbus_read_byte() in PMBus core
driver. With this change, device specific read functions can be implemented for
all registers.

Since the device specific read_byte function is now always called, we need to be
more careful with page validations. Only fail if the passed page number is larger
than 0, since -1 means "current page".

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
179144a0d4128e7588b3d613a14807402f5e7c37 01-Sep-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Replace EINVAL return codes with more appropriate errors

EINVAL was over-used in the code. Replace it with more appropriate errors.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
866cf12a0eab65f94e40608bdd21ca8dea4d0ac2 26-Aug-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Don't return errors from driver remove functions

Driver remove functions have an error return value, but rarely return an error
in practice. If a driver does return an error from its remove function, the
driver won't be unloaded and is expected to stay alive.

pmbus_do_remove() is defined as returning an int, but always returns 0 (no
error). Calling code passes that return value on to high level driver
remove functions, but does not evaluate it and removes driver data even if
pmbus_do_remove() returned an error (which it in practice never does). Even if
this code could never cause a real problem, it is nevertheless conceptually
wrong.

To reduce confusion and simplify the code, change pmbus_do_remove() to be a void
function, and have PMBus client drivers always return zero in their driver
remove functions.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
40257b953fdd519c743138f3fbe3962d54991116 10-Sep-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Fix low limit temperature alarms

Temperature alarms are detected by checking the alarm bit and comparing
temperature limits against the current temperature. For low limits, this
comparison needs to be reversed (temp < limit instead of temp > limit).
This was not taken into account, resulting in wrong alarms if a temperature
fell below a low limit.

Fix by adding a low limit flag in the limit data structure. When creating the
sensor entry, the order of registers to compare is now reversed for low limits.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org # 3.0+
044cd3a574be5cd97ab80d0c6d06f5fab327541d 30-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Virtualize pmbus_write_byte

With virtual pages and to be able to handle more chips, it is necessary to
virtualise pmbus_write_byte().

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
03e9bd8dbcee60c2e22fd54f9f28f0d32da218c3 08-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Add client driver for LM25066, LM5064, and LM5066

PMBus client driver supporting National Semiconductor LM25066, LM5064, and LM5066.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
6f183d33a02e686608f708ef713b6423db39bcba 09-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Add support for peak attributes

Most PMBus devices provide manufacturer specific commands to read low and/or
high peak values for some or all of its sensors.

To support providing those values as lowest/highest attributes to the user,
introduce virtual PMBus commands. Those commands reside outside the normal
command set and have to be implemented in device specific code, which map the
virtual commands to device specific commands.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
c6bfb767e431d3a236eab439d3660ff562598c84 09-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Strengthen check for status register existence

With virtual register page support, it is now possible that the status register
on virtual pages does not exist or is itself virtual. To take this into account
when creating alarm attributes, generate those attributes only if the status
register on the respective page is known to exist.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
9c1ed8941d30fd6252e84a9941e6507e497d242b 09-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Add support for virtual pages

Some PMBus chips have non-standard sensor registers. An easy way to
support such sensors is to introduce virtual pages and map the non-standard
registers into standard registers on an extra page.

For this to work, the code verifying if the configured number of pages exists
has to be removed. Since a wrong number of pages can only be configured in a
front-end driver, this should not have a practical impact since the resulting
errors should be found during development and testing.

Also, functions to read the chip status while checking if a command register
exists must be modified to no longer set the page register before reading the
status, since the physical page associated with the checked register may not
exist. This does not make a functional difference since the page was already set
when the attempt to read the register was made.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
46243f3ab44ad0d2e9ca62e6485ca433659f3881 08-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Support reading and writing of word registers in device specific code

Some PMBus devices use non-standard registers for some of the sensors and/or
limits. To support such devices, add code to support reading and writing of word
size registers in device specific code.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2bd05bf4d2a5807dcc1c52788b842827e5ef0ee9 09-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Increase attribute name size

Some hwmon sysfs attributes have a length of 20 bytes (plus terminating 0).
I2C_NAME_SIZE is defined as 20 and thus can not be used to define the length
of hwmon sysfs attributes. Replace it with PMBUS_NAME_SIZE, set to 24.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
1061d8518f8bde548a03a5ff77dbe9a4202ad826 25-Jun-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Add support for VID output voltage mode

In VID mode, output voltages are measured and reported as VID values, and
have to be converted to voltages using VID conversion tables or functions.
Support is added for VR11 only at this time.

This patch enables support for PMBus devices supporting VID VR11 based output
voltage selection such as NCP4200 and NCP4208.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
9d2ecfb768bd2f8b41816a23b0f1dda026fef41d 12-Jul-2011 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (pmbus) Move PMBus drivers to drivers/hwmon/pmbus

Since the number of PMBus drivers is getting large, move them into
directory drivers/hwmon/pmbus to improve readability and scalability.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>