xref: /linux/drivers/iio/chemical/sps30.h (revision 0be3ff0c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _SPS30_H
3 #define _SPS30_H
4 
5 #include <linux/types.h>
6 
7 struct sps30_state;
8 struct sps30_ops {
9 	int (*start_meas)(struct sps30_state *state);
10 	int (*stop_meas)(struct sps30_state *state);
11 	int (*read_meas)(struct sps30_state *state, __be32 *meas, size_t num);
12 	int (*reset)(struct sps30_state *state);
13 	int (*clean_fan)(struct sps30_state *state);
14 	int (*read_cleaning_period)(struct sps30_state *state, __be32 *period);
15 	int (*write_cleaning_period)(struct sps30_state *state, __be32 period);
16 	int (*show_info)(struct sps30_state *state);
17 };
18 
19 struct sps30_state {
20 	/* serialize access to the device */
21 	struct mutex lock;
22 	struct device *dev;
23 	int state;
24 	/*
25 	 * priv pointer is solely for serdev driver private data. We keep it
26 	 * here because driver_data inside dev has been already used for iio and
27 	 * struct serdev_device doesn't have one.
28 	 */
29 	void *priv;
30 	const struct sps30_ops *ops;
31 };
32 
33 int sps30_probe(struct device *dev, const char *name, void *priv, const struct sps30_ops *ops);
34 
35 #endif
36