diff options
Diffstat (limited to 'drivers/rtc/rtc-ds1511.c')
-rw-r--r-- | drivers/rtc/rtc-ds1511.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 86981d34fbb6..25caada78398 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -153,8 +153,8 @@ ds1511_wdog_set(unsigned long deciseconds) | |||
153 | /* | 153 | /* |
154 | * set the wdog values in the wdog registers | 154 | * set the wdog values in the wdog registers |
155 | */ | 155 | */ |
156 | rtc_write(BIN2BCD(deciseconds % 100), DS1511_WD_MSEC); | 156 | rtc_write(bin2bcd(deciseconds % 100), DS1511_WD_MSEC); |
157 | rtc_write(BIN2BCD(deciseconds / 100), DS1511_WD_SEC); | 157 | rtc_write(bin2bcd(deciseconds / 100), DS1511_WD_SEC); |
158 | /* | 158 | /* |
159 | * set wdog enable and wdog 'steering' bit to issue a reset | 159 | * set wdog enable and wdog 'steering' bit to issue a reset |
160 | */ | 160 | */ |
@@ -220,13 +220,13 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) | |||
220 | /* | 220 | /* |
221 | * each register is a different number of valid bits | 221 | * each register is a different number of valid bits |
222 | */ | 222 | */ |
223 | sec = BIN2BCD(sec) & 0x7f; | 223 | sec = bin2bcd(sec) & 0x7f; |
224 | min = BIN2BCD(min) & 0x7f; | 224 | min = bin2bcd(min) & 0x7f; |
225 | hrs = BIN2BCD(hrs) & 0x3f; | 225 | hrs = bin2bcd(hrs) & 0x3f; |
226 | day = BIN2BCD(day) & 0x3f; | 226 | day = bin2bcd(day) & 0x3f; |
227 | mon = BIN2BCD(mon) & 0x1f; | 227 | mon = bin2bcd(mon) & 0x1f; |
228 | yrs = BIN2BCD(yrs) & 0xff; | 228 | yrs = bin2bcd(yrs) & 0xff; |
229 | cen = BIN2BCD(cen) & 0xff; | 229 | cen = bin2bcd(cen) & 0xff; |
230 | 230 | ||
231 | spin_lock_irqsave(&ds1511_lock, flags); | 231 | spin_lock_irqsave(&ds1511_lock, flags); |
232 | rtc_disable_update(); | 232 | rtc_disable_update(); |
@@ -264,14 +264,14 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) | |||
264 | rtc_enable_update(); | 264 | rtc_enable_update(); |
265 | spin_unlock_irqrestore(&ds1511_lock, flags); | 265 | spin_unlock_irqrestore(&ds1511_lock, flags); |
266 | 266 | ||
267 | rtc_tm->tm_sec = BCD2BIN(rtc_tm->tm_sec); | 267 | rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec); |
268 | rtc_tm->tm_min = BCD2BIN(rtc_tm->tm_min); | 268 | rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min); |
269 | rtc_tm->tm_hour = BCD2BIN(rtc_tm->tm_hour); | 269 | rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour); |
270 | rtc_tm->tm_mday = BCD2BIN(rtc_tm->tm_mday); | 270 | rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday); |
271 | rtc_tm->tm_wday = BCD2BIN(rtc_tm->tm_wday); | 271 | rtc_tm->tm_wday = bcd2bin(rtc_tm->tm_wday); |
272 | rtc_tm->tm_mon = BCD2BIN(rtc_tm->tm_mon); | 272 | rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon); |
273 | rtc_tm->tm_year = BCD2BIN(rtc_tm->tm_year); | 273 | rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year); |
274 | century = BCD2BIN(century) * 100; | 274 | century = bcd2bin(century) * 100; |
275 | 275 | ||
276 | /* | 276 | /* |
277 | * Account for differences between how the RTC uses the values | 277 | * Account for differences between how the RTC uses the values |
@@ -304,16 +304,16 @@ ds1511_rtc_update_alarm(struct rtc_plat_data *pdata) | |||
304 | 304 | ||
305 | spin_lock_irqsave(&pdata->rtc->irq_lock, flags); | 305 | spin_lock_irqsave(&pdata->rtc->irq_lock, flags); |
306 | rtc_write(pdata->alrm_mday < 0 || (pdata->irqen & RTC_UF) ? | 306 | rtc_write(pdata->alrm_mday < 0 || (pdata->irqen & RTC_UF) ? |
307 | 0x80 : BIN2BCD(pdata->alrm_mday) & 0x3f, | 307 | 0x80 : bin2bcd(pdata->alrm_mday) & 0x3f, |
308 | RTC_ALARM_DATE); | 308 | RTC_ALARM_DATE); |
309 | rtc_write(pdata->alrm_hour < 0 || (pdata->irqen & RTC_UF) ? | 309 | rtc_write(pdata->alrm_hour < 0 || (pdata->irqen & RTC_UF) ? |
310 | 0x80 : BIN2BCD(pdata->alrm_hour) & 0x3f, | 310 | 0x80 : bin2bcd(pdata->alrm_hour) & 0x3f, |
311 | RTC_ALARM_HOUR); | 311 | RTC_ALARM_HOUR); |
312 | rtc_write(pdata->alrm_min < 0 || (pdata->irqen & RTC_UF) ? | 312 | rtc_write(pdata->alrm_min < 0 || (pdata->irqen & RTC_UF) ? |
313 | 0x80 : BIN2BCD(pdata->alrm_min) & 0x7f, | 313 | 0x80 : bin2bcd(pdata->alrm_min) & 0x7f, |
314 | RTC_ALARM_MIN); | 314 | RTC_ALARM_MIN); |
315 | rtc_write(pdata->alrm_sec < 0 || (pdata->irqen & RTC_UF) ? | 315 | rtc_write(pdata->alrm_sec < 0 || (pdata->irqen & RTC_UF) ? |
316 | 0x80 : BIN2BCD(pdata->alrm_sec) & 0x7f, | 316 | 0x80 : bin2bcd(pdata->alrm_sec) & 0x7f, |
317 | RTC_ALARM_SEC); | 317 | RTC_ALARM_SEC); |
318 | rtc_write(rtc_read(RTC_CMD) | (pdata->irqen ? RTC_TIE : 0), RTC_CMD); | 318 | rtc_write(rtc_read(RTC_CMD) | (pdata->irqen ? RTC_TIE : 0), RTC_CMD); |
319 | rtc_read(RTC_CMD1); /* clear interrupts */ | 319 | rtc_read(RTC_CMD1); /* clear interrupts */ |
@@ -481,7 +481,6 @@ static struct bin_attribute ds1511_nvram_attr = { | |||
481 | .attr = { | 481 | .attr = { |
482 | .name = "nvram", | 482 | .name = "nvram", |
483 | .mode = S_IRUGO | S_IWUGO, | 483 | .mode = S_IRUGO | S_IWUGO, |
484 | .owner = THIS_MODULE, | ||
485 | }, | 484 | }, |
486 | .size = DS1511_RAM_MAX, | 485 | .size = DS1511_RAM_MAX, |
487 | .read = ds1511_nvram_read, | 486 | .read = ds1511_nvram_read, |