-
Notifications
You must be signed in to change notification settings - Fork 7k
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
drivers: regulator: regulator_shell: create command to print regulators #83970
drivers: regulator: regulator_shell: create command to print regulators #83970
Conversation
Hello @bdesterBE, and thank you very much for your first pull request to the Zephyr project! |
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 doesn't make sense, you're documenting "Print regulator names", but only regulator-fixed
is considered.
Thanks for the reply. I originally implemented this as any node with status okay that has the |
First, name should be stored on each regulator, then, you can iterate over all regulators and retrieve their name. |
4fc0046
to
701c08e
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.
I still fail to see the utility of this. List may be incomplete to start with, and you can't obtain a regulator device handle from its 'regulator-name'. It's now possible to list all devices from a particular class, so better use that.
11807f4
to
cd4d80f
Compare
…ames. The regulator shell commands require that you provide the name of the regulator node to be able to interact with them (e.g. regulator enable myRegulator). It can be inconvenient to have to go to Devicetree files to find the name of the regulator to change. This commit visits all nodes with an 'okay' status and prints the node names of nodes belonging to the regulator device API class. Note that the name printed is the node name and not the value of 'regulator_name'. This is because the node name is what is used to interact with the regulators in the shell. Fixes: zephyrproject-rtos#83073 Signed-off-by: Brandon Dester <bdester@boston-engineering.com>
cd4d80f
to
65bb39a
Compare
The intended utility is to be able to easily get the names of regulator nodes without needing to reference devicetree files or guess from tab completion. The node names are needed in order to do anything with regulators from the shell. I pushed the change to use the device class, thanks for the suggestion as it's definitely a better solution. Please let me know if it's preferred to use |
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 is pasting tons of if (device_is_regulator(device_get_binding(DT_NODE_FULL_NAME(node_id))))
, ie, runtime checks, when regulator devices are known at compile time now. Why is this useful when tab
autocompletes regulators only?
The regulator shell commands require that you provide the name of the regulator node to be able to interact with them (e.g.
regulator enable myRegulator
). It can be inconvenient to have to go to Devicetree files to find the name of the regulator to change.Fixes: #83073