Lines Matching refs:spi
89 struct spi_device *spi; member
161 err = spi_write_then_read(ds1305->spi, buf, sizeof(buf), NULL, 0); in ds1305_alarm_irq_enable()
184 status = spi_write_then_read(ds1305->spi, &addr, sizeof(addr), in ds1305_get_time()
240 return spi_write_then_read(ds1305->spi, buf, sizeof(buf), in ds1305_set_time()
278 struct spi_device *spi = ds1305->spi; in ds1305_get_alarm() local
289 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_get_alarm()
299 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_get_alarm()
337 struct spi_device *spi = ds1305->spi; in ds1305_set_alarm() local
368 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0); in ds1305_set_alarm()
384 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_set_alarm()
394 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0); in ds1305_set_alarm()
459 struct spi_device *spi = ds1305->spi; in ds1305_work() local
477 status = spi_write_then_read(spi, buf, sizeof(buf), in ds1305_work()
480 dev_dbg(&spi->dev, "clear irq --> %d\n", status); in ds1305_work()
485 enable_irq(spi->irq); in ds1305_work()
533 struct spi_device *spi; in ds1305_nvram_read() local
539 spi = container_of(kobj, struct spi_device, dev.kobj); in ds1305_nvram_read()
553 status = spi_sync(spi, &m); in ds1305_nvram_read()
555 dev_err(&spi->dev, "nvram %s error %d\n", "read", status); in ds1305_nvram_read()
564 struct spi_device *spi; in ds1305_nvram_write() local
570 spi = container_of(kobj, struct spi_device, dev.kobj); in ds1305_nvram_write()
584 status = spi_sync(spi, &m); in ds1305_nvram_write()
586 dev_err(&spi->dev, "nvram %s error %d\n", "write", status); in ds1305_nvram_write()
604 static int ds1305_probe(struct spi_device *spi) in ds1305_probe() argument
609 struct ds1305_platform_data *pdata = dev_get_platdata(&spi->dev); in ds1305_probe()
616 if ((spi->bits_per_word && spi->bits_per_word != 8) in ds1305_probe()
617 || (spi->max_speed_hz > 2000000) in ds1305_probe()
618 || !(spi->mode & SPI_CPHA)) in ds1305_probe()
622 ds1305 = devm_kzalloc(&spi->dev, sizeof(*ds1305), GFP_KERNEL); in ds1305_probe()
625 ds1305->spi = spi; in ds1305_probe()
626 spi_set_drvdata(spi, ds1305); in ds1305_probe()
630 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_probe()
633 dev_dbg(&spi->dev, "can't %s, %d\n", in ds1305_probe()
638 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "read", ds1305->ctrl); in ds1305_probe()
646 dev_dbg(&spi->dev, "RTC chip is not present\n"); in ds1305_probe()
650 dev_dbg(&spi->dev, "chip may not be present\n"); in ds1305_probe()
662 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_probe()
664 dev_dbg(&spi->dev, "clear WP --> %d\n", status); in ds1305_probe()
675 dev_warn(&spi->dev, "SET TIME!\n"); in ds1305_probe()
716 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_probe()
718 dev_dbg(&spi->dev, "can't %s, %d\n", in ds1305_probe()
723 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "write", ds1305->ctrl); in ds1305_probe()
728 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_probe()
731 dev_dbg(&spi->dev, "read HOUR --> %d\n", status); in ds1305_probe()
737 dev_dbg(&spi->dev, "AM/PM\n"); in ds1305_probe()
740 ds1305->rtc = devm_rtc_device_register(&spi->dev, "ds1305", in ds1305_probe()
744 dev_dbg(&spi->dev, "register rtc --> %d\n", status); in ds1305_probe()
754 if (spi->irq) { in ds1305_probe()
756 status = devm_request_irq(&spi->dev, spi->irq, ds1305_irq, in ds1305_probe()
759 dev_err(&spi->dev, "request_irq %d --> %d\n", in ds1305_probe()
760 spi->irq, status); in ds1305_probe()
762 device_set_wakeup_capable(&spi->dev, 1); in ds1305_probe()
767 status = sysfs_create_bin_file(&spi->dev.kobj, &nvram); in ds1305_probe()
769 dev_err(&spi->dev, "register nvram --> %d\n", status); in ds1305_probe()
775 static int ds1305_remove(struct spi_device *spi) in ds1305_remove() argument
777 struct ds1305 *ds1305 = spi_get_drvdata(spi); in ds1305_remove()
779 sysfs_remove_bin_file(&spi->dev.kobj, &nvram); in ds1305_remove()
782 if (spi->irq) { in ds1305_remove()
784 devm_free_irq(&spi->dev, spi->irq, ds1305); in ds1305_remove()