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/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf 8 */ 9 10 #include <linux/mod_devicetable.h> 11 #include <linux/module.h> 12 #include <linux/spi/spi.h> 13 #include <linux/stddef.h> 14 15 #include <linux/iio/iio.h> 16 17 #include "hsc030pa.h" 18 19 static int hsc_spi_recv(struct hsc_data *data) 20 { 21 struct spi_device *spi = to_spi_device(data->dev); 22 struct spi_transfer xfer = { 23 .tx_buf = NULL, 24 .rx_buf = data->buffer, 25 .len = HSC_REG_MEASUREMENT_RD_SIZE, 26 }; 27 28 return spi_sync_transfer(spi, &xfer, 1); 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