aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max6900.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-max6900.c')
-rw-r--r--drivers/rtc/rtc-max6900.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
index 12c9cd25cad8..80782798763f 100644
--- a/drivers/rtc/rtc-max6900.c
+++ b/drivers/rtc/rtc-max6900.c
@@ -150,14 +150,14 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
150 if (rc < 0) 150 if (rc < 0)
151 return rc; 151 return rc;
152 152
153 tm->tm_sec = BCD2BIN(regs[MAX6900_REG_SC]); 153 tm->tm_sec = bcd2bin(regs[MAX6900_REG_SC]);
154 tm->tm_min = BCD2BIN(regs[MAX6900_REG_MN]); 154 tm->tm_min = bcd2bin(regs[MAX6900_REG_MN]);
155 tm->tm_hour = BCD2BIN(regs[MAX6900_REG_HR] & 0x3f); 155 tm->tm_hour = bcd2bin(regs[MAX6900_REG_HR] & 0x3f);
156 tm->tm_mday = BCD2BIN(regs[MAX6900_REG_DT]); 156 tm->tm_mday = bcd2bin(regs[MAX6900_REG_DT]);
157 tm->tm_mon = BCD2BIN(regs[MAX6900_REG_MO]) - 1; 157 tm->tm_mon = bcd2bin(regs[MAX6900_REG_MO]) - 1;
158 tm->tm_year = BCD2BIN(regs[MAX6900_REG_YR]) + 158 tm->tm_year = bcd2bin(regs[MAX6900_REG_YR]) +
159 BCD2BIN(regs[MAX6900_REG_CENTURY]) * 100 - 1900; 159 bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900;
160 tm->tm_wday = BCD2BIN(regs[MAX6900_REG_DW]); 160 tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]);
161 161
162 return 0; 162 return 0;
163} 163}
@@ -184,14 +184,14 @@ max6900_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm)
184 if (rc < 0) 184 if (rc < 0)
185 return rc; 185 return rc;
186 186
187 regs[MAX6900_REG_SC] = BIN2BCD(tm->tm_sec); 187 regs[MAX6900_REG_SC] = bin2bcd(tm->tm_sec);
188 regs[MAX6900_REG_MN] = BIN2BCD(tm->tm_min); 188 regs[MAX6900_REG_MN] = bin2bcd(tm->tm_min);
189 regs[MAX6900_REG_HR] = BIN2BCD(tm->tm_hour); 189 regs[MAX6900_REG_HR] = bin2bcd(tm->tm_hour);
190 regs[MAX6900_REG_DT] = BIN2BCD(tm->tm_mday); 190 regs[MAX6900_REG_DT] = bin2bcd(tm->tm_mday);
191 regs[MAX6900_REG_MO] = BIN2BCD(tm->tm_mon + 1); 191 regs[MAX6900_REG_MO] = bin2bcd(tm->tm_mon + 1);
192 regs[MAX6900_REG_DW] = BIN2BCD(tm->tm_wday); 192 regs[MAX6900_REG_DW] = bin2bcd(tm->tm_wday);
193 regs[MAX6900_REG_YR] = BIN2BCD(tm->tm_year % 100); 193 regs[MAX6900_REG_YR] = bin2bcd(tm->tm_year % 100);
194 regs[MAX6900_REG_CENTURY] = BIN2BCD((tm->tm_year + 1900) / 100); 194 regs[MAX6900_REG_CENTURY] = bin2bcd((tm->tm_year + 1900) / 100);
195 /* set write protect */ 195 /* set write protect */
196 regs[MAX6900_REG_CT] = MAX6900_REG_CT_WP; 196 regs[MAX6900_REG_CT] = MAX6900_REG_CT_WP;
197 197