serial: 8250: omap: Provide ability to enable/disable UART as wakeup source
authorVignesh R <vigneshr@ti.com>
Mon, 2 Apr 2018 12:20:37 +0000 (17:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 08:12:14 +0000 (10:12 +0200)
commit09d8b2bdbc5c61dd6289d78ab4cb57d22dd5e0e6
treef6a53b5f845efc58e4c1877245ebb160c5ed50a0
parentb7639b0b15ddd1a4686b0142e70dfb122eefc88f
serial: 8250: omap: Provide ability to enable/disable UART as wakeup source

Enable/Clear module level UART wakeup in UART_OMAP_WER register based on
return value of device_may_wakeup() in .suspend(). This allows
userspace to use sysfs to control the ability of UART to wakeup the
system from deep sleep state. Register is restored back in .startup()
call that happens as part of resume sequence.

With this patch, userspace can control UART wakeup capability via sysfs:
To enable wakeup capability:
echo enabled >  /sys/class/tty/ttyXX/device/power/wakeup
For disabling wakeup capability:
echo disabled > /sys/class/tty/ttyXX/device/power/wakeup

Note that the UART wakeup events configured in the 8250 hardware only
work for idle modes that do not cut off power for the UART. For deeper
idle states, dedicated padconf wakeirqs must be used. Or in some cases
the UART RX pin can be remuxed to GPIO input if the GPIO block stays
powered.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_omap.c