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()
544 status = spi_sync(spi, &m); in ds1305_nvram_read()
546 dev_err(&spi->dev, "nvram %s error %d\n", "read", status); in ds1305_nvram_read()
555 struct spi_device *spi; in ds1305_nvram_write() local
561 spi = container_of(kobj, struct spi_device, dev.kobj); in ds1305_nvram_write()
566 status = spi_sync(spi, &m); in ds1305_nvram_write()
568 dev_err(&spi->dev, "nvram %s error %d\n", "write", status); in ds1305_nvram_write()
586 static int ds1305_probe(struct spi_device *spi) in ds1305_probe() argument
591 struct ds1305_platform_data *pdata = dev_get_platdata(&spi->dev); in ds1305_probe()
598 if ((spi->bits_per_word && spi->bits_per_word != 8) in ds1305_probe()
599 || (spi->max_speed_hz > 2000000) in ds1305_probe()
600 || !(spi->mode & SPI_CPHA)) in ds1305_probe()
604 ds1305 = devm_kzalloc(&spi->dev, sizeof(*ds1305), GFP_KERNEL); in ds1305_probe()
607 ds1305->spi = spi; in ds1305_probe()
608 spi_set_drvdata(spi, ds1305); in ds1305_probe()
612 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_probe()
615 dev_dbg(&spi->dev, "can't %s, %d\n", in ds1305_probe()
620 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "read", ds1305->ctrl); in ds1305_probe()
628 dev_dbg(&spi->dev, "RTC chip is not present\n"); in ds1305_probe()
632 dev_dbg(&spi->dev, "chip may not be present\n"); in ds1305_probe()
644 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_probe()
646 dev_dbg(&spi->dev, "clear WP --> %d\n", status); in ds1305_probe()
657 dev_warn(&spi->dev, "SET TIME!\n"); in ds1305_probe()
698 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_probe()
700 dev_dbg(&spi->dev, "can't %s, %d\n", in ds1305_probe()
705 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "write", ds1305->ctrl); in ds1305_probe()
710 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_probe()
713 dev_dbg(&spi->dev, "read HOUR --> %d\n", status); in ds1305_probe()
719 dev_dbg(&spi->dev, "AM/PM\n"); in ds1305_probe()
722 ds1305->rtc = devm_rtc_device_register(&spi->dev, "ds1305", in ds1305_probe()
726 dev_dbg(&spi->dev, "register rtc --> %d\n", status); in ds1305_probe()
736 if (spi->irq) { in ds1305_probe()
738 status = devm_request_irq(&spi->dev, spi->irq, ds1305_irq, in ds1305_probe()
741 dev_err(&spi->dev, "request_irq %d --> %d\n", in ds1305_probe()
742 spi->irq, status); in ds1305_probe()
744 device_set_wakeup_capable(&spi->dev, 1); in ds1305_probe()
749 status = sysfs_create_bin_file(&spi->dev.kobj, &nvram); in ds1305_probe()
751 dev_err(&spi->dev, "register nvram --> %d\n", status); in ds1305_probe()
757 static int ds1305_remove(struct spi_device *spi) in ds1305_remove() argument
759 struct ds1305 *ds1305 = spi_get_drvdata(spi); in ds1305_remove()
761 sysfs_remove_bin_file(&spi->dev.kobj, &nvram); in ds1305_remove()
764 if (spi->irq) { in ds1305_remove()
766 devm_free_irq(&spi->dev, spi->irq, ds1305); in ds1305_remove()