1 #ifndef _LINUX_ALARMTIMER_H
2 #define _LINUX_ALARMTIMER_H
4 #include <linux/time.h>
5 #include <linux/hrtimer.h>
6 #include <linux/timerqueue.h>
13 /* Supported types end here */
16 /* Used for tracing information. No usable types. */
17 ALARM_REALTIME_FREEZER
,
18 ALARM_BOOTTIME_FREEZER
,
21 enum alarmtimer_restart
{
27 #define ALARMTIMER_STATE_INACTIVE 0x00
28 #define ALARMTIMER_STATE_ENQUEUED 0x01
31 * struct alarm - Alarm timer structure
32 * @node: timerqueue node for adding to the event list this value
33 * also includes the expiration time.
34 * @timer: hrtimer used to schedule events while running
35 * @function: Function pointer to be executed when the timer fires.
36 * @type: Alarm type (BOOTTIME/REALTIME).
37 * @state: Flag that represents if the alarm is set to fire or not.
38 * @data: Internal data value.
41 struct timerqueue_node node
;
43 enum alarmtimer_restart (*function
)(struct alarm
*, ktime_t now
);
44 enum alarmtimer_type type
;
49 void alarm_init(struct alarm
*alarm
, enum alarmtimer_type type
,
50 enum alarmtimer_restart (*function
)(struct alarm
*, ktime_t
));
51 void alarm_start(struct alarm
*alarm
, ktime_t start
);
52 void alarm_start_relative(struct alarm
*alarm
, ktime_t start
);
53 void alarm_restart(struct alarm
*alarm
);
54 int alarm_try_to_cancel(struct alarm
*alarm
);
55 int alarm_cancel(struct alarm
*alarm
);
57 u64
alarm_forward(struct alarm
*alarm
, ktime_t now
, ktime_t interval
);
58 u64
alarm_forward_now(struct alarm
*alarm
, ktime_t interval
);
59 ktime_t
alarm_expires_remaining(const struct alarm
*alarm
);
61 /* Provide way to access the rtc device being used by alarmtimers */
62 struct rtc_device
*alarmtimer_get_rtcdev(void);