diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 15d1db1c73..448e7aef72 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -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 diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 28d59b5984..8701c1e6c3 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -58,6 +58,7 @@ #include #include #include +#include /************************************************************************************ * 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 } /************************************************************************************