aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-v3020.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-v3020.c')
-rw-r--r--drivers/rtc/rtc-v3020.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index 14d4f036a768..66955cc9c746 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -28,7 +28,7 @@
28#include <linux/rtc-v3020.h> 28#include <linux/rtc-v3020.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30 30
31#include <asm/io.h> 31#include <linux/io.h>
32 32
33#undef DEBUG 33#undef DEBUG
34 34
@@ -63,7 +63,7 @@ static void v3020_set_reg(struct v3020 *chip, unsigned char address,
63 63
64static unsigned char v3020_get_reg(struct v3020 *chip, unsigned char address) 64static unsigned char v3020_get_reg(struct v3020 *chip, unsigned char address)
65{ 65{
66 unsigned int data=0; 66 unsigned int data = 0;
67 int i; 67 int i;
68 68
69 for (i = 0; i < 4; i++) { 69 for (i = 0; i < 4; i++) {
@@ -106,16 +106,14 @@ static int v3020_read_time(struct device *dev, struct rtc_time *dt)
106 tmp = v3020_get_reg(chip, V3020_YEAR); 106 tmp = v3020_get_reg(chip, V3020_YEAR);
107 dt->tm_year = bcd2bin(tmp)+100; 107 dt->tm_year = bcd2bin(tmp)+100;
108 108
109#ifdef DEBUG 109 dev_dbg(dev, "\n%s : Read RTC values\n", __func__);
110 printk("\n%s : Read RTC values\n",__func__); 110 dev_dbg(dev, "tm_hour: %i\n", dt->tm_hour);
111 printk("tm_hour: %i\n",dt->tm_hour); 111 dev_dbg(dev, "tm_min : %i\n", dt->tm_min);
112 printk("tm_min : %i\n",dt->tm_min); 112 dev_dbg(dev, "tm_sec : %i\n", dt->tm_sec);
113 printk("tm_sec : %i\n",dt->tm_sec); 113 dev_dbg(dev, "tm_year: %i\n", dt->tm_year);
114 printk("tm_year: %i\n",dt->tm_year); 114 dev_dbg(dev, "tm_mon : %i\n", dt->tm_mon);
115 printk("tm_mon : %i\n",dt->tm_mon); 115 dev_dbg(dev, "tm_mday: %i\n", dt->tm_mday);
116 printk("tm_mday: %i\n",dt->tm_mday); 116 dev_dbg(dev, "tm_wday: %i\n", dt->tm_wday);
117 printk("tm_wday: %i\n",dt->tm_wday);
118#endif
119 117
120 return 0; 118 return 0;
121} 119}
@@ -125,15 +123,13 @@ static int v3020_set_time(struct device *dev, struct rtc_time *dt)
125{ 123{
126 struct v3020 *chip = dev_get_drvdata(dev); 124 struct v3020 *chip = dev_get_drvdata(dev);
127 125
128#ifdef DEBUG 126 dev_dbg(dev, "\n%s : Setting RTC values\n", __func__);
129 printk("\n%s : Setting RTC values\n",__func__); 127 dev_dbg(dev, "tm_sec : %i\n", dt->tm_sec);
130 printk("tm_sec : %i\n",dt->tm_sec); 128 dev_dbg(dev, "tm_min : %i\n", dt->tm_min);
131 printk("tm_min : %i\n",dt->tm_min); 129 dev_dbg(dev, "tm_hour: %i\n", dt->tm_hour);
132 printk("tm_hour: %i\n",dt->tm_hour); 130 dev_dbg(dev, "tm_mday: %i\n", dt->tm_mday);
133 printk("tm_mday: %i\n",dt->tm_mday); 131 dev_dbg(dev, "tm_wday: %i\n", dt->tm_wday);
134 printk("tm_wday: %i\n",dt->tm_wday); 132 dev_dbg(dev, "tm_year: %i\n", dt->tm_year);
135 printk("tm_year: %i\n",dt->tm_year);
136#endif
137 133
138 /* Write all the values to ram... */ 134 /* Write all the values to ram... */
139 v3020_set_reg(chip, V3020_SECONDS, bin2bcd(dt->tm_sec)); 135 v3020_set_reg(chip, V3020_SECONDS, bin2bcd(dt->tm_sec));
@@ -191,7 +187,7 @@ static int rtc_probe(struct platform_device *pdev)
191 /* Test chip by doing a write/read sequence 187 /* Test chip by doing a write/read sequence
192 * to the chip ram */ 188 * to the chip ram */
193 v3020_set_reg(chip, V3020_SECONDS, 0x33); 189 v3020_set_reg(chip, V3020_SECONDS, 0x33);
194 if(v3020_get_reg(chip, V3020_SECONDS) != 0x33) { 190 if (v3020_get_reg(chip, V3020_SECONDS) != 0x33) {
195 retval = -ENODEV; 191 retval = -ENODEV;
196 goto err_io; 192 goto err_io;
197 } 193 }