Lines Matching refs:spi
59 struct spi_device *spi = to_spi_device(dev); in ds1390_set_reg() local
66 spi_write(spi, buf, 2); in ds1390_set_reg()
72 struct spi_device *spi = to_spi_device(dev); in ds1390_get_reg() local
82 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 1); in ds1390_get_reg()
91 static void ds1390_trickle_of_init(struct spi_device *spi) in ds1390_trickle_of_init() argument
96 if (of_property_read_u32(spi->dev.of_node, "trickle-resistor-ohms", in ds1390_trickle_of_init()
102 if (of_property_read_bool(spi->dev.of_node, "trickle-diode-disable")) in ds1390_trickle_of_init()
119 dev_warn(&spi->dev, in ds1390_trickle_of_init()
124 ds1390_set_reg(&spi->dev, DS1390_REG_TRICKLE, value); in ds1390_trickle_of_init()
132 struct spi_device *spi = to_spi_device(dev); in ds1390_read_time() local
140 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 8); in ds1390_read_time()
161 struct spi_device *spi = to_spi_device(dev); in ds1390_set_time() local
176 return spi_write_then_read(spi, chip->txrx_buf, 8, NULL, 0); in ds1390_set_time()
184 static int ds1390_probe(struct spi_device *spi) in ds1390_probe() argument
190 spi->mode = SPI_MODE_3; in ds1390_probe()
191 spi->bits_per_word = 8; in ds1390_probe()
192 spi_setup(spi); in ds1390_probe()
194 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); in ds1390_probe()
198 spi_set_drvdata(spi, chip); in ds1390_probe()
200 res = ds1390_get_reg(&spi->dev, DS1390_REG_SECONDS, &tmp); in ds1390_probe()
202 dev_err(&spi->dev, "unable to read device\n"); in ds1390_probe()
206 if (spi->dev.of_node) in ds1390_probe()
207 ds1390_trickle_of_init(spi); in ds1390_probe()
209 chip->rtc = devm_rtc_device_register(&spi->dev, "ds1390", in ds1390_probe()
212 dev_err(&spi->dev, "unable to register device\n"); in ds1390_probe()