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

os/drivers/serial: avoid board sleep in UART RX #6485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gSahitya-samsung
Copy link
Contributor

@gSahitya-samsung gSahitya-samsung commented Nov 6, 2024

This commit make use of PM APIs to avoid board sleep during uart_recvchars operation. This will ensure UART RX IRQ can be handled by application without board sleep.

This commit make use of PM APIs to avoid board sleep during uart_recvchars operation. This will ensure UART RX IRQ can be handled by application without board sleep.
@neel-samsung
Copy link
Contributor

Test Results : Building and booting is fine.
Output TASH Issue:
TASH>>CA32PG-KM4PG-Wakeup : UART LOG
TASH>>aabcdefghijklmnopqrstuvwxyzzzzaabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzaaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnn
TASH: cmd (aabcdefghijklmnopqrstuvwxyzzzzaabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzaaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnn) not registered

dev->received(dev);
#ifdef CONFIG_PM
/* Enable board sleep after completing received operation */
(void)pm_resume(pm_uart_domain_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

it should be in serial_read().

@@ -75,6 +75,12 @@
* Pre-processor Definitions
************************************************************************************/

/* The UART Domain name, that needs to register with PM */
Copy link
Contributor

Choose a reason for hiding this comment

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

A header in os/include is for outside usages. But only serial uses those two definitions inside. Let's move them in some header in os/drivers/serial.

Copy link
Contributor

@samsung-singh samsung-singh left a comment

Choose a reason for hiding this comment

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

avoiding board to sleep in uart rx this fixes the issue, change is good to merge.

DEBUGASSERT(pm_uart_domain_id != -1);
/* Suspend board sleep if application is wating for UART data */
(void)pm_suspend(pm_uart_domain_id);
#endif
dev->received(dev);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will just post a semaphore and not perform the actual read operation. So, pm can still go into sleep if we resume here. pm_resume must be called at the end of uart_read when we know that the app has actually read the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants