This source file includes following definitions.
- host1x_syncpt_check_max
- host1x_syncpt_client_managed
- host1x_syncpt_idle
- host1x_syncpt_is_valid
1
2
3
4
5
6
7
8 #ifndef __HOST1X_SYNCPT_H
9 #define __HOST1X_SYNCPT_H
10
11 #include <linux/atomic.h>
12 #include <linux/host1x.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15
16 #include "intr.h"
17
18 struct host1x;
19
20
21 #define HOST1X_SYNCPT_RESERVED 0
22
23 struct host1x_syncpt_base {
24 unsigned int id;
25 bool requested;
26 };
27
28 struct host1x_syncpt {
29 unsigned int id;
30 atomic_t min_val;
31 atomic_t max_val;
32 u32 base_val;
33 const char *name;
34 bool client_managed;
35 struct host1x *host;
36 struct host1x_client *client;
37 struct host1x_syncpt_base *base;
38
39
40 struct host1x_syncpt_intr intr;
41 };
42
43
44 int host1x_syncpt_init(struct host1x *host);
45
46
47 void host1x_syncpt_deinit(struct host1x *host);
48
49
50 unsigned int host1x_syncpt_nb_pts(struct host1x *host);
51
52
53 unsigned int host1x_syncpt_nb_bases(struct host1x *host);
54
55
56 unsigned int host1x_syncpt_nb_mlocks(struct host1x *host);
57
58
59
60
61
62
63
64 static inline bool host1x_syncpt_check_max(struct host1x_syncpt *sp, u32 real)
65 {
66 u32 max;
67 if (sp->client_managed)
68 return true;
69 max = host1x_syncpt_read_max(sp);
70 return (s32)(max - real) >= 0;
71 }
72
73
74 static inline bool host1x_syncpt_client_managed(struct host1x_syncpt *sp)
75 {
76 return sp->client_managed;
77 }
78
79
80
81
82
83 static inline bool host1x_syncpt_idle(struct host1x_syncpt *sp)
84 {
85 int min, max;
86 smp_rmb();
87 min = atomic_read(&sp->min_val);
88 max = atomic_read(&sp->max_val);
89 return (min == max);
90 }
91
92
93 u32 host1x_syncpt_load(struct host1x_syncpt *sp);
94
95
96 bool host1x_syncpt_is_expired(struct host1x_syncpt *sp, u32 thresh);
97
98
99 void host1x_syncpt_save(struct host1x *host);
100
101
102 void host1x_syncpt_restore(struct host1x *host);
103
104
105 u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp);
106
107
108 u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
109
110
111 static inline int host1x_syncpt_is_valid(struct host1x_syncpt *sp)
112 {
113 return sp->id < host1x_syncpt_nb_pts(sp->host);
114 }
115
116 #endif