aboutsummaryrefslogtreecommitdiff
path: root/include/linux/sbsuspend.h
blob: 869c5307807b94ca4fe1987d03f3766554e9cd03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* include/linux/sbsuspend.h
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program 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 General Public License for more details.
 *
 */
 
#ifndef _LINUX_SBSUSPEND_H
#define _LINUX_SBSUSPEND_H

#ifdef CONFIG_HAS_SBSUSPEND
#include <linux/list.h>
#endif

//level definition
enum {
    SB_LEVEL_DISABLE_TOUCH = 50,
    SB_LEVEL_DISABLE_KEYPAD = 100,
    SB_LEVEL_DISABLE_FB = 150,
};

//smartbook handler structure
struct sb_handler {
#ifdef CONFIG_HAS_SBSUSPEND
    struct list_head link;
    int level;
    char name[32];
    void (*plug_in)(struct sb_handler *h);
    void (*plug_out)(struct sb_handler *h);
    void (*enable)(struct sb_handler *h);
    void (*disable)(struct sb_handler *h);
    void (*suspend)(struct sb_handler *h);
    void (*resume)(struct sb_handler *h);
#endif
};


typedef int __bitwise sb_state_t;
#define SB_STATE_DISABLE    ((__force sb_state_t) 0)
#define SB_STATE_ENABLE     ((__force sb_state_t) 1)
#define SB_STATE_SUSPEND    ((__force sb_state_t) 2)
#define SB_STATE_RESUME     ((__force sb_state_t) 3)
#define SB_STATE_MAX        ((__force sb_state_t) 4)

/*
typedef int __bitwise sb_event_t;
#define SB_EVENT_ENABLE     ((__force sb_state_t) 0)
#define SB_EVENT_DISABLE    ((__force sb_state_t) 1)
#define SB_EVENT_SUSPEND    ((__force sb_state_t) 2)
#define SB_EVENT_RESUME     ((__force sb_state_t) 3)
*/

#ifdef CONFIG_HAS_SBSUSPEND

//for peripheral drivers who is smartbook aware to register handler (process context)
extern void register_sb_handler(struct sb_handler *handler);
extern void unregister_sb_handler(struct sb_handler *handler);

//for tester to execute callbacks directly (process context)
extern void sb_enable(void);
extern void sb_disable(void);
extern void sb_suspend(void);
extern void sb_resume(void);

//for hdmi driver to notify plug in/out event
extern void sb_plug_in(void);
extern void sb_plug_out(void);

#else

#define register_sb_handler(handler) do { } while (0)
#define unregister_sb_handler(handler) do { } while (0)
#define sb_enable() do { } while (0)
#define sb_disable() do { } while (0)
#define sb_suspend() do { } while (0)
#define sb_resume() do { } while (0)

#endif

#endif //#ifndef _LINUX_SBSUSPEND_H