-
Notifications
You must be signed in to change notification settings - Fork 845
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
base: main
Are you sure you want to change the base?
Conversation
ca32f70
to
ffc9249
Compare
There was a problem hiding this 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 <[email protected]> | |||
|
|||
description: | | |||
The ADP1050 is used to monitor system voltages, currents and temperatures. | |||
The ADP1050, ADP1051, and ADP1055 are used to monitor system voltages, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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, | ||
}; |
There was a problem hiding this comment.
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)
drivers/hwmon/pmbus/adp1050.c
Outdated
ADP1050, | ||
ADP1051, | ||
ADP1055, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the id
drivers/hwmon/pmbus/adp1050.c
Outdated
{ .compatible = "adi,adp1050"}, | ||
{ .compatible = "adi,adp1050", .data = (void *)ADP1050}, | ||
{ .compatible = "adi,adp1051", .data = (void *)ADP1051}, | ||
{ .compatible = "adi,adp1055", .data = (void *)ADP1055}, |
There was a problem hiding this comment.
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...
drivers/hwmon/pmbus/adp1050.c
Outdated
{"adp1050", 0}, | ||
{"adp1050", ADP1050}, | ||
{"adp1051", ADP1051}, | ||
{"adp1055", ADP1055}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you need a cast but there are examples:
https://elixir.bootlin.com/linux/v6.11.5/source/drivers/iio/addac/ad74413r.c#L1530
drivers/hwmon/pmbus/adp1050.c
Outdated
return pmbus_do_probe(client, &adp1050_info); | ||
enum ADP1050_type type; | ||
|
||
type = (enum ADP1050_type)(uintptr_t)device_get_match_data(&client->dev); |
There was a problem hiding this comment.
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;
39943c4
to
9a7485b
Compare
v2 .yaml:
.rst
.c
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fell free to send this upstream...
- enum: | ||
- adi,adp1050 | ||
- adi,adp1051 | ||
- adi,adp1055 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On top of what I've said already, you don't need "items:" in here (as you have things now at least).
drivers/hwmon/pmbus/adp1050.c
Outdated
return pmbus_do_probe(client, &adp1050_info); | ||
struct pmbus_driver_info *info; | ||
|
||
info = (struct pmbus_driver_info *)device_get_match_data(&client->dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for the cast..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the cast just to remove a warning but yes this can be removed to simplify the code further.
edit: removal of the cast started failing some of the checks. is this ok?
drivers/hwmon/pmbus/adp1050.c
Outdated
/* 6.1 probe() function still uses the second struct i2c_device_id argument */ | ||
static int adp1050_probe(struct i2c_client *client, | ||
const struct i2c_device_id *id) | ||
{ | ||
return pmbus_do_probe(client, &adp1050_info); | ||
struct pmbus_driver_info *info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be const pmbus_driver_info *info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously a typo from me... const struct pmbus_driver_info *info
and then no need for the cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
9a7485b
to
82c4d40
Compare
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 <[email protected]>
82c4d40
to
72a535b
Compare
PR Description
PR Type
PR Checklist