aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-x1205.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-x1205.c')
-rw-r--r--drivers/rtc/rtc-x1205.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 7dcfba1bbfe..310c10795e9 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -118,13 +118,13 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm,
118 for (i = 0; i <= 4; i++) 118 for (i = 0; i <= 4; i++)
119 buf[i] &= 0x7F; 119 buf[i] &= 0x7F;
120 120
121 tm->tm_sec = BCD2BIN(buf[CCR_SEC]); 121 tm->tm_sec = bcd2bin(buf[CCR_SEC]);
122 tm->tm_min = BCD2BIN(buf[CCR_MIN]); 122 tm->tm_min = bcd2bin(buf[CCR_MIN]);
123 tm->tm_hour = BCD2BIN(buf[CCR_HOUR] & 0x3F); /* hr is 0-23 */ 123 tm->tm_hour = bcd2bin(buf[CCR_HOUR] & 0x3F); /* hr is 0-23 */
124 tm->tm_mday = BCD2BIN(buf[CCR_MDAY]); 124 tm->tm_mday = bcd2bin(buf[CCR_MDAY]);
125 tm->tm_mon = BCD2BIN(buf[CCR_MONTH]) - 1; /* mon is 0-11 */ 125 tm->tm_mon = bcd2bin(buf[CCR_MONTH]) - 1; /* mon is 0-11 */
126 tm->tm_year = BCD2BIN(buf[CCR_YEAR]) 126 tm->tm_year = bcd2bin(buf[CCR_YEAR])
127 + (BCD2BIN(buf[CCR_Y2K]) * 100) - 1900; 127 + (bcd2bin(buf[CCR_Y2K]) * 100) - 1900;
128 tm->tm_wday = buf[CCR_WDAY]; 128 tm->tm_wday = buf[CCR_WDAY];
129 129
130 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " 130 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
@@ -174,11 +174,11 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm,
174 __func__, 174 __func__,
175 tm->tm_sec, tm->tm_min, tm->tm_hour); 175 tm->tm_sec, tm->tm_min, tm->tm_hour);
176 176
177 buf[CCR_SEC] = BIN2BCD(tm->tm_sec); 177 buf[CCR_SEC] = bin2bcd(tm->tm_sec);
178 buf[CCR_MIN] = BIN2BCD(tm->tm_min); 178 buf[CCR_MIN] = bin2bcd(tm->tm_min);
179 179
180 /* set hour and 24hr bit */ 180 /* set hour and 24hr bit */
181 buf[CCR_HOUR] = BIN2BCD(tm->tm_hour) | X1205_HR_MIL; 181 buf[CCR_HOUR] = bin2bcd(tm->tm_hour) | X1205_HR_MIL;
182 182
183 /* should we also set the date? */ 183 /* should we also set the date? */
184 if (datetoo) { 184 if (datetoo) {
@@ -187,15 +187,15 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm,
187 __func__, 187 __func__,
188 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 188 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
189 189
190 buf[CCR_MDAY] = BIN2BCD(tm->tm_mday); 190 buf[CCR_MDAY] = bin2bcd(tm->tm_mday);
191 191
192 /* month, 1 - 12 */ 192 /* month, 1 - 12 */
193 buf[CCR_MONTH] = BIN2BCD(tm->tm_mon + 1); 193 buf[CCR_MONTH] = bin2bcd(tm->tm_mon + 1);
194 194
195 /* year, since the rtc epoch*/ 195 /* year, since the rtc epoch*/
196 buf[CCR_YEAR] = BIN2BCD(tm->tm_year % 100); 196 buf[CCR_YEAR] = bin2bcd(tm->tm_year % 100);
197 buf[CCR_WDAY] = tm->tm_wday & 0x07; 197 buf[CCR_WDAY] = tm->tm_wday & 0x07;
198 buf[CCR_Y2K] = BIN2BCD(tm->tm_year / 100); 198 buf[CCR_Y2K] = bin2bcd(tm->tm_year / 100);
199 } 199 }
200 200
201 /* If writing alarm registers, set compare bits on registers 0-4 */ 201 /* If writing alarm registers, set compare bits on registers 0-4 */
@@ -437,7 +437,7 @@ static int x1205_validate_client(struct i2c_client *client)
437 return -EIO; 437 return -EIO;
438 } 438 }
439 439
440 value = BCD2BIN(reg & probe_limits_pattern[i].mask); 440 value = bcd2bin(reg & probe_limits_pattern[i].mask);
441 441
442 if (value > probe_limits_pattern[i].max || 442 if (value > probe_limits_pattern[i].max ||
443 value < probe_limits_pattern[i].min) { 443 value < probe_limits_pattern[i].min) {