0001
0002 #ifndef _SCD30_H
0003 #define _SCD30_H
0004
0005 #include <linux/completion.h>
0006 #include <linux/device.h>
0007 #include <linux/mutex.h>
0008 #include <linux/pm.h>
0009 #include <linux/regulator/consumer.h>
0010 #include <linux/types.h>
0011
0012 struct scd30_state;
0013
0014 enum scd30_cmd {
0015
0016 CMD_START_MEAS,
0017
0018 CMD_STOP_MEAS,
0019
0020 CMD_MEAS_INTERVAL,
0021
0022 CMD_MEAS_READY,
0023
0024 CMD_READ_MEAS,
0025
0026 CMD_ASC,
0027
0028 CMD_FRC,
0029
0030 CMD_TEMP_OFFSET,
0031
0032 CMD_FW_VERSION,
0033
0034 CMD_RESET,
0035
0036
0037
0038
0039
0040 };
0041
0042 #define SCD30_MEAS_COUNT 3
0043
0044 typedef int (*scd30_command_t)(struct scd30_state *state, enum scd30_cmd cmd, u16 arg,
0045 void *response, int size);
0046
0047 struct scd30_state {
0048
0049 struct mutex lock;
0050 struct device *dev;
0051 struct regulator *vdd;
0052 struct completion meas_ready;
0053
0054
0055
0056
0057
0058 void *priv;
0059 int irq;
0060
0061
0062
0063
0064 u16 pressure_comp;
0065 u16 meas_interval;
0066 int meas[SCD30_MEAS_COUNT];
0067
0068 scd30_command_t command;
0069 };
0070
0071 extern const struct dev_pm_ops scd30_pm_ops;
0072
0073 int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
0074
0075 #endif