Lines Matching refs:chip

52 	struct ds1390 *chip = dev_get_drvdata(dev);  in ds1390_get_reg()  local
59 chip->txrx_buf[0] = address & 0x7f; in ds1390_get_reg()
61 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 1); in ds1390_get_reg()
65 *data = chip->txrx_buf[1]; in ds1390_get_reg()
73 struct ds1390 *chip = dev_get_drvdata(dev); in ds1390_read_time() local
77 chip->txrx_buf[0] = DS1390_REG_SECONDS; in ds1390_read_time()
80 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 8); in ds1390_read_time()
86 dt->tm_sec = bcd2bin(chip->txrx_buf[0]); in ds1390_read_time()
87 dt->tm_min = bcd2bin(chip->txrx_buf[1]); in ds1390_read_time()
88 dt->tm_hour = bcd2bin(chip->txrx_buf[2]); in ds1390_read_time()
89 dt->tm_wday = bcd2bin(chip->txrx_buf[3]); in ds1390_read_time()
90 dt->tm_mday = bcd2bin(chip->txrx_buf[4]); in ds1390_read_time()
92 dt->tm_mon = bcd2bin(chip->txrx_buf[5] & 0x7f) - 1; in ds1390_read_time()
94 dt->tm_year = bcd2bin(chip->txrx_buf[6]) + ((chip->txrx_buf[5] & 0x80) ? 100 : 0); in ds1390_read_time()
102 struct ds1390 *chip = dev_get_drvdata(dev); in ds1390_set_time() local
105 chip->txrx_buf[0] = DS1390_REG_SECONDS | 0x80; in ds1390_set_time()
106 chip->txrx_buf[1] = bin2bcd(dt->tm_sec); in ds1390_set_time()
107 chip->txrx_buf[2] = bin2bcd(dt->tm_min); in ds1390_set_time()
108 chip->txrx_buf[3] = bin2bcd(dt->tm_hour); in ds1390_set_time()
109 chip->txrx_buf[4] = bin2bcd(dt->tm_wday); in ds1390_set_time()
110 chip->txrx_buf[5] = bin2bcd(dt->tm_mday); in ds1390_set_time()
111 chip->txrx_buf[6] = bin2bcd(dt->tm_mon + 1) | in ds1390_set_time()
113 chip->txrx_buf[7] = bin2bcd(dt->tm_year % 100); in ds1390_set_time()
116 return spi_write_then_read(spi, chip->txrx_buf, 8, NULL, 0); in ds1390_set_time()
127 struct ds1390 *chip; in ds1390_probe() local
134 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); in ds1390_probe()
135 if (!chip) in ds1390_probe()
138 spi_set_drvdata(spi, chip); in ds1390_probe()
146 chip->rtc = devm_rtc_device_register(&spi->dev, "ds1390", in ds1390_probe()
148 if (IS_ERR(chip->rtc)) { in ds1390_probe()
150 res = PTR_ERR(chip->rtc); in ds1390_probe()