enter_doze();
}
-/* get configurations from setting */
-static int get_lcd_timeout_from_settings(void)
-{
- int i;
- int val = 0;
-
- for (i = 0; i < S_END; i++) {
- switch (states[i].state) {
- case S_NORMAL:
- get_run_timeout(&val);
- break;
- case S_LCDDIM:
- get_dim_timeout(&val);
- break;
- case S_LCDOFF:
- val = display_conf.lcdoff_timeout;
- break;
- default:
- /* This state doesn't need to set time out. */
- val = 0;
- break;
- }
- if (val > 0)
- states[i].timeout = val;
-
- _I("State(%s) timeout(%d) ms", states[i].name,
- states[i].timeout);
- }
-
- return 0;
-}
-
static void update_display_time(void)
{
int run_timeout, val;
break;
case INIT_INTERFACE:
if (display_conf.timeout_enable)
- get_lcd_timeout_from_settings();
+ display_initialize_display_state_timeout_from_setting();
ret = init_sysfs(flags);
break;
case INIT_POLL:
enter_doze();
}
-/* get configurations from setting */
-static int get_lcd_timeout_from_settings(void)
-{
- int i;
- int val = 0;
-
- for (i = 0; i < S_END; i++) {
- switch (states[i].state) {
- case S_NORMAL:
- get_run_timeout(&val);
- break;
- case S_LCDDIM:
- get_dim_timeout(&val);
- break;
- case S_LCDOFF:
- val = display_conf.lcdoff_timeout;
- break;
- default:
- /* This state doesn't need to set time out. */
- val = 0;
- break;
- }
- if (val > 0)
- states[i].timeout = val;
-
- _I("State(%s) timeout(%d) ms", states[i].name,
- states[i].timeout);
- }
-
- return 0;
-}
-
static void update_display_time(void)
{
int run_timeout, val;
break;
case INIT_INTERFACE:
if (display_conf.timeout_enable)
- get_lcd_timeout_from_settings();
+ display_initialize_display_state_timeout_from_setting();
ret = init_sysfs(flags);
break;
case INIT_POLL:
enter_doze();
}
-/* get configurations from setting */
-static int get_lcd_timeout_from_settings(void)
-{
- int i;
- int val = 0;
-
- for (i = 0; i < S_END; i++) {
- switch (states[i].state) {
- case S_NORMAL:
- get_run_timeout(&val);
- break;
- case S_LCDDIM:
- get_dim_timeout(&val);
- break;
- case S_LCDOFF:
- val = display_conf.lcdoff_timeout;
- break;
- default:
- /* This state doesn't need to set time out. */
- val = 0;
- break;
- }
- if (val > 0)
- states[i].timeout = val;
-
- _I("State(%s) timeout(%d) ms", states[i].name,
- states[i].timeout);
- }
-
- return 0;
-}
-
static void update_display_time(void)
{
int run_timeout, val;
break;
case INIT_INTERFACE:
if (display_conf.timeout_enable)
- get_lcd_timeout_from_settings();
+ display_initialize_display_state_timeout_from_setting();
ret = init_sysfs(flags);
break;
case INIT_POLL:
enter_doze();
}
-/* get configurations from setting */
-static int get_lcd_timeout_from_settings(void)
-{
- int i;
- int val = 0;
-
- for (i = 0; i < S_END; i++) {
- switch (states[i].state) {
- case S_NORMAL:
- get_run_timeout(&val);
- break;
- case S_LCDDIM:
- get_dim_timeout(&val);
- break;
- case S_LCDOFF:
- val = display_conf.lcdoff_timeout;
- break;
- default:
- /* This state doesn't need to set time out. */
- val = 0;
- break;
- }
- if (val > 0)
- states[i].timeout = val;
-
- _I("State(%s) timeout(%d) ms", states[i].name,
- states[i].timeout);
- }
-
- return 0;
-}
-
static void update_display_time(void)
{
int run_timeout, val;
break;
case INIT_INTERFACE:
if (display_conf.timeout_enable)
- get_lcd_timeout_from_settings();
+ display_initialize_display_state_timeout_from_setting();
ret = init_sysfs(flags);
break;
case INIT_POLL:
return -EOPNOTSUPP;
}
+int display_plugin_state_get_state_by_state_index(int state_index, enum state_t *state)
+{
+ if (!state)
+ return -EINVAL;
+
+ if (g_display_plugin.display_states[state_index]) {
+ *state = g_display_plugin.display_states[state_index]->state;
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
int display_plugin_config_get_timeout_enable(bool *timeout_enable)
{
if (!timeout_enable)
return -EOPNOTSUPP;
}
+int display_plugin_config_get_lcdoff_timeout(int *lcdoff_timeout)
+{
+ if (!lcdoff_timeout)
+ return -EINVAL;
+
+ if (g_display_plugin.config) {
+ *lcdoff_timeout = g_display_plugin.config->lcdoff_timeout;
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
int display_plugin_set_dim_state(bool on)
{
if (g_display_plugin.set_dim_state) {
int display_plugin_state_get_name(enum state_t state, const char **state_name);
int display_plugin_state_set_timeout(enum state_t state, int state_timeout);
int display_plugin_state_get_timeout(enum state_t state, int *state_timeout);
+int display_plugin_state_get_state_by_state_index(int state_index, enum state_t *state);
/* FIXME: display config getter/setter is also temporary in this file */
int display_plugin_config_get_timeout_enable(bool *timeout_enable);
+int display_plugin_config_get_lcdoff_timeout(int *lcdoff_timeout);
#endif //__DISPLAY_PLUGIN_H__
return false;
}
+int display_initialize_display_state_timeout_from_setting(void)
+{
+ int i;
+ int val = 0;
+ const char* state_name = NULL;
+ enum state_t state = S_START;
+
+ for (i = 0; i < S_END; i++) {
+ display_plugin_state_get_state_by_state_index(i, &state);
+ switch (state) {
+ case S_NORMAL:
+ get_run_timeout(&val);
+ break;
+ case S_LCDDIM:
+ get_dim_timeout(&val);
+ break;
+ case S_LCDOFF:
+ display_plugin_config_get_lcdoff_timeout(&val);
+ break;
+ default:
+ /* This state doesn't need to set time out. */
+ val = 0;
+ break;
+ }
+ if (val > 0) {
+ display_plugin_state_set_timeout(i, val);
+ }
+
+ display_plugin_state_get_name(i, &state_name);
+ _I("State(%s) timeout(%d) ms", state_name, val);
+ }
+
+ return 0;
+}
+
static int display_probe(void *data)
{
display_plugin_device_ops = find_device("display-plugin");
void display_register_dependent_device(const struct device_ops *ops);
void display_unregister_dependent_device(void);
bool display_dimstay_check(void);
+int display_initialize_display_state_timeout_from_setting(void);
#endif //__DISPLAY_H__