18f3f1308STomasz Duszynski /* SPDX-License-Identifier: GPL-2.0 */ 28f3f1308STomasz Duszynski #ifndef _SPS30_H 38f3f1308STomasz Duszynski #define _SPS30_H 48f3f1308STomasz Duszynski 58f3f1308STomasz Duszynski #include <linux/types.h> 68f3f1308STomasz Duszynski 78f3f1308STomasz Duszynski struct sps30_state; 88f3f1308STomasz Duszynski struct sps30_ops { 98f3f1308STomasz Duszynski int (*start_meas)(struct sps30_state *state); 108f3f1308STomasz Duszynski int (*stop_meas)(struct sps30_state *state); 118f3f1308STomasz Duszynski int (*read_meas)(struct sps30_state *state, __be32 *meas, size_t num); 128f3f1308STomasz Duszynski int (*reset)(struct sps30_state *state); 138f3f1308STomasz Duszynski int (*clean_fan)(struct sps30_state *state); 148f3f1308STomasz Duszynski int (*read_cleaning_period)(struct sps30_state *state, __be32 *period); 158f3f1308STomasz Duszynski int (*write_cleaning_period)(struct sps30_state *state, __be32 period); 168f3f1308STomasz Duszynski int (*show_info)(struct sps30_state *state); 178f3f1308STomasz Duszynski }; 188f3f1308STomasz Duszynski 198f3f1308STomasz Duszynski struct sps30_state { 208f3f1308STomasz Duszynski /* serialize access to the device */ 218f3f1308STomasz Duszynski struct mutex lock; 228f3f1308STomasz Duszynski struct device *dev; 238f3f1308STomasz Duszynski int state; 248f3f1308STomasz Duszynski /* 258f3f1308STomasz Duszynski * priv pointer is solely for serdev driver private data. We keep it 268f3f1308STomasz Duszynski * here because driver_data inside dev has been already used for iio and 278f3f1308STomasz Duszynski * struct serdev_device doesn't have one. 288f3f1308STomasz Duszynski */ 298f3f1308STomasz Duszynski void *priv; 308f3f1308STomasz Duszynski const struct sps30_ops *ops; 318f3f1308STomasz Duszynski }; 328f3f1308STomasz Duszynski 338f3f1308STomasz Duszynski int sps30_probe(struct device *dev, const char *name, void *priv, const struct sps30_ops *ops); 348f3f1308STomasz Duszynski 358f3f1308STomasz Duszynski #endif 36