summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus
AgeCommit message (Collapse)AuthorFilesLines
2020-05-22hwmon: (pmbus) Driver for Maxim MAX16601Guenter Roeck3-0/+324
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-22hwmon: (pmbus) Improve initialization of 'currpage' and 'currphase'Guenter Roeck1-4/+4
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-04-13hwmon: (pmbus/isl68137) Fix up chip IDsGuenter Roeck1-7/+85
I2C chip IDs need to reflect chip names, not chip functionality. Fixes: f621d61fd59f ("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-03-23hwmon: (pmbus) add support for 2nd Gen Renesas digital multiphaseGrant Peltier2-18/+99
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-15hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detectionEddie James1-1/+13
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-09hwmon: (pmbus/tps53679) Add support for TPS53647 and TPS53667Guenter Roeck2-4/+15
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-09hwmon: (pmbus/tps53679) Add support for TPS53681Guenter Roeck2-5/+119
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-09hwmon: (pmbus/tps53679) Add support for IIN and PIN to TPS53679 and TPS53688Guenter Roeck1-3/+3
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-09hwmon: (pmbus/tps53679) Add support for multiple chips IDsGuenter Roeck1-10/+31
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-09hwmon: (pmbus) Implement multi-phase supportGuenter Roeck2-23/+68
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-09hwmon: (pmbus) Add 'phase' parameter where needed for multi-phase supportGuenter Roeck18-117/+177
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-09hwmon: (pmbus) Add IC_DEVICE_ID and IC_DEVICE_REV command definitionsGuenter Roeck1-0/+3
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-09hwmon: (pmbus/ltc2978) add support for more parts.Mike Jones2-9/+96
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-02-26hwmon: (pmbus/xdpe12284) Add callback for vout limits conversionVadim Pasternak1-0/+54
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: aaafb7c8eb1c ("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-12hwmon: (pmbus/xdpe12284) fix typo in compatible stringsJohan Hovold1-2/+2
Make sure that the driver compatible strings matches the binding by removing the space between the manufacturer and model. Fixes: aaafb7c8eb1c ("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-10hwmon: (pmbus/ltc2978) Fix PMBus polling of MFR_COMMON definitions.Mike Jones1-2/+2
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: e04d1ce9bbb49 ("hwmon: (ltc2978) Add polling for chips requiring it") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-24hwmon: (pmbus) Add support for Infineon Multi-phase xdpe122 family controllersVadim Pasternak3-0/+127
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-24hwmon: (pmbus/tps53679) Extend device list supported by driverVadim Pasternak2-2/+4
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-24hwmon: (pmbus/core) Add support for Intel IMVP9 and AMD 6.25mV modesVadim Pasternak2-1/+9
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-24hwmon: (pmbus/core) Add support for vid mode detection per page basesVadim Pasternak6-46/+53
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-24hwmon: (pmbus/ibm-cffps) Prevent writing on_off_config with bad dataEddie James1-1/+1
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-24hwmon: (pmbus/ibm-cffps) Fix the LED behavior when turned offEddie James1-5/+4
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-24hwmon: (pmbus/ibm-cffps) Add the VMON property for version 2Eddie James1-1/+5
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-24hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entriesEddie James1-4/+70
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-24hwmon: (pmbus) Driver for MAX20730, MAX20734, and MAX20743Guenter Roeck3-0/+382
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-24hwmon: (pmbus) Add MAX20796 to devices supported by generic pmbus driverGuenter Roeck2-2/+3
MAX20796 is a dual-phase scalable integrated voltage regulator with PMBus interface. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-01-24hwmon: (pmbus) Detect if chip is write protectedGuenter Roeck2-0/+23
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-24hwmon: (pmbus/ucd9000) Add support for UCD90320 Power SequencerJim Wright2-15/+30
Add support for the UCD90320 chip and its expanded set of GPIO pins. Signed-off-by: Jim Wright <wrightj@linux.vnet.ibm.com> Link: https://lore.kernel.org/r/20191205232411.21492-3-wrightj@linux.vnet.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-11-07hwmon: (pmbus) add driver for BEL PFE1100 and PFE3000Tao Ren3-0/+141
Add "bel-pfe" pmbus driver to support hardware monitoring for BEL PFE1100 and PFE3000 power supplies. Signed-off-by: Tao Ren <rentao.bupt@gmail.com> Link: https://lore.kernel.org/r/20191029182054.32279-2-rentao.bupt@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-11-07hwmon: (pmbus/ibm-cffps) Add version detection capabilityEddie James1-4/+33
Some systems may plug in either version 1 or version 2 of the IBM common form factor power supply. Add a version-less compatibility string that tells the driver to try and detect which version of the power supply is connected. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/1570648262-25383-3-git-send-email-eajames@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-11-07hwmon: (pmbus/ibm-cffps) Fix LED blink behaviorEddie James1-8/+19
The LED blink_set function incorrectly did not tell the PSU LED to blink if brightness was LED_OFF. Fix this, and also correct the LED_OFF command data, which should give control of the LED back to the PSU firmware. Also prevent I2C failures from getting the driver LED state out of sync and add some dev_dbg statements. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/20191106200106.29519-3-eajames@linux.ibm.com Fixes: ef9e1cdf419a3 ("hwmon: (pmbus/cffps) Add led class device for power supply fault led") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-11-07hwmon: (pmbus/ibm-cffps) Switch LEDs to blocking brightness callEddie James1-4/+6
Since i2c_smbus functions can sleep, the brightness setting function for this driver must be the blocking version to avoid scheduling while atomic. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/20191106200106.29519-2-eajames@linux.ibm.com Fixes: ef9e1cdf419a3 ("hwmon: (pmbus/cffps) Add led class device for power supply fault led") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03pmbus: (ibm-cffps) Add support for version 2 of the PSUEddie James1-22/+88
Version 2 of the PSU supports a second page of data and changes the format of the FW version. Use the devicetree binding to differentiate between the version the driver should use. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/1567192263-15065-4-git-send-email-eajames@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: pmbus: Add Inspur Power System power supply driverJohn Wang3-0/+238
Add the driver to monitor Inspur Power System power supplies with hwmon over pmbus. This driver adds sysfs attributes for additional power supply data, including vendor, model, part_number, serial number, firmware revision, hardware revision, and psu mode(active/standby). Signed-off-by: John Wang <wangzqbj@inspur.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/20190819091509.29276-1-wangzqbj@inspur.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (pmbus/max31785) Remove a useless #defineChristophe JAILLET1-2/+0
There is a typo in MAX37185_NUM_FAN_PAGES. To be consistent, it should be MAX31785_NUM_FAN_PAGES (1 and 7 switched). At line 24, we already have: #define MAX31785_NR_FAN_PAGES 6 and MAX37185_NUM_FAN_PAGES seems to be unused. It is likely that it is only a typo and/or a left-over. So, axe it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20190721101553.20911-1-christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-31hwmon: pmbus: ucd9000: remove unneeded includeBartosz Golaszewski1-1/+0
Build bot reports the following build issue after commit 9091373ab7ea ("gpio: remove less important #ifdef around declarations): In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:576:1: error: redefinition of 'gpiochip_add_pin_range' gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:245:1: note: previous definition of 'gpiochip_add_pin_range' was here gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:583:1: error: redefinition of 'gpiochip_add_pingroup_range' gpiochip_add_pingroup_range(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:254:1: note: previous definition of 'gpiochip_add_pingroup_range' was here gpiochip_add_pingroup_range(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:591:1: error: redefinition of 'gpiochip_remove_pin_ranges' gpiochip_remove_pin_ranges(struct gpio_chip *chip) ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:263:1: note: previous definition of 'gpiochip_remove_pin_ranges' was here gpiochip_remove_pin_ranges(struct gpio_chip *chip) This is caused by conflicting defines from linux/gpio.h and linux/gpio/driver.h. Drivers should not include both the legacy and the new API headers. This driver doesn't even use linux/gpio.h so remove it. Reported-by: kbuild test robot <lkp@intel.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20190808080144.6183-1-brgl@bgdev.pl Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-24hwmon: (pmbus/adm1275) Fix power sampling supportGuenter Roeck1-19/+65
Not every chip supported by this driver supports setting the number of samples for power averaging. Also, the power monitoring register is not always a 16-bit register, and the configuration bits used for voltage sampling are different depending on the register width. Some conditional code is needed to fix the problem. On top of all that, the compiler complains about problems with FIELD_GET and FIELD_PREP macros if the file is built with W=1. Avoid using those macros to silence the warning. Cc: Krzysztof Adamski <krzysztof.adamski@nokia.com> Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com> Reviewed-by: Krzysztof Adamski <krzysztof.adamski@nokia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-24hwmon: (pmbus) Add Infineon IRPS5401 driverRobert Hancock3-0/+77
Add a driver to support the Infineon IRPS5401 PMIC. This chip has 5 pages corresponding to 4 switching outputs and one linear (LDO) output. The switching and LDO outputs have slightly different supported parameters. Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-24hwmon: (pmbus) Add Infineon PXE1610 VR driverVijay Khemka3-0/+149
Added pmbus driver for the new device Infineon pxe1610 voltage regulator. It also supports similar family device PXE1110 and PXM1310. Signed-off-by: Vijay Khemka <vijaykhemka@fb.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-24hwmon: (pmbus/adm1275) support PMBUS_VIRT_*_SAMPLESAdamski, Krzysztof (Nokia - PL/Wroclaw)1-1/+58
The device supports setting the number of samples for averaging the measurements. There are two separate settings - PWR_AVG for averaging PIN and VI_AVG for averaging VIN/VAUX/IOUT, both being part of PMON_CONFIG register. The values are stored as exponent of base 2 of the actual number of samples that will be taken. Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> [groeck: Dropped unused variables] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-06hwmon: (pmbus/core) Treat parameters as paged if on multiple pagesRobert Hancock1-4/+30
Some chips have attributes which exist on more than one page but the attribute is not presently marked as paged. This causes the attributes to be generated with the same label, which makes it impossible for userspace to tell them apart. Marking all such attributes as paged would result in the page suffix being added regardless of whether they were present on more than one page or not, which might break existing setups. Therefore, we add a second check which treats the attribute as paged, even if not marked as such, if it is present on multiple pages. Fixes: b4ce237b7f7d ("hwmon: (pmbus) Introduce infrastructure to detect sensors and limit registers") Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-06-06hwmon: (pmbus/core) mutex_lock write in pmbus_set_samplesAdamski, Krzysztof (Nokia - PL/Wroclaw)1-0/+3
update_lock is a mutex intended to protect write operations. It was not taken, however, when _pmbus_write_word_data is called from pmbus_set_samples() function which may cause problems especially when some PMBUS_VIRT_* operation is implemented as a read-modify-write cycle. This patch makes sure the lock is held during the operation. Fixes: 49c4455dccf2 ("hwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registers") Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> [groeck: Declared and initialized missing 'data' variable] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner6-60/+6
Based on 3 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 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 [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] 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 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 [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner3-15/+3
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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61Thomas Gleixner10-140/+10
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-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner1-0/+1
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-16hwmon: (pmbus/isl68137) Add driver for Intersil ISL68137 PWM ControllerMaxim Sloyko3-0/+179
Intersil ISL68137 is a digital output 7-phase configurable PWM controller with an AVSBus interface. Signed-off-by: Maxim Sloyko <maxims@google.com> Signed-off-by: Robert Lippert <rlippert@google.com> Signed-off-by: Patrick Venture <venture@google.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-04-16pmbus: support for custom sysfs attributeskrzysztof.adamski@nokia.com2-1/+15
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-16hwmon: (lm25066) Support SAMPLES_FOR_AVG registerAdamski, Krzysztof (Nokia - PL/Wroclaw)1-1/+16
Manufacturer specific SAMPLES_FOR_AVG register allows setting the number of samples used in computing the average values (PMBUS_VIRT_READ_*_AVG). The number we write is an exponent of base 2 of the number of samples so for example writing 3 will result in 8 samples average. Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-04-16hwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registersAdamski, Krzysztof (Nokia - PL/Wroclaw)2-0/+125
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>