1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Honeywell TruStability HSC Series pressure/temperature sensor 4 * 5 * Copyright (c) 2023 Petre Rodan <petre.rodan@subdimension.ro> 6 * 7 * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-spi-comms-digital-ouptu-pressure-sensors-tn-008202-3-en-ciid-45843.pdf 8 * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf 9 */ 10 11 #include <linux/delay.h> 12 #include <linux/device.h> 13 #include <linux/mod_devicetable.h> 14 #include <linux/module.h> 15 #include <linux/spi/spi.h> 16 #include <linux/stddef.h> 17 #include <linux/types.h> 18 19 #include <linux/iio/iio.h> 20 21 #include "hsc030pa.h" 22 23 static int hsc_spi_recv(struct hsc_data *data) 24 { 25 struct spi_device *spi = to_spi_device(data->dev); 26 27 msleep_interruptible(HSC_RESP_TIME_MS); 28 return spi_read(spi, data->buffer, HSC_REG_MEASUREMENT_RD_SIZE); 29 } 30 31 static int hsc_spi_probe(struct spi_device *spi) 32 { 33 return hsc_common_probe(&spi->dev, hsc_spi_recv); 34 } 35 36 static const struct of_device_id hsc_spi_match[] = { 37 { .compatible = "honeywell,hsc030pa" }, 38 {} 39 }; 40 MODULE_DEVICE_TABLE(of, hsc_spi_match); 41 42 static const struct spi_device_id hsc_spi_id[] = { 43 { "hsc030pa" }, 44 {} 45 }; 46 MODULE_DEVICE_TABLE(spi, hsc_spi_id); 47 48 static struct spi_driver hsc_spi_driver = { 49 .driver = { 50 .name = "hsc030pa", 51 .of_match_table = hsc_spi_match, 52 }, 53 .probe = hsc_spi_probe, 54 .id_table = hsc_spi_id, 55 }; 56 module_spi_driver(hsc_spi_driver); 57 58 MODULE_AUTHOR("Petre Rodan <petre.rodan@subdimension.ro>"); 59 MODULE_DESCRIPTION("Honeywell HSC and SSC pressure sensor spi driver"); 60 MODULE_LICENSE("GPL"); 61 MODULE_IMPORT_NS(IIO_HONEYWELL_HSC030PA); 62