1 // SPDX-License-Identifier: GPL-2.0-only
3 * Honeywell TruStability HSC Series pressure/temperature sensor
5 * Copyright (c) 2023 Petre Rodan <petre.rodan@subdimension.ro>
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 [hsc]
8 * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf [i2c related]
11 #include <linux/errno.h>
12 #include <linux/i2c.h>
13 #include <linux/mod_devicetable.h>
14 #include <linux/module.h>
16 #include <linux/iio/iio.h>
20 static int hsc_i2c_recv(struct hsc_data *data)
22 struct i2c_client *client = to_i2c_client(data->dev);
26 msg.addr = client->addr;
27 msg.flags = client->flags | I2C_M_RD;
28 msg.len = HSC_REG_MEASUREMENT_RD_SIZE;
29 msg.buf = data->buffer;
31 ret = i2c_transfer(client->adapter, &msg, 1);
33 return (ret == 2) ? 0 : ret;
36 static int hsc_i2c_probe(struct i2c_client *client)
38 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
41 return hsc_common_probe(&client->dev, hsc_i2c_recv);
44 static const struct of_device_id hsc_i2c_match[] = {
45 { .compatible = "honeywell,hsc030pa" },
48 MODULE_DEVICE_TABLE(of, hsc_i2c_match);
50 static const struct i2c_device_id hsc_i2c_id[] = {
54 MODULE_DEVICE_TABLE(i2c, hsc_i2c_id);
56 static struct i2c_driver hsc_i2c_driver = {
59 .of_match_table = hsc_i2c_match,
61 .probe = hsc_i2c_probe,
62 .id_table = hsc_i2c_id,
64 module_i2c_driver(hsc_i2c_driver);
66 MODULE_AUTHOR("Petre Rodan <petre.rodan@subdimension.ro>");
67 MODULE_DESCRIPTION("Honeywell HSC and SSC pressure sensor i2c driver");
68 MODULE_LICENSE("GPL");
69 MODULE_IMPORT_NS(IIO_HONEYWELL_HSC030PA);