Commit graph

43 commits

Author SHA1 Message Date
Brandon Wyman
a5436af598 hwmon: (pmbus) Add Vin unit off handling
If there is an input undervoltage fault, reported in STATUS_INPUT
command response, there is quite likely a "Unit Off For Insufficient
Input Voltage" condition as well.

Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit
attributes to include both bits in the mask for clearing faults.

If an input undervoltage fault occurs, causing a unit off for
insufficient input voltage, but the unit is off bit is not cleared, the
STATUS_WORD will not be updated to clear the input fault condition.
Including the unit is off bit (bit 3) allows for the input fault
condition to completely clear.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Link: https://lore.kernel.org/r/20220317232123.2103592-1-bjwyman@gmail.com
Fixes: b4ce237b7f ("hwmon: (pmbus) Introduce infrastructure to detect sensors and limit registers")
[groeck: Dropped unnecessary ()]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-03-17 22:30:28 -07:00
Marcello Sylvester Bauer
54cc3dbfc1 hwmon: (pmbus) Add regulator supply into macro
Add regulator supply into PWBUS_REGULATOR macro. This makes it optional
to define a vin-supply in DT. Not defining a supply will add a dummy
regulator supply instead and only cause the following debug output:

```
Looking up vin-supply property in node [...] failed
```

Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
Link: https://lore.kernel.org/r/58f2ff7b90233fad3d7ae2e9d66d5192e2c1ac01.1645437439.git.sylv@sylv.io
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-27 17:03:19 -08:00
Vadim Pasternak
0c1acde1d3 hwmon: (pmbus) Increase maximum number of phases per page
Increase maximum number of phases from 8 to 10 to support multi-phase
devices allowing up to 10 phases.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20210511055619.118104-2-vadimp@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-06-17 04:21:45 -07:00
Erik Rosen
d3e33067a6 hwmon: (pmbus) Add pmbus_set_update() function to set update flag
For the STPDDC60 chip, the vout alarm-limits are represented as an offset
relative to the commanded output voltage. This means that the limits are
dynamic and must not be cached by the pmbus driver. This patch adds a
pmbus_set_sensor() function to pmbus_core to be able to set the update flag
on selected sensors after auto-detection of limit attributes.

Signed-off-by: Erik Rosen <erik.rosen@metormote.com>
Link: https://lore.kernel.org/r/20210218115249.28513-2-erik.rosen@metormote.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20 06:50:14 -07:00
Bartosz Golaszewski
3bce071a30 hwmon: (pmbus) shrink code and remove pmbus_do_remove()
The only action currently performed in pmbus_do_remove() is removing the
debugfs hierarchy. We can schedule a devm action at probe time and remove
pmbus_do_remove() entirely from all pmbus drivers.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20201026105352.20359-1-brgl@bgdev.pl
[groeck: Removed references to pmbus_do_remove from documentation]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-12-02 17:42:23 -08:00
Stephen Kitt
dd43193976 hwmon (pmbus) use simple i2c probe function
pmbus_do_probe doesn't use the id information provided in its second
argument, so this can be removed, which then allows using the
single-parameter i2c probe function ("probe_new") for probes.

This avoids scanning the identifier tables during probes.

Drivers which didn't use the id are converted as-is; drivers which did
are modified as follows:

* if the information in i2c_client is sufficient, that's used instead
  (client->name);
* configured v. probed comparisons are performed by comparing the
  configured name to the detected name, instead of the ids; this
  involves strcmp but is still cheaper than comparing all the device
  names when scanning the tables;
* anything else is handled by calling i2c_match_id() with the same
  level of error-handling (if any) as before.

Additionally, the mismatch message in the ltc2978 driver is adjusted
so that it no longer assumes that the driver_data is an index into
ltc2978_id.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Acked-by: Wolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20200808210004.30880-1-steve@sk2.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:39 -07:00
Zbigniew Lukwinski
787c095eda hwmon: (pmbus/core) Add support for rated attributes
Adding implementation for new attributes (rated_min/rated_max) to
cover PMBus specification about rated values reporting:
MFR_VIN_MIN, MFR_VIN_MAX, MFR_IIN_MAX, MFR_PIN_MAX, MFR_VOUT_MIN,
MFR_VOUT_MAX, MFR_IOUT_MAX, MFR_POUT_MAX, MFR_MAX_TEMP_1/2/3.

Tested with OpenBMC stack. All rated attributes were available
and reported correct values.

Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com>
Link: https://lore.kernel.org/r/1596224237-32280-4-git-send-email-zbigniew.lukwinski@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:39 -07:00
Guenter Roeck
16358542f3 hwmon: (pmbus) Implement multi-phase support
Some PMBus chips support multiple phases, and report telemetry such
as input current, output current, or temperature for each phase.
Add support for such chips to the PMBus core.

Start with a maximum of 8 phases per page, and assume that supported
sensors per phase are similar for all pages. Only support per-phase
telemetry attributes, no limits or alarms.

As part of this patch, set the initial page variable to 0xff to ensure
that the page is updated when the first page command is issued. Also
only issue page commands if the chip supports more than one page.

Cc: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-08 20:35:47 -07:00
Guenter Roeck
43f33b6e59 hwmon: (pmbus) Add 'phase' parameter where needed for multi-phase support
In preparation for multi-phase support, add 'phase' parameter to read_word
and set_page functions. Actual multi-phase support will be added in
a subsequent patch.

Cc: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-08 20:35:47 -07:00
Guenter Roeck
a1dd176c42 hwmon: (pmbus) Add IC_DEVICE_ID and IC_DEVICE_REV command definitions
Recent PMBus versions added IC_DEVICE_ID and IC_DEVICE_REV commands as
additional means to identify the chip. Add command definitions to
pmbus.h include file.

Cc: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-08 20:35:47 -07:00
Vadim Pasternak
9d72340b6a hwmon: (pmbus/core) Add support for Intel IMVP9 and AMD 6.25mV modes
Extend "vrm_version" with the type for Intel IMVP9 and AMD 6.25mV VID
modes.
Add calculation for those types.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200113150841.17670-3-vadimp@mellanox.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Vadim Pasternak
b9fa0a3acf hwmon: (pmbus/core) Add support for vid mode detection per page bases
Add support for VID protocol detection per page bases, instead of
detecting it based on "PMBU_VOUT" readout from page 0 for all the pages
supported by particular device.
The reason that some devices allows to configure different VID modes
per page within the same device.
Patch modifies the field "vrm_version" within the structure
"pmbus_driver_info" to be per page array.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200113150841.17670-2-vadimp@mellanox.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Guenter Roeck
9e347728c4 hwmon: (pmbus) Detect if chip is write protected
If a chip is write protected, we can not change any limits, and we can
not clear status flags. This may be the reason why clearing status flags
is reported to not work for some chips. Detect the condition in the pmbus
core. If the chip is write protected, set limit attributes as read-only,
and set the flag indicating that the status flag should be ignored.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:09 -08:00
Thomas Gleixner
74ba9207e1 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61
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 <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 17:36:45 +02:00
krzysztof.adamski@nokia.com
991d679951 pmbus: support for custom sysfs attributes
This patch makes it possible to pass custom struct attribute_group array
via the pmbus_driver_info struct so that those can be added to the
attribute groups passed to hwmon_device_register_with_groups().

This makes it possible to register custom sysfs attributes by PMBUS
drivers similar to how you can do this with most other busses/classes.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-04-15 17:19:53 -07:00
Adamski, Krzysztof (Nokia - PL/Wroclaw)
49c4455dcc hwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registers
Those virtual registers can be used to export manufacturer specific
functionality for controlling the number of samples for average values
reported by the device.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-04-15 17:19:53 -07:00
Edward A. James
eb6489b696 hwmon: (pmbus) Export pmbus device debugfs directory entry
Pmbus client drivers, if they want to use debugfs, should use the same
root directory as the pmbus debugfs entries are using. Therefore, export
the device dentry for the pmbus client.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-01-02 15:05:34 -08:00
Andrew Jeffery
464df6fa37 hwmon: (pmbus) Add virtual page config bit
Some circumstances call for virtual pages, to expose multiple values
packed into an extended PMBus register in a manner non-compliant with
the PMBus standard. An example of this is the Maxim MAX31785 controller,
which extends the READ_FAN_SPEED_1 PMBus register from two to four bytes
to support tach readings for both rotors of a dual rotor fan. This extended
register contains two word-sized values, one reporting the rate of the
fastest rotor, the other the rate of the slowest. The concept of virtual
pages aids this situation by mapping the page number onto the value to be
selected from the vectored result.

We should not try to set virtual pages on the device as such a page
explicitly doesn't exist; add a flag so we can avoid doing so.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-01-02 15:05:34 -08:00
Andrew Jeffery
d206636e76 hwmon: (pmbus) Add fan control support
Expose fanX_target, pwmX and pwmX_enable hwmon sysfs attributes.

Fans in a PMBus device are driven by the configuration of two registers,
FAN_CONFIG_x_y and FAN_COMMAND_x: FAN_CONFIG_x_y dictates how the fan
and the tacho operate (if installed), while FAN_COMMAND_x sets the
desired fan rate. The unit of FAN_COMMAND_x is dependent on the
operational fan mode, RPM or PWM percent duty, as determined by the
corresponding configuration in FAN_CONFIG_x_y.

The mapping of fanX_target, pwmX and pwmX_enable onto FAN_CONFIG_x_y and
FAN_COMMAND_x is implemented with the addition of virtual registers to
facilitate the necessary side-effects of each access:

1. PMBUS_VIRT_FAN_TARGET_x
2. PMBUS_VIRT_PWM_x
3. PMBUS_VIRT_PWM_ENABLE_x

Some complexity arises with the fanX_target and pwmX attributes both mapping
onto FAN_COMMAND_x: There is no general mapping between PWM percent duty and
RPM, so we can't display values in either attribute in terms of the other
(which in my mind is the intuitive, if impossible, behaviour). This problem
also affects the pwmX_enable attribute which allows userspace to switch between
full speed, manual PWM and a number of automatic control modes, possibly
including a switch to RPM behaviour (e.g. automatically adjusting PWM duty to
reach a RPM target, the behaviour of fanX_target).

The next most intuitive behaviour is for fanX_target and pwmX to simply be
independent, to retain their most recently set value even if that value is not
active on the hardware (due to switching to the alternative control mode). This
property of retaining the value independent of the hardware state has useful
results for both userspace and the kernel: Userspace always sees a sensible
value in the attribute (the last thing it was set to, as opposed to 0 or
receiving an error on read), and the kernel can use the attributes as a value
cache. This latter point eases the implementation of pwmX_enable, which can
look up the associated pmbus_sensor object, take its cached value and apply it
to hardware on changing control mode. This ensures we will not arbitrarily set
a PWM value as an RPM value or vice versa, and we can assume that the RPM or
PWM value set was sensible at least at some point in the past.

Finally, the DIRECT mode coefficients of some controllers is different between
RPM and PWM percent duty control modes, so PSC_PWM is introduced to capture the
necessary coefficients. As pmbus core had no PWM support previously PSC_FAN
continues to be used to capture the RPM DIRECT coefficients, but in order to
avoid falsely applying RPM scaling to PWM values I have introduced the
PMBUS_HAVE_PWM12 and PMB_BUS_HAVE_PWM34 feature bits. These feature bits allow
drivers to explicitly declare PWM support in order to have the attributes
exposed.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-01-02 15:05:34 -08:00
Edward A. James
6dcf2fb5e8 hwmon: (pmbus/core) Prevent unintentional setting of page to 0xFF
The pmbus core may call read/write word data functions with a page value
of -1, intending to perform the operation without setting the page.
However, the read/write word data functions accept only unsigned 8-bit
page numbers, and therefore cannot check for negative page number to
avoid setting the page. This results in setting the page number to 0xFF.
This may result in errors or undefined behavior of some devices
(specifically the ir35221, which allows the page to be set to 0xFF,
but some subsequent operations to read registers may fail).

Switch the pmbus_set_page page parameter to an integer and perform the
check for negative page there. Make read/write functions consistent in
accepting an integer page number parameter.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
Fixes: cbcdec6202 ("hwmon: (pmbus): Access word data for STATUS_WORD")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29 18:35:54 -07:00
Vadim Pasternak
d4977c083a hwmon: (pmbus) Add support for Intel VID protocol VR13
The below lists of VOUT_MODE command readout with their related VID
protocols, Digital to Analog Converter steps:
- VR13.0 mode, 10-mV DAC - 0x24
- VR13.0 mode, 5-mV DAC - 0x27

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-30 06:31:00 -07:00
Guenter Roeck
2c052d4280 hwmon: (pmbus) Use BIT macro
Using the BIT macro makes the code a little easier to read.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-19 09:08:17 -07:00
Guenter Roeck
2238835c5c hwmon: (pmbus) Convert command register definitions to enum
This will simplify adding new virtual commands.

Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 11:55:55 -07:00
Guenter Roeck
068c227056 hwmon: (pmbus) Add support for VR12
Newer chips such as MAX20751 support VR12. Add support for it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:27 -07:00
Guenter Roeck
48065a138a hwmon: (pmbus) Add support for lowest power value attributes
Add support for powerX_input_lowest for both input and output power.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Axel Lin
a07d73113f hwmon: (pmbus_core) Constify pmbus_regulator_ops
pmbus_regulator_ops is not modified after initialized, so make it const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Axel Lin
7b7a8b4237 hwmon: (pmbus) Explicitly set regulator type for pmbus_regulator_ops
The pmbus_regulator_ops is for voltage regulators, so explicitly set
regulator type for better readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Alan Tull
ddbb4db4ce hwmon: (pmbus) Add regulator support
Add support for simple on/off control of each channel.

To add regulator support, the pmbus part driver needs to add
regulator_desc information and number of regulators to its
pmbus_driver_info struct.

regulator_desc can be declared using default macro for a
regulator (PMBUS_REGULATOR) that is in pmbus.h

The regulator_init_data can be initialized from either
platform data or the device tree.

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Alan Tull
11c119986f hwmon: (pmbus) add helpers for byte write and read modify write
Add two helper functions:
 * pmbus_write_byte_data  = paged byte write
 * pmbus_update_byte_data = paged byte read/modify/write

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Guenter Roeck
ce603b18f3 hwmon: (pmbus) Add function to clear sensor cache
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-06 09:58:04 -08:00
Guenter Roeck
aebcbbfc49 hwmon: (pmbus) Add support for additional voltage sensor
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-06 09:58:03 -08:00
Guenter Roeck
60b873e332 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>
2012-03-18 18:27:51 -07:00
Guenter Roeck
dd285ad737 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>
2012-03-18 18:27:46 -07:00
Guenter Roeck
3d790287c4 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>
2011-10-24 11:09:42 -07:00
Guenter Roeck
866cf12a0e 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>
2011-10-24 11:09:33 -07:00
Guenter Roeck
20fcfe1721 hwmon: (pmbus) Add comments explaining internal driver API return values
Return values for functions reading/writing manufacturer specific registers are
poorly explained. Add comments to improve documentation.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
2011-10-24 11:09:33 -07:00
Guenter Roeck
044cd3a574 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>
2011-08-11 10:14:04 -07:00
Guenter Roeck
03e9bd8dbc 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>
2011-07-28 20:16:17 -07:00
Guenter Roeck
6f183d33a0 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>
2011-07-28 17:09:32 -07:00
Guenter Roeck
9c1ed8941d 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>
2011-07-28 17:02:15 -07:00
Guenter Roeck
46243f3ab4 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>
2011-07-28 16:55:13 -07:00
Guenter Roeck
1061d8518f 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>
2011-07-28 15:31:11 -07:00
Guenter Roeck
9d2ecfb768 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>
2011-07-28 11:47:53 -07:00
Renamed from drivers/hwmon/pmbus.h (Browse further)