1
2
3
4
5
6
7
8 #ifndef __LINUX_MFD_WM8350_RTC_H
9 #define __LINUX_MFD_WM8350_RTC_H
10
11 #include <linux/platform_device.h>
12
13
14
15
16 #define WM8350_RTC_SECONDS_MINUTES 0x10
17 #define WM8350_RTC_HOURS_DAY 0x11
18 #define WM8350_RTC_DATE_MONTH 0x12
19 #define WM8350_RTC_YEAR 0x13
20 #define WM8350_ALARM_SECONDS_MINUTES 0x14
21 #define WM8350_ALARM_HOURS_DAY 0x15
22 #define WM8350_ALARM_DATE_MONTH 0x16
23 #define WM8350_RTC_TIME_CONTROL 0x17
24
25
26
27
28 #define WM8350_RTC_MINS_MASK 0x7F00
29 #define WM8350_RTC_MINS_SHIFT 8
30 #define WM8350_RTC_SECS_MASK 0x007F
31 #define WM8350_RTC_SECS_SHIFT 0
32
33
34
35
36 #define WM8350_RTC_DAY_MASK 0x0700
37 #define WM8350_RTC_DAY_SHIFT 8
38 #define WM8350_RTC_HPM_MASK 0x0020
39 #define WM8350_RTC_HPM_SHIFT 5
40 #define WM8350_RTC_HRS_MASK 0x001F
41 #define WM8350_RTC_HRS_SHIFT 0
42
43
44 #define WM8350_RTC_DAY_SUN 1
45 #define WM8350_RTC_DAY_MON 2
46 #define WM8350_RTC_DAY_TUE 3
47 #define WM8350_RTC_DAY_WED 4
48 #define WM8350_RTC_DAY_THU 5
49 #define WM8350_RTC_DAY_FRI 6
50 #define WM8350_RTC_DAY_SAT 7
51
52 #define WM8350_RTC_HPM_AM 0
53 #define WM8350_RTC_HPM_PM 1
54
55
56
57
58 #define WM8350_RTC_MTH_MASK 0x1F00
59 #define WM8350_RTC_MTH_SHIFT 8
60 #define WM8350_RTC_DATE_MASK 0x003F
61 #define WM8350_RTC_DATE_SHIFT 0
62
63
64 #define WM8350_RTC_MTH_JAN 1
65 #define WM8350_RTC_MTH_FEB 2
66 #define WM8350_RTC_MTH_MAR 3
67 #define WM8350_RTC_MTH_APR 4
68 #define WM8350_RTC_MTH_MAY 5
69 #define WM8350_RTC_MTH_JUN 6
70 #define WM8350_RTC_MTH_JUL 7
71 #define WM8350_RTC_MTH_AUG 8
72 #define WM8350_RTC_MTH_SEP 9
73 #define WM8350_RTC_MTH_OCT 10
74 #define WM8350_RTC_MTH_NOV 11
75 #define WM8350_RTC_MTH_DEC 12
76 #define WM8350_RTC_MTH_JAN_BCD 0x01
77 #define WM8350_RTC_MTH_FEB_BCD 0x02
78 #define WM8350_RTC_MTH_MAR_BCD 0x03
79 #define WM8350_RTC_MTH_APR_BCD 0x04
80 #define WM8350_RTC_MTH_MAY_BCD 0x05
81 #define WM8350_RTC_MTH_JUN_BCD 0x06
82 #define WM8350_RTC_MTH_JUL_BCD 0x07
83 #define WM8350_RTC_MTH_AUG_BCD 0x08
84 #define WM8350_RTC_MTH_SEP_BCD 0x09
85 #define WM8350_RTC_MTH_OCT_BCD 0x10
86 #define WM8350_RTC_MTH_NOV_BCD 0x11
87 #define WM8350_RTC_MTH_DEC_BCD 0x12
88
89
90
91
92 #define WM8350_RTC_YHUNDREDS_MASK 0x3F00
93 #define WM8350_RTC_YHUNDREDS_SHIFT 8
94 #define WM8350_RTC_YUNITS_MASK 0x00FF
95 #define WM8350_RTC_YUNITS_SHIFT 0
96
97
98
99
100 #define WM8350_RTC_ALMMINS_MASK 0x7F00
101 #define WM8350_RTC_ALMMINS_SHIFT 8
102 #define WM8350_RTC_ALMSECS_MASK 0x007F
103 #define WM8350_RTC_ALMSECS_SHIFT 0
104
105
106 #define WM8350_RTC_ALMMINS_DONT_CARE -1
107 #define WM8350_RTC_ALMSECS_DONT_CARE -1
108
109
110
111
112 #define WM8350_RTC_ALMDAY_MASK 0x0F00
113 #define WM8350_RTC_ALMDAY_SHIFT 8
114 #define WM8350_RTC_ALMHPM_MASK 0x0020
115 #define WM8350_RTC_ALMHPM_SHIFT 5
116 #define WM8350_RTC_ALMHRS_MASK 0x001F
117 #define WM8350_RTC_ALMHRS_SHIFT 0
118
119
120 #define WM8350_RTC_ALMDAY_DONT_CARE -1
121 #define WM8350_RTC_ALMDAY_SUN 1
122 #define WM8350_RTC_ALMDAY_MON 2
123 #define WM8350_RTC_ALMDAY_TUE 3
124 #define WM8350_RTC_ALMDAY_WED 4
125 #define WM8350_RTC_ALMDAY_THU 5
126 #define WM8350_RTC_ALMDAY_FRI 6
127 #define WM8350_RTC_ALMDAY_SAT 7
128
129 #define WM8350_RTC_ALMHPM_AM 0
130 #define WM8350_RTC_ALMHPM_PM 1
131
132 #define WM8350_RTC_ALMHRS_DONT_CARE -1
133
134
135
136
137 #define WM8350_RTC_ALMMTH_MASK 0x1F00
138 #define WM8350_RTC_ALMMTH_SHIFT 8
139 #define WM8350_RTC_ALMDATE_MASK 0x003F
140 #define WM8350_RTC_ALMDATE_SHIFT 0
141
142
143 #define WM8350_RTC_ALMDATE_DONT_CARE -1
144
145 #define WM8350_RTC_ALMMTH_DONT_CARE -1
146 #define WM8350_RTC_ALMMTH_JAN 1
147 #define WM8350_RTC_ALMMTH_FEB 2
148 #define WM8350_RTC_ALMMTH_MAR 3
149 #define WM8350_RTC_ALMMTH_APR 4
150 #define WM8350_RTC_ALMMTH_MAY 5
151 #define WM8350_RTC_ALMMTH_JUN 6
152 #define WM8350_RTC_ALMMTH_JUL 7
153 #define WM8350_RTC_ALMMTH_AUG 8
154 #define WM8350_RTC_ALMMTH_SEP 9
155 #define WM8350_RTC_ALMMTH_OCT 10
156 #define WM8350_RTC_ALMMTH_NOV 11
157 #define WM8350_RTC_ALMMTH_DEC 12
158 #define WM8350_RTC_ALMMTH_JAN_BCD 0x01
159 #define WM8350_RTC_ALMMTH_FEB_BCD 0x02
160 #define WM8350_RTC_ALMMTH_MAR_BCD 0x03
161 #define WM8350_RTC_ALMMTH_APR_BCD 0x04
162 #define WM8350_RTC_ALMMTH_MAY_BCD 0x05
163 #define WM8350_RTC_ALMMTH_JUN_BCD 0x06
164 #define WM8350_RTC_ALMMTH_JUL_BCD 0x07
165 #define WM8350_RTC_ALMMTH_AUG_BCD 0x08
166 #define WM8350_RTC_ALMMTH_SEP_BCD 0x09
167 #define WM8350_RTC_ALMMTH_OCT_BCD 0x10
168 #define WM8350_RTC_ALMMTH_NOV_BCD 0x11
169 #define WM8350_RTC_ALMMTH_DEC_BCD 0x12
170
171
172
173
174 #define WM8350_RTC_BCD 0x8000
175 #define WM8350_RTC_BCD_MASK 0x8000
176 #define WM8350_RTC_BCD_SHIFT 15
177 #define WM8350_RTC_12HR 0x4000
178 #define WM8350_RTC_12HR_MASK 0x4000
179 #define WM8350_RTC_12HR_SHIFT 14
180 #define WM8350_RTC_DST 0x2000
181 #define WM8350_RTC_DST_MASK 0x2000
182 #define WM8350_RTC_DST_SHIFT 13
183 #define WM8350_RTC_SET 0x0800
184 #define WM8350_RTC_SET_MASK 0x0800
185 #define WM8350_RTC_SET_SHIFT 11
186 #define WM8350_RTC_STS 0x0400
187 #define WM8350_RTC_STS_MASK 0x0400
188 #define WM8350_RTC_STS_SHIFT 10
189 #define WM8350_RTC_ALMSET 0x0200
190 #define WM8350_RTC_ALMSET_MASK 0x0200
191 #define WM8350_RTC_ALMSET_SHIFT 9
192 #define WM8350_RTC_ALMSTS 0x0100
193 #define WM8350_RTC_ALMSTS_MASK 0x0100
194 #define WM8350_RTC_ALMSTS_SHIFT 8
195 #define WM8350_RTC_PINT 0x0070
196 #define WM8350_RTC_PINT_MASK 0x0070
197 #define WM8350_RTC_PINT_SHIFT 4
198 #define WM8350_RTC_DSW 0x000F
199 #define WM8350_RTC_DSW_MASK 0x000F
200 #define WM8350_RTC_DSW_SHIFT 0
201
202
203 #define WM8350_RTC_BCD_BINARY 0
204 #define WM8350_RTC_BCD_BCD 1
205
206 #define WM8350_RTC_12HR_24HR 0
207 #define WM8350_RTC_12HR_12HR 1
208
209 #define WM8350_RTC_DST_DISABLED 0
210 #define WM8350_RTC_DST_ENABLED 1
211
212 #define WM8350_RTC_SET_RUN 0
213 #define WM8350_RTC_SET_SET 1
214
215 #define WM8350_RTC_STS_RUNNING 0
216 #define WM8350_RTC_STS_STOPPED 1
217
218 #define WM8350_RTC_ALMSET_RUN 0
219 #define WM8350_RTC_ALMSET_SET 1
220
221 #define WM8350_RTC_ALMSTS_RUNNING 0
222 #define WM8350_RTC_ALMSTS_STOPPED 1
223
224 #define WM8350_RTC_PINT_DISABLED 0
225 #define WM8350_RTC_PINT_SECS 1
226 #define WM8350_RTC_PINT_MINS 2
227 #define WM8350_RTC_PINT_HRS 3
228 #define WM8350_RTC_PINT_DAYS 4
229 #define WM8350_RTC_PINT_MTHS 5
230
231 #define WM8350_RTC_DSW_DISABLED 0
232 #define WM8350_RTC_DSW_1HZ 1
233 #define WM8350_RTC_DSW_2HZ 2
234 #define WM8350_RTC_DSW_4HZ 3
235 #define WM8350_RTC_DSW_8HZ 4
236 #define WM8350_RTC_DSW_16HZ 5
237 #define WM8350_RTC_DSW_32HZ 6
238 #define WM8350_RTC_DSW_64HZ 7
239 #define WM8350_RTC_DSW_128HZ 8
240 #define WM8350_RTC_DSW_256HZ 9
241 #define WM8350_RTC_DSW_512HZ 10
242 #define WM8350_RTC_DSW_1024HZ 11
243
244
245
246
247 #define WM8350_RTC_TICKSTS 0x4000
248 #define WM8350_RTC_CLKSRC 0x2000
249 #define WM8350_RTC_TRIM_MASK 0x03FF
250
251
252
253
254 #define WM8350_IRQ_RTC_PER 7
255 #define WM8350_IRQ_RTC_SEC 8
256 #define WM8350_IRQ_RTC_ALM 9
257
258 struct wm8350_rtc {
259 struct platform_device *pdev;
260 struct rtc_device *rtc;
261 int alarm_enabled;
262 int update_enabled;
263 };
264
265 #endif