Commit Graph

118 Commits

Author SHA1 Message Date
Guenter Roeck ccf2dc51bc hwmon: (ltc2978) Add support for LTM4675
LTM2975 is a dual 9A or single 18A μModule regulator.
It is register compatible with LTM4676.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-19 09:08:55 -07:00
Michael Jones e04d1ce9bb hwmon: (ltc2978) Add polling for chips requiring it
Some of the LTC chips supported by this driver have to be polled
to ensure that they are ready to accept commands.

Signed-off-by: Michael Jones <mike@proclivis.com>
[Guenter Roeck: simplifications and formatting changes]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-19 09:08:41 -07:00
Guenter Roeck d830e27dac hwmon: (pmbus) Enable PEC if the controller supports it
PMBus controllers optionally support PEC. Configure the driver
to use it if available to improve operational security.

Suggested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-19 09:08:29 -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 228b687d9e hwmon: (ltc2978) Add support for LTC3886
LTC3886 is a is a dual PolyPhase DC/DC synchronous step-down switching
regulator controller. It is mostly command compatible to LTC3883,
but supports two phases instead of one.

Suggested-by: Michael Jones <mike@proclivis.com>
Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 16:36:00 -07:00
Guenter Roeck 52aae6af71 hwmon: (ltc2978) Add support for LTC2980 and LTM2987
LTC2980 and LTM2987 are command compatible to LTC2977. They consist of
two LTC2977 on a single die, and are instantiated as two separate chips,
each supporting eight channels.

Suggested-by: Michael Jones <mike@proclivis.com>
Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 16:35:59 -07:00
Guenter Roeck acb092cdf9 hwmon: (ltc2978) Add missing chip IDs for LTC2978 and LTC3882
Add additional chip ID for an older revision of LTC2978, as well
as two chip IDs for LTC3882. Turns out the LTC3882 does support the
LTC2978_MFR_SPECIAL_ID register, and reading it returns its chip ID,
but the register is undocumented.

Suggested-by: Michael Jones <mike@proclivis.com>
Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 16:35:13 -07:00
Guenter Roeck 00c8337191 hwmon: (ltc2978) Use correct ID mask to detect all chips
Per information from Linear Technologies, the ID mask is 12 bit
for all chips of this series. Use this mask to detect chips to ensure
that all chip revisions are detected.

Suggested-by: Michael Jones <mike@proclivis.com>
Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 16:34:02 -07:00
Guenter Roeck ee847a2526 hwmon: (ltc2978) Introduce helper functions for min and max values
The code used to determine historic low and high peaks is repeated
several times. Introduce helper functions to simplify it.

Tested-by: Michael Jones <mike@proclivis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-17 11:55:56 -07:00
Guenter Roeck 8582bcc8eb hwmon: (ltc2978) Introduce feature flags
It is becoming cumbersom to track per-chip feature support.
Introduce feature flag to simplify the code.

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 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 649ca820da hwmon: (ltc2978) Add support for LTC2975
LTC2975 is mostly compatible to LTC2974, but supports input current
and power measurement.

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 15398566f0 hwmon: (ltc2978) Add support for LTC3887
LTC3887 is an enhanced version of LTC3880 and supports the same commands.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-12 12:29:36 -07:00
Guenter Roeck e8047a2686 hwmon: (ltc2978) Add additional chip IDs for LTM4676 and LTM4676A
Per datasheet, the chip ID for LTM4676 is 0x448x. This was observed
in real systems. In addition to that, chip ID 0x4401 was observed
as well. Research shows that the chip ID has been changed from 0x440x
to 0x448x in datasheet revision C. Add support for the additional chip ID.

Also add the chip ID for LTM4676A, which is functionally identical
to LTM4676.

Reported-by: Ananda Babu Nettam <anandab@juniper.net>
Cc: Ananda Babu Nettam <anandab@juniper.net>
Cc: Amit U Jain <amjain@juniper.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-12 12:29:22 -07:00
Guenter Roeck bf89386f16 hwmon: (ltc2978) Add support for LTC3882
LTC3882 is mostly compatible with LTC3880. Major differences are that it
does not measure the input current, and it no longer supports LTC's legacy
mechanism to identify the chip.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-12 12:29:22 -07:00
Guenter Roeck 836954dadc hwmon: (ltc2978) Move code to read chip ID into separate function
Verifying the chip type is getting more complicated with new chips,
since not all chips support the same mechanism to read the chip type.
Move the code into a separate function to simplify adding support for
those chips.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-12 12:29:12 -07:00
Guenter Roeck cfca3789e0 hwmon: (pmbus) Add device IDs for TPS544{B,C}2{0,5}
Add device IDs and references for Texas Instruments TPS544B20, TPS544B25,
TPS544C20, and TPS544C25 to the generic PMBus driver.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-10 22:59:47 -07:00
Guenter Roeck 1f61cab8a7 hwmon: (pmbus) Add support for MAX20751
MAX20751 is a multiphase power controller with internal buck converter.
It uses VR12.0 to report the output voltage. This requires an explicit
driver, since the VR version can not be auto-detected.

The chip supports a manufacturer specific command to fine-tune the output
voltage.  This command is not currently supported.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:27 -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 aeaa4d9f81 hwmon: (ltc2978) LTM4676 supports CLEAR_PEAKS
Use the CLEAR_PEAKS command on LTM4676.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:27 -07:00
Guenter Roeck 68a4038236 hwmon: (adm1275) Add support for ADM1293 and ADM1294
ADM1293 and ADM1294 are mostly compatible with other chips of the same
series, but have more configuration options. There are also some
differences in register details.

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
Guenter Roeck 9048539b7c hwmon: (adm1275) Introduce new feature flags
Introduce have_vout, have_vaux_status, have_pin_max, and have_uc_fault
to simplify adding support for new chips.

Also simplify error returns where appropriate to return immediately
on error.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Guenter Roeck 904b296f30 hwmon: (adm1275) Introduce configuration data structure for coeffcients
Each new chip supported by the driver has a new set of coefficients,
making hard-coding coefficients more and more cumbersome. Introduce
a datastructure and table to simplify configuration.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Guenter Roeck 99b416085c hwmon: (adm1275) Use BIT macro
Use BIT macro to simplify adding new bit masks.

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
Christoph Jaeger 6341e62b21 kconfig: use bool instead of boolean for type definition attributes
Support for keyword 'boolean' will be dropped later on.

No functional change.

Reference: http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-01-07 13:08:04 +01:00
Alan Tull 77aa358580 hwmon: (ltc2978) Add regulator support
Add simple on/off regulator support for ltc2978 and
other pmbus parts supported by the ltc2978 driver.

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08: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
Zhu, Richard \(NSN - CN/Beijing\) a8bfeceb0c hwmon: (pmbus) Add tps40422 front-end driver
For TI power management chip TPS40422, READ_TEMPERATURE_2 command is supported on
page 1 of the chip, but the original driver(pmbus.c) only tried to detect this command
on page 0, this will lead to a result that the temperature sensor in page 1 couldn't
be detected. This change is to isolate the tps40422 driver from pmbus.c into a solo
front-end driver.

Signed-off-by: Zhu Laiwen <richard.zhu@nsn.com>
[Guenter Roeck: Dropped unnecessary license text (fixes checkpatch warning)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04 07:01:38 -07:00
Guenter Roeck f76992b00a hwmon: (pmbus/ltc2978) Add support for LTM4676
The chip's programming interface is quite similar to LTC3880
and supports the same set of sensors.

Reviewed-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-19 18:59:40 -07:00
Guenter Roeck a2e1510743 hwmon: (pmbus/ltc2978) Add new chip ID for LTC2974
LTC2974 datasheet revision C lists the chip ID for LTC2974 as 0x0213.

Reviewed-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-05 21:52:06 -08:00
Guenter Roeck daa436e67c hwmon: (pmbus) Support per-page exponent in linear mode
Some chips use different exponents for sensors on different pages
or rails. Detect and store exponent per page to support this situation.

This fixes a problem with wrong voltages seen on UCD90120.

Reported-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-02-02 21:21:40 -08:00
Guenter Roeck 3f08d7f49f hwmon: (pmbus/ltc2978): Add support for LTC2978A
Detect LTC2978A chip ID. Treat it as LC2978.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:03 -07:00
Guenter Roeck c24c407e96 hwmon: (pmbus/ltc2978): Add support for LTC2977
LTC2977 is a pin compatible replacement for LTC2978.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:03 -07:00
Guenter Roeck c8ccab7ab5 hwmon: (pmbus/lm25066) Add support for LM25063
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:02 -07:00
LABBE Corentin 84fb029faa hwmon: Correct some typos
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:02 -07:00
Guenter Roeck c3b7cddc70 hwmon: (pmbus) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck af78fdf4a6 hwmon: (pmbus) Don't unnecessarily crash the kernel
pmbus code currently crashes the kernel if it detects an internal
implementation error. While the detected condition suggests that there
is a bug in the code, it is hardly fatal. Therefore, it should not
trigger a crash. Replace BUG() with WARN().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Jingoo Han a8b3a3a53f hwmon: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 58615a94f6 hwmon: (pmbus/lm25066) Add support for LM25056
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck e53e6497fc hwmon: (pmbus/lm25066) Refactor device specific coefficients
Initialize device specific coefficients from table instead of hard-coding it
to simplify adding additional chips.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck 2507abb3a7 hwmon: (pmbus/lm25066) Clamp limit attributes
Limits on all supported sensors and chips have to be within 0..0x0fff,
and limits are always positive.

Clamp written values in chip driver. Also clear value cache to ensure
that the actually written value is read back and reported correctly.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck a7c69118bd hwmon: (pmbus/lm25066) Report VAUX as vmon
So far the driver reported the voltage on VAUX as "vout2". This was not
entirely appropriate as it is not an output voltage, and complicates
the code. Use the new virtual "VMON" register set and report the voltage
as "vmon" instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck fd9175d2f6 hwmon: (pmbus/ltc2978) Add support for LTC2974 and LTC3883
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck 3d0d283993 hwmon: (pmbus/ltc2978) Code cleanup
Use u16 instead of int to store cached limit attributes.
This reduces allocated data size per driver instance by 48 bytes.
Use defines for the number of pages supported by individual chips.
Use ARRAY_SIZE for loops to initialize array variables, and
initialize all variables in the same code block.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:41 -07:00
Guenter Roeck 8c958c703e hwmon: (pmbus/ltc2978) Fix temperature reporting
On LTC2978, only READ_TEMPERATURE is supported. It reports
the internal junction temperature. This register is unpaged.

On LTC3880, READ_TEMPERATURE and READ_TEMPERATURE2 are supported.
READ_TEMPERATURE is paged and reports external temperatures.
READ_TEMPERATURE2 is unpaged and reports the internal junction
temperature.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org # 3.2+
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-03-14 09:03:51 -07:00
David Woodhouse 6975404fb9 hwmon: (pmbus) Fix krealloc() misuse in pmbus_add_attribute()
If krealloc() returns NULL, it *doesn't* free the original. So any code
of the form 'foo = krealloc(foo, …);' is almost certainly a bug.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-03-14 06:57:19 -07:00