summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/Kconfig7
-rw-r--r--drivers/iio/Makefile7
-rw-r--r--drivers/iio/imu/Kconfig11
-rw-r--r--drivers/iio/imu/Makefile8
-rw-r--r--drivers/iio/imu/adis.c (renamed from drivers/staging/iio/imu/adis.c)3
-rw-r--r--drivers/iio/imu/adis_buffer.c (renamed from drivers/staging/iio/imu/adis_buffer.c)3
-rw-r--r--drivers/iio/imu/adis_trigger.c (renamed from drivers/staging/iio/imu/adis_trigger.c)3
-rw-r--r--drivers/staging/iio/accel/adis16201_core.c2
-rw-r--r--drivers/staging/iio/accel/adis16203_core.c2
-rw-r--r--drivers/staging/iio/accel/adis16204_core.c2
-rw-r--r--drivers/staging/iio/accel/adis16209_core.c2
-rw-r--r--drivers/staging/iio/accel/adis16220.h2
-rw-r--r--drivers/staging/iio/accel/adis16240_core.c2
-rw-r--r--drivers/staging/iio/gyro/adis16260.h2
-rw-r--r--drivers/staging/iio/imu/Kconfig12
-rw-r--r--drivers/staging/iio/imu/Makefile5
-rw-r--r--drivers/staging/iio/imu/adis.h186
17 files changed, 37 insertions, 222 deletions
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 65ae734c607d..b2f963be3993 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -63,11 +63,12 @@ config IIO_CONSUMERS_PER_TRIGGER
source "drivers/iio/accel/Kconfig"
source "drivers/iio/adc/Kconfig"
source "drivers/iio/amplifiers/Kconfig"
-source "drivers/iio/light/Kconfig"
-source "drivers/iio/frequency/Kconfig"
-source "drivers/iio/dac/Kconfig"
source "drivers/iio/common/Kconfig"
+source "drivers/iio/dac/Kconfig"
+source "drivers/iio/frequency/Kconfig"
source "drivers/iio/gyro/Kconfig"
+source "drivers/iio/imu/Kconfig"
+source "drivers/iio/light/Kconfig"
source "drivers/iio/magnetometer/Kconfig"
endif # IIO
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
index 31d76a07ec65..a0e8cdd67e4d 100644
--- a/drivers/iio/Makefile
+++ b/drivers/iio/Makefile
@@ -14,9 +14,10 @@ obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o
obj-y += accel/
obj-y += adc/
obj-y += amplifiers/
-obj-y += light/
-obj-y += frequency/
-obj-y += dac/
obj-y += common/
+obj-y += dac/
obj-y += gyro/
+obj-y += frequency/
+obj-y += imu/
+obj-y += light/
obj-y += magnetometer/
diff --git a/drivers/iio/imu/Kconfig b/drivers/iio/imu/Kconfig
new file mode 100644
index 000000000000..c24410c873c7
--- /dev/null
+++ b/drivers/iio/imu/Kconfig
@@ -0,0 +1,11 @@
+config IIO_ADIS_LIB
+ tristate
+ help
+ A set of IO helper functions for the Analog Devices ADIS* device family.
+
+config IIO_ADIS_LIB_BUFFER
+ bool
+ select IIO_TRIGGERED_BUFFER
+ help
+ A set of buffer helper functions for the Analog Devices ADIS* device
+ family.
diff --git a/drivers/iio/imu/Makefile b/drivers/iio/imu/Makefile
new file mode 100644
index 000000000000..97676ab5723d
--- /dev/null
+++ b/drivers/iio/imu/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for Inertial Measurement Units
+#
+
+adis_lib-y += adis.o
+adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_trigger.o
+adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_buffer.o
+obj-$(CONFIG_IIO_ADIS_LIB) += adis_lib.o
diff --git a/drivers/staging/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 0bd21022e4c0..8259b774078f 100644
--- a/drivers/staging/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -20,8 +20,7 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
-
-#include "adis.h"
+#include <linux/iio/imu/adis.h>
#define ADIS_MSC_CTRL_DATA_RDY_EN BIT(2)
#define ADIS_MSC_CTRL_DATA_RDY_POL_HIGH BIT(1)
diff --git a/drivers/staging/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
index 342758c14d2b..a91b4cbdc73a 100644
--- a/drivers/staging/iio/imu/adis_buffer.c
+++ b/drivers/iio/imu/adis_buffer.c
@@ -18,8 +18,7 @@
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-
-#include "adis.h"
+#include <linux/iio/imu/adis.h>
int adis_update_scan_mode(struct iio_dev *indio_dev,
const unsigned long *scan_mask)
diff --git a/drivers/staging/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index 3e89b2e83708..5a24c9cac343 100644
--- a/drivers/staging/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -14,8 +14,7 @@
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
-
-#include "adis.h"
+#include <linux/iio/imu/adis.h>
static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c
index 833dd6b73bc3..ccdc8d23f6a3 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -18,9 +18,9 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
+#include <linux/iio/imu/adis.h>
#include "adis16201.h"
-#include "../imu/adis.h"
static const u8 adis16201_addresses[] = {
[ADIS16201_SCAN_ACC_X] = ADIS16201_XACCL_OFFS,
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c
index f631e578fbd1..202985ea3531 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -18,9 +18,9 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
+#include <linux/iio/imu/adis.h>
#include "adis16203.h"
-#include "../imu/adis.h"
#define DRIVER_NAME "adis16203"
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c
index dbec841ce30c..6dafad67cd23 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -21,9 +21,9 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
+#include <linux/iio/imu/adis.h>
#include "adis16204.h"
-#include "../imu/adis.h"
/* Unique to this driver currently */
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c
index f9f9d582b32d..d2921c30a8bb 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -19,9 +19,9 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
+#include <linux/iio/imu/adis.h>
#include "adis16209.h"
-#include "../imu/adis.h"
static const u8 adis16209_addresses[8][1] = {
[ADIS16209_SCAN_SUPPLY] = { },
diff --git a/drivers/staging/iio/accel/adis16220.h b/drivers/staging/iio/accel/adis16220.h
index 7cc4d2f3ec28..a894ad7fb26d 100644
--- a/drivers/staging/iio/accel/adis16220.h
+++ b/drivers/staging/iio/accel/adis16220.h
@@ -1,7 +1,7 @@
#ifndef SPI_ADIS16220_H_
#define SPI_ADIS16220_H_
-#include "../imu/adis.h"
+#include <linux/iio/imu/adis.h>
#define ADIS16220_STARTUP_DELAY 220 /* ms */
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c
index 3d1a8a9921ad..d098b49cc18b 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -22,9 +22,9 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
+#include <linux/iio/imu/adis.h>
#include "adis16240.h"
-#include "../imu/adis.h"
static ssize_t adis16240_spi_read_signed(struct device *dev,
struct device_attribute *attr,
diff --git a/drivers/staging/iio/gyro/adis16260.h b/drivers/staging/iio/gyro/adis16260.h
index ea5eba205bbf..df3c0b7e954a 100644
--- a/drivers/staging/iio/gyro/adis16260.h
+++ b/drivers/staging/iio/gyro/adis16260.h
@@ -2,7 +2,7 @@
#define SPI_ADIS16260_H_
#include "adis16260_platform_data.h"
-#include "../imu/adis.h"
+#include <linux/iio/imu/adis.h>
#define ADIS16260_STARTUP_DELAY 220 /* ms */
diff --git a/drivers/staging/iio/imu/Kconfig b/drivers/staging/iio/imu/Kconfig
index 2c564edeb172..2c2f47de2630 100644
--- a/drivers/staging/iio/imu/Kconfig
+++ b/drivers/staging/iio/imu/Kconfig
@@ -15,15 +15,3 @@ config ADIS16400
(adis16400 series also have magnetometers).
endmenu
-
-config IIO_ADIS_LIB
- tristate
- help
- A set of IO helper functions for the Analog Devices ADIS* device family.
-
-config IIO_ADIS_LIB_BUFFER
- bool
- select IIO_TRIGGERED_BUFFER
- help
- A set of buffer helper functions for the Analog Devices ADIS* device
- family.
diff --git a/drivers/staging/iio/imu/Makefile b/drivers/staging/iio/imu/Makefile
index 65dafba1e5df..3400a13d1522 100644
--- a/drivers/staging/iio/imu/Makefile
+++ b/drivers/staging/iio/imu/Makefile
@@ -5,8 +5,3 @@
adis16400-y := adis16400_core.o
adis16400-$(CONFIG_IIO_BUFFER) += adis16400_ring.o adis16400_trigger.o
obj-$(CONFIG_ADIS16400) += adis16400.o
-
-adis_lib-y += adis.o
-adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_trigger.o
-adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_buffer.o
-obj-$(CONFIG_IIO_ADIS_LIB) += adis_lib.o
diff --git a/drivers/staging/iio/imu/adis.h b/drivers/staging/iio/imu/adis.h
deleted file mode 100644
index 8c3304d44b97..000000000000
--- a/drivers/staging/iio/imu/adis.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Common library for ADIS16XXX devices
- *
- * Copyright 2012 Analog Devices Inc.
- * Author: Lars-Peter Clausen <lars@metafoo.de>
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __IIO_ADIS_H__
-#define __IIO_ADIS_H__
-
-#include <linux/spi/spi.h>
-#include <linux/interrupt.h>
-#include <linux/iio/types.h>
-
-#define ADIS_WRITE_REG(reg) (0x80 | (reg))
-#define ADIS_READ_REG(reg) (reg)
-
-/**
- * struct adis_data - ADIS chip variant specific data
- * @read_delay: SPI delay for read operations in us
- * @write_delay: SPI delay for write operations in us
- * @glob_cmd_reg: Register address of the GLOB_CMD register
- * @msc_ctrl_reg: Register address of the MSC_CTRL register
- * @diag_stat_reg: Register address of the DIAG_STAT register
- * @status_error_msgs: Array of error messgaes
- * @status_error_mask:
- */
-struct adis_data {
- unsigned int read_delay;
- unsigned int write_delay;
-
- unsigned int glob_cmd_reg;
- unsigned int msc_ctrl_reg;
- unsigned int diag_stat_reg;
-
- unsigned int self_test_mask;
- unsigned int startup_delay;
-
- const char * const *status_error_msgs;
- unsigned int status_error_mask;
-};
-
-struct adis {
- struct spi_device *spi;
- struct iio_trigger *trig;
-
- const struct adis_data *data;
-
- struct mutex txrx_lock;
- struct spi_message msg;
- struct spi_transfer *xfer;
- void *buffer;
-
- uint8_t tx[8] ____cacheline_aligned;
- uint8_t rx[4];
-};
-
-int adis_init(struct adis *adis, struct iio_dev *indio_dev,
- struct spi_device *spi, const struct adis_data *data);
-int adis_reset(struct adis *adis);
-
-int adis_write_reg_8(struct adis *adis, unsigned int reg, uint8_t val);
-int adis_write_reg_16(struct adis *adis, unsigned int reg, uint16_t val);
-int adis_read_reg_16(struct adis *adis, unsigned int reg, uint16_t *val);
-
-int adis_enable_irq(struct adis *adis, bool enable);
-int adis_check_status(struct adis *adis);
-
-int adis_initial_startup(struct adis *adis);
-
-int adis_single_conversion(struct iio_dev *indio_dev,
- const struct iio_chan_spec *chan, unsigned int error_mask,
- int *val);
-
-#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \
- .type = IIO_VOLTAGE, \
- .indexed = 1, \
- .channel = (chan), \
- .extend_name = name, \
- .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
- IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
- .address = (addr), \
- .scan_index = (si), \
- .scan_type = { \
- .sign = 'u', \
- .realbits = (bits), \
- .storagebits = 16, \
- .endianness = IIO_BE, \
- }, \
-}
-
-#define ADIS_SUPPLY_CHAN(addr, si, bits) \
- ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits)
-
-#define ADIS_AUX_ADC_CHAN(addr, si, bits) \
- ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits)
-
-#define ADIS_TEMP_CHAN(addr, si, bits) { \
- .type = IIO_TEMP, \
- .indexed = 1, \
- .channel = 0, \
- .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
- IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \
- IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
- .address = (addr), \
- .scan_index = (si), \
- .scan_type = { \
- .sign = 'u', \
- .realbits = (bits), \
- .storagebits = 16, \
- .endianness = IIO_BE, \
- }, \
-}
-
-#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \
- .type = (_type), \
- .modified = 1, \
- .channel2 = IIO_MOD_ ## mod, \
- .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
- IIO_CHAN_INFO_SCALE_SHARED_BIT | \
- info, \
- .address = (addr), \
- .scan_index = (si), \
- .scan_type = { \
- .sign = 's', \
- .realbits = (bits), \
- .storagebits = 16, \
- .endianness = IIO_BE, \
- }, \
-}
-
-#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \
- ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits)
-
-#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \
- ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits)
-
-#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \
- ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits)
-
-#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \
- ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits)
-
-#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
-
-int adis_setup_buffer_and_trigger(struct adis *adis,
- struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *));
-void adis_cleanup_buffer_and_trigger(struct adis *adis,
- struct iio_dev *indio_dev);
-
-int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev);
-void adis_remove_trigger(struct adis *adis);
-
-int adis_update_scan_mode(struct iio_dev *indio_dev,
- const unsigned long *scan_mask);
-
-#else /* CONFIG_IIO_BUFFER */
-
-static inline int adis_setup_buffer_and_trigger(struct adis *adis,
- struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *))
-{
- return 0;
-}
-
-static inline void adis_cleanup_buffer_and_trigger(struct adis *adis,
- struct iio_dev *indio_dev)
-{
-}
-
-static inline int adis_probe_trigger(struct adis *adis,
- struct iio_dev *indio_dev)
-{
- return 0;
-}
-
-static inline void adis_remove_trigger(struct adis *adis)
-{
-}
-
-#define adis_update_scan_mode NULL
-
-#endif /* CONFIG_IIO_BUFFER */
-
-#endif