ODROID: Enable to prevent Sleep mode.

If prevent_sleep is 1, system never enter sleep mode,
but system turn off HDMI PHY, if suspend_hdmiphy is not 0.

Signed-off-by: Chris KIM <codewalker@hardkernel.com>
Change-Id: Ic7848d174390a9a9549222e421b1b7bbfc7fc404
This commit is contained in:
Chris KIM
2020-03-09 18:41:41 +09:00
parent dfadef6839
commit a01c0147fb

View File

@@ -33,6 +33,21 @@
#include <linux/hrtimer.h>
#include <asm/setup.h>
static int prevent_sleep = 0;
static int __init prevent_sleep_setup(char *s)
{
if (!strcmp(s, "true") || !strcmp(s, "1"))
prevent_sleep = 1;
else
prevent_sleep = 0;
return 0;
}
__setup("prevent_sleep=", prevent_sleep_setup);
struct wakeup_source wake_src;
MODULE_AUTHOR("Hardkernel Co,.Ltd");
MODULE_DESCRIPTION("SYSFS driver for ODROID hardware");
MODULE_LICENSE("GPL");
@@ -133,6 +148,8 @@ static struct class odroid_class = {
static int odroid_sysfs_probe(struct platform_device *pdev)
{
int error = 0;
if (prevent_sleep)
__pm_stay_awake(&wake_src);
#ifdef CONFIG_USE_OF
struct device_node *node;
@@ -149,6 +166,9 @@ static int odroid_sysfs_probe(struct platform_device *pdev)
static int odroid_sysfs_remove(struct platform_device *pdev)
{
if (prevent_sleep)
__pm_relax(&wake_src);
return 0;
}
@@ -192,6 +212,9 @@ static int __init odroid_sysfs_init(void)
{
int error = class_register(&odroid_class);
if (prevent_sleep)
wakeup_source_init(&wake_src, "odroid_sysfs");
if (error < 0)
return error;