4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __DEVICE_NOTIFIER_H__
21 #define __DEVICE_NOTIFIER_H__
23 enum device_notifier_type {
24 DEVICE_NOTIFIER_DAEMON_RESTARTED,
25 DEVICE_NOTIFIER_DELAYED_INIT,
27 DEVICE_NOTIFIER_LCD_OFF,
28 DEVICE_NOTIFIER_LCD_OFF_COMPLETE,
29 DEVICE_NOTIFIER_LCD_AUTOBRT_SENSING,
30 DEVICE_NOTIFIER_LOWBAT,
31 DEVICE_NOTIFIER_FULLBAT,
32 DEVICE_NOTIFIER_POWER_SUPPLY,
33 DEVICE_NOTIFIER_BATTERY_HEALTH,
34 DEVICE_NOTIFIER_BATTERY_PRESENT,
35 DEVICE_NOTIFIER_BATTERY_OVP,
36 DEVICE_NOTIFIER_BATTERY_CHARGING,
37 DEVICE_NOTIFIER_DISPLAY_AMBIENT_CONDITION,
38 DEVICE_NOTIFIER_DISPLAY_AMBIENT_STATE,
39 DEVICE_NOTIFIER_DISPLAY_LOCK,
40 DEVICE_NOTIFIER_POWER_RESUME,
41 DEVICE_NOTIFIER_POWEROFF,
42 DEVICE_NOTIFIER_APPLICATION_BACKGROUND,
43 DEVICE_NOTIFIER_APPLICATION_FOREGROUND,
44 DEVICE_NOTIFIER_APPLICATION_TERMINATED,
45 DEVICE_NOTIFIER_USB_DEBUG_MODE,
46 DEVICE_NOTIFIER_USB_TETHERING_MODE,
47 DEVICE_NOTIFIER_EVENT_HANDLER,
48 DEVICE_NOTIFIER_CPU_BOOST_LOWBAT,
49 DEVICE_NOTIFIER_CPU_BOOST_POWEROFF,
50 /* Experimental for Specific device - contact to deviced owner */
51 DEVICE_NOTIFIER_PMQOS,
52 DEVICE_NOTIFIER_PMQOS_ULTRAPOWERSAVING,
53 DEVICE_NOTIFIER_PMQOS_POWERSAVING,
54 DEVICE_NOTIFIER_COOL_DOWN,
55 DEVICE_NOTIFIER_VITAL_STATE,
56 DEVICE_NOTIFIER_LONGKEY_RESTORE,
58 DEVICE_NOTIFIER_UPSM_OFF,
59 DEVICE_NOTIFIER_BEZEL_WAKEUP,
60 DEVICE_NOTIFIER_DISPLAY_BRIGHTNESS,
61 DEVICE_NOTIFIER_ULTRAPOWERSAVING,
62 DEVICE_NOTIFIER_EXTCON_COUNT,
63 DEVICE_NOTIFIER_KEY_PRESS,
64 DEVICE_NOTIFIER_KEY_RELEASE,
66 /* action triggered by input event */
67 DEVICE_NOTIFIER_INPUT_TRIGGER_POWEROFF,
68 DEVICE_NOTIFIER_INPUT_BROADCAST_SIGNAL,
69 DEVICE_NOTIFIER_INPUT_TRANSITION_STATE,
72 /* Purpose of calling methods of different modules
73 * Use prefix DEVICE_NOTIFIER_REQUEST */
74 DEVICE_NOTIFIER_REQUEST_ENABLE_AUTOSLEEP,
75 DEVICE_NOTIFIER_REQUEST_DISABLE_AUTOSLEEP,
76 DEVICE_NOTIFIER_REQUEST_WAKE_LOCK,
77 DEVICE_NOTIFIER_REQUEST_WAKE_UNLOCK,
81 typedef enum _device_notifier_state {
82 DEVICE_NOTIFIER_STATE_STOP,
83 DEVICE_NOTIFIER_STATE_START,
84 DEVICE_NOTIFIER_STATE_CHANGED,
85 /* add more states here */
86 } device_notifier_state_e;
88 typedef int (*notify_cb)(void *data);
90 * This is for internal callback method.
92 int __register_notifier(enum device_notifier_type type, notify_cb func, const char *caller);
93 #define register_notifier(type, func) __register_notifier(type, func, __func__)
94 int __unregister_notifier(enum device_notifier_type type, notify_cb func, const char *caller);
95 #define unregister_notifier(type, func) __unregister_notifier(type, func, __func__)
96 void device_notify(enum device_notifier_type type, void *value);
97 void device_notify_once(enum device_notifier_type status, void *data);
99 #endif /* __DEVICE_NOTIFIER_H__ */