1 /* SPDX-License-Identifier: GPL-2.0 */
3 * MPRLS0025PA - Honeywell MicroPressure pressure sensor series driver
8 * https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/micropressure-mpr-series/documents/sps-siot-mpr-series-datasheet-32332628-ciid-172626.pdf
11 #ifndef _MPRLS0025PA_H
12 #define _MPRLS0025PA_H
14 #include <linux/completion.h>
15 #include <linux/delay.h>
16 #include <linux/device.h>
17 #include <linux/mutex.h>
18 #include <linux/stddef.h>
19 #include <linux/types.h>
21 #include <linux/iio/iio.h>
23 #define MPR_MEASUREMENT_RD_SIZE 4
24 #define MPR_CMD_NOP 0xf0
25 #define MPR_CMD_SYNC 0xaa
26 #define MPR_PKT_NOP_LEN MPR_MEASUREMENT_RD_SIZE
27 #define MPR_PKT_SYNC_LEN 3
39 * @pres: pressure value
55 * @dev: current device structure
56 * @ops: functions that implement the sensor reads/writes, bus init
57 * @lock: access to device during read
58 * @pmin: minimal pressure in pascal
59 * @pmax: maximal pressure in pascal
60 * @function: transfer function
61 * @outmin: minimum raw pressure in counts (based on transfer function)
62 * @outmax: maximum raw pressure in counts (based on transfer function)
63 * @scale: pressure scale
64 * @scale2: pressure scale, decimal number
65 * @offset: pressure offset
66 * @offset2: pressure offset, decimal number
68 * @irq: end of conversion irq. used to distinguish between irq mode and
69 * reading in a loop until data is ready
70 * @completion: handshake from irq to read
71 * @chan: channel values for buffered mode
72 * @buffer: raw conversion data
76 const struct mpr_ops *ops;
80 enum mpr_func_id function;
87 struct gpio_desc *gpiod_reset;
89 struct completion completion;
91 u8 buffer[MPR_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);
95 int (*init)(struct device *dev);
96 int (*read)(struct mpr_data *data, const u8 cmd, const u8 cnt);
97 int (*write)(struct mpr_data *data, const u8 cmd, const u8 cnt);
100 int mpr_common_probe(struct device *dev, const struct mpr_ops *ops, int irq);