aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-m48t86.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index f6e7ee04f3dc..8c0d1a6739ad 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -48,33 +48,33 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
48 struct platform_device *pdev = to_platform_device(dev); 48 struct platform_device *pdev = to_platform_device(dev);
49 struct m48t86_ops *ops = pdev->dev.platform_data; 49 struct m48t86_ops *ops = pdev->dev.platform_data;
50 50
51 reg = ops->readb(M48T86_REG_B); 51 reg = ops->readbyte(M48T86_REG_B);
52 52
53 if (reg & M48T86_REG_B_DM) { 53 if (reg & M48T86_REG_B_DM) {
54 /* data (binary) mode */ 54 /* data (binary) mode */
55 tm->tm_sec = ops->readb(M48T86_REG_SEC); 55 tm->tm_sec = ops->readbyte(M48T86_REG_SEC);
56 tm->tm_min = ops->readb(M48T86_REG_MIN); 56 tm->tm_min = ops->readbyte(M48T86_REG_MIN);
57 tm->tm_hour = ops->readb(M48T86_REG_HOUR) & 0x3F; 57 tm->tm_hour = ops->readbyte(M48T86_REG_HOUR) & 0x3F;
58 tm->tm_mday = ops->readb(M48T86_REG_DOM); 58 tm->tm_mday = ops->readbyte(M48T86_REG_DOM);
59 /* tm_mon is 0-11 */ 59 /* tm_mon is 0-11 */
60 tm->tm_mon = ops->readb(M48T86_REG_MONTH) - 1; 60 tm->tm_mon = ops->readbyte(M48T86_REG_MONTH) - 1;
61 tm->tm_year = ops->readb(M48T86_REG_YEAR) + 100; 61 tm->tm_year = ops->readbyte(M48T86_REG_YEAR) + 100;
62 tm->tm_wday = ops->readb(M48T86_REG_DOW); 62 tm->tm_wday = ops->readbyte(M48T86_REG_DOW);
63 } else { 63 } else {
64 /* bcd mode */ 64 /* bcd mode */
65 tm->tm_sec = BCD2BIN(ops->readb(M48T86_REG_SEC)); 65 tm->tm_sec = BCD2BIN(ops->readbyte(M48T86_REG_SEC));
66 tm->tm_min = BCD2BIN(ops->readb(M48T86_REG_MIN)); 66 tm->tm_min = BCD2BIN(ops->readbyte(M48T86_REG_MIN));
67 tm->tm_hour = BCD2BIN(ops->readb(M48T86_REG_HOUR) & 0x3F); 67 tm->tm_hour = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F);
68 tm->tm_mday = BCD2BIN(ops->readb(M48T86_REG_DOM)); 68 tm->tm_mday = BCD2BIN(ops->readbyte(M48T86_REG_DOM));
69 /* tm_mon is 0-11 */ 69 /* tm_mon is 0-11 */
70 tm->tm_mon = BCD2BIN(ops->readb(M48T86_REG_MONTH)) - 1; 70 tm->tm_mon = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1;
71 tm->tm_year = BCD2BIN(ops->readb(M48T86_REG_YEAR)) + 100; 71 tm->tm_year = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100;
72 tm->tm_wday = BCD2BIN(ops->readb(M48T86_REG_DOW)); 72 tm->tm_wday = BCD2BIN(ops->readbyte(M48T86_REG_DOW));
73 } 73 }
74 74
75 /* correct the hour if the clock is in 12h mode */ 75 /* correct the hour if the clock is in 12h mode */
76 if (!(reg & M48T86_REG_B_H24)) 76 if (!(reg & M48T86_REG_B_H24))
77 if (ops->readb(M48T86_REG_HOUR) & 0x80) 77 if (ops->readbyte(M48T86_REG_HOUR) & 0x80)
78 tm->tm_hour += 12; 78 tm->tm_hour += 12;
79 79
80 return 0; 80 return 0;
@@ -86,35 +86,35 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm)
86 struct platform_device *pdev = to_platform_device(dev); 86 struct platform_device *pdev = to_platform_device(dev);
87 struct m48t86_ops *ops = pdev->dev.platform_data; 87 struct m48t86_ops *ops = pdev->dev.platform_data;
88 88
89 reg = ops->readb(M48T86_REG_B); 89 reg = ops->readbyte(M48T86_REG_B);
90 90
91 /* update flag and 24h mode */ 91 /* update flag and 24h mode */
92 reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; 92 reg |= M48T86_REG_B_SET | M48T86_REG_B_H24;
93 ops->writeb(reg, M48T86_REG_B); 93 ops->writebyte(reg, M48T86_REG_B);
94 94
95 if (reg & M48T86_REG_B_DM) { 95 if (reg & M48T86_REG_B_DM) {
96 /* data (binary) mode */ 96 /* data (binary) mode */
97 ops->writeb(tm->tm_sec, M48T86_REG_SEC); 97 ops->writebyte(tm->tm_sec, M48T86_REG_SEC);
98 ops->writeb(tm->tm_min, M48T86_REG_MIN); 98 ops->writebyte(tm->tm_min, M48T86_REG_MIN);
99 ops->writeb(tm->tm_hour, M48T86_REG_HOUR); 99 ops->writebyte(tm->tm_hour, M48T86_REG_HOUR);
100 ops->writeb(tm->tm_mday, M48T86_REG_DOM); 100 ops->writebyte(tm->tm_mday, M48T86_REG_DOM);
101 ops->writeb(tm->tm_mon + 1, M48T86_REG_MONTH); 101 ops->writebyte(tm->tm_mon + 1, M48T86_REG_MONTH);
102 ops->writeb(tm->tm_year % 100, M48T86_REG_YEAR); 102 ops->writebyte(tm->tm_year % 100, M48T86_REG_YEAR);
103 ops->writeb(tm->tm_wday, M48T86_REG_DOW); 103 ops->writebyte(tm->tm_wday, M48T86_REG_DOW);
104 } else { 104 } else {
105 /* bcd mode */ 105 /* bcd mode */
106 ops->writeb(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); 106 ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC);
107 ops->writeb(BIN2BCD(tm->tm_min), M48T86_REG_MIN); 107 ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN);
108 ops->writeb(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); 108 ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR);
109 ops->writeb(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); 109 ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM);
110 ops->writeb(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); 110 ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH);
111 ops->writeb(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); 111 ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR);
112 ops->writeb(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); 112 ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW);
113 } 113 }
114 114
115 /* update ended */ 115 /* update ended */
116 reg &= ~M48T86_REG_B_SET; 116 reg &= ~M48T86_REG_B_SET;
117 ops->writeb(reg, M48T86_REG_B); 117 ops->writebyte(reg, M48T86_REG_B);
118 118
119 return 0; 119 return 0;
120} 120}
@@ -125,12 +125,12 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq)
125 struct platform_device *pdev = to_platform_device(dev); 125 struct platform_device *pdev = to_platform_device(dev);
126 struct m48t86_ops *ops = pdev->dev.platform_data; 126 struct m48t86_ops *ops = pdev->dev.platform_data;
127 127
128 reg = ops->readb(M48T86_REG_B); 128 reg = ops->readbyte(M48T86_REG_B);
129 129
130 seq_printf(seq, "mode\t\t: %s\n", 130 seq_printf(seq, "mode\t\t: %s\n",
131 (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); 131 (reg & M48T86_REG_B_DM) ? "binary" : "bcd");
132 132
133 reg = ops->readb(M48T86_REG_D); 133 reg = ops->readbyte(M48T86_REG_D);
134 134
135 seq_printf(seq, "battery\t\t: %s\n", 135 seq_printf(seq, "battery\t\t: %s\n",
136 (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); 136 (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted");
@@ -157,7 +157,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev)
157 platform_set_drvdata(dev, rtc); 157 platform_set_drvdata(dev, rtc);
158 158
159 /* read battery status */ 159 /* read battery status */
160 reg = ops->readb(M48T86_REG_D); 160 reg = ops->readbyte(M48T86_REG_D);
161 dev_info(&dev->dev, "battery %s\n", 161 dev_info(&dev->dev, "battery %s\n",
162 (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); 162 (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted");
163 163