2 * RTC subsystem, proc interface
4 * Copyright (C) 2005-06 Tower Technologies
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
7 * based on arch/arm/common/rtctime.c
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/rtc.h>
16 #include <linux/proc_fs.h>
17 #include <linux/seq_file.h>
23 #if defined(CONFIG_RTC_HCTOSYS_DEVICE)
24 static bool is_rtc_hctosys(struct rtc_device *rtc)
29 size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id);
33 return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE);
36 static bool is_rtc_hctosys(struct rtc_device *rtc)
38 return (rtc->id == 0);
42 static int rtc_proc_show(struct seq_file *seq, void *offset)
45 struct rtc_device *rtc = seq->private;
46 const struct rtc_class_ops *ops = rtc->ops;
47 struct rtc_wkalrm alrm;
50 err = rtc_read_time(rtc, &tm);
54 "rtc_date\t: %ptRd\n",
58 err = rtc_read_alarm(rtc, &alrm);
60 seq_printf(seq, "alrm_time\t: %ptRt\n", &alrm.time);
61 seq_printf(seq, "alrm_date\t: %ptRd\n", &alrm.time);
62 seq_printf(seq, "alarm_IRQ\t: %s\n",
63 alrm.enabled ? "yes" : "no");
64 seq_printf(seq, "alrm_pending\t: %s\n",
65 alrm.pending ? "yes" : "no");
66 seq_printf(seq, "update IRQ enabled\t: %s\n",
67 (rtc->uie_rtctimer.enabled) ? "yes" : "no");
68 seq_printf(seq, "periodic IRQ enabled\t: %s\n",
69 (rtc->pie_enabled) ? "yes" : "no");
70 seq_printf(seq, "periodic IRQ frequency\t: %d\n",
72 seq_printf(seq, "max user IRQ frequency\t: %d\n",
76 seq_printf(seq, "24hr\t\t: yes\n");
79 ops->proc(rtc->dev.parent, seq);
84 void rtc_proc_add_device(struct rtc_device *rtc)
86 if (is_rtc_hctosys(rtc))
87 proc_create_single_data("driver/rtc", 0, NULL, rtc_proc_show,
91 void rtc_proc_del_device(struct rtc_device *rtc)
93 if (is_rtc_hctosys(rtc))
94 remove_proc_entry("driver/rtc", NULL);