1 /*
2  * s5m-rtc.h
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd
5  *              http://www.samsung.com
6  *
7  *  This program is free software; you can redistribute  it and/or modify it
8  *  under  the terms of  the GNU General  Public License as published by the
9  *  Free Software Foundation;  either version 2 of the  License, or (at your
10  *  option) any later version.
11  *
12  */
13 
14 #ifndef __LINUX_MFD_S5M_RTC_H
15 #define __LINUX_MFD_S5M_RTC_H
16 
17 enum s5m87xx_rtc_reg {
18 	S5M87XX_RTC_SEC,
19 	S5M87XX_RTC_MIN,
20 	S5M87XX_RTC_HOUR,
21 	S5M87XX_RTC_WEEKDAY,
22 	S5M87XX_RTC_DATE,
23 	S5M87XX_RTC_MONTH,
24 	S5M87XX_RTC_YEAR1,
25 	S5M87XX_RTC_YEAR2,
26 	S5M87XX_ALARM0_SEC,
27 	S5M87XX_ALARM0_MIN,
28 	S5M87XX_ALARM0_HOUR,
29 	S5M87XX_ALARM0_WEEKDAY,
30 	S5M87XX_ALARM0_DATE,
31 	S5M87XX_ALARM0_MONTH,
32 	S5M87XX_ALARM0_YEAR1,
33 	S5M87XX_ALARM0_YEAR2,
34 	S5M87XX_ALARM1_SEC,
35 	S5M87XX_ALARM1_MIN,
36 	S5M87XX_ALARM1_HOUR,
37 	S5M87XX_ALARM1_WEEKDAY,
38 	S5M87XX_ALARM1_DATE,
39 	S5M87XX_ALARM1_MONTH,
40 	S5M87XX_ALARM1_YEAR1,
41 	S5M87XX_ALARM1_YEAR2,
42 	S5M87XX_ALARM0_CONF,
43 	S5M87XX_ALARM1_CONF,
44 	S5M87XX_RTC_STATUS,
45 	S5M87XX_WTSR_SMPL_CNTL,
46 	S5M87XX_RTC_UDR_CON,
47 };
48 
49 #define RTC_I2C_ADDR		(0x0C >> 1)
50 
51 #define HOUR_12			(1 << 7)
52 #define HOUR_AMPM		(1 << 6)
53 #define HOUR_PM			(1 << 5)
54 #define ALARM0_STATUS		(1 << 1)
55 #define ALARM1_STATUS		(1 << 2)
56 #define UPDATE_AD		(1 << 0)
57 
58 /* RTC Control Register */
59 #define BCD_EN_SHIFT		0
60 #define BCD_EN_MASK		(1 << BCD_EN_SHIFT)
61 #define MODEL24_SHIFT		1
62 #define MODEL24_MASK		(1 << MODEL24_SHIFT)
63 /* RTC Update Register1 */
64 #define RTC_UDR_SHIFT		0
65 #define RTC_UDR_MASK		(1 << RTC_UDR_SHIFT)
66 /* RTC Hour register */
67 #define HOUR_PM_SHIFT		6
68 #define HOUR_PM_MASK		(1 << HOUR_PM_SHIFT)
69 /* RTC Alarm Enable */
70 #define ALARM_ENABLE_SHIFT	7
71 #define ALARM_ENABLE_MASK	(1 << ALARM_ENABLE_SHIFT)
72 
73 enum {
74 	RTC_SEC = 0,
75 	RTC_MIN,
76 	RTC_HOUR,
77 	RTC_WEEKDAY,
78 	RTC_DATE,
79 	RTC_MONTH,
80 	RTC_YEAR1,
81 	RTC_YEAR2,
82 };
83 
84 #endif /*  __LINUX_MFD_S5M_RTC_H */
85