Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 1 | /* rtc.h |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 2 | * |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 3 | * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 4 | * http://www.samsung.com |
| 5 | * |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 6 | * 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 Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 15 | * |
| 16 | */ |
| 17 | |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 18 | #ifndef __LINUX_MFD_SEC_RTC_H |
| 19 | #define __LINUX_MFD_SEC_RTC_H |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 20 | |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 21 | enum 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 Kozlowski | b07e2b7 | 2014-02-28 11:41:41 +0100 | [diff] [blame] | 51 | |
| 52 | SEC_RTC_REG_MAX, |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 53 | }; |
| 54 | |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 55 | enum 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 Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 86 | #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 Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 95 | #define S2MPS_ALARM0_STATUS (1 << 2) |
| 96 | #define S2MPS_ALARM1_STATUS (1 << 1) |
| 97 | |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 98 | /* 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 Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 106 | #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 Kim | 5bccae6 | 2013-11-12 15:11:04 -0800 | [diff] [blame] | 110 | #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 Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 115 | /* 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 Kim | 5bccae6 | 2013-11-12 15:11:04 -0800 | [diff] [blame] | 122 | #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 Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 128 | enum { |
| 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 Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 139 | #endif /* __LINUX_MFD_SEC_RTC_H */ |