sps30.h 1.0 KB

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