diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-pcf8583.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index 5875ebb8c79d..a69db6185530 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c | |||
@@ -81,11 +81,11 @@ static int pcf8583_get_datetime(struct i2c_client *client, struct rtc_time *dt) | |||
81 | buf[4] &= 0x3f; | 81 | buf[4] &= 0x3f; |
82 | buf[5] &= 0x1f; | 82 | buf[5] &= 0x1f; |
83 | 83 | ||
84 | dt->tm_sec = BCD_TO_BIN(buf[1]); | 84 | dt->tm_sec = BCD2BIN(buf[1]); |
85 | dt->tm_min = BCD_TO_BIN(buf[2]); | 85 | dt->tm_min = BCD2BIN(buf[2]); |
86 | dt->tm_hour = BCD_TO_BIN(buf[3]); | 86 | dt->tm_hour = BCD2BIN(buf[3]); |
87 | dt->tm_mday = BCD_TO_BIN(buf[4]); | 87 | dt->tm_mday = BCD2BIN(buf[4]); |
88 | dt->tm_mon = BCD_TO_BIN(buf[5]); | 88 | dt->tm_mon = BCD2BIN(buf[5]); |
89 | } | 89 | } |
90 | 90 | ||
91 | return ret == 2 ? 0 : -EIO; | 91 | return ret == 2 ? 0 : -EIO; |
@@ -99,14 +99,14 @@ static int pcf8583_set_datetime(struct i2c_client *client, struct rtc_time *dt, | |||
99 | buf[0] = 0; | 99 | buf[0] = 0; |
100 | buf[1] = get_ctrl(client) | 0x80; | 100 | buf[1] = get_ctrl(client) | 0x80; |
101 | buf[2] = 0; | 101 | buf[2] = 0; |
102 | buf[3] = BIN_TO_BCD(dt->tm_sec); | 102 | buf[3] = BIN2BCD(dt->tm_sec); |
103 | buf[4] = BIN_TO_BCD(dt->tm_min); | 103 | buf[4] = BIN2BCD(dt->tm_min); |
104 | buf[5] = BIN_TO_BCD(dt->tm_hour); | 104 | buf[5] = BIN2BCD(dt->tm_hour); |
105 | 105 | ||
106 | if (datetoo) { | 106 | if (datetoo) { |
107 | len = 8; | 107 | len = 8; |
108 | buf[6] = BIN_TO_BCD(dt->tm_mday) | (dt->tm_year << 6); | 108 | buf[6] = BIN2BCD(dt->tm_mday) | (dt->tm_year << 6); |
109 | buf[7] = BIN_TO_BCD(dt->tm_mon) | (dt->tm_wday << 5); | 109 | buf[7] = BIN2BCD(dt->tm_mon) | (dt->tm_wday << 5); |
110 | } | 110 | } |
111 | 111 | ||
112 | ret = i2c_master_send(client, (char *)buf, len); | 112 | ret = i2c_master_send(client, (char *)buf, len); |