-
Notifications
You must be signed in to change notification settings - Fork 8.1k
modem: cellular: baudrate update from devicetree #97702
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
base: main
Are you sure you want to change the base?
modem: cellular: baudrate update from devicetree #97702
Conversation
Add the option for request strings to be selected at runtime from a function instead of hardcoded at compile time. Signed-off-by: Jordan Yates <[email protected]>
Validate that the `request_fn` functionality works as expected. Signed-off-by: Jordan Yates <[email protected]>
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.
Scripts are designed to be prepared in advance, they can be hardcoded to save RAM, or they can be stored in RAM and prepared at runtime.
And this PR was designed to preserve that capability to the greatest extent possible. In return, this allows moving hardware configuration to devicetree, which is where it should be. More generally, it allows tailoring any AT commands which should be configured on a per device basis, rather than the hardcoded configuration currently. The current behaviour of |
|
||
target-speed: | ||
type: int | ||
default: 3000000 |
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.
Isn't baud rate dependent on host capabilities? Might a more conservative default of 1000000
be better?
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.
Absolutely, and this was the primary motivation for the change. The value of 3000000 was chosen to match the deprecated kconfig option, but I can drop it back to 921600 or something if that is preferable.
Move baudrate updates from a global kconfig to a devicetree property. Signed-off-by: Jordan Yates <[email protected]>
275f892
to
e52041c
Compare
|
Simplicity is the key here, not saving a few bytes. The simplest way to achieve this is to just define a custom baudrate request script for the instance of the lara_r6.
and if this is common to all modems, which it looks like it is, a helper can be created which is a bit more general. A more complex way would be to add a mutable script and use that across all modems like we do for apn requests but those cost quite a bit of RAM and complexity.
I agree with the problem, I just don't agree with the proposed solution |
I guess the question is, simplicity for who, and where. Your proposal works, but basically doubles the size of the device creation macro. I am skeptical of turning it into a generic macro, if configuration could be generalized in that way, we probably wouldn't be duplicating every chat script for every modem. The second optioned mentioned, the mutable scripts used by the APN configuration, is a ridiculous amount of boilerplate and code for what essentially boils down to sending a compile time const string. But even ignoring those two points above, the changes to
That's completely trivial with the ability to pull the string from a function, but I don't even want to think about the headache of doing it with dynamic scripts, and flat out impossible with the constant scripts. My follow up question would be, what part of this proposal has the complexity you are arguing against? |
Move baudrate updates from a global kconfig to a devicetree property.
Implemented by extending the modem chat API to support requests to be provided from a callback instead of being statically specified.
Tested on an OOT modem using the same implementation as applied for the LARA_R6.