Skip to content
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

hwmon: (pmbus/adp1050): Support adp1051 and adp1055 #2629

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

actorreno
Copy link

PR Description

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

Add dt-bindings for adp1051 and adp1055 pmbus.
ADP1051: 6 PWM for I/O Voltage, I/O Current, Temperature
ADP1055: 6 PWM for I/O Voltage, I/O Current, Power, Temperature

Signed-off-by: Alexis Torreno <alexisczezar.torreno@analog.com>
ADP1051: 6 PWM for I/O Voltage, I/O Current, Temperature
ADP1055: 6 PWM for I/O Voltage, I/O Current, Power, Temperature

Signed-off-by: Alexis Torreno <alexisczezar.torreno@analog.com>
Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another hint is to run:

git log --oneline drivers/hwmon/pmbus to look for the style used in that dir for commit titles. The most common seems to be (adapted for your case):

hwmon: (pmbus/adp1050): Support adp1051 and adp1055

@@ -10,16 +10,35 @@ maintainers:
- Radu Sabau <radu.sabau@analog.com>

description: |
The ADP1050 is used to monitor system voltages, currents and temperatures.
The ADP1050, ADP1051, and ADP1055 are used to monitor system voltages,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not scale. Instead say "The ADP1050 and similar devices..."

The ADP1050 is used to monitor system voltages, currents and temperatures.
The ADP1050, ADP1051, and ADP1055 are used to monitor system voltages,
currents, power and temperatures.

Through the PMBus interface, the ADP1050 targets isolated power supplies
and has four individual monitors for input/output voltage, input current
and temperature.
Datasheet:
https://www.analog.com/en/products/adp1050.html
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add here the links to new datasheets


hwmon@70 {
compatible = "adi,adp1050";
compatible = "adi,adp1050", "adi,adp1051";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not work like this... If you can fallback to some compatible, that needs to be stated in the bindings which is not.

reg = <0x70>;
vcc-supply = <&vcc>;
status = "okay";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the status

compatible = "adi,adp1055";
reg = <0x4b>;
vcc-supply = <&vcc>;
status = "okay";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it#s only a matter of the address being different, I would not bother in adding another example

| PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
| PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also unrelated change. I would drop it (or add it in a different patch)

ADP1050,
ADP1051,
ADP1055,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the id

{ .compatible = "adi,adp1050"},
{ .compatible = "adi,adp1050", .data = (void *)ADP1050},
{ .compatible = "adi,adp1051", .data = (void *)ADP1051},
{ .compatible = "adi,adp1055", .data = (void *)ADP1055},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass in directly the pmbus_driver_info structs...

{"adp1050", 0},
{"adp1050", ADP1050},
{"adp1051", ADP1051},
{"adp1055", ADP1055},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return pmbus_do_probe(client, &adp1050_info);
enum ADP1050_type type;

type = (enum ADP1050_type)(uintptr_t)device_get_match_data(&client->dev);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you can properly do error checking:

info = device_get_match_data();
if (!info)
    return -ENODEV;

@actorreno actorreno changed the title Added support for ADP1051 and ADP1055 on existing ADP1050 driver hwmon: (pmbus/adp1050): Support adp1051 and adp1055 Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants