-
Notifications
You must be signed in to change notification settings - Fork 882
Add driver for MAX42500 #2659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kentlibe
wants to merge
6
commits into
analogdevicesinc:main
Choose a base branch
from
kentlibe:dev/max42500
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add driver for MAX42500 #2659
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0e4dd5c
dt-bindings: mfd: add adi,max42500
kentlibe 979e451
mfd: add driver for max42500
kentlibe e33a857
doc: add supported sysfs for max42500
kentlibe 516a2b9
hwmon: add driver for max42500-hwmon
kentlibe ffa2a87
watchdog: add driver for max42500-wdt
kentlibe ff692c0
Kconfig.adi: imply SENSORS_MAX42500
kentlibe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
%YAML 1.2 | ||
--- | ||
$id: http://devicetree.org/schemas/hwmon/adi,max42500.yaml# | ||
$schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
||
title: Analog Devices MAX42500 Industrial Power System Monitor | ||
|
||
maintainers: | ||
- Kent Libetario <Kent.Libetario@analog.com> | ||
|
||
description: | | ||
Analog Devices MAX42500 Industrial Power System Monitor Family | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/max42500.pdf | ||
|
||
properties: | ||
compatible: | ||
enum: | ||
- adi,max42500 | ||
reg: | ||
maxItems: 1 | ||
|
||
poweroff-gpios: | ||
description: | ||
This property sets the GPIO as output. Then used to control the power and | ||
mode state of the device. This can be enabled optionally to control the | ||
state of comparators in the voltage monitoring and/or trigger timestamp | ||
recording in the flexible power sequence recording functions. Check the | ||
state transition conditions in datasheet for more information. | ||
maxItems: 1 | ||
|
||
sleepoff-gpios: | ||
description: | ||
This property sets the GPIO as output. Then used to control the power and | ||
mode state of the device. This can be enabled and masked optionally to | ||
control the state of comparators in the voltage monitoring and/or trigger | ||
timestamp recording in the flexible power sequence recording functions. | ||
Check the state transition conditions in datasheet for more information. | ||
maxItems: 1 | ||
|
||
required: | ||
- compatible | ||
- reg | ||
|
||
additionalProperties: false | ||
|
||
examples: | ||
- | | ||
#include <dt-bindings/gpio/gpio.h> | ||
i2c { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
hwmon@28 { | ||
compatible = "adi,max42500"; | ||
reg = <0x28>; | ||
}; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
.. SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
Kernel driver max42500 | ||
====================== | ||
|
||
Supported chips: | ||
* Analog Devices MAX42500 | ||
|
||
Prefix: 'max42500' | ||
|
||
Addresses scanned: I2C 0x28 to 0x2B | ||
|
||
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max42500.pdf | ||
|
||
Author: Kent Libetario <Kent.Libetario@analog.com> | ||
|
||
Description | ||
----------- | ||
|
||
This driver supports hardware monitoring of MAX42500 power system with up | ||
to seven voltage monitor inputs. Each input has programmable overvoltage | ||
(OV) and undervoltage (UV) thresholds where two of the inputs support | ||
dynamic voltage scaling (DVS). Additionally, the MAX42500 features a | ||
programmable flexible power sequence recorder that stores timestamps | ||
separately. And also, the MAX42500 has a programmable challenge and | ||
response watchdog with a configurable RESET output. | ||
|
||
|
||
Usage Notes | ||
----------- | ||
|
||
This driver does not auto-detect devices. You will have to instantiate the | ||
devices explicitly. Please see Documentation/i2c/instantiating-devices.rst | ||
for details. | ||
|
||
Due to its multi-functionality, the MAX42500 is split into three drivers: | ||
the mfd driver as the main device, and the hwmon and watchdog drivers as | ||
the sub-devices. The mfd driver is a client to the core driver and | ||
consumed by both the hwmon and watchdog drivers. | ||
|
||
Optionally, two power management GPIOs are provided by the mfd driver and | ||
consumed only by the hwmon sub-device driver. The pins are fixed-outputs | ||
to control the voltage monitor comparators and trigger the power sequence | ||
timestamp recording of the device. Please see the datasheet for details. | ||
|
||
For the two GPIO output pins to be consumed, the device tree will look | ||
like this: | ||
|
||
.. code-block:: | ||
|
||
i2c { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
poweroff-gpios | ||
sleepoff-gpios | ||
|
||
hwmon@28 { | ||
compatible = "adi,max42500"; | ||
reg = <0x28>; | ||
}; | ||
}; | ||
|
||
Otherwise, the two pins maybe omitted in the device tree if unused. | ||
|
||
|
||
Platform data support | ||
--------------------- | ||
|
||
The Hwmon driver supports standard Hwmon ABI driver and sysfs platform | ||
data. While the watchdog driver supports the standard watchdog ABI driver | ||
and sysfs platform data. | ||
|
||
|
||
Hwmon Sysfs entries | ||
------------------- | ||
|
||
The following attributes are supported. Limits are read-write; all other | ||
attributes are read-only. | ||
|
||
|
||
Chip | ||
~~~~ | ||
|
||
======================= ======================================================= | ||
chip_pec Enable or disable PEC: PECE bit in CONFIG1 register | ||
======================= ======================================================= | ||
|
||
In | ||
~~ | ||
|
||
======================= ====================================================== | ||
in[1-7]_label "VMON[1-7]" | ||
in[1-7]_enable Enable or disable voltage monitors: VM1 to VM7 bits of | ||
VMON register | ||
in[1-5]_min Nominal Voltage set point: VIN1 to VIN5 registers | ||
in[1-5]_lcrit IN1-IN5 UV threshold: UV1 to UV5 nibbles of OVUV1 to | ||
OVUV5 registers | ||
in[6-7]_lcrit IN6-IN7 UV threshold: VINU6 to VINU7 registers | ||
in[1-5]_crit IN1-IN5 OV threshold: OV1 to OV5 nibbles of OVUV1 to | ||
OVUV5 registers | ||
in[6-7]_crit IN6-IN7 OV threshold: VINO6 to VINO7 registers | ||
in[1-7]_reset_history Enable or disable reset mapping: IN1 to IN7 bits of | ||
RSTMAP register | ||
======================= ====================================================== | ||
|
||
Power | ||
~~~~~ | ||
|
||
=============================== =============================================== | ||
power[1-7]_label "STATUS[1-7]" | ||
power_enable OFF comparator status: STATOFF register | ||
power_lcrit_alarm UV comparator status: STATUV register | ||
power_crit_alarm OV comparator status: STATOV register | ||
power[1-7]_average_interval_min Power-Down sequence time-stamp: DTIME1 to | ||
DTIME7 registers | ||
power[1-7]_average_interval_max Power-Up sequence time-stamp: UTIME1 to | ||
UTIME7 registers | ||
=============================== =============================================== | ||
|
||
|
||
Watchdog Sysfs entries | ||
---------------------- | ||
|
||
======================= ======================================================= | ||
start Enable the watchdog: WDEN bit of WDCFG2 register | ||
stop Disable the watchdog: WDEN bit of WDCFG2 register | ||
ping Set the watchdog key to the device: WDKEY register | ||
status Watchdog status: WDSTAT register | ||
set_timeout Watchdog Clock Divider: WDIV bits of WDCDIV register | ||
set_pretimeout First Update Extension: 1UD bit of WDCFG2 register | ||
restart Reset Hold or Active Timeout: RHLD bits of RSTCTRL | ||
register | ||
======================= ======================================================= | ||
|
||
.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,5 @@ config HWMON_ALL_ADI_DRIVERS | |
imply MAX31827 | ||
imply SENSORS_MAX31760 | ||
imply SENSORS_LT7182S | ||
imply SENSORS_MAX42500 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.