#include <linux/bits.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/types.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regulator/consumer.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <asm/byteorder.h>
#include "scd30.h"
#define SCD30_PRESSURE_COMP_MIN_MBAR …
#define SCD30_PRESSURE_COMP_MAX_MBAR …
#define SCD30_PRESSURE_COMP_DEFAULT …
#define SCD30_MEAS_INTERVAL_MIN_S …
#define SCD30_MEAS_INTERVAL_MAX_S …
#define SCD30_MEAS_INTERVAL_DEFAULT …
#define SCD30_FRC_MIN_PPM …
#define SCD30_FRC_MAX_PPM …
#define SCD30_TEMP_OFFSET_MAX …
#define SCD30_EXTRA_TIMEOUT_PER_S …
enum { … };
static int scd30_command_write(struct scd30_state *state, enum scd30_cmd cmd, u16 arg)
{ … }
static int scd30_command_read(struct scd30_state *state, enum scd30_cmd cmd, u16 *val)
{ … }
static int scd30_reset(struct scd30_state *state)
{ … }
static int scd30_float_to_fp(int float32)
{ … }
static int scd30_read_meas(struct scd30_state *state)
{ … }
static int scd30_wait_meas_irq(struct scd30_state *state)
{ … }
static int scd30_wait_meas_poll(struct scd30_state *state)
{ … }
static int scd30_read_poll(struct scd30_state *state)
{ … }
static int scd30_read(struct scd30_state *state)
{ … }
static int scd30_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int scd30_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static int scd30_write_raw_get_fmt(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
long mask)
{ … }
static const int scd30_pressure_raw_available[] = …;
static const int scd30_temp_calibbias_available[] = …;
static int scd30_read_avail(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
const int **vals, int *type, int *length, long mask)
{ … }
static ssize_t sampling_frequency_available_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t calibration_auto_enable_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t calibration_auto_enable_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t calibration_forced_value_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t calibration_forced_value_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static IIO_DEVICE_ATTR_RO(sampling_frequency_available, 0);
static IIO_DEVICE_ATTR_RW(calibration_auto_enable, 0);
static IIO_DEVICE_ATTR_RW(calibration_forced_value, 0);
static struct attribute *scd30_attrs[] = …;
static const struct attribute_group scd30_attr_group = …;
static const struct iio_info scd30_info = …;
#define SCD30_CHAN_SCAN_TYPE(_sign, _realbits) …
static const struct iio_chan_spec scd30_channels[] = …;
static int scd30_suspend(struct device *dev)
{ … }
static int scd30_resume(struct device *dev)
{ … }
EXPORT_NS_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume, IIO_SCD30);
static void scd30_stop_meas(void *data)
{ … }
static void scd30_disable_regulator(void *data)
{ … }
static irqreturn_t scd30_irq_handler(int irq, void *priv)
{ … }
static irqreturn_t scd30_irq_thread_handler(int irq, void *priv)
{ … }
static irqreturn_t scd30_trigger_handler(int irq, void *p)
{ … }
static int scd30_set_trigger_state(struct iio_trigger *trig, bool state)
{ … }
static const struct iio_trigger_ops scd30_trigger_ops = …;
static int scd30_setup_trigger(struct iio_dev *indio_dev)
{ … }
int scd30_probe(struct device *dev, int irq, const char *name, void *priv,
scd30_command_t command)
{ … }
EXPORT_SYMBOL_NS(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;