drivers/serial/serial.c: Call pm_activity() when characters are received on a console device.

This commit is contained in:
Gregory Nutt 2019-01-27 10:50:15 -06:00
parent 63276899bf
commit f992fd9f51
2 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,22 @@ config DEV_LOWCONSOLE
---help---
Use the simple, low-level, write-only serial console driver (minimal support)
config SERIAL_PM_ACTIVITY_DOMAIN
int "PM activity domain"
default 0
depends on PM
---help---
When characters are received on a console device, pm_activity()
will be called with this PM domain
config SERIAL_PM_ACTIVITY_PRIORITY
int "PM activity priority when reive character"
default 6
depends on PM
---help---
When characters are received on a console device, pm_activity()
will be called with this PM priority
config SERIAL_REMOVABLE
bool
default n

View File

@ -58,6 +58,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/serial/serial.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/power/pm.h>
/************************************************************************************
* Pre-processor Definitions
@ -1687,6 +1688,16 @@ void uart_datareceived(FAR uart_dev_t *dev)
/* Notify all poll/select waiters that they can read from the recv buffer */
uart_pollnotify(dev, POLLIN);
#ifdef CONFIG_PM
/* Call pm_activity when characters are received on the console device */
if (dev->isconsole)
{
pm_activity(CONFIG_SERIAL_PM_ACTIVITY_DOMAIN,
CONFIG_SERIAL_PM_ACTIVITY_PRIORITY);
}
#endif
}
/************************************************************************************