#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define AM2315_REG_HUM_MSB …
#define AM2315_REG_HUM_LSB …
#define AM2315_REG_TEMP_MSB …
#define AM2315_REG_TEMP_LSB …
#define AM2315_FUNCTION_READ …
#define AM2315_HUM_OFFSET …
#define AM2315_TEMP_OFFSET …
#define AM2315_ALL_CHANNEL_MASK …
#define AM2315_DRIVER_NAME …
struct am2315_data { … };
struct am2315_sensor_data { … };
static const struct iio_chan_spec am2315_channels[] = …;
static u16 am2315_crc(u8 *data, u8 nr_bytes)
{ … }
static void am2315_ping(struct i2c_client *client)
{ … }
static int am2315_read_data(struct am2315_data *data,
struct am2315_sensor_data *sensor_data)
{ … }
static irqreturn_t am2315_trigger_handler(int irq, void *p)
{ … }
static int am2315_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static const struct iio_info am2315_info = …;
static int am2315_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id am2315_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, am2315_i2c_id);
static struct i2c_driver am2315_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;