aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s3c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
-rw-r--r--drivers/rtc/rtc-s3c.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index e7d19b6c265a..910bc704939c 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -134,12 +134,12 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
134 rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, 134 rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday,
135 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); 135 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);
136 136
137 BCD_TO_BIN(rtc_tm->tm_sec); 137 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
138 BCD_TO_BIN(rtc_tm->tm_min); 138 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
139 BCD_TO_BIN(rtc_tm->tm_hour); 139 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
140 BCD_TO_BIN(rtc_tm->tm_mday); 140 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
141 BCD_TO_BIN(rtc_tm->tm_mon); 141 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
142 BCD_TO_BIN(rtc_tm->tm_year); 142 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
143 143
144 rtc_tm->tm_year += 100; 144 rtc_tm->tm_year += 100;
145 rtc_tm->tm_mon -= 1; 145 rtc_tm->tm_mon -= 1;
@@ -163,12 +163,12 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
163 return -EINVAL; 163 return -EINVAL;
164 } 164 }
165 165
166 writeb(BIN2BCD(tm->tm_sec), base + S3C2410_RTCSEC); 166 writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC);
167 writeb(BIN2BCD(tm->tm_min), base + S3C2410_RTCMIN); 167 writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN);
168 writeb(BIN2BCD(tm->tm_hour), base + S3C2410_RTCHOUR); 168 writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);
169 writeb(BIN2BCD(tm->tm_mday), base + S3C2410_RTCDATE); 169 writeb(bin2bcd(tm->tm_mday), base + S3C2410_RTCDATE);
170 writeb(BIN2BCD(tm->tm_mon + 1), base + S3C2410_RTCMON); 170 writeb(bin2bcd(tm->tm_mon + 1), base + S3C2410_RTCMON);
171 writeb(BIN2BCD(year), base + S3C2410_RTCYEAR); 171 writeb(bin2bcd(year), base + S3C2410_RTCYEAR);
172 172
173 return 0; 173 return 0;
174} 174}
@@ -199,34 +199,34 @@ static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)
199 /* decode the alarm enable field */ 199 /* decode the alarm enable field */
200 200
201 if (alm_en & S3C2410_RTCALM_SECEN) 201 if (alm_en & S3C2410_RTCALM_SECEN)
202 BCD_TO_BIN(alm_tm->tm_sec); 202 alm_tm->tm_sec = bcd2bin(alm_tm->tm_sec);
203 else 203 else
204 alm_tm->tm_sec = 0xff; 204 alm_tm->tm_sec = 0xff;
205 205
206 if (alm_en & S3C2410_RTCALM_MINEN) 206 if (alm_en & S3C2410_RTCALM_MINEN)
207 BCD_TO_BIN(alm_tm->tm_min); 207 alm_tm->tm_min = bcd2bin(alm_tm->tm_min);
208 else 208 else
209 alm_tm->tm_min = 0xff; 209 alm_tm->tm_min = 0xff;
210 210
211 if (alm_en & S3C2410_RTCALM_HOUREN) 211 if (alm_en & S3C2410_RTCALM_HOUREN)
212 BCD_TO_BIN(alm_tm->tm_hour); 212 alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour);
213 else 213 else
214 alm_tm->tm_hour = 0xff; 214 alm_tm->tm_hour = 0xff;
215 215
216 if (alm_en & S3C2410_RTCALM_DAYEN) 216 if (alm_en & S3C2410_RTCALM_DAYEN)
217 BCD_TO_BIN(alm_tm->tm_mday); 217 alm_tm->tm_mday = bcd2bin(alm_tm->tm_mday);
218 else 218 else
219 alm_tm->tm_mday = 0xff; 219 alm_tm->tm_mday = 0xff;
220 220
221 if (alm_en & S3C2410_RTCALM_MONEN) { 221 if (alm_en & S3C2410_RTCALM_MONEN) {
222 BCD_TO_BIN(alm_tm->tm_mon); 222 alm_tm->tm_mon = bcd2bin(alm_tm->tm_mon);
223 alm_tm->tm_mon -= 1; 223 alm_tm->tm_mon -= 1;
224 } else { 224 } else {
225 alm_tm->tm_mon = 0xff; 225 alm_tm->tm_mon = 0xff;
226 } 226 }
227 227
228 if (alm_en & S3C2410_RTCALM_YEAREN) 228 if (alm_en & S3C2410_RTCALM_YEAREN)
229 BCD_TO_BIN(alm_tm->tm_year); 229 alm_tm->tm_year = bcd2bin(alm_tm->tm_year);
230 else 230 else
231 alm_tm->tm_year = 0xffff; 231 alm_tm->tm_year = 0xffff;
232 232
@@ -250,17 +250,17 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
250 250
251 if (tm->tm_sec < 60 && tm->tm_sec >= 0) { 251 if (tm->tm_sec < 60 && tm->tm_sec >= 0) {
252 alrm_en |= S3C2410_RTCALM_SECEN; 252 alrm_en |= S3C2410_RTCALM_SECEN;
253 writeb(BIN2BCD(tm->tm_sec), base + S3C2410_ALMSEC); 253 writeb(bin2bcd(tm->tm_sec), base + S3C2410_ALMSEC);
254 } 254 }
255 255
256 if (tm->tm_min < 60 && tm->tm_min >= 0) { 256 if (tm->tm_min < 60 && tm->tm_min >= 0) {
257 alrm_en |= S3C2410_RTCALM_MINEN; 257 alrm_en |= S3C2410_RTCALM_MINEN;
258 writeb(BIN2BCD(tm->tm_min), base + S3C2410_ALMMIN); 258 writeb(bin2bcd(tm->tm_min), base + S3C2410_ALMMIN);
259 } 259 }
260 260
261 if (tm->tm_hour < 24 && tm->tm_hour >= 0) { 261 if (tm->tm_hour < 24 && tm->tm_hour >= 0) {
262 alrm_en |= S3C2410_RTCALM_HOUREN; 262 alrm_en |= S3C2410_RTCALM_HOUREN;
263 writeb(BIN2BCD(tm->tm_hour), base + S3C2410_ALMHOUR); 263 writeb(bin2bcd(tm->tm_hour), base + S3C2410_ALMHOUR);
264 } 264 }
265 265
266 pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en); 266 pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en);