summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRuss Dill <Russ.Dill@ti.com>2014-08-26 11:13:22 +0530
committerTero Kristo <t-kristo@ti.com>2014-09-01 10:55:10 +0300
commitf1afc4828f47033d82bf49c8e9941e2e10d9f35a (patch)
tree073190f19ed6f606a21862f68eea881696e5a11a /include
parent0b235d848008d12da1012dad93c9c49e94472f19 (diff)
RTC: Add functionality to read/write rtc scratch registers.
Many RTCs provide scratch registers that are maintained so long as the RTC has power. Provide a generic method to access these registers. Signed-off-by: Russ Dill <Russ.Dill@ti.com> [j-keerthy@ti.com] ported to 3.14 Signed-off-by: Keerthy <j-keerthy@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/rtc.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index c2c28975293..4be0268fd38 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -63,6 +63,10 @@ struct rtc_class_ops {
int (*set_mmss)(struct device *, unsigned long secs);
int (*read_callback)(struct device *, int data);
int (*alarm_irq_enable)(struct device *, unsigned int enabled);
+ int (*read_scratch)(struct device *, unsigned int, u32*);
+ int (*write_scratch)(struct device *, unsigned int, u32);
+
+ unsigned int scratch_size;
};
#define RTC_DEVICE_NAME_SIZE 20
@@ -186,6 +190,9 @@ int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer,
int rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer* timer);
void rtc_timer_do_work(struct work_struct *work);
+int rtc_read_scratch(struct rtc_device *rtc, unsigned index, u32 *value);
+int rtc_write_scratch(struct rtc_device *rtc, unsigned index, u32 value);
+
static inline bool is_leap_year(unsigned int year)
{
return (!(year % 4) && (year % 100)) || !(year % 400);