diff options
Diffstat (limited to 'include/linux/rtc.h')
-rw-r--r-- | include/linux/rtc.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index b739ac1f7ca0..ab61cd1199f2 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -91,10 +91,102 @@ struct rtc_pll_info { | |||
91 | #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ | 91 | #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ |
92 | #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ | 92 | #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ |
93 | 93 | ||
94 | /* interrupt flags */ | ||
95 | #define RTC_IRQF 0x80 /* any of the following is active */ | ||
96 | #define RTC_PF 0x40 | ||
97 | #define RTC_AF 0x20 | ||
98 | #define RTC_UF 0x10 | ||
99 | |||
94 | #ifdef __KERNEL__ | 100 | #ifdef __KERNEL__ |
95 | 101 | ||
96 | #include <linux/interrupt.h> | 102 | #include <linux/interrupt.h> |
97 | 103 | ||
104 | extern int rtc_month_days(unsigned int month, unsigned int year); | ||
105 | extern int rtc_valid_tm(struct rtc_time *tm); | ||
106 | extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); | ||
107 | extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); | ||
108 | |||
109 | #include <linux/device.h> | ||
110 | #include <linux/seq_file.h> | ||
111 | #include <linux/cdev.h> | ||
112 | #include <linux/poll.h> | ||
113 | #include <linux/mutex.h> | ||
114 | |||
115 | extern struct class *rtc_class; | ||
116 | |||
117 | struct rtc_class_ops { | ||
118 | int (*open)(struct device *); | ||
119 | void (*release)(struct device *); | ||
120 | int (*ioctl)(struct device *, unsigned int, unsigned long); | ||
121 | int (*read_time)(struct device *, struct rtc_time *); | ||
122 | int (*set_time)(struct device *, struct rtc_time *); | ||
123 | int (*read_alarm)(struct device *, struct rtc_wkalrm *); | ||
124 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); | ||
125 | int (*proc)(struct device *, struct seq_file *); | ||
126 | int (*set_mmss)(struct device *, unsigned long secs); | ||
127 | int (*irq_set_state)(struct device *, int enabled); | ||
128 | int (*irq_set_freq)(struct device *, int freq); | ||
129 | int (*read_callback)(struct device *, int data); | ||
130 | }; | ||
131 | |||
132 | #define RTC_DEVICE_NAME_SIZE 20 | ||
133 | struct rtc_task; | ||
134 | |||
135 | struct rtc_device | ||
136 | { | ||
137 | struct class_device class_dev; | ||
138 | struct module *owner; | ||
139 | |||
140 | int id; | ||
141 | char name[RTC_DEVICE_NAME_SIZE]; | ||
142 | |||
143 | struct rtc_class_ops *ops; | ||
144 | struct mutex ops_lock; | ||
145 | |||
146 | struct class_device *rtc_dev; | ||
147 | struct cdev char_dev; | ||
148 | struct mutex char_lock; | ||
149 | |||
150 | unsigned long irq_data; | ||
151 | spinlock_t irq_lock; | ||
152 | wait_queue_head_t irq_queue; | ||
153 | struct fasync_struct *async_queue; | ||
154 | |||
155 | struct rtc_task *irq_task; | ||
156 | spinlock_t irq_task_lock; | ||
157 | int irq_freq; | ||
158 | }; | ||
159 | #define to_rtc_device(d) container_of(d, struct rtc_device, class_dev) | ||
160 | |||
161 | extern struct rtc_device *rtc_device_register(const char *name, | ||
162 | struct device *dev, | ||
163 | struct rtc_class_ops *ops, | ||
164 | struct module *owner); | ||
165 | extern void rtc_device_unregister(struct rtc_device *rdev); | ||
166 | extern int rtc_interface_register(struct class_interface *intf); | ||
167 | |||
168 | extern int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm); | ||
169 | extern int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm); | ||
170 | extern int rtc_set_mmss(struct class_device *class_dev, unsigned long secs); | ||
171 | extern int rtc_read_alarm(struct class_device *class_dev, | ||
172 | struct rtc_wkalrm *alrm); | ||
173 | extern int rtc_set_alarm(struct class_device *class_dev, | ||
174 | struct rtc_wkalrm *alrm); | ||
175 | extern void rtc_update_irq(struct class_device *class_dev, | ||
176 | unsigned long num, unsigned long events); | ||
177 | |||
178 | extern struct class_device *rtc_class_open(char *name); | ||
179 | extern void rtc_class_close(struct class_device *class_dev); | ||
180 | |||
181 | extern int rtc_irq_register(struct class_device *class_dev, | ||
182 | struct rtc_task *task); | ||
183 | extern void rtc_irq_unregister(struct class_device *class_dev, | ||
184 | struct rtc_task *task); | ||
185 | extern int rtc_irq_set_state(struct class_device *class_dev, | ||
186 | struct rtc_task *task, int enabled); | ||
187 | extern int rtc_irq_set_freq(struct class_device *class_dev, | ||
188 | struct rtc_task *task, int freq); | ||
189 | |||
98 | typedef struct rtc_task { | 190 | typedef struct rtc_task { |
99 | void (*func)(void *private_data); | 191 | void (*func)(void *private_data); |
100 | void *private_data; | 192 | void *private_data; |