hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/rtc.h
....@@ -16,6 +16,7 @@
1616 #include <linux/types.h>
1717 #include <linux/interrupt.h>
1818 #include <linux/nvmem-provider.h>
19
+#include <linux/android_kabi.h>
1920 #include <uapi/linux/rtc.h>
2021
2122 extern int rtc_month_days(unsigned int month, unsigned int year);
....@@ -32,18 +33,6 @@
3233 static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
3334 {
3435 return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
35
-}
36
-
37
-static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
38
-{
39
- rtc_time64_to_tm(time, tm);
40
-}
41
-
42
-static inline int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
43
-{
44
- *time = rtc_tm_to_time64(tm);
45
-
46
- return 0;
4736 }
4837
4938 #include <linux/device.h>
....@@ -67,10 +56,6 @@
6756 *
6857 * The (current) exceptions are mostly filesystem hooks:
6958 * - the proc() hook for procfs
70
- * - non-ioctl() chardev hooks: open(), release(), read_callback()
71
- *
72
- * REVISIT those periodic irq calls *do* have ops_lock when they're
73
- * issued through ioctl() ...
7459 */
7560 struct rtc_class_ops {
7661 int (*ioctl)(struct device *, unsigned int, unsigned long);
....@@ -79,22 +64,22 @@
7964 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
8065 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
8166 int (*proc)(struct device *, struct seq_file *);
82
- int (*set_mmss64)(struct device *, time64_t secs);
83
- int (*set_mmss)(struct device *, unsigned long secs);
84
- int (*read_callback)(struct device *, int data);
8567 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
8668 int (*read_offset)(struct device *, long *offset);
8769 int (*set_offset)(struct device *, long offset);
70
+
71
+ ANDROID_KABI_RESERVE(1);
8872 };
73
+
74
+struct rtc_device;
8975
9076 struct rtc_timer {
9177 struct timerqueue_node node;
9278 ktime_t period;
93
- void (*func)(void *private_data);
94
- void *private_data;
79
+ void (*func)(struct rtc_device *rtc);
80
+ struct rtc_device *rtc;
9581 int enabled;
9682 };
97
-
9883
9984 /* flags */
10085 #define RTC_DEV_BUSY 0
....@@ -138,7 +123,6 @@
138123
139124 bool registered;
140125
141
- struct nvmem_device *nvmem;
142126 /* Old ABI support */
143127 bool nvram_old_abi;
144128 struct bin_attribute *nvram;
....@@ -159,27 +143,30 @@
159143 unsigned int uie_task_active:1;
160144 unsigned int uie_timer_active:1;
161145 #endif
146
+
147
+ ANDROID_KABI_RESERVE(1);
162148 };
163149 #define to_rtc_device(d) container_of(d, struct rtc_device, dev)
164150
151
+#define rtc_lock(d) mutex_lock(&d->ops_lock)
152
+#define rtc_unlock(d) mutex_unlock(&d->ops_lock)
153
+
165154 /* useful timestamps */
155
+#define RTC_TIMESTAMP_BEGIN_0000 -62167219200ULL /* 0000-01-01 00:00:00 */
166156 #define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */
167157 #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */
158
+#define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */
159
+#define RTC_TIMESTAMP_END_2079 3471292799LL /* 2079-12-31 23:59:59 */
168160 #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */
161
+#define RTC_TIMESTAMP_END_2199 7258118399LL /* 2199-12-31 23:59:59 */
162
+#define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */
169163
170
-extern struct rtc_device *rtc_device_register(const char *name,
171
- struct device *dev,
172
- const struct rtc_class_ops *ops,
173
- struct module *owner);
174164 extern struct rtc_device *devm_rtc_device_register(struct device *dev,
175165 const char *name,
176166 const struct rtc_class_ops *ops,
177167 struct module *owner);
178168 struct rtc_device *devm_rtc_allocate_device(struct device *dev);
179169 int __rtc_register_device(struct module *owner, struct rtc_device *rtc);
180
-extern void rtc_device_unregister(struct rtc_device *rtc);
181
-extern void devm_rtc_device_unregister(struct device *dev,
182
- struct rtc_device *rtc);
183170
184171 extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
185172 extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
....@@ -205,11 +192,12 @@
205192 unsigned int enabled);
206193
207194 void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode);
208
-void rtc_aie_update_irq(void *private);
209
-void rtc_uie_update_irq(void *private);
195
+void rtc_aie_update_irq(struct rtc_device *rtc);
196
+void rtc_uie_update_irq(struct rtc_device *rtc);
210197 enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer);
211198
212
-void rtc_timer_init(struct rtc_timer *timer, void (*f)(void *p), void *data);
199
+void rtc_timer_init(struct rtc_timer *timer, void (*f)(struct rtc_device *r),
200
+ struct rtc_device *rtc);
213201 int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer *timer,
214202 ktime_t expires, ktime_t period);
215203 void rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer *timer);
....@@ -277,4 +265,20 @@
277265 static inline void rtc_nvmem_unregister(struct rtc_device *rtc) {}
278266 #endif
279267
268
+#ifdef CONFIG_RTC_INTF_SYSFS
269
+int rtc_add_group(struct rtc_device *rtc, const struct attribute_group *grp);
270
+int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps);
271
+#else
272
+static inline
273
+int rtc_add_group(struct rtc_device *rtc, const struct attribute_group *grp)
274
+{
275
+ return 0;
276
+}
277
+
278
+static inline
279
+int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps)
280
+{
281
+ return 0;
282
+}
283
+#endif
280284 #endif /* _LINUX_RTC_H_ */