-
Notifications
You must be signed in to change notification settings - Fork 920
hwmon: (pmbus/lt3074) add support for lt3074 #2685
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
Merged
Merged
Changes from all commits
Commits
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
69 changes: 69 additions & 0 deletions
69
Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
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,69 @@ | ||
| # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| %YAML 1.2 | ||
| --- | ||
| $id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml# | ||
| $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
|
||
| title: Analog Devices LT3074 voltage regulator | ||
|
|
||
| maintainers: | ||
| - Cedric Encarnacion <cedricjustine.encarnacion@analog.com> | ||
|
|
||
| description: | | ||
| The LT3074 is a low voltage, ultra-low noise and ultra-fast transient | ||
| response linear regulator. It allows telemetry for input/output voltage, | ||
| output current and temperature through the PMBus serial interface. | ||
|
|
||
| Datasheet: | ||
| https://www.analog.com/en/products/lt3074.html | ||
|
|
||
| allOf: | ||
| - $ref: /schemas/regulator/regulator.yaml# | ||
|
|
||
| properties: | ||
| compatible: | ||
| enum: | ||
| - adi,lt3074 | ||
|
|
||
| reg: | ||
| maxItems: 1 | ||
|
|
||
| regulators: | ||
| type: object | ||
| description: | | ||
| list of regulators provided by this controller. | ||
|
|
||
| properties: | ||
| vout: | ||
| $ref: /schemas/regulator/regulator.yaml# | ||
| type: object | ||
|
|
||
| unevaluatedProperties: false | ||
|
|
||
| additionalProperties: false | ||
|
|
||
| required: | ||
| - compatible | ||
| - reg | ||
|
|
||
| additionalProperties: false | ||
|
|
||
| examples: | ||
| - | | ||
| i2c { | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
|
|
||
| regulator@6d { | ||
| compatible = "adi,lt3074"; | ||
| reg = <0x6d>; | ||
|
|
||
| regulators { | ||
| vout0 { | ||
| regulator-name = "vout"; | ||
| regulator-max-microvolt = <1250000>; | ||
| regulator-min-microvolt = <1150000>; | ||
| }; | ||
| }; | ||
| }; | ||
| }; |
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 |
|---|---|---|
|
|
@@ -115,6 +115,7 @@ Hardware Monitoring Kernel Drivers | |
| lm95234 | ||
| lm95245 | ||
| lochnagar | ||
| lt3074 | ||
| lt7182s | ||
| ltc2992 | ||
| ltc2945 | ||
|
|
||
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,72 @@ | ||
| .. SPDX-License-Identifier: GPL-2.0 | ||
|
|
||
| Kernel driver lt3074 | ||
| ==================== | ||
|
|
||
| Supported chips: | ||
|
|
||
| * Analog Devices LT3074 | ||
|
|
||
| Prefix: 'lt3074' | ||
|
|
||
| Addresses scanned: - | ||
|
|
||
| Datasheet: https://www.analog.com/en/products/lt3074.html | ||
|
|
||
| Authors: Cedric Encarnacion <cedricjustine.encarnacion@analog.com> | ||
|
|
||
|
|
||
| Description | ||
| ----------- | ||
|
|
||
| This driver supports hardware monitoring for Analog Devices LT3074 Linear | ||
| Regulator with PMBus interface. | ||
|
|
||
| The LT3074 is a low voltage, ultra-low noise and ultra-fast transient | ||
| response linear regulator with PMBus serial interface. PMBus telemetry | ||
| feature provides information regarding the output voltage and current, | ||
| input voltage, bias voltage and die temperature. | ||
|
|
||
| The driver is a client driver to the core PMBus driver. Please see | ||
| Documentation/hwmon/pmbus.rst for details on PMBus client drivers. | ||
|
|
||
| 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. | ||
|
|
||
| Platform data support | ||
| --------------------- | ||
|
|
||
| The driver supports standard PMBus driver platform data. | ||
|
|
||
| Sysfs entries | ||
| ------------- | ||
|
|
||
| ======================= ======================================================= | ||
| in1_label "vin" | ||
| in1_input Measured input voltage | ||
| in1_max Input overvoltage warning limit | ||
| in1_max_alarm Input overvoltage warning status | ||
| in1_min Input undervoltage warning limit | ||
| in1_min_alarm Input undervoltage warning status | ||
| in2_label "vmon" | ||
| in2_input Measured bias voltage | ||
| in2_max Bias overvoltage warning limit | ||
| in2_min Bias undervoltage warning limit | ||
| in3_label "vout1" | ||
| in3_input Measured output voltage | ||
| in3_max Output overvoltage warning limit | ||
| in3_max_alarm Output overvoltage warning status | ||
| in3_min Output undervoltage warning limit | ||
| in3_min_alarm Output undervoltage warning status | ||
| curr1_label "iout1" | ||
| curr1_input Measured output current. | ||
| curr1_crit Output overcurrent fault limit | ||
| curr1_crit_alarm Output overcurrent fault status | ||
| temp1_input Measured temperature | ||
| temp1_max Maximum temperature limit | ||
| temp1_max_alarm Overtemperature warning status | ||
| ======================= ======================================================= |
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
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 |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
| /* | ||
| * Hardware monitoring driver for Analog Devices LT3074 | ||
| * | ||
| * Copyright (C) 2025 Analog Devices, Inc. | ||
| */ | ||
| #include <linux/err.h> | ||
| #include <linux/i2c.h> | ||
| #include <linux/mod_devicetable.h> | ||
| #include <linux/module.h> | ||
|
|
||
| #include "pmbus.h" | ||
|
|
||
| #define LT3074_MFR_READ_VBIAS 0xc6 | ||
| #define LT3074_MFR_BIAS_OV_WARN_LIMIT 0xc7 | ||
| #define LT3074_MFR_BIAS_UV_WARN_LIMIT 0xc8 | ||
| #define LT3074_MFR_SPECIAL_ID 0xe7 | ||
|
|
||
| #define LT3074_SPECIAL_ID_VALUE 0x1c1d | ||
|
|
||
| static const struct regulator_desc __maybe_unused lt3074_reg_desc[] = { | ||
| PMBUS_REGULATOR("vout", 0), | ||
| }; | ||
|
|
||
| static int lt3074_read_word_data(struct i2c_client *client, int page, | ||
| int phase, int reg) | ||
| { | ||
| switch (reg) { | ||
| case PMBUS_VIRT_READ_VMON: | ||
| return pmbus_read_word_data(client, page, phase, | ||
| LT3074_MFR_READ_VBIAS); | ||
| case PMBUS_VIRT_VMON_UV_WARN_LIMIT: | ||
| return pmbus_read_word_data(client, page, phase, | ||
| LT3074_MFR_BIAS_UV_WARN_LIMIT); | ||
| case PMBUS_VIRT_VMON_OV_WARN_LIMIT: | ||
| return pmbus_read_word_data(client, page, phase, | ||
| LT3074_MFR_BIAS_OV_WARN_LIMIT); | ||
| default: | ||
| return -ENODATA; | ||
| } | ||
| } | ||
|
|
||
| static int lt3074_write_word_data(struct i2c_client *client, int page, | ||
| int reg, u16 word) | ||
| { | ||
| switch (reg) { | ||
| case PMBUS_VIRT_VMON_UV_WARN_LIMIT: | ||
| return pmbus_write_word_data(client, 0, | ||
| LT3074_MFR_BIAS_UV_WARN_LIMIT, | ||
| word); | ||
| case PMBUS_VIRT_VMON_OV_WARN_LIMIT: | ||
| return pmbus_write_word_data(client, 0, | ||
| LT3074_MFR_BIAS_OV_WARN_LIMIT, | ||
| word); | ||
| default: | ||
| return -ENODATA; | ||
| } | ||
| } | ||
|
|
||
| static struct pmbus_driver_info lt3074_info = { | ||
| .pages = 1, | ||
| .format[PSC_VOLTAGE_IN] = linear, | ||
| .format[PSC_VOLTAGE_OUT] = linear, | ||
| .format[PSC_CURRENT_OUT] = linear, | ||
| .format[PSC_TEMPERATURE] = linear, | ||
| .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT | | ||
| PMBUS_HAVE_TEMP | PMBUS_HAVE_VMON | | ||
| PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT | | ||
| PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP, | ||
| .read_word_data = lt3074_read_word_data, | ||
| .write_word_data = lt3074_write_word_data, | ||
| #if IS_ENABLED(CONFIG_SENSORS_LT3074_REGULATOR) | ||
| .num_regulators = 1, | ||
| .reg_desc = lt3074_reg_desc, | ||
| #endif | ||
| }; | ||
|
|
||
| static int lt3074_probe(struct i2c_client *client) | ||
| { | ||
| int ret; | ||
| struct device *dev = &client->dev; | ||
|
|
||
| if (!i2c_check_functionality(client->adapter, | ||
| I2C_FUNC_SMBUS_READ_WORD_DATA)) | ||
| return -ENODEV; | ||
|
|
||
| ret = i2c_smbus_read_word_data(client, LT3074_MFR_SPECIAL_ID); | ||
| if (ret < 0) | ||
| return dev_err_probe(dev, ret, "Failed to read ID\n"); | ||
|
|
||
| if (ret != LT3074_SPECIAL_ID_VALUE) | ||
| return dev_err_probe(dev, -ENODEV, "ID mismatch\n"); | ||
|
|
||
| return pmbus_do_probe(client, <3074_info); | ||
| } | ||
|
|
||
| static const struct i2c_device_id lt3074_id[] = { | ||
| { "lt3074", 0 }, | ||
| {} | ||
| }; | ||
| MODULE_DEVICE_TABLE(i2c, lt3074_id); | ||
|
|
||
| static const struct of_device_id __maybe_unused lt3074_of_match[] = { | ||
| { .compatible = "adi,lt3074" }, | ||
| {} | ||
| }; | ||
| MODULE_DEVICE_TABLE(of, lt3074_of_match); | ||
|
|
||
| static struct i2c_driver lt3074_driver = { | ||
| .driver = { | ||
| .name = "lt3074", | ||
| .of_match_table = of_match_ptr(lt3074_of_match), | ||
| }, | ||
| .probe = lt3074_probe, | ||
| .id_table = lt3074_id, | ||
| }; | ||
| module_i2c_driver(lt3074_driver); | ||
|
|
||
| MODULE_AUTHOR("Cedric Encarnacion <cedricjustine.encarnacion@analog.com>"); | ||
| MODULE_DESCRIPTION("PMBus driver for Analog Devices LT3074"); | ||
| MODULE_LICENSE("GPL"); | ||
| MODULE_IMPORT_NS("PMBUS"); | ||
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.