Lines Matching defs:spi

14 #include <linux/spi/spi.h>
15 #include <linux/spi/ds1305.h>
76 /* trickle bits are defined in <linux/spi/ds1305.h> */
85 struct spi_device *spi;
157 err = spi_write_then_read(ds1305->spi, buf, sizeof(buf), NULL, 0);
180 status = spi_write_then_read(ds1305->spi, &addr, sizeof(addr),
231 return spi_write_then_read(ds1305->spi, buf, sizeof(buf),
269 struct spi_device *spi = ds1305->spi;
280 status = spi_write_then_read(spi, &addr, sizeof(addr),
290 status = spi_write_then_read(spi, &addr, sizeof(addr),
321 struct spi_device *spi = ds1305->spi;
348 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0);
364 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0);
374 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0);
438 struct spi_device *spi = ds1305->spi;
456 status = spi_write_then_read(spi, buf, sizeof(buf),
459 dev_dbg(&spi->dev, "clear irq --> %d\n", status);
464 enable_irq(spi->irq);
511 struct spi_device *spi = ds1305->spi;
519 return spi_sync(spi, &m);
526 struct spi_device *spi = ds1305->spi;
534 return spi_sync(spi, &m);
543 static int ds1305_probe(struct spi_device *spi)
548 struct ds1305_platform_data *pdata = dev_get_platdata(&spi->dev);
563 if ((spi->bits_per_word && spi->bits_per_word != 8)
564 || (spi->max_speed_hz > 2000000)
565 || !(spi->mode & SPI_CPHA))
569 ds1305 = devm_kzalloc(&spi->dev, sizeof(*ds1305), GFP_KERNEL);
572 ds1305->spi = spi;
573 spi_set_drvdata(spi, ds1305);
577 status = spi_write_then_read(spi, &addr, sizeof(addr),
580 dev_dbg(&spi->dev, "can't %s, %d\n",
585 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "read", ds1305->ctrl);
593 dev_dbg(&spi->dev, "RTC chip is not present\n");
597 dev_dbg(&spi->dev, "chip may not be present\n");
609 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0);
611 dev_dbg(&spi->dev, "clear WP --> %d\n", status);
622 dev_warn(&spi->dev, "SET TIME!\n");
663 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0);
665 dev_dbg(&spi->dev, "can't %s, %d\n",
670 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "write", ds1305->ctrl);
675 status = spi_write_then_read(spi, &addr, sizeof(addr),
678 dev_dbg(&spi->dev, "read HOUR --> %d\n", status);
684 dev_dbg(&spi->dev, "AM/PM\n");
687 ds1305->rtc = devm_rtc_allocate_device(&spi->dev);
709 if (spi->irq) {
711 status = devm_request_irq(&spi->dev, spi->irq, ds1305_irq,
714 dev_err(&spi->dev, "request_irq %d --> %d\n",
715 spi->irq, status);
717 device_set_wakeup_capable(&spi->dev, 1);
724 static void ds1305_remove(struct spi_device *spi)
726 struct ds1305 *ds1305 = spi_get_drvdata(spi);
729 if (spi->irq) {
731 devm_free_irq(&spi->dev, spi->irq, ds1305);
747 MODULE_ALIAS("spi:rtc-ds1305");