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

console/logging: uart: Device Idle Power Management #26401

Closed
wants to merge 2 commits into from
Closed

console/logging: uart: Device Idle Power Management #26401

wants to merge 2 commits into from

Conversation

JordanYates
Copy link
Collaborator

These two patches allow the console and logging UART backends to coexist with 'Device Idle Power Management'.
An application can enable idle power management on the UART backend with device_pm_enable and no longer need to worry about the UART hardware being enabled when it does not need to be.

Relevant code is only run when the power management hardware has been manually enabled.

The console request/release code is less efficient than the corresponding logging request/release code as the console output function operates on single bytes. There are 3 options to mitigate this:

  1. Don't enable idle power management
  2. The application can manually call device_pm_get_sync and device_pm_put_sync before large numbers of prints
  3. printk can be routed through the more efficient logging implementation via CONFIG_LOG_PRINTK

Jordan Yates added 2 commits June 24, 2020 15:37
Allow the log_backend_uart char_out implementation to integrate with
'Device Idle Power Management'.

Without using idle PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call device_set_power_state when the
lowest power states must be reached, while still allowing log messages
to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Allow the uart_console console_out implementation to integrate with
'Device Idle Power Management'.

Without using idle PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call device_set_power_state when the
lowest power states must be reached, while still allowing console and
printk messages to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
@JordanYates
Copy link
Collaborator Author

JordanYates commented Jun 26, 2020

After reading through some other idle power management issues for tangential reasons, I am not sure that device_idle_pm usage is actually wanted in tree.
#24653
@pabigot Do you have any further thoughts on this?

@pabigot
Copy link
Collaborator

pabigot commented Jun 26, 2020

I don't think we want to introduce uses of device_pm_{put,get} because that API was never used in-tree and everything in power management is changing anyway. There's been agreement (on slack) from the folks who introduced it that it could be removed at some point.

I have a use-case for disabling UART when not needed, but it needs API changes to allow the user to say "I may be receiving something; leave this active" vs "I only ever use this for transmit, shut it down when there's nothing pending." Right now the only way to do that, for drivers that support it, is removing the configuration of the RX pin. It should be more general so drivers can self-control power based on their current state. (This still should be coordinated with application control of whether that can happen.).

Also it may be necessary to clarify the required behavior of things like uart_poll_out, which right now can return before the character has actually been transmitted (making it difficult to know when it's safe to turn off the device).

I would prefer to start with API extensions.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Aug 26, 2020
@pabigot pabigot removed the Stale label Aug 26, 2020
@JordanYates JordanYates deleted the log_uart_idle_pm branch September 20, 2020 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants