# Default: horizontal
# DisplayInitDirection=(horizontal or vertical)
+# This is the type of DPMS.
+# If DPMS type is window_manager, turning display on or off, it uses window manager DPMS.
+# If DPMS type is none, when the DPMS function is called, it does nothing just returns true.
+# Default value is window_manager.
+# DisplayDPMSType=(window_manager or none)
+
LCDAlwaysOn=no
TimeoutEnable=yes
SleepSupport=no
# If this value is no, LCD is turned off just by external requests.
# TimeoutEnable=(yes or no)
+# This is the type of DPMS.
+# If DPMS type is window_manager, turning display on or off, it uses window manager DPMS.
+# If DPMS type is none, when the DPMS function is called, it does nothing just returns true.
+# Default value is window_manager.
+# DisplayDPMSType=(window_manager or none)
+
LCDAlwaysOn=no
TimeoutEnable=yes
# If this value is no, LCD is turned off just by external requests.
# TimeoutEnable=(yes or no)
+# This is the type of DPMS.
+# If DPMS type is window_manager, turning display on or off, it uses window manager DPMS.
+# If DPMS type is none, when the DPMS function is called, it does nothing just returns true.
+# Default value is window_manager.
+# DisplayDPMSType=(window_manager or none)
+
LCDAlwaysOn=yes
TimeoutEnable=no
SleepSupport=no
# If this value is no, LCD is turned off just by external requests.
# TimeoutEnable=(yes or no)
+# This is the type of DPMS.
+# If DPMS type is window_manager, turning display on or off, it uses window manager DPMS.
+# If DPMS type is none, when the DPMS function is called, it does nothing just returns true.
+# Default value is window_manager.
+# DisplayDPMSType=(window_manager or none)
+
LCDAlwaysOn=no
TimeoutEnable=yes
ControlDisplay=no
.aod_tsp = true,
.touch_wakeup = false,
.display_on_usb_conn_changed = true,
+ .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER,
};
struct display_function_info display_info = {
.aod_tsp = true,
.touch_wakeup = false,
.display_on_usb_conn_changed = true,
+ .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER,
};
struct display_function_info display_info = {
.aod_tsp = true,
.touch_wakeup = false,
.display_on_usb_conn_changed = true,
+ .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER,
};
struct display_function_info display_info = {
.aod_tsp = true,
.touch_wakeup = false,
.display_on_usb_conn_changed = true,
+ .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER,
};
struct display_function_info display_info = {
#include "poll.h"
#include "device-interface.h"
#include "setting.h"
+#include "display-dpms.h"
#define WITHOUT_STARTNOTI 0x1
#define MASK_BIT 0x7 /* 111 */
bool input_support;
bool touch_wakeup;
bool display_on_usb_conn_changed;
+ enum display_dpms_type display_dpms_type;
};
/*
#include "display/util.h"
#include "display/display-dpms.h"
#include "display/device-interface.h"
+#include "core.h"
#define DPMS_RESPONSE_TIMEOUT 10 /* second */
bool connected;
} wl_glib_info;
+struct dpms_ops {
+ void (*set_state)(int on);
+ int (*get_state)(void);
+ int (*get_cached_state)(void);
+ bool (*init)(void);
+ void (*exit)(void);
+};
+
static wl_glib_info *dpms_client = NULL;
static bool wm_is_ready;
+static struct dpms_ops g_dpms_ops;
+
static GMainLoop *dpms_loop;
static GMainContext *dpms_context;
static bool dpms_get_state_done;
g_source_unref(timeout_source);
}
-void dpms_set_state(int on)
+static void wm_dpms_set_state(int on)
{
uint32_t mode;
}
}
-int dpms_get_state(void)
+static int wm_dpms_get_state(void)
{
if (!dpms_is_available()) {
_E("Dpms is not available.");
}
}
-int dpms_get_cached_state(void)
+static int wm_dpms_get_cached_state(void)
{
if (!dpms_is_available()) {
_E("Dpms is not available.");
return dpms_cache;
}
-bool dpms_init(void)
+static bool wm_dpms_init(void)
{
if (dpms_client)
return true;
if (!check_wm_ready())
return false;
- _I("Init dpms.");
+ _I("Init dpms window manager.");
dpms_context = g_main_context_new();
/* Initialize client */
return true;
}
-void dpms_exit(void)
+static void wm_dpms_exit(void)
{
- _I("Exit dpms.");
+ _I("Exit dpms window manager.");
if (dpms_loop) {
g_main_loop_unref(dpms_loop);
dpms_loop = NULL;
if (dpms_client && !g_source_is_destroyed((GSource *)dpms_client))
g_source_destroy((GSource *)dpms_client);
}
+
+static void none_dpms_set_state(int on) { dpms_cache = on; }
+static int none_dpms_get_state(void) { return dpms_cache; }
+static int none_dpms_get_cached_state(void) { return dpms_cache; }
+static bool none_dpms_init(void) { return true; }
+static void none_dpms_exit(void) {}
+
+void dpms_set_state(int on)
+{
+ if (g_dpms_ops.set_state)
+ g_dpms_ops.set_state(on);
+}
+
+int dpms_get_state(void)
+{
+ if (g_dpms_ops.get_state)
+ return g_dpms_ops.get_state();
+ return -EINVAL;
+}
+
+int dpms_get_cached_state(void)
+{
+ if (g_dpms_ops.get_cached_state)
+ return g_dpms_ops.get_cached_state();
+ return -EINVAL;
+}
+
+bool dpms_init(void)
+{
+ const struct display_config *display_conf = get_var_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration");
+ return false;
+ }
+
+ switch (display_conf->display_dpms_type) {
+ case DISPLAY_DPMS_TYPE_WINDOW_MANAGER:
+ g_dpms_ops.set_state = wm_dpms_set_state;
+ g_dpms_ops.get_state = wm_dpms_get_state;
+ g_dpms_ops.get_cached_state = wm_dpms_get_cached_state;
+ g_dpms_ops.init = wm_dpms_init;
+ g_dpms_ops.exit = wm_dpms_exit;
+ break;
+ case DISPLAY_DPMS_TYPE_NONE:
+ g_dpms_ops.set_state = none_dpms_set_state;
+ g_dpms_ops.get_state = none_dpms_get_state;
+ g_dpms_ops.get_cached_state = none_dpms_get_cached_state;
+ g_dpms_ops.init = none_dpms_init;
+ g_dpms_ops.exit = none_dpms_exit;
+ break;
+ default:
+ _E("Invalid dpms type");
+ return false;
+ }
+
+ if (g_dpms_ops.init)
+ return g_dpms_ops.init();
+
+ return false;
+}
+
+void dpms_exit(void)
+{
+ if (g_dpms_ops.exit)
+ g_dpms_ops.exit();
+}
void dpms_exit(void);
void __register_dpms_checklist(int mode, void (*checker)(void), const char *caller);
#define register_dpms_checklist(mode, checker) __register_dpms_checklist(mode, checker, __func__)
+
+enum display_dpms_type {
+ DISPLAY_DPMS_TYPE_NONE,
+ DISPLAY_DPMS_TYPE_WINDOW_MANAGER,
+};
+
#endif /* __DISPLAY_DPMS_H__ */
#include "util.h"
#include "core.h"
+#include "display-dpms.h"
#include "display-ops.h"
#include "dd-display.h"
#include "shared/common.h"
} else if (MATCH(result->name, "DisplayInitDirection")) {
c->display_init_direction = (MATCH(result->value, "vertical") ? \
DISPLAY_INIT_DIRECTION_VERTICAL : DISPLAY_INIT_DIRECTION_HORIZONTAL);
+ } else if (MATCH(result->name, "DisplayDPMSType")) {
+ c->display_dpms_type = (MATCH(result->value, "none") ? \
+ DISPLAY_DPMS_TYPE_NONE : DISPLAY_DPMS_TYPE_WINDOW_MANAGER);
}
return 0;