Lines Matching refs:buf

65 static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf)  in m41t62_update_rtc_time()  argument
70 buf[0], buf[1], buf[2], buf[3], in m41t62_update_rtc_time()
71 buf[4], buf[5], buf[6], buf[7]); in m41t62_update_rtc_time()
73 tm->tm_sec = bcd2bin(buf[M41T62_REG_SEC] & 0x7f); in m41t62_update_rtc_time()
74 tm->tm_min = bcd2bin(buf[M41T62_REG_MIN] & 0x7f); in m41t62_update_rtc_time()
75 tm->tm_hour = bcd2bin(buf[M41T62_REG_HOUR] & 0x3f); in m41t62_update_rtc_time()
76 tm->tm_mday = bcd2bin(buf[M41T62_REG_DAY] & 0x3f); in m41t62_update_rtc_time()
77 tm->tm_wday = buf[M41T62_REG_WDAY] & 0x07; in m41t62_update_rtc_time()
78 tm->tm_mon = bcd2bin(buf[M41T62_REG_MON] & 0x1f); in m41t62_update_rtc_time()
82 tm->tm_year = bcd2bin(buf[M41T62_REG_YEAR]) + 100 + 1900; in m41t62_update_rtc_time()
91 static void m41t62_set_rtc_buf(const struct rtc_time *tm, u8 *buf) in m41t62_set_rtc_buf() argument
98 buf[M41T62_REG_SSEC] = 0; in m41t62_set_rtc_buf()
99 buf[M41T62_REG_SEC] = in m41t62_set_rtc_buf()
100 bin2bcd(tm->tm_sec) | (buf[M41T62_REG_SEC] & ~0x7f); in m41t62_set_rtc_buf()
101 buf[M41T62_REG_MIN] = in m41t62_set_rtc_buf()
102 bin2bcd(tm->tm_min) | (buf[M41T62_REG_MIN] & ~0x7f); in m41t62_set_rtc_buf()
103 buf[M41T62_REG_HOUR] = in m41t62_set_rtc_buf()
104 bin2bcd(tm->tm_hour) | (buf[M41T62_REG_HOUR] & ~0x3f) ; in m41t62_set_rtc_buf()
105 buf[M41T62_REG_WDAY] = in m41t62_set_rtc_buf()
106 (tm->tm_wday & 0x07) | (buf[M41T62_REG_WDAY] & ~0x07); in m41t62_set_rtc_buf()
107 buf[M41T62_REG_DAY] = in m41t62_set_rtc_buf()
108 bin2bcd(tm->tm_mday) | (buf[M41T62_REG_DAY] & ~0x3f); in m41t62_set_rtc_buf()
109 buf[M41T62_REG_MON] = in m41t62_set_rtc_buf()
110 bin2bcd(tm->tm_mon) | (buf[M41T62_REG_MON] & ~0x1f); in m41t62_set_rtc_buf()
112 buf[M41T62_REG_YEAR] = bin2bcd(tm->tm_year % 100); in m41t62_set_rtc_buf()
118 u8 buf[M41T62_DATETIME_REG_SIZE]; in m41t62_rtc_get() local
121 ret = dm_i2c_read(dev, 0, buf, sizeof(buf)); in m41t62_rtc_get()
125 m41t62_update_rtc_time(tm, buf); in m41t62_rtc_get()
132 u8 buf[M41T62_DATETIME_REG_SIZE]; in m41t62_rtc_set() local
135 ret = dm_i2c_read(dev, 0, buf, sizeof(buf)); in m41t62_rtc_set()
139 m41t62_set_rtc_buf(tm, buf); in m41t62_rtc_set()
141 ret = dm_i2c_write(dev, 0, buf, sizeof(buf)); in m41t62_rtc_set()
320 u8 buf[M41T62_DATETIME_REG_SIZE]; in rtc_get() local
322 i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, buf, M41T62_DATETIME_REG_SIZE); in rtc_get()
323 m41t62_update_rtc_time(tm, buf); in rtc_get()
330 u8 buf[M41T62_DATETIME_REG_SIZE]; in rtc_set() local
332 i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, buf, M41T62_DATETIME_REG_SIZE); in rtc_set()
333 m41t62_set_rtc_buf(tm, buf); in rtc_set()
335 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, buf, in rtc_set()