162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _SPS30_H
362306a36Sopenharmony_ci#define _SPS30_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/types.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_cistruct sps30_state;
862306a36Sopenharmony_cistruct sps30_ops {
962306a36Sopenharmony_ci	int (*start_meas)(struct sps30_state *state);
1062306a36Sopenharmony_ci	int (*stop_meas)(struct sps30_state *state);
1162306a36Sopenharmony_ci	int (*read_meas)(struct sps30_state *state, __be32 *meas, size_t num);
1262306a36Sopenharmony_ci	int (*reset)(struct sps30_state *state);
1362306a36Sopenharmony_ci	int (*clean_fan)(struct sps30_state *state);
1462306a36Sopenharmony_ci	int (*read_cleaning_period)(struct sps30_state *state, __be32 *period);
1562306a36Sopenharmony_ci	int (*write_cleaning_period)(struct sps30_state *state, __be32 period);
1662306a36Sopenharmony_ci	int (*show_info)(struct sps30_state *state);
1762306a36Sopenharmony_ci};
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cistruct sps30_state {
2062306a36Sopenharmony_ci	/* serialize access to the device */
2162306a36Sopenharmony_ci	struct mutex lock;
2262306a36Sopenharmony_ci	struct device *dev;
2362306a36Sopenharmony_ci	int state;
2462306a36Sopenharmony_ci	/*
2562306a36Sopenharmony_ci	 * priv pointer is solely for serdev driver private data. We keep it
2662306a36Sopenharmony_ci	 * here because driver_data inside dev has been already used for iio and
2762306a36Sopenharmony_ci	 * struct serdev_device doesn't have one.
2862306a36Sopenharmony_ci	 */
2962306a36Sopenharmony_ci	void *priv;
3062306a36Sopenharmony_ci	const struct sps30_ops *ops;
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciint sps30_probe(struct device *dev, const char *name, void *priv, const struct sps30_ops *ops);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#endif
36