Commit graph

249 commits

Author SHA1 Message Date
Linus Torvalds
fe151462bd Driver Core patches for 5.10-rc1
Here is the "big" set of driver core patches for 5.10-rc1
 
 They include a lot of different things, all related to the driver core
 and/or some driver logic:
 	- sysfs common write functions to make it easier to audit sysfs
 	  attributes
 	- device connection cleanups and fixes
 	- devm helpers for a few functions
 	- NOIO allocations for when devices are being removed
 	- minor cleanups and fixes
 
 All have been in linux-next for a while with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCX4c4yA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylS7gCfcS+7/PE42eXxMY0z8rBX8aDMadIAn2DVEghA
 Eoh9UoMEW4g1uMKORA0c
 =CVAW
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the "big" set of driver core patches for 5.10-rc1

  They include a lot of different things, all related to the driver core
  and/or some driver logic:

   - sysfs common write functions to make it easier to audit sysfs
     attributes

   - device connection cleanups and fixes

   - devm helpers for a few functions

   - NOIO allocations for when devices are being removed

   - minor cleanups and fixes

  All have been in linux-next for a while with no reported issues"

* tag 'driver-core-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (31 commits)
  regmap: debugfs: use semicolons rather than commas to separate statements
  platform/x86: intel_pmc_core: do not create a static struct device
  drivers core: node: Use a more typical macro definition style for ACCESS_ATTR
  drivers core: Use sysfs_emit for shared_cpu_map_show and shared_cpu_list_show
  mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit
  drivers core: Miscellaneous changes for sysfs_emit
  drivers core: Reindent a couple uses around sysfs_emit
  drivers core: Remove strcat uses around sysfs_emit and neaten
  drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions
  sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output
  dyndbg: use keyword, arg varnames for query term pairs
  driver core: force NOIO allocations during unplug
  platform_device: switch to simpler IDA interface
  driver core: platform: Document return type of more functions
  Revert "driver core: Annotate dev_err_probe() with __must_check"
  Revert "test_firmware: Test platform fw loading on non-EFI systems"
  iio: adc: xilinx-xadc: use devm_krealloc()
  hwmon: pmbus: use more devres helpers
  devres: provide devm_krealloc()
  syscore: Use pm_pr_dbg() for syscore_{suspend,resume}()
  ...
2020-10-14 16:09:32 -07:00
Chu Lin
9b20aec24b hwmon: (pmbus/max20730) adjust the vout reading given voltage divider
Problem:
We use voltage dividers so that the voltage presented at the voltage
sense pins is confusing. We might need to convert these readings to more
meaningful readings given the voltage divider.

Solution:
Read the voltage divider resistance from dts and convert the voltage
reading to a more meaningful reading.

Testing:
max20730 with voltage divider

Signed-off-by: Chu Lin <linchuyuan@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20201004031445.2321090-3-linchuyuan@google.com
[groeck: Return -EINVAL instead of -ENODEV on bad deevicetree data]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-10-06 14:54:55 -07:00
Ugur Usug
8910c0bd53 hwmon: (pmbus/max20730) add device monitoring via debugfs
Add debugfs interface support for accessing device specific registers
(MFR_VOUT_MIN, MFR_DEVSET1 and MFR_DEVSET2) and others including
OPERATION, ON_OFF_CONFIG, SMB_ALERT_MASK, VOUT_MODE, VOUT_COMMAND
and VOUT_MAX.

Signed-off-by: Ugur Usug <ugur.usug@maximintegrated.com>
Link: https://lore.kernel.org/r/MWHPR11MB1965C01083AD013C630646B2FD3B0@MWHPR11MB1965.namprd11.prod.outlook.com
[groeck: Resolved conflics seen due to PMBus driver API changes]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-10-05 09:16:33 -07:00
Steve Foreman
2b52278150 hwmon: (pmbus/max34440) Fix OC fault limits
The max34* family have the IOUT_OC_WARN_LIMIT and IOUT_OC_CRIT_LIMIT
registers swapped.

Cc: stable@vger.kernel.org
Signed-off-by: Steve Foreman <foremans@google.com>
[groeck: Updated subject, use C comment style, tab after defines]
[groeck: Added missing break; statements (by alexandru.ardelean@analog.com)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-10-05 09:16:31 -07:00
Vadim Pasternak
2c6fcbb211 hwmon: (pmbus) Add support for MPS Multi-phase mp2975 controller
Add support for mp295 device from Monolithic Power Systems, Inc. (MPS)
vendor. This is a dual-loop, digital, multi-phase controller.
This device:
- Supports two power rail.
- Provides 8 pulse-width modulations (PWMs), and can be configured up
  to 8-phase operation for rail 1 and up to 4-phase operation for rail
  2.
- Supports two pages 0 and 1 for telemetry and also pages 2 and 3 for
  configuration.
- Can configured VOUT readout in direct or VID format and allows
  setting of different formats on rails 1 and 2. For VID the following
  protocols are available: VR13 mode with 5-mV DAC; VR13 mode with
  10-mV DAC, IMVP9 mode with 5-mV DAC.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20200926204957.10268-2-vadimp@nvidia.com
[groeck: Cleaned up a couple of error returns; fixed up API changes]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-10-04 08:40:10 -07:00
Guenter Roeck
04e216d19e hwmon: (pmbus) Move boolean error condition check to generating code
0-day rightfully complains about a sometimes uninitialized variable
in pmbus_get_boolean().

drivers/hwmon/pmbus/pmbus_core.c:903:13: warning:
		variable 'ret' is used uninitialized whenever 'if' condition is true
	} else if (!s1 || !s2) {

While that is technically true, it won't be hit in the field since the
condition indicates a programming error. Move the check of that condition
into the code generating the attribute entry, and refuse generating the
attribute if the condition is true. Swap the condition check in
pmbus_get_boolean() to ensure that static analyzers don't get a hiccup
(because we check if s1 and s2 are NULL, static analyzers may believe
that they can be NULL independently of each other).

Reported-by: kernel test robot <lkp@intel.com>
Cc: Alex Qiu <xqiu@google.com>
Reviewed-by: Alex Qiu <xqiu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Andrew Jeffery
2cd8529cfb hwmon: (pmbus) Expose PEC debugfs attribute
Enable runtime debug control of whether the PEC byte is exchanged with
the PMBus device.

Some manufacturers have asked for the PEC to be disabled as part of
debugging driver communication issues with devices.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Link: https://lore.kernel.org/r/20200910021106.2958382-1-andrew@aj.id.au
[groeck: Replace %1llu with %llu]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Guenter Roeck
a919ba0697 hwmon: (pmbus) Stop caching register values
Caching register values can be very expensive for PMBus chips. Some
modern chips may have 10 or more pages, with several sensors supported
per page. For example, MAX16601 creates more than 90 sysfs attributes.
Register caching for such chips is time consuming, especially if only a
few attributes are read on a regular basis. For MAX16601, it was observed
that it can take up to two seconds to read all attributes on a slow I2C
bus. In this situation, register caching results in the opposite of its
intention: It increases the number of I2C operations, in some cases
substantially, and it results in large latency when trying to access
individual sensor data.

Drop all register caching to solve the problem. Since it is no longer
necessary, drop status register mapping as part of the change, and specify
status registers directly.

Cc: Alex Qiu <xqiu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Alex Qiu <xqiu@google.com>
Tested-by: Alex Qiu <xqiu@google.com>
Link: https://lore.kernel.org/r/20200904163314.259087-1-linux@roeck-us.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Alexandru Tachici
15609d1893 hwmon: (pmbus/adm1266) read blackbox
Use the nvmem kernel api to expose the black box
chip functionality to userspace.

Using this feature, the device is capable of recording
to nonvolatile flash memory the vital data about the
system status that caused the system to perform a
black box write.

A blackbox is 64 bytes of data containing all the
status registers, last two states of the sequencer,
timestamp and counters. The mapping of this data is
described in the adm1266 datasheet.

On power-up the driver sets the unix time to
the adm1266 using the SET_RTC command. This value
is incremented by an internal clock and it is used
as timestamp for the black box feature.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20200812142055.9213-6-alexandru.tachici@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Alexandru Tachici
ed1ff457e1 hwmon: (pmbus/adm1266) add debugfs for states
Add a debugfs entry which prints the current state
of the adm1266 sequencer.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20200812142055.9213-5-alexandru.tachici@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Alexandru Tachici
d98dfad35c hwmon: (pmbus/adm1266) Add support for GPIOs
Adm1266 exposes 9 GPIOs and 16 PDIOs which are currently read-only. They
are controlled by the internal sequencing engine.

This patch makes adm1266 driver expose GPIOs and PDIOs to user-space
using GPIO provider kernel api.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20200812142055.9213-4-alexandru.tachici@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Alexandru Tachici
407dc802a9 hwmon: (pmbus/adm1266) Add Block process call
PmBus devices support Block Write-Block Read Process
Call described in SMBus specification v 2.0 with the
exception that Block writes and reads are permitted to
have up 255 data bytes instead of max 32 bytes (SMBus).

This patch adds Block WR process call support for ADM1266.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20200812142055.9213-3-alexandru.tachici@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:41 -07:00
Alexandru Tachici
9514a22866 hwmon: (pmbus) Add support for ADM1266
Add pmbus probing driver for the adm1266 Cascadable
Super Sequencer with Margin Control and Fault Recording.
Driver is using the pmbus_core, creating sysfs files
under hwmon for inputs: vh1->vh4 and vp1->vp13.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20200812142055.9213-2-alexandru.tachici@analog.com
[groeck: Use .probe_new function, adjust for changed pmbus_do_probe API]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:40 -07: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
6c094b31ea hwmon: (pmbus/max34440) Fix status register reads for MAX344{51,60,61}
Starting with MAX34451, the chips of this series support STATUS_IOUT and
STATUS_TEMPERATURE commands, and no longer report over-current and
over-temperature status with STATUS_MFR_SPECIFIC.

Fixes: 7a001dbab4 ("hwmon: (pmbus/max34440) Add support for MAX34451.")
Fixes: 50115ac9b6 ("hwmon: (pmbus/max34440) Add support for MAX34460 and MAX34461")
Reported-by: Steve Foreman <foremans@google.com>
Cc: Steve Foreman <foremans@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:39:40 -07:00
Greg Kroah-Hartman
9ef8638bd8 Merge 5.9-rc5 into driver-core-next
We need the driver core changes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-14 10:08:57 +02:00
Bartosz Golaszewski
bb19133fc8 hwmon: pmbus: use more devres helpers
Shrink pmbus code by using devm_hwmon_device_register_with_groups()
and devm_krealloc() instead of their non-managed variants.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200824173859.4910-3-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-08 13:32:06 +02:00
Grant Peltier
51fb91ed5a hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_1 telemetry for RAA228228
Per the RAA228228 datasheet, READ_TEMPERATURE_1 is not a supported PMBus
command.

Signed-off-by: Grant Peltier <grantpeltier93@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-08-16 15:00:48 -07:00
Josh Lehan
8ba75b2028 hwmon: (pmbus/core) Use s64 instead of long for calculations
Using s64 type, instead of long type, for internal calculations and for
the sysfs interface.

This allows 64-bit values to appear correctly on 32-bit kernels.
As wattage is reported in microwatts, monitoring a power supply over
2KW requires this.

Although it may seem unlikely to run a 32-bit kernel on such a large
machine, enterprise servers often include a BMC, and the BMC might be
running a 32-bit kernel.

Signed-off-by: Josh Lehan <krellan@google.com>
[groeck: Removed Change-Id and other tags, reformatted description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-24 07:44:57 -07:00
Ugur Usug
5c9353f5f8 hwmon: (pmbus/max20730) Add max20710 support
Add support for max20710 into the existing max20730 driver.

Signed-off-by: Ugur Usug <ugur.usug@maximintegrated.com>
Link: https://lore.kernel.org/r/BYAPR11MB317423C13909AE6F1913BBD7FD9C0@BYAPR11MB3174.namprd11.prod.outlook.com
[groeck: Fixed various whitespace errors]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-24 07:44:18 -07:00
Manikandan Elumalai
a37881dead hwmon: (adm1275) Enable adm1278 ADM1278_TEMP1_EN
The adm1278 temp attribute need it for openbmc platform .
This feature not enabled by default, so PMON_CONFIG needs to enable it.

Signed-off-by: Manikandan Elumalai <manikandan.hcl.ers.epl@gmail.com>
Link: https://lore.kernel.org/r/20200622153727.GA9347@cnn
[groeck: Split long line]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-19 16:25:21 -07:00
Chu Lin
6d1d41c075 hwmon: (adm1275) Make sure we are reading enough data for different chips
Issue:
When PEC is enabled, binding adm1272 to the adm1275 would
fail due to PEC error. See below:
adm1275: probe of xxxx failed with error -74

Diagnosis:
Per the datasheet of adm1272, adm1278, adm1293 and amd1294,
PMON_CONFIG (0xd4) is 16bits wide. On the other hand,
PMON_CONFIG (0xd4) for adm1275 is 8bits wide. The driver should not
assume everything is 8bits wide and read only 8bits from it.

Solution:
If it is adm1272, adm1278, adm1293 and adm1294, use i2c_read_word.
Else, use i2c_read_byte

Testing:
Binding adm1272 to the driver.
The change is only tested on adm1272.

Signed-off-by: Chu Lin <linchuyuan@google.com>
Link: https://lore.kernel.org/r/20200709040612.3977094-1-linchuyuan@google.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-09 07:02:35 -07:00
Tao Ren
0d242479b3 hwmon: (pmbus) fix a typo in Kconfig SENSORS_IR35221 option
Fix a typo in SENSORS_IR35221 option: module name should be "ir35221"
instead of "ir35521".

Fixes: 8991ebd9c9 ("hwmon: (pmbus) Add client driver for IR35221")

Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Link: https://lore.kernel.org/r/20200702221349.18139-1-rentao.bupt@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-02 17:43:14 -07:00
Jan Kundrát
b4c8af4c2a hwmon: (pmbus) Fix page vs. register when accessing fans
Commit 16358542f3 ("hwmon: (pmbus) Implement multi-phase support")
added support for multi-phase pmbus devices. However, when calling
pmbus_add_sensor() for fans, the patch swapped the `page` and `reg`
attributes. As a result, the fan speeds were reported as 0 RPM on my device.

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Fixes: 16358542f3 ("hwmon: (pmbus) Implement multi-phase support")
Cc: stable@vger.kernel.org # v5.7+
Link: https://lore.kernel.org/r/449bc9e6c0e4305581e45905ce9d043b356a9932.1592904387.git.jan.kundrat@cesnet.cz
[groeck: Fixed references to offending commit]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-06-23 06:31:28 -07:00
Guenter Roeck
2138f8853a hwmon: (pmbus) Driver for Maxim MAX16601
MAX16601 is a VR13.HC Dual-Output Voltage Regulator Chipset,
implementing a (8+1) multiphase synchronous buck converter.

Cc: Alex Qiu <xqiu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-05-22 06:28:38 -07:00
Guenter Roeck
d86f3c9bba hwmon: (pmbus) Improve initialization of 'currpage' and 'currphase'
The 'currpage' and 'currphase' variables in struct pmbus_data are used by
the PMBus core to determine if the phase or page value has changed. Both
are initialized with values which are never expected to be set in the code
to ensure that the first page/phase write operation is actually performed.

This is not well explained and occasionally causes confusion. Change the
type of both variables to s16 and initialize with -1 to ensure that the
initial value never matches a requested value, and clarify that this
value means "unknown/unset".

Cc: Alex Qiu <xqiu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-05-22 06:28:38 -07:00
Guenter Roeck
37d59d10a8 hwmon: (pmbus/isl68137) Fix up chip IDs
I2C chip IDs need to reflect chip names, not chip functionality.

Fixes: f621d61fd5 ("hwmon: (pmbus) add support for 2nd Gen Renesas digital multiphase")
Cc: Grant Peltier <grantpeltier93@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-04-12 15:12:51 -07:00
Grant Peltier
f621d61fd5 hwmon: (pmbus) add support for 2nd Gen Renesas digital multiphase
Extend the isl68137 driver to provide support for 2nd generation Renesas
digital multiphase voltage regulators.

Signed-off-by: Grant Peltier <grantpeltier93@gmail.com>
Link: https://lore.kernel.org/r/62c000adf0108aeb65d3f275f28eb26b690384aa.1584720563.git.grantpeltier93@gmail.com
[groeck: Adjusted for new PMBus API function parameters]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-22 16:42:21 -07:00
Eddie James
b1fbe673b8 hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection
There is an additional CCIN for the IBM CFFPS that may be classifed as
either version one or version two, based upon the rest of the bits of
the CCIN. Add support for it in the version detection.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1583948590-17220-1-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-15 06:38:59 -07:00
Guenter Roeck
6f944004f8 hwmon: (pmbus/tps53679) Add support for TPS53647 and TPS53667
TPS53647 and TPS53667 are single channel, Step-Down Buck Controllers.
TPS53647 supports 4 phases, TPS53667 supports 6 phases.
The chips do not support per-phase output telemetry.

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
53030bcc87 hwmon: (pmbus/tps53679) Add support for TPS53681
TPS53681 is a dual-channel multiphase step-down controller
supporting per-phase and per-channel output telemetry.

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
39c749aca8 hwmon: (pmbus/tps53679) Add support for IIN and PIN to TPS53679 and TPS53688
All chips of this series with published datasheets support IIN, PIN, and
STATUS_INPUT PMBus commands. Per TI Power Management Forum, "TPS53679 and
TPS53681 have the same PMBus command set". There is no reason to believe
that this does not apply to TPS53688. Let's assume that this is correct
and add support for IIN, PIN, and STATUS_INPUT to TPS53679 and TPS53688
to simplify adding support for more chips of the same series.

At the same time, drop reporting VIN on channel 2. On chips with published
datasheets this voltage is identical to the voltage reported on channel 1,
and there is no reason to believe that this is different for TPS53679 and
TPS53888.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-08 20:35:47 -07:00
Guenter Roeck
63eb4587f6 hwmon: (pmbus/tps53679) Add support for multiple chips IDs
Chip specific support will be needed in the driver to be able to
support additional chips of the same series. Add support for it
to the driver.

To simplify adding support for more chips, call identification code
from the probe function. This lets us use a single structure for common
elements of struct pmbus_driver_info, thus reducing code size as support
for more chips is added.

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
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
Mike Jones
ee44fafb38 hwmon: (pmbus/ltc2978) add support for more parts.
LTC2972, LTC2979, LTC3884, LTC3889, LTC7880, LTM4664, LTM4677,
LTM4678, LTM4680, LTM4700.

Signed-off-by: Mike Jones <michael-a1.jones@analog.com>
Link: https://lore.kernel.org/r/1581032654-4330-1-git-send-email-michael-a1.jones@analog.com
[groeck: Fixed checkpatch issues (long lines, whitespace)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-08 20:35:46 -07:00
Vadim Pasternak
deddc9e8c0 hwmon: (pmbus/xdpe12284) Add callback for vout limits conversion
Provide read_word_data() callback for overvoltage and undervoltage
output readouts conversion. These registers are presented in
'slinear11' format, while default conversion for 'vout' class for the
devices is 'vid'. It is resulted in wrong conversion in pmbus_reg2data()
for in{3-4}_lcrit and in{3-4}_crit attributes.
)
Fixes: aaafb7c8eb ("hwmon: (pmbus) Add support for Infineon Multi-phase xdpe122 family controllers")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200224225202.19576-1-vadimp@mellanox.com
[gropeck: Adjusted to mainline PMBus API]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-02-25 13:23:26 -08:00
Johan Hovold
205447fa9e hwmon: (pmbus/xdpe12284) fix typo in compatible strings
Make sure that the driver compatible strings matches the binding by
removing the space between the manufacturer and model.

Fixes: aaafb7c8eb ("hwmon: (pmbus) Add support for Infineon Multi-phase xdpe122 family controllers")
Cc: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200212092426.24012-1-johan@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-02-12 12:43:01 -08:00
Mike Jones
cf2b012c90 hwmon: (pmbus/ltc2978) Fix PMBus polling of MFR_COMMON definitions.
Change 21537dc driver PMBus polling of MFR_COMMON from bits 5/4 to
bits 6/5. This fixs a LTC297X family bug where polling always returns
not busy even when the part is busy. This fixes a LTC388X and
LTM467X bug where polling used PEND and NOT_IN_TRANS, and BUSY was
not polled, which can lead to NACKing of commands. LTC388X and
LTM467X modules now poll BUSY and PEND, increasing reliability by
eliminating NACKing of commands.

Signed-off-by: Mike Jones <michael-a1.jones@analog.com>
Link: https://lore.kernel.org/r/1580234400-2829-2-git-send-email-michael-a1.jones@analog.com
Fixes: e04d1ce9bb ("hwmon: (ltc2978) Add polling for chips requiring it")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-02-09 18:41:08 -08:00
Vadim Pasternak
aaafb7c8eb hwmon: (pmbus) Add support for Infineon Multi-phase xdpe122 family controllers
Add support for devices XDPE12254, XDPE12284.

All these device support two pages.
The below lists of VOUT_MODE command readout with their related VID
protocols, Digital to Analog Converter steps, supported by these
devices:
VR12.0 mode, 5-mV DAC - 0x01;
VR12.5 mode, 10-mV DAC - 0x02;
IMVP9 mode, 5-mV DAC - 0x03;
AMD mode 6.25mV - 0x10.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200113150841.17670-5-vadimp@mellanox.com
[groeck: Added missing break statement]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Vadim Pasternak
583dc92127 hwmon: (pmbus/tps53679) Extend device list supported by driver
Extends driver with support of the additional devices:
Texas Instruments Dual channel DCAP+ multiphase controllers: TPS53688.

Extend Kconfig with added device.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Link: https://lore.kernel.org/r/20200113150841.17670-4-vadimp@mellanox.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08: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
Eddie James
d9c8ae69b9 hwmon: (pmbus/ibm-cffps) Prevent writing on_off_config with bad data
If the user write parameters resulted in no bytes being written to the
temporary buffer, then ON_OFF_CONFIG will be written with uninitialized
data. Prevent this by bailing out in this case.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1578411640-16929-1-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Eddie James
74a71a831b hwmon: (pmbus/ibm-cffps) Fix the LED behavior when turned off
The driver should remain in control of the LED on the PSU, even while
off, not the PSU firmware as previously indicated.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1576788607-13567-4-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Eddie James
1952d79a0d hwmon: (pmbus/ibm-cffps) Add the VMON property for version 2
Version 2 of the PSU supports reading an auxiliary voltage. Use the
pmbus VMON property and associated virtual register to read it.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1576788607-13567-3-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Eddie James
abe508b66d hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entries
Add support for a number of manufacturer-specific registers in the
debugfs entries, as well as support to read and write the
PMBUS_ON_OFF_CONFIG register through debugfs.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1576788607-13567-2-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00
Guenter Roeck
cce209581a hwmon: (pmbus) Driver for MAX20730, MAX20734, and MAX20743
Add support for Maxim MAX20730, MAX20734, MAX20743 Integrated,
Step-Down Switching Regulators with PMBus support.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-23 13:15:10 -08:00