Commit a180ca1f authored by spiiroin's avatar spiiroin

[wltimer] Add moduled for suspend blocking timers. Contributes to JB#32462

MCE code has accumulated copy paste code dealing with blocking suspend
for limited time.

Implement wakelock timer object logic that encapsulates holding a wakelock
while waiting for a glib timeout to trigger.

The interface is derived from already existing heartbeat timer code.
parent 7e0f6f92
......@@ -342,6 +342,24 @@ mce-wakelock.pic.o:\
mce-log.h\
mce-wakelock.h\
mce-wltimer.o:\
mce-wltimer.c\
datapipe.h\
mce-lib.h\
mce-log.h\
mce-wakelock.h\
mce-wltimer.h\
mce.h\
mce-wltimer.pic.o:\
mce-wltimer.c\
datapipe.h\
mce-lib.h\
mce-log.h\
mce-wakelock.h\
mce-wltimer.h\
mce.h\
mce.o:\
mce.c\
builtin-gconf.h\
......@@ -360,6 +378,7 @@ mce.o:\
mce-modules.h\
mce-sensorfw.h\
mce-wakelock.h\
mce-wltimer.h\
mce.h\
modetransition.h\
powerkey.h\
......@@ -383,6 +402,7 @@ mce.pic.o:\
mce-modules.h\
mce-sensorfw.h\
mce-wakelock.h\
mce-wltimer.h\
mce.h\
modetransition.h\
powerkey.h\
......
......@@ -280,6 +280,7 @@ MCE_CORE += mce-dbus.c
MCE_CORE += mce-dsme.c
MCE_CORE += mce-gconf.c
MCE_CORE += mce-hbtimer.c
MCE_CORE += mce-wltimer.c
MCE_CORE += mce-wakelock.c
MCE_CORE += event-input.c
MCE_CORE += event-switches.c
......@@ -537,6 +538,8 @@ NORMALIZE_USES_SPC =\
mce-command-line.h\
mce-hbtimer.c\
mce-hbtimer.h\
mce-wltimer.c\
mce-wltimer.h\
mce-hybris.c\
mce-hybris.h\
mce-modules.h\
......
This diff is collapsed.
/**
* @file mce-wltimer.h
*
* Mode Control Entity - Timers that block suspend until triggered
*
* <p>
*
* Copyright (C) 2015 Jolla Ltd.
*
* <p>
*
* @author Simo Piiroinen <simo.piiroinen@jollamobile.com>
*
* mce is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* mce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mce. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MCE_WLTIMER_H_
# define MCE_WLTIMER_H_
# include <stdbool.h>
# include <glib.h>
# ifdef __cplusplus
extern "C" {
# endif
typedef struct mce_wltimer_t mce_wltimer_t;
mce_wltimer_t * mce_wltimer_create (const char *name, int period, GSourceFunc notify, void *user_data);
void mce_wltimer_delete (mce_wltimer_t *self);
bool mce_wltimer_is_active (const mce_wltimer_t *self);
const char *mce_wltimer_get_name (const mce_wltimer_t *self);
void mce_wltimer_set_period (mce_wltimer_t *self, int period);
void mce_wltimer_start (mce_wltimer_t *self);
void mce_wltimer_stop (mce_wltimer_t *self);
void mce_wltimer_dispatch (void);
void mce_wltimer_init (void);
void mce_wltimer_quit (void);
# ifdef __cplusplus
};
# endif
#endif /* MCE_WLTIMER_H_ */
......@@ -24,6 +24,7 @@
#include "mce-conf.h"
#include "mce-fbdev.h"
#include "mce-hbtimer.h"
#include "mce-wltimer.h"
#include "mce-gconf.h"
#include "mce-dbus.h"
#include "mce-dsme.h"
......@@ -976,6 +977,9 @@ int main(int argc, char **argv)
/* Allow registering of suspend proof timers */
mce_hbtimer_init();
/* Allow registering of suspend blocking timers */
mce_wltimer_init();
/* Initialise mode management
* pre-requisite: mce_gconf_init()
* pre-requisite: mce_dbus_init()
......@@ -1060,6 +1064,7 @@ EXIT:
mce_powerkey_exit();
mce_dsme_exit();
mce_mode_exit();
mce_wltimer_quit();
mce_hbtimer_quit();
/* Free all datapipes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment