#include <linux/crc8.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define SGP_WORD_LEN …
#define SGP_CRC8_POLYNOMIAL …
#define SGP_CRC8_INIT …
#define SGP_CRC8_LEN …
#define SGP_CMD(cmd_word) …
#define SGP_CMD_DURATION_US …
#define SGP_MEASUREMENT_DURATION_US …
#define SGP_CMD_LEN …
#define SGP_CMD_MAX_BUF_SIZE …
#define SGP_MEASUREMENT_LEN …
#define SGP30_MEASURE_INTERVAL_HZ …
#define SGPC3_MEASURE_INTERVAL_HZ …
#define SGP_VERS_PRODUCT(data) …
#define SGP_VERS_RESERVED(data) …
#define SGP_VERS_GEN(data) …
#define SGP_VERS_ENG_BIT(data) …
#define SGP_VERS_MAJOR(data) …
#define SGP_VERS_MINOR(data) …
DECLARE_CRC8_TABLE(sgp_crc8_table);
enum sgp_product_id { … };
enum sgp30_channel_idx { … };
enum sgpc3_channel_idx { … };
enum sgp_cmd { … };
struct sgp_version { … };
struct sgp_crc_word { … } __attribute__((packed));
sgp_reading;
enum _iaq_buffer_state { … };
struct sgp_data { … };
struct sgp_device { … };
static const struct sgp_version supported_versions_sgp30[] = …;
static const struct sgp_version supported_versions_sgpc3[] = …;
static const struct iio_chan_spec sgp30_channels[] = …;
static const struct iio_chan_spec sgpc3_channels[] = …;
static const struct sgp_device sgp_devices[] = …;
static int sgp_verify_buffer(const struct sgp_data *data,
union sgp_reading *buf, size_t word_count)
{ … }
static int sgp_read_cmd(struct sgp_data *data, enum sgp_cmd cmd,
union sgp_reading *buf, size_t word_count,
unsigned long duration_us)
{ … }
static int sgp_measure_iaq(struct sgp_data *data)
{ … }
static void sgp_iaq_thread_sleep_until(const struct sgp_data *data,
unsigned long sleep_jiffies)
{ … }
static int sgp_iaq_threadfn(void *p)
{ … }
static int sgp_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{ … }
static int sgp_check_compat(struct sgp_data *data,
unsigned int product_id)
{ … }
static void sgp_init(struct sgp_data *data)
{ … }
static const struct iio_info sgp_info = …;
static const struct of_device_id sgp_dt_ids[] = …;
static int sgp_probe(struct i2c_client *client)
{ … }
static void sgp_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id sgp_id[] = …;
MODULE_DEVICE_TABLE(i2c, sgp_id);
MODULE_DEVICE_TABLE(of, sgp_dt_ids);
static struct i2c_driver sgp_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;