#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/imu/adis.h>
#include <linux/debugfs.h>
#define ADIS16136_REG_FLASH_CNT …
#define ADIS16136_REG_TEMP_OUT …
#define ADIS16136_REG_GYRO_OUT2 …
#define ADIS16136_REG_GYRO_OUT …
#define ADIS16136_REG_GYRO_OFF2 …
#define ADIS16136_REG_GYRO_OFF …
#define ADIS16136_REG_ALM_MAG1 …
#define ADIS16136_REG_ALM_MAG2 …
#define ADIS16136_REG_ALM_SAMPL1 …
#define ADIS16136_REG_ALM_SAMPL2 …
#define ADIS16136_REG_ALM_CTRL …
#define ADIS16136_REG_GPIO_CTRL …
#define ADIS16136_REG_MSC_CTRL …
#define ADIS16136_REG_SMPL_PRD …
#define ADIS16136_REG_AVG_CNT …
#define ADIS16136_REG_DEC_RATE …
#define ADIS16136_REG_SLP_CTRL …
#define ADIS16136_REG_DIAG_STAT …
#define ADIS16136_REG_GLOB_CMD …
#define ADIS16136_REG_LOT1 …
#define ADIS16136_REG_LOT2 …
#define ADIS16136_REG_LOT3 …
#define ADIS16136_REG_PROD_ID …
#define ADIS16136_REG_SERIAL_NUM …
#define ADIS16136_DIAG_STAT_FLASH_UPDATE_FAIL …
#define ADIS16136_DIAG_STAT_SPI_FAIL …
#define ADIS16136_DIAG_STAT_SELF_TEST_FAIL …
#define ADIS16136_DIAG_STAT_FLASH_CHKSUM_FAIL …
#define ADIS16136_MSC_CTRL_MEMORY_TEST …
#define ADIS16136_MSC_CTRL_SELF_TEST …
struct adis16136_chip_info { … };
struct adis16136 { … };
#ifdef CONFIG_DEBUG_FS
static ssize_t adis16136_show_serial(struct file *file,
char __user *userbuf, size_t count, loff_t *ppos)
{ … }
static const struct file_operations adis16136_serial_fops = …;
static int adis16136_show_product_id(void *arg, u64 *val)
{ … }
DEFINE_DEBUGFS_ATTRIBUTE(…);
static int adis16136_show_flash_count(void *arg, u64 *val)
{ … }
DEFINE_DEBUGFS_ATTRIBUTE(…);
static int adis16136_debugfs_init(struct iio_dev *indio_dev)
{ … }
#else
static int adis16136_debugfs_init(struct iio_dev *indio_dev)
{
return 0;
}
#endif
static int adis16136_set_freq(struct adis16136 *adis16136, unsigned int freq)
{ … }
static int __adis16136_get_freq(struct adis16136 *adis16136, unsigned int *freq)
{ … }
static ssize_t adis16136_write_frequency(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static ssize_t adis16136_read_frequency(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
adis16136_read_frequency,
adis16136_write_frequency);
static const unsigned adis16136_3db_divisors[] = …;
static int adis16136_set_filter(struct iio_dev *indio_dev, int val)
{ … }
static int adis16136_get_filter(struct iio_dev *indio_dev, int *val)
{ … }
static int adis16136_read_raw(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, int *val, int *val2, long info)
{ … }
static int adis16136_write_raw(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, int val, int val2, long info)
{ … }
enum { … };
static const struct iio_chan_spec adis16136_channels[] = …;
static struct attribute *adis16136_attributes[] = …;
static const struct attribute_group adis16136_attribute_group = …;
static const struct iio_info adis16136_info = …;
static int adis16136_stop_device(struct iio_dev *indio_dev)
{ … }
static int adis16136_initial_setup(struct iio_dev *indio_dev)
{ … }
static const char * const adis16136_status_error_msgs[] = …;
#define ADIS16136_DATA(_timeouts) …
enum adis16136_id { … };
static const struct adis_timeout adis16133_timeouts = …;
static const struct adis_timeout adis16136_timeouts = …;
static const struct adis16136_chip_info adis16136_chip_info[] = …;
static void adis16136_stop(void *data)
{ … }
static int adis16136_probe(struct spi_device *spi)
{ … }
static const struct spi_device_id adis16136_ids[] = …;
MODULE_DEVICE_TABLE(spi, adis16136_ids);
static struct spi_driver adis16136_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);