#include <linux/bitops.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/time64.h>
#include <linux/iio/iio.h>
#define DRIVER_NAME …
#define SUNRISE_ERROR_STATUS_REG …
#define SUNRISE_CO2_FILTERED_COMP_REG …
#define SUNRISE_CHIP_TEMPERATURE_REG …
#define SUNRISE_CALIBRATION_STATUS_REG …
#define SUNRISE_CALIBRATION_COMMAND_REG …
#define SUNRISE_CALIBRATION_FACTORY_CMD …
#define SUNRISE_CALIBRATION_BACKGROUND_CMD …
#define SUNRISE_CALIBRATION_TIMEOUT_US …
struct sunrise_dev { … };
static int sunrise_regmap_read(void *context, const void *reg_buf,
size_t reg_size, void *val_buf, size_t val_size)
{ … }
static int sunrise_regmap_write(void *context, const void *val_buf, size_t count)
{ … }
static int sunrise_read_byte(struct sunrise_dev *sunrise, u8 reg)
{ … }
static int sunrise_read_word(struct sunrise_dev *sunrise, u8 reg, u16 *val)
{ … }
static int sunrise_write_byte(struct sunrise_dev *sunrise, u8 reg, u8 val)
{ … }
static int sunrise_write_word(struct sunrise_dev *sunrise, u8 reg, u16 data)
{ … }
enum { … };
static const struct sunrise_calib_data { … } calib_data[] = …;
static int sunrise_calibrate(struct sunrise_dev *sunrise,
const struct sunrise_calib_data *data)
{ … }
static ssize_t sunrise_cal_factory_write(struct iio_dev *iiodev,
uintptr_t private,
const struct iio_chan_spec *chan,
const char *buf, size_t len)
{ … }
static ssize_t sunrise_cal_background_write(struct iio_dev *iiodev,
uintptr_t private,
const struct iio_chan_spec *chan,
const char *buf, size_t len)
{ … }
enum { … };
static const char * const sunrise_error_statuses[] = …;
static const struct iio_enum sunrise_error_statuses_enum = …;
static ssize_t sunrise_error_status_read(struct iio_dev *iiodev,
uintptr_t private,
const struct iio_chan_spec *chan,
char *buf)
{ … }
static const struct iio_chan_spec_ext_info sunrise_concentration_ext_info[] = …;
static const struct iio_chan_spec sunrise_channels[] = …;
static int sunrise_read_raw(struct iio_dev *iio_dev,
const struct iio_chan_spec *chan,
int *val, int *val2, long mask)
{ … }
static const struct iio_info sunrise_info = …;
static const struct regmap_bus sunrise_regmap_bus = …;
static const struct regmap_config sunrise_regmap_config = …;
static int sunrise_probe(struct i2c_client *client)
{ … }
static const struct of_device_id sunrise_of_match[] = …;
MODULE_DEVICE_TABLE(of, sunrise_of_match);
static struct i2c_driver sunrise_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;