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

smartbond UART power management #62190

Merged
merged 4 commits into from
May 12, 2024

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented Sep 1, 2023

This adds power management functionality to SmartBond(tm) serial driver.

With this PR:

  • UART allows platform to go to sleep handling PM_DEVICE_ACTION_RESUME/PM_DEVICE_ACTION_SUSPEND messages.
  • Platform can be woken up on UART RX activity
  • Platform can be keep awaken when DTR line is asserted (optional feature of selected GPIO)
  • DT now has definition of UART2 and UART3

This change requires #61857 and #61844 and #61941

Signed-off-by: Jerzy Kasenberg jerzy.kasenberg@codecoup.pl

@zephyrbot zephyrbot added platform: Renesas SmartBond Renesas Electronics Corporation, SmartBond area: UART Universal Asynchronous Receiver-Transmitter area: Devicetree Binding PR modifies or adds a Device Tree binding labels Sep 1, 2023
@kasjer kasjer force-pushed the kasjer/da1469x-uart-pm branch 7 times, most recently from 6d7dced to c907740 Compare September 15, 2023 08:56
@MaureenHelm
Copy link
Member

@andrzej-kaczmarek @dcpleung please take a look

@kasjer
Copy link
Contributor Author

kasjer commented Oct 5, 2023

Just reminder that this requires #61857

dts/arm/renesas/smartbond/da1469x.dtsi Outdated Show resolved Hide resolved
Copy link
Member

@dcpleung dcpleung left a comment

Choose a reason for hiding this comment

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

(clicked the wrong button.)

@kasjer kasjer force-pushed the kasjer/da1469x-uart-pm branch from c907740 to bd69ca1 Compare October 6, 2023 05:31
dcpleung
dcpleung previously approved these changes Oct 6, 2023
Copy link

github-actions bot commented Dec 6, 2023

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 Dec 6, 2023
@kasjer
Copy link
Contributor Author

kasjer commented Dec 7, 2023

Still waiting for #61857 to be processed

@dcpleung dcpleung removed the Stale label Dec 7, 2023
Copy link

github-actions bot commented Feb 6, 2024

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 Feb 6, 2024
@kasjer
Copy link
Contributor Author

kasjer commented Feb 6, 2024

Still waiting for #61857 to be accepted

@dcpleung dcpleung removed the Stale label Feb 6, 2024
@nashif
Copy link
Member

nashif commented Mar 26, 2024

needs rebase


ret = gpio_add_callback(config->rx_wake_gpio.port, &data->rx_wake_cb);
if (ret < 0) {
return ret;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we call da1469x_pd_release(MCU_PD_DOMAIN_COM); before returning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ydamigos you are right, code will be changed not to return here. If add callback fails (unlikely) timeout will not be configured and UART will work except timeout functionality will be inactive

kasjer and others added 4 commits May 6, 2024 09:16
UART2 and UART3 (unlink UART) do support hardware flow control.
This simply add necessary flag that is already handled in the code.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This is initial version that implements device power
management support when configured in Kconfig files.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This change allows to wake up UART from sleep mode when
low level on inactive UART is detected during platform sleep.

Timeout can be specified for each UART separately in device tree.
If one of the UARTs is selected as console sleep timeout is taken
from Kconfig same way other platform configure same functionality
using CONFIG_UART_CONSOLE_INPUT_EXPIRED_TIMEOUT

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This change allows to use DTR line driven from external serial port
that when active (low) will prevent UART device from going to sleep.
It will also wake up platform when DTR line becomes active.

DTR line is often activated in serial port connected to host computer
when operating system opens serial device like COMx for Windows
or /dev/ttyACMx /dev/ttyUSBx for Linux based systems.

DTR line (specified in device tree) will be used by WAKEUP and PDC
controllers (via GPIO driver) to handle DTR line changes.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
@kasjer kasjer force-pushed the kasjer/da1469x-uart-pm branch from bd69ca1 to 7b34296 Compare May 6, 2024 08:13
@zephyrbot zephyrbot requested a review from decsny May 6, 2024 08:13
@kasjer
Copy link
Contributor Author

kasjer commented May 6, 2024

rebased to fix conflicts and @ydamigos comment addressed

@decsny decsny requested review from fabiobaltieri and gmarull and removed request for decsny May 6, 2024 14:17
@nashif nashif merged commit 961959f into zephyrproject-rtos:main May 12, 2024
21 checks passed
@kasjer kasjer deleted the kasjer/da1469x-uart-pm branch May 15, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: UART Universal Asynchronous Receiver-Transmitter platform: Renesas SmartBond Renesas Electronics Corporation, SmartBond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants