projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix/hda' into topic/hda
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
rtc
/
rtc-s35390a.c
diff --git
a/drivers/rtc/rtc-s35390a.c
b/drivers/rtc/rtc-s35390a.c
index 29f47bacfc77b5503086473f858fb1cc6124f33e..def4d396d0b096cef968a5572f2b5122d92eeb33 100644
(file)
--- 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)
static char s35390a_hr2reg(struct s35390a *s35390a, int hour)
{
if (s35390a->twentyfourhour)
static char s35390a_hr2reg(struct s35390a *s35390a, int hour)
{
if (s35390a->twentyfourhour)
- return
BIN2BCD
(hour);
+ return
bin2bcd
(hour);
if (hour < 12)
if (hour < 12)
- return
BIN2BCD
(hour);
+ return
bin2bcd
(hour);
- return 0x40 |
BIN2BCD
(hour - 12);
+ return 0x40 |
bin2bcd
(hour - 12);
}
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
}
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
@@
-117,9
+117,9
@@
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
unsigned hour;
if (s35390a->twentyfourhour)
unsigned hour;
if (s35390a->twentyfourhour)
- return
BCD2BIN
(reg & 0x3f);
+ return
bcd2bin
(reg & 0x3f);
- hour =
BCD2BIN
(reg & 0x3f);
+ hour =
bcd2bin
(reg & 0x3f);
if (reg & 0x40)
hour += 12;
if (reg & 0x40)
hour += 12;
@@
-137,13
+137,13
@@
static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_wday);
tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_wday);
- buf[S35390A_BYTE_YEAR] =
BIN2BCD
(tm->tm_year - 100);
- buf[S35390A_BYTE_MONTH] =
BIN2BCD
(tm->tm_mon + 1);
- buf[S35390A_BYTE_DAY] =
BIN2BCD
(tm->tm_mday);
- buf[S35390A_BYTE_WDAY] =
BIN2BCD
(tm->tm_wday);
+ buf[S35390A_BYTE_YEAR] =
bin2bcd
(tm->tm_year - 100);
+ buf[S35390A_BYTE_MONTH] =
bin2bcd
(tm->tm_mon + 1);
+ buf[S35390A_BYTE_DAY] =
bin2bcd
(tm->tm_mday);
+ buf[S35390A_BYTE_WDAY] =
bin2bcd
(tm->tm_wday);
buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour);
buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour);
- buf[S35390A_BYTE_MINS] =
BIN2BCD
(tm->tm_min);
- buf[S35390A_BYTE_SECS] =
BIN2BCD
(tm->tm_sec);
+ buf[S35390A_BYTE_MINS] =
bin2bcd
(tm->tm_min);
+ buf[S35390A_BYTE_SECS] =
bin2bcd
(tm->tm_sec);
/* This chip expects the bits of each byte to be in reverse order */
for (i = 0; i < 7; ++i)
/* This chip expects the bits of each byte to be in reverse order */
for (i = 0; i < 7; ++i)
@@
-168,13
+168,13
@@
static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)
for (i = 0; i < 7; ++i)
buf[i] = bitrev8(buf[i]);
for (i = 0; i < 7; ++i)
buf[i] = bitrev8(buf[i]);
- tm->tm_sec =
BCD2BIN
(buf[S35390A_BYTE_SECS]);
- tm->tm_min =
BCD2BIN
(buf[S35390A_BYTE_MINS]);
+ tm->tm_sec =
bcd2bin
(buf[S35390A_BYTE_SECS]);
+ tm->tm_min =
bcd2bin
(buf[S35390A_BYTE_MINS]);
tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]);
tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]);
- tm->tm_wday =
BCD2BIN
(buf[S35390A_BYTE_WDAY]);
- tm->tm_mday =
BCD2BIN
(buf[S35390A_BYTE_DAY]);
- tm->tm_mon =
BCD2BIN
(buf[S35390A_BYTE_MONTH]) - 1;
- tm->tm_year =
BCD2BIN
(buf[S35390A_BYTE_YEAR]) + 100;
+ tm->tm_wday =
bcd2bin
(buf[S35390A_BYTE_WDAY]);
+ tm->tm_mday =
bcd2bin
(buf[S35390A_BYTE_DAY]);
+ tm->tm_mon =
bcd2bin
(buf[S35390A_BYTE_MONTH]) - 1;
+ tm->tm_year =
bcd2bin
(buf[S35390A_BYTE_YEAR]) + 100;
dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, "
"mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec,
dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, "
"mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec,
@@
-227,7
+227,7
@@
static int s35390a_probe(struct i2c_client *client,
/* This chip uses multiple addresses, use dummy devices for them */
for (i = 1; i < 8; ++i) {
s35390a->client[i] = i2c_new_dummy(client->adapter,
/* This chip uses multiple addresses, use dummy devices for them */
for (i = 1; i < 8; ++i) {
s35390a->client[i] = i2c_new_dummy(client->adapter,
- client->addr + i
, "rtc-s35390a"
);
+ client->addr + i);
if (!s35390a->client[i]) {
dev_err(&client->dev, "Address %02x unavailable\n",
client->addr + i);
if (!s35390a->client[i]) {
dev_err(&client->dev, "Address %02x unavailable\n",
client->addr + i);