#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define SRF08_WRITE_COMMAND …
#define SRF08_WRITE_MAX_GAIN …
#define SRF08_WRITE_RANGE …
#define SRF08_READ_SW_REVISION …
#define SRF08_READ_LIGHT …
#define SRF08_READ_ECHO_1_HIGH …
#define SRF08_READ_ECHO_1_LOW …
#define SRF08_CMD_RANGING_CM …
enum srf08_sensor_type { … };
struct srf08_chip_info { … };
struct srf08_data { … };
static const struct srf08_chip_info srf02_chip_info = …;
static const int srf08_sensitivity_avail[] = …;
static const struct srf08_chip_info srf08_chip_info = …;
static const int srf10_sensitivity_avail[] = …;
static const struct srf08_chip_info srf10_chip_info = …;
static int srf08_read_ranging(struct srf08_data *data)
{ … }
static irqreturn_t srf08_trigger_handler(int irq, void *p)
{ … }
static int srf08_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *channel, int *val,
int *val2, long mask)
{ … }
static ssize_t srf08_show_range_mm_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEVICE_ATTR(sensor_max_range_available, S_IRUGO,
srf08_show_range_mm_available, NULL, 0);
static ssize_t srf08_show_range_mm(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t srf08_write_range_mm(struct srf08_data *data, unsigned int val)
{ … }
static ssize_t srf08_store_range_mm(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static IIO_DEVICE_ATTR(sensor_max_range, S_IRUGO | S_IWUSR,
srf08_show_range_mm, srf08_store_range_mm, 0);
static ssize_t srf08_show_sensitivity_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEVICE_ATTR(sensor_sensitivity_available, S_IRUGO,
srf08_show_sensitivity_available, NULL, 0);
static ssize_t srf08_show_sensitivity(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t srf08_write_sensitivity(struct srf08_data *data,
unsigned int val)
{ … }
static ssize_t srf08_store_sensitivity(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static IIO_DEVICE_ATTR(sensor_sensitivity, S_IRUGO | S_IWUSR,
srf08_show_sensitivity, srf08_store_sensitivity, 0);
static struct attribute *srf08_attributes[] = …;
static const struct attribute_group srf08_attribute_group = …;
static const struct iio_chan_spec srf08_channels[] = …;
static const struct iio_info srf08_info = …;
static const struct iio_info srf02_info = …;
static int srf08_probe(struct i2c_client *client)
{ … }
static const struct of_device_id of_srf08_match[] = …;
MODULE_DEVICE_TABLE(of, of_srf08_match);
static const struct i2c_device_id srf08_id[] = …;
MODULE_DEVICE_TABLE(i2c, srf08_id);
static struct i2c_driver srf08_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;