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