blob: 3e02b768d53704968a76e27af9cece0f455de6bc [file] [log] [blame]
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +01001/* rtc.h
Sangbeom Kim0f5f7072011-12-23 17:28:08 +09002 *
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +01003 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd
Sangbeom Kim0f5f7072011-12-23 17:28:08 +09004 * http://www.samsung.com
5 *
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +01006 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090015 *
16 */
17
Sangbeom Kim54227bc2012-07-11 21:07:16 +090018#ifndef __LINUX_MFD_SEC_RTC_H
19#define __LINUX_MFD_SEC_RTC_H
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090020
Sangbeom Kim54227bc2012-07-11 21:07:16 +090021enum sec_rtc_reg {
22 SEC_RTC_SEC,
23 SEC_RTC_MIN,
24 SEC_RTC_HOUR,
25 SEC_RTC_WEEKDAY,
26 SEC_RTC_DATE,
27 SEC_RTC_MONTH,
28 SEC_RTC_YEAR1,
29 SEC_RTC_YEAR2,
30 SEC_ALARM0_SEC,
31 SEC_ALARM0_MIN,
32 SEC_ALARM0_HOUR,
33 SEC_ALARM0_WEEKDAY,
34 SEC_ALARM0_DATE,
35 SEC_ALARM0_MONTH,
36 SEC_ALARM0_YEAR1,
37 SEC_ALARM0_YEAR2,
38 SEC_ALARM1_SEC,
39 SEC_ALARM1_MIN,
40 SEC_ALARM1_HOUR,
41 SEC_ALARM1_WEEKDAY,
42 SEC_ALARM1_DATE,
43 SEC_ALARM1_MONTH,
44 SEC_ALARM1_YEAR1,
45 SEC_ALARM1_YEAR2,
46 SEC_ALARM0_CONF,
47 SEC_ALARM1_CONF,
48 SEC_RTC_STATUS,
49 SEC_WTSR_SMPL_CNTL,
50 SEC_RTC_UDR_CON,
Krzysztof Kozlowskib07e2b72014-02-28 11:41:41 +010051
52 SEC_RTC_REG_MAX,
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090053};
54
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +010055enum s2mps_rtc_reg {
56 S2MPS_RTC_CTRL,
57 S2MPS_WTSR_SMPL_CNTL,
58 S2MPS_RTC_UDR_CON,
59 S2MPS_RSVD,
60 S2MPS_RTC_SEC,
61 S2MPS_RTC_MIN,
62 S2MPS_RTC_HOUR,
63 S2MPS_RTC_WEEKDAY,
64 S2MPS_RTC_DATE,
65 S2MPS_RTC_MONTH,
66 S2MPS_RTC_YEAR,
67 S2MPS_ALARM0_SEC,
68 S2MPS_ALARM0_MIN,
69 S2MPS_ALARM0_HOUR,
70 S2MPS_ALARM0_WEEKDAY,
71 S2MPS_ALARM0_DATE,
72 S2MPS_ALARM0_MONTH,
73 S2MPS_ALARM0_YEAR,
74 S2MPS_ALARM1_SEC,
75 S2MPS_ALARM1_MIN,
76 S2MPS_ALARM1_HOUR,
77 S2MPS_ALARM1_WEEKDAY,
78 S2MPS_ALARM1_DATE,
79 S2MPS_ALARM1_MONTH,
80 S2MPS_ALARM1_YEAR,
81 S2MPS_OFFSRC,
82
83 S2MPS_RTC_REG_MAX,
84};
85
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090086#define RTC_I2C_ADDR (0x0C >> 1)
87
88#define HOUR_12 (1 << 7)
89#define HOUR_AMPM (1 << 6)
90#define HOUR_PM (1 << 5)
91#define ALARM0_STATUS (1 << 1)
92#define ALARM1_STATUS (1 << 2)
93#define UPDATE_AD (1 << 0)
94
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +010095#define S2MPS_ALARM0_STATUS (1 << 2)
96#define S2MPS_ALARM1_STATUS (1 << 1)
97
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090098/* RTC Control Register */
99#define BCD_EN_SHIFT 0
100#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
101#define MODEL24_SHIFT 1
102#define MODEL24_MASK (1 << MODEL24_SHIFT)
103/* RTC Update Register1 */
104#define RTC_UDR_SHIFT 0
105#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
Sangbeom Kim5bccae62013-11-12 15:11:04 -0800110#define RTC_TCON_SHIFT 1
111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
112#define RTC_TIME_EN_SHIFT 3
113#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT)
114
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900115/* RTC Hour register */
116#define HOUR_PM_SHIFT 6
117#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
118/* RTC Alarm Enable */
119#define ALARM_ENABLE_SHIFT 7
120#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
121
Sangbeom Kim5bccae62013-11-12 15:11:04 -0800122#define SMPL_ENABLE_SHIFT 7
123#define SMPL_ENABLE_MASK (1 << SMPL_ENABLE_SHIFT)
124
125#define WTSR_ENABLE_SHIFT 6
126#define WTSR_ENABLE_MASK (1 << WTSR_ENABLE_SHIFT)
127
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900128enum {
129 RTC_SEC = 0,
130 RTC_MIN,
131 RTC_HOUR,
132 RTC_WEEKDAY,
133 RTC_DATE,
134 RTC_MONTH,
135 RTC_YEAR1,
136 RTC_YEAR2,
137};
138
Sangbeom Kim54227bc2012-07-11 21:07:16 +0900139#endif /* __LINUX_MFD_SEC_RTC_H */