diff options
Diffstat (limited to 'drivers/rtc/rtc-s35390a.c')
-rw-r--r-- | drivers/rtc/rtc-s35390a.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index a6fa1f2f2ca6..def4d396d0b0 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
@@ -104,12 +104,12 @@ static int s35390a_disable_test_mode(struct s35390a *s35390a) | |||
104 | static char s35390a_hr2reg(struct s35390a *s35390a, int hour) | 104 | static char s35390a_hr2reg(struct s35390a *s35390a, int hour) |
105 | { | 105 | { |
106 | if (s35390a->twentyfourhour) | 106 | if (s35390a->twentyfourhour) |
107 | return BIN2BCD(hour); | 107 | return bin2bcd(hour); |
108 | 108 | ||
109 | if (hour < 12) | 109 | if (hour < 12) |
110 | return BIN2BCD(hour); | 110 | return bin2bcd(hour); |
111 | 111 | ||
112 | return 0x40 | BIN2BCD(hour - 12); | 112 | return 0x40 | bin2bcd(hour - 12); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int s35390a_reg2hr(struct s35390a *s35390a, char reg) | 115 | static int s35390a_reg2hr(struct s35390a *s35390a, char reg) |
@@ -117,9 +117,9 @@ static int s35390a_reg2hr(struct s35390a *s35390a, char reg) | |||
117 | unsigned hour; | 117 | unsigned hour; |
118 | 118 | ||
119 | if (s35390a->twentyfourhour) | 119 | if (s35390a->twentyfourhour) |
120 | return BCD2BIN(reg & 0x3f); | 120 | return bcd2bin(reg & 0x3f); |
121 | 121 | ||
122 | hour = BCD2BIN(reg & 0x3f); | 122 | hour = bcd2bin(reg & 0x3f); |
123 | if (reg & 0x40) | 123 | if (reg & 0x40) |
124 | hour += 12; | 124 | hour += 12; |
125 | 125 | ||
@@ -137,13 +137,13 @@ static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
137 | tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, | 137 | tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, |
138 | tm->tm_wday); | 138 | tm->tm_wday); |
139 | 139 | ||
140 | buf[S35390A_BYTE_YEAR] = BIN2BCD(tm->tm_year - 100); | 140 | buf[S35390A_BYTE_YEAR] = bin2bcd(tm->tm_year - 100); |
141 | buf[S35390A_BYTE_MONTH] = BIN2BCD(tm->tm_mon + 1); | 141 | buf[S35390A_BYTE_MONTH] = bin2bcd(tm->tm_mon + 1); |
142 | buf[S35390A_BYTE_DAY] = BIN2BCD(tm->tm_mday); | 142 | buf[S35390A_BYTE_DAY] = bin2bcd(tm->tm_mday); |
143 | buf[S35390A_BYTE_WDAY] = BIN2BCD(tm->tm_wday); | 143 | buf[S35390A_BYTE_WDAY] = bin2bcd(tm->tm_wday); |
144 | buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour); | 144 | buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour); |
145 | buf[S35390A_BYTE_MINS] = BIN2BCD(tm->tm_min); | 145 | buf[S35390A_BYTE_MINS] = bin2bcd(tm->tm_min); |
146 | buf[S35390A_BYTE_SECS] = BIN2BCD(tm->tm_sec); | 146 | buf[S35390A_BYTE_SECS] = bin2bcd(tm->tm_sec); |
147 | 147 | ||
148 | /* This chip expects the bits of each byte to be in reverse order */ | 148 | /* This chip expects the bits of each byte to be in reverse order */ |
149 | for (i = 0; i < 7; ++i) | 149 | for (i = 0; i < 7; ++i) |
@@ -168,13 +168,13 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
168 | for (i = 0; i < 7; ++i) | 168 | for (i = 0; i < 7; ++i) |
169 | buf[i] = bitrev8(buf[i]); | 169 | buf[i] = bitrev8(buf[i]); |
170 | 170 | ||
171 | tm->tm_sec = BCD2BIN(buf[S35390A_BYTE_SECS]); | 171 | tm->tm_sec = bcd2bin(buf[S35390A_BYTE_SECS]); |
172 | tm->tm_min = BCD2BIN(buf[S35390A_BYTE_MINS]); | 172 | tm->tm_min = bcd2bin(buf[S35390A_BYTE_MINS]); |
173 | tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]); | 173 | tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]); |
174 | tm->tm_wday = BCD2BIN(buf[S35390A_BYTE_WDAY]); | 174 | tm->tm_wday = bcd2bin(buf[S35390A_BYTE_WDAY]); |
175 | tm->tm_mday = BCD2BIN(buf[S35390A_BYTE_DAY]); | 175 | tm->tm_mday = bcd2bin(buf[S35390A_BYTE_DAY]); |
176 | tm->tm_mon = BCD2BIN(buf[S35390A_BYTE_MONTH]) - 1; | 176 | tm->tm_mon = bcd2bin(buf[S35390A_BYTE_MONTH]) - 1; |
177 | tm->tm_year = BCD2BIN(buf[S35390A_BYTE_YEAR]) + 100; | 177 | tm->tm_year = bcd2bin(buf[S35390A_BYTE_YEAR]) + 100; |
178 | 178 | ||
179 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, " | 179 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, " |
180 | "mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec, | 180 | "mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec, |