Lines Matching refs:spi
56 struct spi_device *spi = to_spi_device(dev); in ds1390_set_reg() local
63 spi_write(spi, buf, 2); in ds1390_set_reg()
69 struct spi_device *spi = to_spi_device(dev); in ds1390_get_reg() local
79 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 1); in ds1390_get_reg()
88 static void ds1390_trickle_of_init(struct spi_device *spi) in ds1390_trickle_of_init() argument
93 if (of_property_read_u32(spi->dev.of_node, "trickle-resistor-ohms", in ds1390_trickle_of_init()
99 if (of_property_read_bool(spi->dev.of_node, "trickle-diode-disable")) in ds1390_trickle_of_init()
116 dev_warn(&spi->dev, in ds1390_trickle_of_init()
121 ds1390_set_reg(&spi->dev, DS1390_REG_TRICKLE, value); in ds1390_trickle_of_init()
129 struct spi_device *spi = to_spi_device(dev); in ds1390_read_time() local
137 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 7); in ds1390_read_time()
158 struct spi_device *spi = to_spi_device(dev); in ds1390_set_time() local
173 return spi_write_then_read(spi, chip->txrx_buf, 8, NULL, 0); in ds1390_set_time()
181 static int ds1390_probe(struct spi_device *spi) in ds1390_probe() argument
187 spi->mode = SPI_MODE_3; in ds1390_probe()
188 spi->bits_per_word = 8; in ds1390_probe()
189 spi_setup(spi); in ds1390_probe()
191 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); in ds1390_probe()
195 spi_set_drvdata(spi, chip); in ds1390_probe()
197 res = ds1390_get_reg(&spi->dev, DS1390_REG_SECONDS, &tmp); in ds1390_probe()
199 dev_err(&spi->dev, "unable to read device\n"); in ds1390_probe()
203 if (spi->dev.of_node) in ds1390_probe()
204 ds1390_trickle_of_init(spi); in ds1390_probe()
206 chip->rtc = devm_rtc_device_register(&spi->dev, "ds1390", in ds1390_probe()
209 dev_err(&spi->dev, "unable to register device\n"); in ds1390_probe()
226 MODULE_DEVICE_TABLE(spi, ds1390_spi_ids);