1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/completion.h>
6 #include <linux/device.h>
7 #include <linux/mutex.h>
9 #include <linux/regulator/consumer.h>
10 #include <linux/types.h>
15 /* start continuous measurement with pressure compensation */
17 /* stop continuous measurement */
19 /* set/get measurement interval */
21 /* check whether new measurement is ready */
25 /* turn on/off automatic self calibration */
27 /* set/get forced recalibration value */
29 /* set/get temperature offset */
31 /* get firmware version */
36 * Command for altitude compensation was omitted intentionally because
37 * the same can be achieved by means of CMD_START_MEAS which takes
38 * pressure above the sea level as an argument.
42 #define SCD30_MEAS_COUNT 3
44 typedef int (*scd30_command_t
)(struct scd30_state
*state
, enum scd30_cmd cmd
, u16 arg
,
45 void *response
, int size
);
48 /* serialize access to the device */
51 struct regulator
*vdd
;
52 struct completion meas_ready
;
54 * priv pointer is solely for serdev driver private data. We keep it
55 * here because driver_data inside dev has been already used for iio and
56 * struct serdev_device doesn't have one.
61 * no way to retrieve current ambient pressure compensation value from
62 * the sensor so keep one around
66 int meas
[SCD30_MEAS_COUNT
];
68 scd30_command_t command
;
71 int scd30_suspend(struct device
*dev
);
72 int scd30_resume(struct device
*dev
);
74 static __maybe_unused
SIMPLE_DEV_PM_OPS(scd30_pm_ops
, scd30_suspend
, scd30_resume
);
76 int scd30_probe(struct device
*dev
, int irq
, const char *name
, void *priv
, scd30_command_t command
);