Lines Matching +full:write +full:- +full:protect

23 #define MAX6900_REG_SC			0	/* seconds      00-59 */
24 #define MAX6900_REG_MN 1 /* minutes 00-59 */
25 #define MAX6900_REG_HR 2 /* hours 00-23 */
26 #define MAX6900_REG_DT 3 /* day of month 00-31 */
27 #define MAX6900_REG_MO 4 /* month 01-12 */
28 #define MAX6900_REG_DW 5 /* day of week 1-7 */
29 #define MAX6900_REG_YR 6 /* year 00-99 */
37 #define MAX6900_REG_CT_WP (1 << 7) /* Write Protect */
40 * register read/write commands
59 .addr = client->addr, in max6900_i2c_read_regs()
60 .flags = 0, /* write */ in max6900_i2c_read_regs()
65 .addr = client->addr, in max6900_i2c_read_regs()
71 .addr = client->addr, in max6900_i2c_read_regs()
72 .flags = 0, /* write */ in max6900_i2c_read_regs()
77 .addr = client->addr, in max6900_i2c_read_regs()
85 rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in max6900_i2c_read_regs()
87 dev_err(&client->dev, "%s: register read failed\n", __func__); in max6900_i2c_read_regs()
88 return -EIO; in max6900_i2c_read_regs()
98 .addr = client->addr, in max6900_i2c_write_regs()
99 .flags = 0, /* write */ in max6900_i2c_write_regs()
106 .addr = client->addr, in max6900_i2c_write_regs()
107 .flags = 0, /* write */ in max6900_i2c_write_regs()
115 * the need to delay after each write to the chip. Also, in max6900_i2c_write_regs()
116 * we write the century byte first, since we set the write-protect in max6900_i2c_write_regs()
117 * bit as part of the burst write. in max6900_i2c_write_regs()
121 rc = i2c_transfer(client->adapter, century_msgs, in max6900_i2c_write_regs()
130 rc = i2c_transfer(client->adapter, burst_msgs, ARRAY_SIZE(burst_msgs)); in max6900_i2c_write_regs()
138 dev_err(&client->dev, "%s: register write failed\n", __func__); in max6900_i2c_write_regs()
139 return -EIO; in max6900_i2c_write_regs()
152 tm->tm_sec = bcd2bin(regs[MAX6900_REG_SC]); in max6900_rtc_read_time()
153 tm->tm_min = bcd2bin(regs[MAX6900_REG_MN]); in max6900_rtc_read_time()
154 tm->tm_hour = bcd2bin(regs[MAX6900_REG_HR] & 0x3f); in max6900_rtc_read_time()
155 tm->tm_mday = bcd2bin(regs[MAX6900_REG_DT]); in max6900_rtc_read_time()
156 tm->tm_mon = bcd2bin(regs[MAX6900_REG_MO]) - 1; in max6900_rtc_read_time()
157 tm->tm_year = bcd2bin(regs[MAX6900_REG_YR]) + in max6900_rtc_read_time()
158 bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900; in max6900_rtc_read_time()
159 tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]); in max6900_rtc_read_time()
179 regs[MAX6900_REG_SC] = bin2bcd(tm->tm_sec); in max6900_rtc_set_time()
180 regs[MAX6900_REG_MN] = bin2bcd(tm->tm_min); in max6900_rtc_set_time()
181 regs[MAX6900_REG_HR] = bin2bcd(tm->tm_hour); in max6900_rtc_set_time()
182 regs[MAX6900_REG_DT] = bin2bcd(tm->tm_mday); in max6900_rtc_set_time()
183 regs[MAX6900_REG_MO] = bin2bcd(tm->tm_mon + 1); in max6900_rtc_set_time()
184 regs[MAX6900_REG_DW] = bin2bcd(tm->tm_wday); in max6900_rtc_set_time()
185 regs[MAX6900_REG_YR] = bin2bcd(tm->tm_year % 100); in max6900_rtc_set_time()
186 regs[MAX6900_REG_CENTURY] = bin2bcd((tm->tm_year + 1900) / 100); in max6900_rtc_set_time()
187 /* set write protect */ in max6900_rtc_set_time()
207 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) in max6900_probe()
208 return -ENODEV; in max6900_probe()
210 rtc = devm_rtc_device_register(&client->dev, max6900_driver.driver.name, in max6900_probe()
228 .name = "rtc-max6900",