brintos

brintos / linux-shallow public Read only

0
0
Text · 1.8 KiB · 337eecc Raw
62 lines · c
1// SPDX-License-Identifier: GPL-2.0-only2/*3 * Honeywell TruStability HSC Series pressure/temperature sensor4 *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.pdf8 * 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.pdf9 */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 23static 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 31static int hsc_spi_probe(struct spi_device *spi)32{33	return hsc_common_probe(&spi->dev, hsc_spi_recv);34}35 36static const struct of_device_id hsc_spi_match[] = {37	{ .compatible = "honeywell,hsc030pa" },38	{}39};40MODULE_DEVICE_TABLE(of, hsc_spi_match);41 42static const struct spi_device_id hsc_spi_id[] = {43	{ "hsc030pa" },44	{}45};46MODULE_DEVICE_TABLE(spi, hsc_spi_id);47 48static 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};56module_spi_driver(hsc_spi_driver);57 58MODULE_AUTHOR("Petre Rodan <petre.rodan@subdimension.ro>");59MODULE_DESCRIPTION("Honeywell HSC and SSC pressure sensor spi driver");60MODULE_LICENSE("GPL");61MODULE_IMPORT_NS(IIO_HONEYWELL_HSC030PA);62