IIO: Move core headers to include/linux/iio
authorJonathan Cameron <jic23@kernel.org>
Wed, 25 Apr 2012 14:54:58 +0000 (15:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Apr 2012 18:01:43 +0000 (11:01 -0700)
Step 1 in moving the IIO core out of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
138 files changed:
drivers/staging/iio/Documentation/iio_event_monitor.c
drivers/staging/iio/accel/adis16201_core.c
drivers/staging/iio/accel/adis16201_ring.c
drivers/staging/iio/accel/adis16201_trigger.c
drivers/staging/iio/accel/adis16203_core.c
drivers/staging/iio/accel/adis16203_ring.c
drivers/staging/iio/accel/adis16203_trigger.c
drivers/staging/iio/accel/adis16204_core.c
drivers/staging/iio/accel/adis16204_ring.c
drivers/staging/iio/accel/adis16204_trigger.c
drivers/staging/iio/accel/adis16209_core.c
drivers/staging/iio/accel/adis16209_ring.c
drivers/staging/iio/accel/adis16209_trigger.c
drivers/staging/iio/accel/adis16220_core.c
drivers/staging/iio/accel/adis16240_core.c
drivers/staging/iio/accel/adis16240_ring.c
drivers/staging/iio/accel/adis16240_trigger.c
drivers/staging/iio/accel/kxsd9.c
drivers/staging/iio/accel/lis3l02dq_core.c
drivers/staging/iio/accel/lis3l02dq_ring.c
drivers/staging/iio/accel/sca3000_core.c
drivers/staging/iio/accel/sca3000_ring.c
drivers/staging/iio/adc/ad7192.c
drivers/staging/iio/adc/ad7280a.c
drivers/staging/iio/adc/ad7291.c
drivers/staging/iio/adc/ad7298_core.c
drivers/staging/iio/adc/ad7298_ring.c
drivers/staging/iio/adc/ad7476_core.c
drivers/staging/iio/adc/ad7476_ring.c
drivers/staging/iio/adc/ad7606_core.c
drivers/staging/iio/adc/ad7606_par.c
drivers/staging/iio/adc/ad7606_ring.c
drivers/staging/iio/adc/ad7606_spi.c
drivers/staging/iio/adc/ad7780.c
drivers/staging/iio/adc/ad7793.c
drivers/staging/iio/adc/ad7816.c
drivers/staging/iio/adc/ad7887_core.c
drivers/staging/iio/adc/ad7887_ring.c
drivers/staging/iio/adc/ad799x_core.c
drivers/staging/iio/adc/ad799x_ring.c
drivers/staging/iio/adc/adt7310.c
drivers/staging/iio/adc/adt7410.c
drivers/staging/iio/adc/lpc32xx_adc.c
drivers/staging/iio/adc/max1363_core.c
drivers/staging/iio/adc/max1363_ring.c
drivers/staging/iio/adc/spear_adc.c
drivers/staging/iio/addac/adt7316.c
drivers/staging/iio/buffer.h [deleted file]
drivers/staging/iio/cdc/ad7150.c
drivers/staging/iio/cdc/ad7152.c
drivers/staging/iio/cdc/ad7746.c
drivers/staging/iio/consumer.h [deleted file]
drivers/staging/iio/dac/ad5064.c
drivers/staging/iio/dac/ad5360.c
drivers/staging/iio/dac/ad5380.c
drivers/staging/iio/dac/ad5421.c
drivers/staging/iio/dac/ad5446.c
drivers/staging/iio/dac/ad5504.c
drivers/staging/iio/dac/ad5624r_spi.c
drivers/staging/iio/dac/ad5686.c
drivers/staging/iio/dac/ad5764.c
drivers/staging/iio/dac/ad5791.c
drivers/staging/iio/dac/max517.c
drivers/staging/iio/dds/ad5930.c
drivers/staging/iio/dds/ad9832.c
drivers/staging/iio/dds/ad9834.c
drivers/staging/iio/dds/ad9850.c
drivers/staging/iio/dds/ad9852.c
drivers/staging/iio/dds/ad9910.c
drivers/staging/iio/dds/ad9951.c
drivers/staging/iio/driver.h [deleted file]
drivers/staging/iio/events.h [deleted file]
drivers/staging/iio/gyro/adis16060_core.c
drivers/staging/iio/gyro/adis16080_core.c
drivers/staging/iio/gyro/adis16130_core.c
drivers/staging/iio/gyro/adis16260_core.c
drivers/staging/iio/gyro/adis16260_ring.c
drivers/staging/iio/gyro/adis16260_trigger.c
drivers/staging/iio/gyro/adxrs450_core.c
drivers/staging/iio/iio.h [deleted file]
drivers/staging/iio/iio_dummy_evgen.c
drivers/staging/iio/iio_hwmon.c
drivers/staging/iio/iio_simple_dummy.c
drivers/staging/iio/iio_simple_dummy_buffer.c
drivers/staging/iio/iio_simple_dummy_events.c
drivers/staging/iio/impedance-analyzer/ad5933.c
drivers/staging/iio/imu/adis16400_core.c
drivers/staging/iio/imu/adis16400_ring.c
drivers/staging/iio/imu/adis16400_trigger.c
drivers/staging/iio/industrialio-buffer.c
drivers/staging/iio/industrialio-core.c
drivers/staging/iio/industrialio-event.c
drivers/staging/iio/industrialio-trigger.c
drivers/staging/iio/inkern.c
drivers/staging/iio/kfifo_buf.c
drivers/staging/iio/kfifo_buf.h [deleted file]
drivers/staging/iio/light/isl29018.c
drivers/staging/iio/light/isl29028.c
drivers/staging/iio/light/tsl2563.c
drivers/staging/iio/light/tsl2583.c
drivers/staging/iio/light/tsl2x7x_core.c
drivers/staging/iio/machine.h [deleted file]
drivers/staging/iio/magnetometer/ak8975.c
drivers/staging/iio/magnetometer/hmc5843.c
drivers/staging/iio/meter/ade7753.c
drivers/staging/iio/meter/ade7754.c
drivers/staging/iio/meter/ade7758_core.c
drivers/staging/iio/meter/ade7758_ring.c
drivers/staging/iio/meter/ade7758_trigger.c
drivers/staging/iio/meter/ade7759.c
drivers/staging/iio/meter/ade7854-i2c.c
drivers/staging/iio/meter/ade7854-spi.c
drivers/staging/iio/meter/ade7854.c
drivers/staging/iio/meter/meter.h
drivers/staging/iio/resolver/ad2s1200.c
drivers/staging/iio/resolver/ad2s1210.c
drivers/staging/iio/resolver/ad2s90.c
drivers/staging/iio/ring_sw.c
drivers/staging/iio/ring_sw.h
drivers/staging/iio/sysfs.h [deleted file]
drivers/staging/iio/trigger.h [deleted file]
drivers/staging/iio/trigger/iio-trig-bfin-timer.c
drivers/staging/iio/trigger/iio-trig-gpio.c
drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
drivers/staging/iio/trigger/iio-trig-sysfs.c
drivers/staging/iio/trigger_consumer.h [deleted file]
drivers/staging/iio/types.h [deleted file]
include/linux/iio/buffer.h [new file with mode: 0644]
include/linux/iio/consumer.h [new file with mode: 0644]
include/linux/iio/driver.h [new file with mode: 0644]
include/linux/iio/events.h [new file with mode: 0644]
include/linux/iio/iio.h [new file with mode: 0644]
include/linux/iio/kfifo_buf.h [new file with mode: 0644]
include/linux/iio/machine.h [new file with mode: 0644]
include/linux/iio/sysfs.h [new file with mode: 0644]
include/linux/iio/trigger.h [new file with mode: 0644]
include/linux/iio/trigger_consumer.h [new file with mode: 0644]
include/linux/iio/types.h [new file with mode: 0644]

index 0d21a277305f4dcf53a58c1ae210d5400681e8ce..22275845fb124b6f2d4cf194f30c0dbfeb8363b1 100644 (file)
@@ -27,7 +27,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "iio_utils.h"
-#include "../events.h"
+#include <linux/iio/events.h>
 
 static const char * const iio_chan_type_name_spec[] = {
        [IIO_VOLTAGE] = "voltage",
index 8022bbdd4b630554959f8437e4202cbdaa981d92..9dce7b8d38a5eab311d959842c545567fa148623 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16201.h"
 
index 49912e2dde3ec78e07db45a0bd2612a652668117..247602a8e54cecbdea46c3fcc7531ef648fc98aa 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16201.h"
 
 
index bce505e716d05f04f26a12a52f9fc9e5a4017593..da687e01cc45cd89c7e94f62306b921bbd2af135 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16201.h"
 
 /**
index f23b7c5125af77fd27bc1f433136825ba5e531ea..cf1a0e5656733ea8b4fc9eca812ec723ecd6eb36 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16203.h"
 
index 5c40f6c72971c8167e27fd443eab0f3d8732831b..2171f7483e71607757cc0838ce488f24cfbcfda6 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16203.h"
 
 /**
index 24bcb8e15c55d708e1735b3e2aff7af06ecfc95e..1e1b981e1581481e8d137691c4222f7a95ddd5b8 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16203.h"
 
 /**
index bffbbe8f737c187785590b3b2c8514c2eebf384d..2a15d71c02c7d78397cbb929b7a45baae10c669c 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16204.h"
 
index bf5488ecc65b44e00e26781b585f7390531586b2..0a8b1255fd1c70dd04f40c890efc0b508b49fe26 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16204.h"
 
 /**
index 6e542af02c095eebb4281d374dae7f8d10f0a11f..e6f2937ade7c6a34f07eb1671627c390dae7bfa3 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16204.h"
 
 /**
index b1fbf19a71f39d90ee0785dede547d6bdf0239e0..cad411340f1dc05f2a45a0872fc1d61198d66a70 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16209.h"
 
index 3101c537d13d2b629eca25c399829f1bd9487f34..f7ed989dd20cb834102b81c8f7c6c97675f9d2a4 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16209.h"
 
 /**
index c5d82c1a55d96f408ebb0797bb788a750ad47aa5..5f5dbed447d7e68f106c5fe01a55c94adbfc8529 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16209.h"
 
 /**
index 2740c8e1398c5aab56e6cdcc182d105af526ba07..c86a3db6d747b3f7abdc9776826f4f4d80d7f4b3 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #include "adis16220.h"
 
index 18ed39692b4d977b6bb1c9be65c154df5ec1c03f..fcc2c19f69dd1f02dec85d501eabc339c7ae4cbe 100644 (file)
@@ -19,9 +19,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16240.h"
 
index c4459f73e74772e579f1214cbcb55f1fa2f67dce..1aa95662e54257e056f581845baa003a6c154594 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16240.h"
 
 /**
index 8e0ce568e64c29cf9048ae5044c85ef1c6b96072..53eda35b37e7325ee2a2b1273fa8a9eb3e8d6db6 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16240.h"
 
 /**
index 601da28f3b3a6afd06ac2aac604ace9626586ec7..329239011d47d6c7ae999ebbae3bbb44c7312e61 100644 (file)
@@ -23,8 +23,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define KXSD9_REG_X            0x00
 #define KXSD9_REG_Y            0x02
index ee8ad3a3f981d2ca74d97163990637a3aae16e4b..bbef0be3d81ecebaaf2608d4e9a21189509908a0 100644 (file)
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
+#include <linux/iio/buffer.h>
 
 #include "lis3l02dq.h"
 
index ebd5b4d3d957ec67e40455c77bf97e35e026863f..c8b8164eef77c3ccaed44c7913fe185330ed7bec 100644 (file)
@@ -6,11 +6,11 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../kfifo_buf.h"
-#include "../trigger.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/kfifo_buf.h>
+#include <linux/iio/trigger.h>
+#include <linux/iio/trigger_consumer.h>
 #include "lis3l02dq.h"
 
 /**
index 646e05ccfa8699361e168ea2dc074b9763e01d27..2ee5eb060932cfdeecf2c741c2013f7e987f5c3b 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
 #include <linux/module.h>
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
+#include <linux/iio/buffer.h>
 
 #include "sca3000.h"
 
index 6b824a11f7f4b42b0f438891469f9dc864a743d2..889bc86047f94685bb176c7a5cd78e63ebb1f53f 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/sched.h>
 #include <linux/poll.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "../ring_hw.h"
 #include "sca3000.h"
 
index 5d316857c13adc18f5350cf632f933f65bd1ecc6..14f983450d7f17cff675f583f754de43ec645844 100644 (file)
 #include <linux/sched.h>
 #include <linux/delay.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger.h>
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7192.h"
 
index f0c0c72a1b07b0a6ba4a9c6fa130062be4d6e079..d72780f91031efb8a3ef3e813402d1f74098a1ff 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 #include "ad7280a.h"
 
index 298249f3988723f578499226f95dc542c2c26f8c..b8e4fe6c0c501011a7127e4fb31ac9e8d843c82e 100644 (file)
@@ -17,9 +17,9 @@
 #include <linux/regulator/consumer.h>
 #include <linux/err.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 /*
  * Simplified handling
index 5d54a795a389ddb1b4136742af4a44c3eb7a1c14..974a8e3ef26aa20391c2ca32def53b6f0b044700 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "ad7298.h"
 
index 538e3b357e44bd94bf19b470d75f2f3eb7230f8d..943caa340bfaf1b645eb38760fc3e2362c195155 100644 (file)
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7298.h"
 
index ce715225eff37be125731901019de5bf116de1a6..1241b9fadbf7a80d272360ae8d95ff76a3d58329 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "ad7476.h"
 
index 8534f6b3cccbbb2a499b1ef96d700177d3489342..51403892bc8bf6091fd6beb03faa2cbc435b5344 100644 (file)
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7476.h"
 
index 802cdaf538f218b47e5b14775801edf6e0de0e12..9c540643576b4e25910f841687753fa64815d78d 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/sched.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "ad7606.h"
 
index bb152a8e8c920aa9216355debe42e9be4b6f01e4..a53faafec070816e6ec8b06e984025e6cd486363 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "ad7606.h"
 
 static int ad7606_par16_read_block(struct device *dev,
index 007b6005beed4d1eb9508102fec4403c3af4cb31..3dd9602b1070d343e832c995d84ffa7a4a4dec0e 100644 (file)
 #include <linux/kernel.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7606.h"
 
index 237f1c44d296ce942b8e0c4cdcdc6fb079b3cc14..099d347da52def3293106ed869a2641dd4469be0 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/types.h>
 #include <linux/err.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "ad7606.h"
 
 #define MAX_SPI_FREQ_HZ                23500000        /* VDRIVE above 4.75 V */
index eeedbdb05a95e243e8343dd8dd99c293fe14f054..a8e661e5e4e659b32f25c54ea5a73dbd9dc649c6 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/gpio.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #include "ad7780.h"
 
index 7f68c7c84ac6452e653e0f8dcc1dd0e73c652037..3a7d1a7b4e05aa230b5cd7d31085527bea318534 100644 (file)
 #include <linux/delay.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger.h>
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7793.h"
 
index 52b720e2b03a422ef86a85bc20224b712a3613b7..586f6c2425e277d4c370ce8ecbc8138ebdf99f4d 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/spi/spi.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 /*
  * AD7816 config masks
index 2cce09f36b74dc7be9c04ca4972a0a8b82696f89..fef916998f24ec8d7cdaa61a15dc43ae99664ba4 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 
 #include "ad7887.h"
index 62681a8d43c1f767a1ce911fbc3fe67f0ad395f7..f1846dbf49a04d8be1275020205b468a768ff49a 100644 (file)
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad7887.h"
 
index 429fb414f2eaa6e6c27805f65a114a5dfd1c9b0a..561ae17ec7cca31d46539a59c79952d63f547c93 100644 (file)
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
+#include <linux/iio/buffer.h>
 
 #include "ad799x.h"
 
index 5190e506716ffa5a3d712e83935a0058e414b85f..18366b5038cefec0849279b40a5bddac06bce4b0 100644 (file)
 #include <linux/i2c.h>
 #include <linux/bitops.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "ad799x.h"
 
index caf57c1169b1482bce1e40e5e99dd977e83d6215..223aea5952dfd477c9c275aa1350ea601aab9b50 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/spi/spi.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 /*
  * ADT7310 registers definition
  */
index dff3e8ca2d7857901a63a0b847866ff52e2cf381..dab4a5abff8a591f42b7ddc1f2975a756b08fed7 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 /*
  * ADT7410 registers definition
index d7f4fe42d17ee0cacffe422c18390e2a080d5011..0ddd91712f44d94fe5f50d259f53edfb42fa484b 100644 (file)
@@ -32,8 +32,8 @@
 #include <linux/completion.h>
 #include <linux/of.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 /*
  * LPC32XX registers definitions
index 1a7a0274751d84cfb50f84f6376fe6b53772e263..7ab871c8aab51f0ae4784c021b97dfeeb24037e0 100644 (file)
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
-#include "../buffer.h"
-#include "../driver.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
+#include <linux/iio/buffer.h>
+#include <linux/iio/driver.h>
 
 #include "max1363.h"
 
index 8372e9819b605e8306dd3237c19481925d79de0b..b30201300121d0dcbd760bd4ef8cce3ac685ec03 100644 (file)
 #include <linux/i2c.h>
 #include <linux/bitops.h>
 
-#include "../iio.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 #include "max1363.h"
 
index 3ca5cc9814eb9b494d7d57e7f79c9f08eae87b3c..2b4e1eb8eab1cc003d674304b9869e0ee55a60e4 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 /*
  * SPEAR registers definitions
index fd6a4544405896b6960d1a6d9efee7140940ff4a..f469ab3cc7b96b01cce193a1855f4fd3edf72a53 100644 (file)
@@ -19,9 +19,9 @@
 #include <linux/rtc.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../events.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/events.h>
+#include <linux/iio/sysfs.h>
 #include "adt7316.h"
 
 /*
diff --git a/drivers/staging/iio/buffer.h b/drivers/staging/iio/buffer.h
deleted file mode 100644 (file)
index 3d3ea9e..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/* The industrial I/O core - generic buffer interfaces.
- *
- * Copyright (c) 2008 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-#ifndef _IIO_BUFFER_GENERIC_H_
-#define _IIO_BUFFER_GENERIC_H_
-#include <linux/sysfs.h>
-#include "iio.h"
-
-#ifdef CONFIG_IIO_BUFFER
-
-struct iio_buffer;
-
-/**
- * struct iio_buffer_access_funcs - access functions for buffers.
- * @store_to:          actually store stuff to the buffer
- * @read_first_n:      try to get a specified number of bytes (must exist)
- * @request_update:    if a parameter change has been marked, update underlying
- *                     storage.
- * @get_bytes_per_datum:get current bytes per datum
- * @set_bytes_per_datum:set number of bytes per datum
- * @get_length:                get number of datums in buffer
- * @set_length:                set number of datums in buffer
- *
- * The purpose of this structure is to make the buffer element
- * modular as event for a given driver, different usecases may require
- * different buffer designs (space efficiency vs speed for example).
- *
- * It is worth noting that a given buffer implementation may only support a
- * small proportion of these functions.  The core code 'should' cope fine with
- * any of them not existing.
- **/
-struct iio_buffer_access_funcs {
-       int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp);
-       int (*read_first_n)(struct iio_buffer *buffer,
-                           size_t n,
-                           char __user *buf);
-
-       int (*request_update)(struct iio_buffer *buffer);
-
-       int (*get_bytes_per_datum)(struct iio_buffer *buffer);
-       int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
-       int (*get_length)(struct iio_buffer *buffer);
-       int (*set_length)(struct iio_buffer *buffer, int length);
-};
-
-/**
- * struct iio_buffer - general buffer structure
- * @length:            [DEVICE] number of datums in buffer
- * @bytes_per_datum:   [DEVICE] size of individual datum including timestamp
- * @scan_el_attrs:     [DRIVER] control of scan elements if that scan mode
- *                     control method is used
- * @scan_mask:         [INTERN] bitmask used in masking scan mode elements
- * @scan_timestamp:    [INTERN] does the scan mode include a timestamp
- * @access:            [DRIVER] buffer access functions associated with the
- *                     implementation.
- * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes.
- * @scan_el_group:     [DRIVER] attribute group for those attributes not
- *                     created from the iio_chan_info array.
- * @pollq:             [INTERN] wait queue to allow for polling on the buffer.
- * @stufftoread:       [INTERN] flag to indicate new data.
- * @demux_list:                [INTERN] list of operations required to demux the scan.
- * @demux_bounce:      [INTERN] buffer for doing gather from incoming scan.
- **/
-struct iio_buffer {
-       int                                     length;
-       int                                     bytes_per_datum;
-       struct attribute_group                  *scan_el_attrs;
-       long                                    *scan_mask;
-       bool                                    scan_timestamp;
-       const struct iio_buffer_access_funcs    *access;
-       struct list_head                        scan_el_dev_attr_list;
-       struct attribute_group                  scan_el_group;
-       wait_queue_head_t                       pollq;
-       bool                                    stufftoread;
-       const struct attribute_group *attrs;
-       struct list_head                        demux_list;
-       unsigned char                           *demux_bounce;
-};
-
-/**
- * iio_buffer_init() - Initialize the buffer structure
- * @buffer: buffer to be initialized
- **/
-void iio_buffer_init(struct iio_buffer *buffer);
-
-/**
- * __iio_update_buffer() - update common elements of buffers
- * @buffer:            buffer that is the event source
- * @bytes_per_datum:   size of individual datum including timestamp
- * @length:            number of datums in buffer
- **/
-static inline void __iio_update_buffer(struct iio_buffer *buffer,
-                                      int bytes_per_datum, int length)
-{
-       buffer->bytes_per_datum = bytes_per_datum;
-       buffer->length = length;
-}
-
-int iio_scan_mask_query(struct iio_dev *indio_dev,
-                       struct iio_buffer *buffer, int bit);
-
-/**
- * iio_scan_mask_set() - set particular bit in the scan mask
- * @buffer: the buffer whose scan mask we are interested in
- * @bit: the bit to be set.
- **/
-int iio_scan_mask_set(struct iio_dev *indio_dev,
-                     struct iio_buffer *buffer, int bit);
-
-/**
- * iio_push_to_buffer() - push to a registered buffer.
- * @buffer:            IIO buffer structure for device
- * @scan:              Full scan.
- * @timestamp:
- */
-int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data,
-                      s64 timestamp);
-
-int iio_update_demux(struct iio_dev *indio_dev);
-
-/**
- * iio_buffer_register() - register the buffer with IIO core
- * @indio_dev: device with the buffer to be registered
- **/
-int iio_buffer_register(struct iio_dev *indio_dev,
-                       const struct iio_chan_spec *channels,
-                       int num_channels);
-
-/**
- * iio_buffer_unregister() - unregister the buffer from IIO core
- * @indio_dev: the device with the buffer to be unregistered
- **/
-void iio_buffer_unregister(struct iio_dev *indio_dev);
-
-/**
- * iio_buffer_read_length() - attr func to get number of datums in the buffer
- **/
-ssize_t iio_buffer_read_length(struct device *dev,
-                              struct device_attribute *attr,
-                              char *buf);
-/**
- * iio_buffer_write_length() - attr func to set number of datums in the buffer
- **/
-ssize_t iio_buffer_write_length(struct device *dev,
-                             struct device_attribute *attr,
-                             const char *buf,
-                             size_t len);
-/**
- * iio_buffer_store_enable() - attr to turn the buffer on
- **/
-ssize_t iio_buffer_store_enable(struct device *dev,
-                               struct device_attribute *attr,
-                               const char *buf,
-                               size_t len);
-/**
- * iio_buffer_show_enable() - attr to see if the buffer is on
- **/
-ssize_t iio_buffer_show_enable(struct device *dev,
-                              struct device_attribute *attr,
-                              char *buf);
-#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR,  \
-                                          iio_buffer_read_length,      \
-                                          iio_buffer_write_length)
-
-#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR,  \
-                                          iio_buffer_show_enable,      \
-                                          iio_buffer_store_enable)
-
-int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
-
-#else /* CONFIG_IIO_BUFFER */
-
-static inline int iio_buffer_register(struct iio_dev *indio_dev,
-                                          struct iio_chan_spec *channels,
-                                          int num_channels)
-{
-       return 0;
-}
-
-static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
-{};
-
-#endif /* CONFIG_IIO_BUFFER */
-
-#endif /* _IIO_BUFFER_GENERIC_H_ */
index 116e6c278437add25ed0b69cd991465d40af209c..c0ccbc524c6efe306cae8fc70ed0aa609e3adfa1 100644 (file)
@@ -13,9 +13,9 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 /*
  * AD7150 registers definition
  */
index 1067ce58e07de87fedf58ecc87bb884f20852326..ea403596c958b964076706c7ea42e071c91344a7 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 /*
  * TODO: Check compliance of calibbias with abi (units)
index 750bf4b0385eaa895996313db55b70bd4eef14cb..74a889a6d899271c154e5f6f713615c960cef20c 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #include "ad7746.h"
 
diff --git a/drivers/staging/iio/consumer.h b/drivers/staging/iio/consumer.h
deleted file mode 100644 (file)
index 36a060c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Industrial I/O in kernel consumer interface
- *
- * Copyright (c) 2011 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-#ifndef _IIO_INKERN_CONSUMER_H_
-#define _IIO_INKERN_CONSUMER_H
-#include "types.h"
-
-struct iio_dev;
-struct iio_chan_spec;
-
-/**
- * struct iio_channel - everything needed for a consumer to use a channel
- * @indio_dev:         Device on which the channel exists.
- * @channel:           Full description of the channel.
- */
-struct iio_channel {
-       struct iio_dev *indio_dev;
-       const struct iio_chan_spec *channel;
-};
-
-/**
- * iio_channel_get() - get description of all that is needed to access channel.
- * @name:              Unique name of the device as provided in the iio_map
- *                     with which the desired provider to consumer mapping
- *                     was registered.
- * @consumer_channel:  Unique name to identify the channel on the consumer
- *                     side. This typically describes the channels use within
- *                     the consumer. E.g. 'battery_voltage'
- */
-struct iio_channel *iio_st_channel_get(const char *name,
-                                      const char *consumer_channel);
-
-/**
- * iio_st_channel_release() - release channels obtained via iio_st_channel_get
- * @chan:              The channel to be released.
- */
-void iio_st_channel_release(struct iio_channel *chan);
-
-/**
- * iio_st_channel_get_all() - get all channels associated with a client
- * @name:              name of consumer device.
- *
- * Returns an array of iio_channel structures terminated with one with
- * null iio_dev pointer.
- * This function is used by fairly generic consumers to get all the
- * channels registered as having this consumer.
- */
-struct iio_channel *iio_st_channel_get_all(const char *name);
-
-/**
- * iio_st_channel_release_all() - reverse iio_st_get_all
- * @chan:              Array of channels to be released.
- */
-void iio_st_channel_release_all(struct iio_channel *chan);
-
-/**
- * iio_st_read_channel_raw() - read from a given channel
- * @channel:           The channel being queried.
- * @val:               Value read back.
- *
- * Note raw reads from iio channels are in adc counts and hence
- * scale will need to be applied if standard units required.
- */
-int iio_st_read_channel_raw(struct iio_channel *chan,
-                           int *val);
-
-/**
- * iio_st_get_channel_type() - get the type of a channel
- * @channel:           The channel being queried.
- * @type:              The type of the channel.
- *
- * returns the enum iio_chan_type of the channel
- */
-int iio_st_get_channel_type(struct iio_channel *channel,
-                           enum iio_chan_type *type);
-
-/**
- * iio_st_read_channel_scale() - read the scale value for a channel
- * @channel:           The channel being queried.
- * @val:               First part of value read back.
- * @val2:              Second part of value read back.
- *
- * Note returns a description of what is in val and val2, such
- * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
- * + val2/1e6
- */
-int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
-                             int *val2);
-
-#endif
index 21893edbf009b06562727d05101dd6af9477a437..c0fad4fd13fa69bccb9ce6199dc6a1b3ced502b6 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/regulator/consumer.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #define AD5064_MAX_DAC_CHANNELS                        8
index cb6160d84b7ba97c2c2612965bef0c262e1929a1..0978dd2891b9ea72c748f0300885eeae51096741 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/regulator/consumer.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #define AD5360_CMD(x)                          ((x) << 22)
index 1d384f01658c702393a3a5aacd53c91f80bdac62..aa077e676dfe554cac74a007c9e73d52b3036a79 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 
index a8b5211ac95a023e1d07050d446ab4d1cac1340a..b1a893ce2c88ce395bfb9d3fcafe5341621d23c0 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 #include "dac.h"
 #include "ad5421.h"
 
index 00b138e56d247948651f953233c245595a9cce03..62ad1d5df4751d06a90aeb075148cd072ad770c1 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #include "ad5446.h"
index 796691e544a2422764f228da997499c89872fe6f..18fc391e62d4743d6cdabf0f6f4a3a370ee98e36 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/regulator/consumer.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 #include "dac.h"
 #include "ad5504.h"
 
index 74eb889afab18bee087ca7c2903cd743c965f5ad..c7786c18b847035f9a99be9718c45855a3d00f7c 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/regulator/consumer.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 #include "ad5624r.h"
 
index b8acd7e572a282529b4622bc0b061d899a70e67e..86c869134bd44b9a50e65ed836eaa3313d1d801f 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/regulator/consumer.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #define AD5686_DAC_CHANNELS                    4
index 1c9ff4fc488d3f6b062a69ed5729ebb36f820196..b01d7eedb95e49fb4c1f1c093d7b990d025714d7 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/regulator/consumer.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #define AD5764_REG_SF_NOP                      0x0
index cdb7b109d6f9b6b43af582a752480bb0d0aa8f6b..c013868dfcd51f80cf184625c8d2d561307265af 100644 (file)
@@ -17,8 +17,8 @@
 #include <linux/regulator/consumer.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 #include "ad5791.h"
 
index 41483c72cec151bf8c9adc5ba40e35ef74fcf3db..373127cc83a8b99231d6d2737c46615502322534 100644 (file)
@@ -25,8 +25,8 @@
 #include <linux/i2c.h>
 #include <linux/err.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dac.h"
 
 #include "max517.h"
index 9c32d1beae2583e07ef5b3ed05c56b43347d0e3f..6df4d86be8494621afbd6b0883214a047b1f119c 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad5930"
 
index 2ccf25dd928946ce0ab8441cfd9fb3884aaf3624..57627ff45c3a2b96f67c36812c133a95c0bc4e2c 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/module.h>
 #include <asm/div64.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dds.h"
 
 #include "ad9832.h"
index 38a2de08626fbbded78815df0ad0edd7a9d7eee7..9b2c8795f8943a798e433a490f97913636979c42 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/module.h>
 #include <asm/div64.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "dds.h"
 
 #include "ad9834.h"
index f4f731bb219115b7833a68db1973ecb295a8e28d..cc7a87d25a599b7287a2e42f5d943013ee21f5d5 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad9850"
 
index 554266c615a811a4fd6d4bc1de30a4b6521bf292..2f8df7bcb78354a772ebc4c65870c81151a4c562 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad9852"
 
index 3985766d6f872ecf6313d91861aa9b821eaee8b2..e91efc5c0fca5e6bfee7f5f006ad1c8773ea339d 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad9910"
 
index 4d150048002a53ef1bdd3e377844956091d21794..ca1d3111b0bfcf5a031dcf0ed78e2607fe5bfb4a 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad9951"
 
diff --git a/drivers/staging/iio/driver.h b/drivers/staging/iio/driver.h
deleted file mode 100644 (file)
index a4f8b2e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Industrial I/O in kernel access map interface.
- *
- * Copyright (c) 2011 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-#ifndef _IIO_INKERN_H_
-#define _IIO_INKERN_H_
-
-struct iio_map;
-
-/**
- * iio_map_array_register() - tell the core about inkernel consumers
- * @indio_dev: provider device
- * @map:       array of mappings specifying association of channel with client
- */
-int iio_map_array_register(struct iio_dev *indio_dev,
-                          struct iio_map *map);
-
-/**
- * iio_map_array_unregister() - tell the core to remove consumer mappings
- * @indio_dev: provider device
- * @map:       array of mappings to remove. Note these must have same memory
- *             addresses as those originally added not just equal parameter
- *             values.
- */
-int iio_map_array_unregister(struct iio_dev *indio_dev,
-                            struct iio_map *map);
-
-#endif
diff --git a/drivers/staging/iio/events.h b/drivers/staging/iio/events.h
deleted file mode 100644 (file)
index c25f0e3..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* The industrial I/O - event passing to userspace
- *
- * Copyright (c) 2008-2011 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-#ifndef _IIO_EVENTS_H_
-#define _IIO_EVENTS_H_
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#include "types.h"
-
-/**
- * struct iio_event_data - The actual event being pushed to userspace
- * @id:                event identifier
- * @timestamp: best estimate of time of event occurrence (often from
- *             the interrupt handler)
- */
-struct iio_event_data {
-       __u64   id;
-       __s64   timestamp;
-};
-
-#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
-
-enum iio_event_type {
-       IIO_EV_TYPE_THRESH,
-       IIO_EV_TYPE_MAG,
-       IIO_EV_TYPE_ROC,
-       IIO_EV_TYPE_THRESH_ADAPTIVE,
-       IIO_EV_TYPE_MAG_ADAPTIVE,
-};
-
-enum iio_event_direction {
-       IIO_EV_DIR_EITHER,
-       IIO_EV_DIR_RISING,
-       IIO_EV_DIR_FALLING,
-};
-
-/**
- * IIO_EVENT_CODE() - create event identifier
- * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
- * @diff:      Whether the event is for an differential channel or not.
- * @modifier:  Modifier for the channel. Should be one of enum iio_modifier.
- * @direction: Direction of the event. One of enum iio_event_direction.
- * @type:      Type of the event. Should be one enum iio_event_type.
- * @chan:      Channel number for non-differential channels.
- * @chan1:     First channel number for differential channels.
- * @chan2:     Second channel number for differential channels.
- */
-
-#define IIO_EVENT_CODE(chan_type, diff, modifier, direction,           \
-                      type, chan, chan1, chan2)                        \
-       (((u64)type << 56) | ((u64)diff << 55) |                        \
-        ((u64)direction << 48) | ((u64)modifier << 40) |               \
-        ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \
-        ((u16)chan))
-
-
-#define IIO_EV_DIR_MAX 4
-#define IIO_EV_BIT(type, direction)                    \
-       (1 << (type*IIO_EV_DIR_MAX + direction))
-
-/**
- * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
- * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
- * @number:    Channel number.
- * @modifier:  Modifier for the channel. Should be one of enum iio_modifier.
- * @type:      Type of the event. Should be one enum iio_event_type.
- * @direction: Direction of the event. One of enum iio_event_direction.
- */
-
-#define IIO_MOD_EVENT_CODE(chan_type, number, modifier,                \
-                          type, direction)                             \
-       IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0)
-
-/**
- * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels
- * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
- * @number:    Channel number.
- * @type:      Type of the event. Should be one enum iio_event_type.
- * @direction: Direction of the event. One of enum iio_event_direction.
- */
-
-#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction)       \
-       IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
-
-#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
-
-#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
-
-#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
-
-/* Event code number extraction depends on which type of event we have.
- * Perhaps review this function in the future*/
-#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
-#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
-
-#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
-#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
-
-#endif
index 2f841cb1923845b4804e8f324949631224c5e28e..08aaf2783895d91237e3852323beb42ea1c4771c 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define ADIS16060_GYRO         0x20 /* Measure Angular Rate (Gyro) */
 #define ADIS16060_TEMP_OUT     0x10 /* Measure Temperature */
index 608b93d07484d3ecb7493568c070ccffa324c4e3..7e3695ba628b6fcdc99a14de2d26bf3b3c8d4c51 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define ADIS16080_DIN_GYRO   (0 << 10) /* Gyroscope output */
 #define ADIS16080_DIN_TEMP   (1 << 10) /* Temperature output */
index 257bdf2bfb46234d45746dde43a64fe55aa633f0..98aa1b92b9d4e78e2510815a1a14685eb36a2296 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define ADIS16130_CON         0x0
 #define ADIS16130_CON_RD      (1 << 6)
index bb2301833495164b76fbdede16a6336617c65825..15253beab9a0c833ced101c7ce5c0d9543401fa9 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 #include "adis16260.h"
 
index 046f84d0eeca8a037b60033da6d98ace2464c54d..25283376f2fccda47714582bfbb6451426a0d040 100644 (file)
@@ -5,9 +5,9 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16260.h"
 
 /**
index 8299cd18d705f2b32445858942080377852c445e..dc56f32637628a5aea4ce29e4bd4e2478be5793b 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16260.h"
 
 /**
index 12935057836e0b94c4091fce40ddfd5fdde68a54..06a9e974f0106da3fce77f7b904ac9ebc25b0fdf 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #include "adxrs450.h"
 
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
deleted file mode 100644 (file)
index 0770340..0000000
+++ /dev/null
@@ -1,463 +0,0 @@
-
-/* The industrial I/O core
- *
- * Copyright (c) 2008 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-#ifndef _INDUSTRIAL_IO_H_
-#define _INDUSTRIAL_IO_H_
-
-#include <linux/device.h>
-#include <linux/cdev.h>
-#include "types.h"
-/* IIO TODO LIST */
-/*
- * Provide means of adjusting timer accuracy.
- * Currently assumes nano seconds.
- */
-
-enum iio_chan_info_enum {
-       IIO_CHAN_INFO_RAW = 0,
-       IIO_CHAN_INFO_PROCESSED,
-       IIO_CHAN_INFO_SCALE,
-       IIO_CHAN_INFO_OFFSET,
-       IIO_CHAN_INFO_CALIBSCALE,
-       IIO_CHAN_INFO_CALIBBIAS,
-       IIO_CHAN_INFO_PEAK,
-       IIO_CHAN_INFO_PEAK_SCALE,
-       IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
-       IIO_CHAN_INFO_AVERAGE_RAW,
-       IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
-       IIO_CHAN_INFO_SAMP_FREQ,
-};
-
-#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
-#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
-
-#define IIO_CHAN_INFO_RAW_SEPARATE_BIT                 \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
-#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT                   \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
-#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT               \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
-#define IIO_CHAN_INFO_SCALE_SHARED_BIT                 \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
-#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT                      \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
-#define IIO_CHAN_INFO_OFFSET_SHARED_BIT                        \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
-#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT                  \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
-#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT                    \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
-#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT                   \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
-#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT                     \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
-#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT                        \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
-#define IIO_CHAN_INFO_PEAK_SHARED_BIT                  \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
-#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT                   \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
-#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT                     \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
-#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT   \
-       IIO_CHAN_INFO_SEPARATE_BIT(                             \
-               IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
-#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT     \
-       IIO_CHAN_INFO_SHARED_BIT(                               \
-               IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
-#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT                 \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
-#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT                   \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
-#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
-       IIO_CHAN_INFO_SHARED_BIT(                              \
-               IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
-#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
-       IIO_CHAN_INFO_SEPARATE_BIT(                            \
-               IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
-#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT           \
-       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
-#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT                     \
-       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
-
-enum iio_endian {
-       IIO_CPU,
-       IIO_BE,
-       IIO_LE,
-};
-
-struct iio_chan_spec;
-struct iio_dev;
-
-/**
- * struct iio_chan_spec_ext_info - Extended channel info attribute
- * @name:      Info attribute name
- * @shared:    Whether this attribute is shared between all channels.
- * @read:      Read callback for this info attribute, may be NULL.
- * @write:     Write callback for this info attribute, may be NULL.
- */
-struct iio_chan_spec_ext_info {
-       const char *name;
-       bool shared;
-       ssize_t (*read)(struct iio_dev *, struct iio_chan_spec const *,
-                       char *buf);
-       ssize_t (*write)(struct iio_dev *, struct iio_chan_spec const *,
-                       const char *buf, size_t len);
-};
-
-/**
- * struct iio_chan_spec - specification of a single channel
- * @type:              What type of measurement is the channel making.
- * @channel:           What number or name do we wish to assign the channel.
- * @channel2:          If there is a second number for a differential
- *                     channel then this is it. If modified is set then the
- *                     value here specifies the modifier.
- * @address:           Driver specific identifier.
- * @scan_index:        Monotonic index to give ordering in scans when read
- *                     from a buffer.
- * @scan_type:         Sign:           's' or 'u' to specify signed or unsigned
- *                     realbits:       Number of valid bits of data
- *                     storage_bits:   Realbits + padding
- *                     shift:          Shift right by this before masking out
- *                                     realbits.
- *                     endianness:     little or big endian
- * @info_mask:         What information is to be exported about this channel.
- *                     This includes calibbias, scale etc.
- * @event_mask:        What events can this channel produce.
- * @ext_info:          Array of extended info attributes for this channel.
- *                     The array is NULL terminated, the last element should
- *                     have it's name field set to NULL.
- * @extend_name:       Allows labeling of channel attributes with an
- *                     informative name. Note this has no effect codes etc,
- *                     unlike modifiers.
- * @datasheet_name:    A name used in in kernel mapping of channels. It should
- *                     correspond to the first name that the channel is referred
- *                     to by in the datasheet (e.g. IND), or the nearest
- *                     possible compound name (e.g. IND-INC).
- * @modified:          Does a modifier apply to this channel. What these are
- *                     depends on the channel type.  Modifier is set in
- *                     channel2. Examples are IIO_MOD_X for axial sensors about
- *                     the 'x' axis.
- * @indexed:           Specify the channel has a numerical index. If not,
- *                     the value in channel will be suppressed for attribute
- *                     but not for event codes. Typically set it to 0 when
- *                     the index is false.
- * @differential:      Channel is differential.
- */
-struct iio_chan_spec {
-       enum iio_chan_type      type;
-       int                     channel;
-       int                     channel2;
-       unsigned long           address;
-       int                     scan_index;
-       struct {
-               char    sign;
-               u8      realbits;
-               u8      storagebits;
-               u8      shift;
-               enum iio_endian endianness;
-       } scan_type;
-       long                    info_mask;
-       long                    event_mask;
-       const struct iio_chan_spec_ext_info *ext_info;
-       const char              *extend_name;
-       const char              *datasheet_name;
-       unsigned                modified:1;
-       unsigned                indexed:1;
-       unsigned                output:1;
-       unsigned                differential:1;
-};
-
-#define IIO_ST(si, rb, sb, sh)                                         \
-       { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
-
-#define IIO_CHAN_SOFT_TIMESTAMP(_si)                                   \
-       { .type = IIO_TIMESTAMP, .channel = -1,                         \
-                       .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
-
-/**
- * iio_get_time_ns() - utility function to get a time stamp for events etc
- **/
-static inline s64 iio_get_time_ns(void)
-{
-       struct timespec ts;
-       /*
-        * calls getnstimeofday.
-        * If hrtimers then up to ns accurate, if not microsecond.
-        */
-       ktime_get_real_ts(&ts);
-
-       return timespec_to_ns(&ts);
-}
-
-/* Device operating modes */
-#define INDIO_DIRECT_MODE              0x01
-#define INDIO_BUFFER_TRIGGERED         0x02
-#define INDIO_BUFFER_HARDWARE          0x08
-
-#define INDIO_ALL_BUFFER_MODES                                 \
-       (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
-
-struct iio_trigger; /* forward declaration */
-struct iio_dev;
-
-/**
- * struct iio_info - constant information about device
- * @driver_module:     module structure used to ensure correct
- *                     ownership of chrdevs etc
- * @event_attrs:       event control attributes
- * @attrs:             general purpose device attributes
- * @read_raw:          function to request a value from the device.
- *                     mask specifies which value. Note 0 means a reading of
- *                     the channel in question.  Return value will specify the
- *                     type of value returned by the device. val and val2 will
- *                     contain the elements making up the returned value.
- * @write_raw:         function to write a value to the device.
- *                     Parameters are the same as for read_raw.
- * @write_raw_get_fmt: callback function to query the expected
- *                     format/precision. If not set by the driver, write_raw
- *                     returns IIO_VAL_INT_PLUS_MICRO.
- * @read_event_config: find out if the event is enabled.
- * @write_event_config:        set if the event is enabled.
- * @read_event_value:  read a value associated with the event. Meaning
- *                     is event dependant. event_code specifies which event.
- * @write_event_value: write the value associated with the event.
- *                     Meaning is event dependent.
- * @validate_trigger:  function to validate the trigger when the
- *                     current trigger gets changed.
- **/
-struct iio_info {
-       struct module                   *driver_module;
-       struct attribute_group          *event_attrs;
-       const struct attribute_group    *attrs;
-
-       int (*read_raw)(struct iio_dev *indio_dev,
-                       struct iio_chan_spec const *chan,
-                       int *val,
-                       int *val2,
-                       long mask);
-
-       int (*write_raw)(struct iio_dev *indio_dev,
-                        struct iio_chan_spec const *chan,
-                        int val,
-                        int val2,
-                        long mask);
-
-       int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
-                        struct iio_chan_spec const *chan,
-                        long mask);
-
-       int (*read_event_config)(struct iio_dev *indio_dev,
-                                u64 event_code);
-
-       int (*write_event_config)(struct iio_dev *indio_dev,
-                                 u64 event_code,
-                                 int state);
-
-       int (*read_event_value)(struct iio_dev *indio_dev,
-                               u64 event_code,
-                               int *val);
-       int (*write_event_value)(struct iio_dev *indio_dev,
-                                u64 event_code,
-                                int val);
-       int (*validate_trigger)(struct iio_dev *indio_dev,
-                               struct iio_trigger *trig);
-       int (*update_scan_mode)(struct iio_dev *indio_dev,
-                               const unsigned long *scan_mask);
-       int (*debugfs_reg_access)(struct iio_dev *indio_dev,
-                                 unsigned reg, unsigned writeval,
-                                 unsigned *readval);
-};
-
-/**
- * struct iio_buffer_setup_ops - buffer setup related callbacks
- * @preenable:         [DRIVER] function to run prior to marking buffer enabled
- * @postenable:                [DRIVER] function to run after marking buffer enabled
- * @predisable:                [DRIVER] function to run prior to marking buffer
- *                     disabled
- * @postdisable:       [DRIVER] function to run after marking buffer disabled
- */
-struct iio_buffer_setup_ops {
-       int                             (*preenable)(struct iio_dev *);
-       int                             (*postenable)(struct iio_dev *);
-       int                             (*predisable)(struct iio_dev *);
-       int                             (*postdisable)(struct iio_dev *);
-};
-
-/**
- * struct iio_dev - industrial I/O device
- * @id:                        [INTERN] used to identify device internally
- * @modes:             [DRIVER] operating modes supported by device
- * @currentmode:       [DRIVER] current operating mode
- * @dev:               [DRIVER] device structure, should be assigned a parent
- *                     and owner
- * @event_interface:   [INTERN] event chrdevs associated with interrupt lines
- * @buffer:            [DRIVER] any buffer present
- * @scan_bytes:                [INTERN] num bytes captured to be fed to buffer demux
- * @mlock:             [INTERN] lock used to prevent simultaneous device state
- *                     changes
- * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
- * @masklength:                [INTERN] the length of the mask established from
- *                     channels
- * @active_scan_mask:  [INTERN] union of all scan masks requested by buffers
- * @scan_timestamp:    [INTERN] set if any buffers have requested timestamp
- * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
- * @trig:              [INTERN] current device trigger (buffer modes)
- * @pollfunc:          [DRIVER] function run on trigger being received
- * @channels:          [DRIVER] channel specification structure table
- * @num_channels:      [DRIVER] number of chanels specified in @channels.
- * @channel_attr_list: [INTERN] keep track of automatically created channel
- *                     attributes
- * @chan_attr_group:   [INTERN] group for all attrs in base directory
- * @name:              [DRIVER] name of the device.
- * @info:              [DRIVER] callbacks and constant info from driver
- * @info_exist_lock:   [INTERN] lock to prevent use during removal
- * @setup_ops:         [DRIVER] callbacks to call before and after buffer
- *                     enable/disable
- * @chrdev:            [INTERN] associated character device
- * @groups:            [INTERN] attribute groups
- * @groupcounter:      [INTERN] index of next attribute group
- * @flags:             [INTERN] file ops related flags including busy flag.
- * @debugfs_dentry:    [INTERN] device specific debugfs dentry.
- * @cached_reg_addr:   [INTERN] cached register address for debugfs reads.
- */
-struct iio_dev {
-       int                             id;
-
-       int                             modes;
-       int                             currentmode;
-       struct device                   dev;
-
-       struct iio_event_interface      *event_interface;
-
-       struct iio_buffer               *buffer;
-       int                             scan_bytes;
-       struct mutex                    mlock;
-
-       const unsigned long             *available_scan_masks;
-       unsigned                        masklength;
-       const unsigned long             *active_scan_mask;
-       bool                            scan_timestamp;
-       unsigned                        scan_index_timestamp;
-       struct iio_trigger              *trig;
-       struct iio_poll_func            *pollfunc;
-
-       struct iio_chan_spec const      *channels;
-       int                             num_channels;
-
-       struct list_head                channel_attr_list;
-       struct attribute_group          chan_attr_group;
-       const char                      *name;
-       const struct iio_info           *info;
-       struct mutex                    info_exist_lock;
-       const struct iio_buffer_setup_ops       *setup_ops;
-       struct cdev                     chrdev;
-#define IIO_MAX_GROUPS 6
-       const struct attribute_group    *groups[IIO_MAX_GROUPS + 1];
-       int                             groupcounter;
-
-       unsigned long                   flags;
-#if defined(CONFIG_DEBUG_FS)
-       struct dentry                   *debugfs_dentry;
-       unsigned                        cached_reg_addr;
-#endif
-};
-
-/**
- * iio_find_channel_from_si() - get channel from its scan index
- * @indio_dev:         device
- * @si:                        scan index to match
- */
-const struct iio_chan_spec
-*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
-
-/**
- * iio_device_register() - register a device with the IIO subsystem
- * @indio_dev:         Device structure filled by the device driver
- **/
-int iio_device_register(struct iio_dev *indio_dev);
-
-/**
- * iio_device_unregister() - unregister a device from the IIO subsystem
- * @indio_dev:         Device structure representing the device.
- **/
-void iio_device_unregister(struct iio_dev *indio_dev);
-
-/**
- * iio_push_event() - try to add event to the list for userspace reading
- * @indio_dev:         IIO device structure
- * @ev_code:           What event
- * @timestamp:         When the event occurred
- **/
-int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
-
-extern struct bus_type iio_bus_type;
-
-/**
- * iio_put_device() - reference counted deallocation of struct device
- * @dev: the iio_device containing the device
- **/
-static inline void iio_put_device(struct iio_dev *indio_dev)
-{
-       if (indio_dev)
-               put_device(&indio_dev->dev);
-};
-
-/* Can we make this smaller? */
-#define IIO_ALIGN L1_CACHE_BYTES
-/**
- * iio_allocate_device() - allocate an iio_dev from a driver
- * @sizeof_priv: Space to allocate for private structure.
- **/
-struct iio_dev *iio_allocate_device(int sizeof_priv);
-
-static inline void *iio_priv(const struct iio_dev *indio_dev)
-{
-       return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
-}
-
-static inline struct iio_dev *iio_priv_to_dev(void *priv)
-{
-       return (struct iio_dev *)((char *)priv -
-                                 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
-}
-
-/**
- * iio_free_device() - free an iio_dev from a driver
- * @dev: the iio_dev associated with the device
- **/
-void iio_free_device(struct iio_dev *indio_dev);
-
-/**
- * iio_buffer_enabled() - helper function to test if the buffer is enabled
- * @indio_dev:         IIO device info structure for device
- **/
-static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
-{
-       return indio_dev->currentmode
-               & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
-};
-
-/**
- * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
- * @indio_dev:         IIO device info structure for device
- **/
-#if defined(CONFIG_DEBUG_FS)
-static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
-{
-       return indio_dev->debugfs_dentry;
-};
-#else
-static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
-{
-       return NULL;
-};
-#endif
-
-#endif /* _INDUSTRIAL_IO_H_ */
index f39f346bf04fa35f75544ded8f0ecbe663cf61c4..0cd4fe916bf90ecd83894b27fbf249693c21b02c 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/sysfs.h>
 
 #include "iio_dummy_evgen.h"
-#include "iio.h"
-#include "sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 /* Fiddly bit of faking and irq without hardware */
 #define IIO_EVENTGEN_NO 10
index a603a5f51f9380b23a04058af42c9d525b931d03..b03554fee443488adbe8d32726842b59b1603bb0 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/platform_device.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
-#include "consumer.h"
-#include "types.h"
+#include <linux/iio/consumer.h>
+#include <linux/iio/types.h>
 
 /**
  * struct iio_hwmon_state - device instance state
index dbeb04c70f0fe3e1c950bffe612a227680ff74f7..fa4a653290091360813b957f6a99e1f61b023475 100644 (file)
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
-#include "iio.h"
-#include "sysfs.h"
-#include "events.h"
-#include "buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
+#include <linux/iio/buffer.h>
 #include "iio_simple_dummy.h"
 
 /*
index 49e7aa19889f4224e789c10127b7b30fa20c571d..372606572d151ac3d94d231bc7b7f96ef07ecaf4 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/irq.h>
 #include <linux/bitmap.h>
 
-#include "iio.h"
-#include "trigger_consumer.h"
-#include "kfifo_buf.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger_consumer.h>
+#include <linux/iio/kfifo_buf.h>
 
 #include "iio_simple_dummy.h"
 
index 449c7a5ece800392fba63b150c4639ab0ee95062..f85bd197ed3177a2d00ab2d0b9b8b804cf47fdec 100644 (file)
@@ -12,9 +12,9 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 
-#include "iio.h"
-#include "sysfs.h"
-#include "events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 #include "iio_simple_dummy.h"
 
 /* Evgen 'fakes' interrupt events for this example */
index 8a0485e697470d4de4bc3dac31788e9e0c7ff522..9d99a7f67fa49cbf9be752a988b54427eda32524 100644 (file)
@@ -19,9 +19,9 @@
 #include <linux/module.h>
 #include <asm/div64.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "../ring_sw.h"
 
 #include "ad5933.h"
index 58a150c1e435ae8900365649a166a1360913256a..68ecc1525017cc441aca2b8a102c66e0acb0f4c4 100644 (file)
@@ -26,9 +26,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "adis16400.h"
 
 enum adis16400_chip_variant {
index d964004fe11bd973f78d7af08e4b4176be751c95..e43c0e2f43a6f41e2bd11c2d7502556fedc36551 100644 (file)
@@ -6,9 +6,9 @@
 #include <linux/bitops.h>
 #include <linux/export.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "adis16400.h"
 
 /**
index 5bf0007575222377b2005ed6427b9d77b0e81689..bd22e6cc11c3faaf74376205f4795e081e2d8511 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "adis16400.h"
 
 /**
index b409b95b5ee51fe11c6be3ed6656553c41882c06..b5b2c38045c54e99800565fb39f22bbaab27a79d 100644 (file)
 #include <linux/slab.h>
 #include <linux/poll.h>
 
-#include "iio.h"
+#include <linux/iio/iio.h>
 #include "iio_core.h"
-#include "sysfs.h"
-#include "buffer.h"
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 
 static const char * const iio_endian_prefix[] = {
        [IIO_BE] = "be",
index db55b815a24ede8d93ae67efb403bb3ba253e4c4..dd1a6a2e81c079f9ec25e3f88a1eb5ca001cc021 100644 (file)
 #include <linux/slab.h>
 #include <linux/anon_inodes.h>
 #include <linux/debugfs.h>
-#include "iio.h"
+#include <linux/iio/iio.h>
 #include "iio_core.h"
 #include "iio_core_trigger.h"
-#include "sysfs.h"
-#include "events.h"
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 /* IDA to assign each registered device a unique id*/
 static DEFINE_IDA(iio_ida);
index 5fdf739e38f9d8d00354ae456c36f68e16088d46..5fcf50b1ae5a2cd18c70963431e65d0b18ec414d 100644 (file)
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/wait.h>
-#include "iio.h"
+#include <linux/iio/iio.h>
 #include "iio_core.h"
-#include "sysfs.h"
-#include "events.h"
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 
 /**
  * struct iio_event_interface - chrdev interface for an event line
index 47ecadd4818d5427771c302585edff8909a9e777..03fee2e097ca9bcae8933ef2621c3178e3c789ad 100644 (file)
 #include <linux/list.h>
 #include <linux/slab.h>
 
-#include "iio.h"
-#include "trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "iio_core.h"
 #include "iio_core_trigger.h"
-#include "trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 
 /* RFC - Question of approach
  * Make the common case (single sensor single trigger)
index de2c8ea649653f9eb50be0eb0b571fdc53792483..22ddf62b107c23ace290ca88d687a604991e8ff9 100644 (file)
 #include <linux/slab.h>
 #include <linux/mutex.h>
 
-#include "iio.h"
+#include <linux/iio/iio.h>
 #include "iio_core.h"
-#include "machine.h"
-#include "driver.h"
-#include "consumer.h"
+#include <linux/iio/machine.h>
+#include <linux/iio/driver.h>
+#include <linux/iio/consumer.h>
 
 struct iio_map_internal {
        struct iio_dev *indio_dev;
index 9f3bd59c0e72bd3a0919d3b6d49a27b8750e1caa..6bf9d05f48411105b68d15a600a617ddea39c47e 100644 (file)
@@ -5,8 +5,7 @@
 #include <linux/workqueue.h>
 #include <linux/kfifo.h>
 #include <linux/mutex.h>
-
-#include "kfifo_buf.h"
+#include <linux/iio/kfifo_buf.h>
 
 struct iio_kfifo {
        struct iio_buffer buffer;
diff --git a/drivers/staging/iio/kfifo_buf.h b/drivers/staging/iio/kfifo_buf.h
deleted file mode 100644 (file)
index 9f7da01..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#include <linux/kfifo.h>
-#include "iio.h"
-#include "buffer.h"
-
-struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
-void iio_kfifo_free(struct iio_buffer *r);
-
index 2c894a6f78815481c3c62d8c3662360b11b617a7..92283ebafa55878549d97c4e9beaee78e2608440 100644 (file)
@@ -28,8 +28,8 @@
 #include <linux/delay.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define CONVERSION_TIME_MS             100
 
index 7057d9b566248cb4730379e642506187bb54adf0..2ada20e65f22a9d7b797246ce649f5ac8f3b884f 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/regmap.h>
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define CONVERSION_TIME_MS             100
 
index a1e5cbeb25acff06f32a199d285ef74eb2f0a786..6351360041037acce4b3ee5f2f70f6adc58f717c 100644 (file)
@@ -35,9 +35,9 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../events.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/events.h>
 #include "tsl2563.h"
 
 /* Use this many bits for fraction part. */
index 8671d98e0448465d3366e089a13e3627fcffc4e7..51b636241d975d2b680de315b763a4c68489a8a7 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/unistd.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include "../iio.h"
+#include <linux/iio/iio.h>
 
 #define TSL258X_MAX_DEVICE_REGS                32
 
index f3fc85a22b1a1480f968dbcd56f1ca75ecfb4f7b..dfc3da6e92e9476bbe46e9971c9f19839e7be06d 100755 (executable)
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/version.h>
+#include <linux/iio/events.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "tsl2x7x.h"
-#include "../events.h"
-#include "../iio.h"
-#include "../sysfs.h"
 
 /* Cal defs*/
 #define PROX_STAT_CAL        0
diff --git a/drivers/staging/iio/machine.h b/drivers/staging/iio/machine.h
deleted file mode 100644 (file)
index 0b1f19b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Industrial I/O in kernel access map definitions for board files.
- *
- * Copyright (c) 2011 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-/**
- * struct iio_map - description of link between consumer and device channels
- * @adc_channel_label: Label used to identify the channel on the provider.
- *                     This is matched against the datasheet_name element
- *                     of struct iio_chan_spec.
- * @consumer_dev_name: Name to uniquely identify the consumer device.
- * @consumer_channel:  Unique name used to idenitify the channel on the
- *                     consumer side.
- */
-struct iio_map {
-       const char *adc_channel_label;
-       const char *consumer_dev_name;
-       const char *consumer_channel;
-};
index 000886fb81a966531e8ae5bc53d3f85daaba4990..d088548c2fa878523f2b9789317bfb8006318465 100644 (file)
@@ -30,8 +30,8 @@
 
 #include <linux/gpio.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 /*
  * Register definitions, as well as various shifts and masks to get at the
  * individual fields of the registers.
index 27c26294b26178e03ede8e8a4af95a3a7eaca71b..3433c41fe5486c81c5c00fc05d7677e01a393334 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/types.h>
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define HMC5843_I2C_ADDRESS                    0x1E
 
index 57baac6c0d40dc64d4b66552858a0950ee44efd2..9b26ae1f23b78b3e9d3746459ecddfa570787a4c 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "meter.h"
 #include "ade7753.h"
 
index 8d81c92007e9012f1e2fc3e0cad267b531dd3cbe..02d10dfe8ac5d4c258c865e5a064c426919c4214 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "meter.h"
 #include "ade7754.h"
 
index 729c03311b9eb917a9506ce2e4bd3da872dfe114..4a3b429003f19ee8dff56fc855e06efd87a937d4 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
-#include "../buffer.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/buffer.h>
 #include "meter.h"
 #include "ade7758.h"
 
index b37bc98ce4d76c32327f35140752a52a984a0ab6..7b9be8a2cc50f6f563c1a5b4fed345862311b9f8 100644 (file)
@@ -12,9 +12,9 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "../ring_sw.h"
-#include "../trigger_consumer.h"
+#include <linux/iio/trigger_consumer.h>
 #include "ade7758.h"
 
 /**
index b6569c706651dffb8a0776ebf92aa0b9a0ea449c..5c48d382dfdbcaebb76aca1e98d4212ff7a3746b 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/spi/spi.h>
 #include <linux/export.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 #include "ade7758.h"
 
 /**
index 0beab478dcd9490a64d98b8676988771ed65063c..1f2b74add572163b8f9f26ec7e2858b67960613c 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "meter.h"
 #include "ade7759.h"
 
index 1e1faa0479d3a734c32ffca43f86417442ce7e3d..c87c86b095e0713d32351000663004f1493bcd4a 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "ade7854.h"
 
 static int ade7854_i2c_write_reg_8(struct device *dev,
index 81121862c1bd405c66da08131fe678a53647765d..11c2cef0e73b618cb53ba2834938e7af46f159ca 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
-#include "../iio.h"
+#include <linux/iio/iio.h>
 #include "ade7854.h"
 
 static int ade7854_spi_write_reg_8(struct device *dev,
index 49c01c5c1b590a95b6947893c0a14ead61a1bba7..2f3c1e2a4b14e0ef25c3e447d384d5ba311db3ad 100644 (file)
@@ -17,8 +17,8 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "meter.h"
 #include "ade7854.h"
 
index 6a3db142363102ba84fd59bc0ef0113d00daafa0..23e1b5f480a9d203b88191c26daa29f3da693072 100644 (file)
@@ -1,4 +1,4 @@
-#include "../sysfs.h"
+#include <linux/iio/sysfs.h>
 
 /* metering ic types of attribute */
 
index 0465e5dff23ab3bf0b817845b1f0920e3d43fe73..48e70e9effd50dfcecd49ca9e225e0b2e39835b3 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/gpio.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 #define DRV_NAME "ad2s1200"
 
index c6ced163105d5977cdb0656ae73bccb1975fc9f2..4d580e238eb8333bb385e12f8cf9149e70d3e61f 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/gpio.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include "ad2s1210.h"
 
 #define DRV_NAME "ad2s1210"
index 20ca5298cdf256ee888a93dbd1da0b3be5a69119..cb689104937f3a47169504b750ead67c0358874e 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/sysfs.h>
 #include <linux/module.h>
 
-#include "../iio.h"
-#include "../sysfs.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 
 struct ad2s90_state {
        struct mutex lock;
index b9945ec44faa6c7386851f0d093b9b62068f27ab..9358c6cb1c72ff10a2b59e00206463984147ebb1 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/sched.h>
 #include <linux/poll.h>
 #include "ring_sw.h"
-#include "trigger.h"
+#include <linux/iio/trigger.h>
 
 /**
  * struct iio_sw_ring_buffer - software ring buffer
index 7556e2122367ecbf1f979734882680ff0b576f41..a5857aa7aefaaf2405224bd96177868a65b503e7 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef _IIO_RING_SW_H_
 #define _IIO_RING_SW_H_
-#include "buffer.h"
+#include <linux/iio/buffer.h>
 
 struct iio_buffer *iio_sw_rb_allocate(struct iio_dev *indio_dev);
 void iio_sw_rb_free(struct iio_buffer *ring);
diff --git a/drivers/staging/iio/sysfs.h b/drivers/staging/iio/sysfs.h
deleted file mode 100644 (file)
index bfedb73..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/* The industrial I/O core
- *
- *Copyright (c) 2008 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- * General attributes
- */
-
-#ifndef _INDUSTRIAL_IO_SYSFS_H_
-#define _INDUSTRIAL_IO_SYSFS_H_
-
-struct iio_chan_spec;
-
-/**
- * struct iio_dev_attr - iio specific device attribute
- * @dev_attr:  underlying device attribute
- * @address:   associated register address
- * @l:         list head for maintaining list of dynamically created attrs.
- */
-struct iio_dev_attr {
-       struct device_attribute dev_attr;
-       u64 address;
-       struct list_head l;
-       struct iio_chan_spec const *c;
-};
-
-#define to_iio_dev_attr(_dev_attr)                             \
-       container_of(_dev_attr, struct iio_dev_attr, dev_attr)
-
-ssize_t iio_read_const_attr(struct device *dev,
-                           struct device_attribute *attr,
-                           char *len);
-
-/**
- * struct iio_const_attr - constant device specific attribute
- *                         often used for things like available modes
- * @string:    attribute string
- * @dev_attr:  underlying device attribute
- */
-struct iio_const_attr {
-       const char *string;
-       struct device_attribute dev_attr;
-};
-
-#define to_iio_const_attr(_dev_attr) \
-       container_of(_dev_attr, struct iio_const_attr, dev_attr)
-
-/* Some attributes will be hard coded (device dependent) and not require an
-   address, in these cases pass a negative */
-#define IIO_ATTR(_name, _mode, _show, _store, _addr)           \
-       { .dev_attr = __ATTR(_name, _mode, _show, _store),      \
-         .address = _addr }
-
-#define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr)    \
-       struct iio_dev_attr iio_dev_attr_##_name                \
-       = IIO_ATTR(_name, _mode, _show, _store, _addr)
-
-#define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
-       struct iio_dev_attr iio_dev_attr_##_vname                       \
-       = IIO_ATTR(_name, _mode, _show, _store, _addr)
-
-#define IIO_CONST_ATTR(_name, _string)                                 \
-       struct iio_const_attr iio_const_attr_##_name                    \
-       = { .string = _string,                                          \
-           .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
-
-#define IIO_CONST_ATTR_NAMED(_vname, _name, _string)                   \
-       struct iio_const_attr iio_const_attr_##_vname                   \
-       = { .string = _string,                                          \
-           .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
-
-/* Generic attributes of onetype or another */
-/**
- * IIO_DEV_ATTR_RESET: resets the device
- **/
-#define IIO_DEV_ATTR_RESET(_store)                     \
-       IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
-
-/**
- * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
- * @_mode: sysfs file mode/permissions
- * @_show: output method for the attribute
- * @_store: input method for the attribute
- **/
-#define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store)                   \
-       IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
-
-/**
- * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
- * @_show: output method for the attribute
- *
- * May be mode dependent on some devices
- **/
-#define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)                            \
-       IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
-/**
- * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
- * @_string: frequency string for the attribute
- *
- * Constant version
- **/
-#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string)                        \
-       IIO_CONST_ATTR(sampling_frequency_available, _string)
-
-#define IIO_DEV_ATTR_TEMP_RAW(_show)                   \
-       IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
-
-#define IIO_CONST_ATTR_TEMP_OFFSET(_string)            \
-       IIO_CONST_ATTR(in_temp_offset, _string)
-
-#define IIO_CONST_ATTR_TEMP_SCALE(_string)             \
-       IIO_CONST_ATTR(in_temp_scale, _string)
-
-#endif /* _INDUSTRIAL_IO_SYSFS_H_ */
diff --git a/drivers/staging/iio/trigger.h b/drivers/staging/iio/trigger.h
deleted file mode 100644 (file)
index 1cfca23..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/* The industrial I/O core, trigger handling functions
- *
- * Copyright (c) 2008 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-#include <linux/irq.h>
-#include <linux/module.h>
-
-#ifndef _IIO_TRIGGER_H_
-#define _IIO_TRIGGER_H_
-
-struct iio_subirq {
-       bool enabled;
-};
-
-/**
- * struct iio_trigger_ops - operations structure for an iio_trigger.
- * @owner:             used to monitor usage count of the trigger.
- * @set_trigger_state: switch on/off the trigger on demand
- * @try_reenable:      function to reenable the trigger when the
- *                     use count is zero (may be NULL)
- * @validate_device:   function to validate the device when the
- *                     current trigger gets changed.
- *
- * This is typically static const within a driver and shared by
- * instances of a given device.
- **/
-struct iio_trigger_ops {
-       struct module                   *owner;
-       int (*set_trigger_state)(struct iio_trigger *trig, bool state);
-       int (*try_reenable)(struct iio_trigger *trig);
-       int (*validate_device)(struct iio_trigger *trig,
-                              struct iio_dev *indio_dev);
-};
-
-
-/**
- * struct iio_trigger - industrial I/O trigger device
- *
- * @id:                        [INTERN] unique id number
- * @name:              [DRIVER] unique name
- * @dev:               [DRIVER] associated device (if relevant)
- * @private_data:      [DRIVER] device specific data
- * @list:              [INTERN] used in maintenance of global trigger list
- * @alloc_list:                [DRIVER] used for driver specific trigger list
- * @use_count:         use count for the trigger
- * @subirq_chip:       [INTERN] associate 'virtual' irq chip.
- * @subirq_base:       [INTERN] base number for irqs provided by trigger.
- * @subirqs:           [INTERN] information about the 'child' irqs.
- * @pool:              [INTERN] bitmap of irqs currently in use.
- * @pool_lock:         [INTERN] protection of the irq pool.
- **/
-struct iio_trigger {
-       const struct iio_trigger_ops    *ops;
-       int                             id;
-       const char                      *name;
-       struct device                   dev;
-
-       void                            *private_data;
-       struct list_head                list;
-       struct list_head                alloc_list;
-       int use_count;
-
-       struct irq_chip                 subirq_chip;
-       int                             subirq_base;
-
-       struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
-       unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
-       struct mutex                    pool_lock;
-};
-
-
-static inline struct iio_trigger *to_iio_trigger(struct device *d)
-{
-       return container_of(d, struct iio_trigger, dev);
-};
-
-static inline void iio_put_trigger(struct iio_trigger *trig)
-{
-       module_put(trig->ops->owner);
-       put_device(&trig->dev);
-};
-
-static inline void iio_get_trigger(struct iio_trigger *trig)
-{
-       get_device(&trig->dev);
-       __module_get(trig->ops->owner);
-};
-
-/**
- * iio_trigger_register() - register a trigger with the IIO core
- * @trig_info: trigger to be registered
- **/
-int iio_trigger_register(struct iio_trigger *trig_info);
-
-/**
- * iio_trigger_unregister() - unregister a trigger from the core
- * @trig_info: trigger to be unregistered
- **/
-void iio_trigger_unregister(struct iio_trigger *trig_info);
-
-/**
- * iio_trigger_poll() - called on a trigger occurring
- * @trig: trigger which occurred
- *
- * Typically called in relevant hardware interrupt handler.
- **/
-void iio_trigger_poll(struct iio_trigger *trig, s64 time);
-void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
-
-irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
-
-__printf(1, 2) struct iio_trigger *iio_allocate_trigger(const char *fmt, ...);
-void iio_free_trigger(struct iio_trigger *trig);
-
-#endif /* _IIO_TRIGGER_H_ */
index 665653d79f029fcea615d7077b384e40d688629a..999fd2e00e81b1ce633ac2d885577298f89caebf 100644 (file)
@@ -15,8 +15,8 @@
 
 #include <asm/gptimers.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 
 struct bfin_timer {
        unsigned short id, bit;
index a3465947235ea949610d8ee39505a7c4a5322897..95fd2f780f52b66dccdd656e2c20d10380cb5fdd 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/gpio.h>
 #include <linux/slab.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 
 static LIST_HEAD(iio_gpio_trigger_list);
 static DEFINE_MUTEX(iio_gpio_trigger_list_lock);
index a80cf67bf84d599034c58379ab9dc84179df2561..2c3ccda745eb6d9ec66b53116f6e812e3a526158 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/rtc.h>
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 
 static LIST_HEAD(iio_prtc_trigger_list);
 static DEFINE_MUTEX(iio_prtc_trigger_list_lock);
index 174dc65709d5d02d53c5f15c458e35e3ccd03c55..404ef192f89fc57055e4258690945f70774583b5 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/slab.h>
 #include <linux/list.h>
 
-#include "../iio.h"
-#include "../trigger.h"
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
 
 struct iio_sysfs_trig {
        struct iio_trigger *trig;
diff --git a/drivers/staging/iio/trigger_consumer.h b/drivers/staging/iio/trigger_consumer.h
deleted file mode 100644 (file)
index 60d64b3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* The industrial I/O core, trigger consumer functions
- *
- * Copyright (c) 2008-2011 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-/**
- * struct iio_poll_func - poll function pair
- *
- * @indio_dev:                 data specific to device (passed into poll func)
- * @h:                         the function that is actually run on trigger
- * @thread:                    threaded interrupt part
- * @type:                      the type of interrupt (basically if oneshot)
- * @name:                      name used to identify the trigger consumer.
- * @irq:                       the corresponding irq as allocated from the
- *                             trigger pool
- * @timestamp:                 some devices need a timestamp grabbed as soon
- *                             as possible after the trigger - hence handler
- *                             passes it via here.
- **/
-struct iio_poll_func {
-       struct iio_dev *indio_dev;
-       irqreturn_t (*h)(int irq, void *p);
-       irqreturn_t (*thread)(int irq, void *p);
-       int type;
-       char *name;
-       int irq;
-       s64 timestamp;
-};
-
-
-struct iio_poll_func
-*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
-                   irqreturn_t (*thread)(int irq, void *p),
-                   int type,
-                   struct iio_dev *indio_dev,
-                   const char *fmt,
-                   ...);
-void iio_dealloc_pollfunc(struct iio_poll_func *pf);
-irqreturn_t iio_pollfunc_store_time(int irq, void *p);
-
-void iio_trigger_notify_done(struct iio_trigger *trig);
-
-/*
- * Two functions for common case where all that happens is a pollfunc
- * is attached and detached from a trigger
- */
-int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
-int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
diff --git a/drivers/staging/iio/types.h b/drivers/staging/iio/types.h
deleted file mode 100644 (file)
index 0c32136..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* industrial I/O data types needed both in and out of kernel
- *
- * Copyright (c) 2008 Jonathan Cameron
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-#ifndef _IIO_TYPES_H_
-#define _IIO_TYPES_H_
-
-enum iio_chan_type {
-       /* real channel types */
-       IIO_VOLTAGE,
-       IIO_CURRENT,
-       IIO_POWER,
-       IIO_ACCEL,
-       IIO_ANGL_VEL,
-       IIO_MAGN,
-       IIO_LIGHT,
-       IIO_INTENSITY,
-       IIO_PROXIMITY,
-       IIO_TEMP,
-       IIO_INCLI,
-       IIO_ROT,
-       IIO_ANGL,
-       IIO_TIMESTAMP,
-       IIO_CAPACITANCE,
-};
-
-enum iio_modifier {
-       IIO_NO_MOD,
-       IIO_MOD_X,
-       IIO_MOD_Y,
-       IIO_MOD_Z,
-       IIO_MOD_X_AND_Y,
-       IIO_MOD_X_AND_Z,
-       IIO_MOD_Y_AND_Z,
-       IIO_MOD_X_AND_Y_AND_Z,
-       IIO_MOD_X_OR_Y,
-       IIO_MOD_X_OR_Z,
-       IIO_MOD_Y_OR_Z,
-       IIO_MOD_X_OR_Y_OR_Z,
-       IIO_MOD_LIGHT_BOTH,
-       IIO_MOD_LIGHT_IR,
-};
-
-#define IIO_VAL_INT 1
-#define IIO_VAL_INT_PLUS_MICRO 2
-#define IIO_VAL_INT_PLUS_NANO 3
-
-#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
new file mode 100644 (file)
index 0000000..fb0fe46
--- /dev/null
@@ -0,0 +1,191 @@
+/* The industrial I/O core - generic buffer interfaces.
+ *
+ * Copyright (c) 2008 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#ifndef _IIO_BUFFER_GENERIC_H_
+#define _IIO_BUFFER_GENERIC_H_
+#include <linux/sysfs.h>
+#include <linux/iio/iio.h>
+
+#ifdef CONFIG_IIO_BUFFER
+
+struct iio_buffer;
+
+/**
+ * struct iio_buffer_access_funcs - access functions for buffers.
+ * @store_to:          actually store stuff to the buffer
+ * @read_first_n:      try to get a specified number of bytes (must exist)
+ * @request_update:    if a parameter change has been marked, update underlying
+ *                     storage.
+ * @get_bytes_per_datum:get current bytes per datum
+ * @set_bytes_per_datum:set number of bytes per datum
+ * @get_length:                get number of datums in buffer
+ * @set_length:                set number of datums in buffer
+ *
+ * The purpose of this structure is to make the buffer element
+ * modular as event for a given driver, different usecases may require
+ * different buffer designs (space efficiency vs speed for example).
+ *
+ * It is worth noting that a given buffer implementation may only support a
+ * small proportion of these functions.  The core code 'should' cope fine with
+ * any of them not existing.
+ **/
+struct iio_buffer_access_funcs {
+       int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp);
+       int (*read_first_n)(struct iio_buffer *buffer,
+                           size_t n,
+                           char __user *buf);
+
+       int (*request_update)(struct iio_buffer *buffer);
+
+       int (*get_bytes_per_datum)(struct iio_buffer *buffer);
+       int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
+       int (*get_length)(struct iio_buffer *buffer);
+       int (*set_length)(struct iio_buffer *buffer, int length);
+};
+
+/**
+ * struct iio_buffer - general buffer structure
+ * @length:            [DEVICE] number of datums in buffer
+ * @bytes_per_datum:   [DEVICE] size of individual datum including timestamp
+ * @scan_el_attrs:     [DRIVER] control of scan elements if that scan mode
+ *                     control method is used
+ * @scan_mask:         [INTERN] bitmask used in masking scan mode elements
+ * @scan_timestamp:    [INTERN] does the scan mode include a timestamp
+ * @access:            [DRIVER] buffer access functions associated with the
+ *                     implementation.
+ * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes.
+ * @scan_el_group:     [DRIVER] attribute group for those attributes not
+ *                     created from the iio_chan_info array.
+ * @pollq:             [INTERN] wait queue to allow for polling on the buffer.
+ * @stufftoread:       [INTERN] flag to indicate new data.
+ * @demux_list:                [INTERN] list of operations required to demux the scan.
+ * @demux_bounce:      [INTERN] buffer for doing gather from incoming scan.
+ **/
+struct iio_buffer {
+       int                                     length;
+       int                                     bytes_per_datum;
+       struct attribute_group                  *scan_el_attrs;
+       long                                    *scan_mask;
+       bool                                    scan_timestamp;
+       const struct iio_buffer_access_funcs    *access;
+       struct list_head                        scan_el_dev_attr_list;
+       struct attribute_group                  scan_el_group;
+       wait_queue_head_t                       pollq;
+       bool                                    stufftoread;
+       const struct attribute_group *attrs;
+       struct list_head                        demux_list;
+       unsigned char                           *demux_bounce;
+};
+
+/**
+ * iio_buffer_init() - Initialize the buffer structure
+ * @buffer: buffer to be initialized
+ **/
+void iio_buffer_init(struct iio_buffer *buffer);
+
+/**
+ * __iio_update_buffer() - update common elements of buffers
+ * @buffer:            buffer that is the event source
+ * @bytes_per_datum:   size of individual datum including timestamp
+ * @length:            number of datums in buffer
+ **/
+static inline void __iio_update_buffer(struct iio_buffer *buffer,
+                                      int bytes_per_datum, int length)
+{
+       buffer->bytes_per_datum = bytes_per_datum;
+       buffer->length = length;
+}
+
+int iio_scan_mask_query(struct iio_dev *indio_dev,
+                       struct iio_buffer *buffer, int bit);
+
+/**
+ * iio_scan_mask_set() - set particular bit in the scan mask
+ * @buffer: the buffer whose scan mask we are interested in
+ * @bit: the bit to be set.
+ **/
+int iio_scan_mask_set(struct iio_dev *indio_dev,
+                     struct iio_buffer *buffer, int bit);
+
+/**
+ * iio_push_to_buffer() - push to a registered buffer.
+ * @buffer:            IIO buffer structure for device
+ * @scan:              Full scan.
+ * @timestamp:
+ */
+int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data,
+                      s64 timestamp);
+
+int iio_update_demux(struct iio_dev *indio_dev);
+
+/**
+ * iio_buffer_register() - register the buffer with IIO core
+ * @indio_dev: device with the buffer to be registered
+ **/
+int iio_buffer_register(struct iio_dev *indio_dev,
+                       const struct iio_chan_spec *channels,
+                       int num_channels);
+
+/**
+ * iio_buffer_unregister() - unregister the buffer from IIO core
+ * @indio_dev: the device with the buffer to be unregistered
+ **/
+void iio_buffer_unregister(struct iio_dev *indio_dev);
+
+/**
+ * iio_buffer_read_length() - attr func to get number of datums in the buffer
+ **/
+ssize_t iio_buffer_read_length(struct device *dev,
+                              struct device_attribute *attr,
+                              char *buf);
+/**
+ * iio_buffer_write_length() - attr func to set number of datums in the buffer
+ **/
+ssize_t iio_buffer_write_length(struct device *dev,
+                             struct device_attribute *attr,
+                             const char *buf,
+                             size_t len);
+/**
+ * iio_buffer_store_enable() - attr to turn the buffer on
+ **/
+ssize_t iio_buffer_store_enable(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf,
+                               size_t len);
+/**
+ * iio_buffer_show_enable() - attr to see if the buffer is on
+ **/
+ssize_t iio_buffer_show_enable(struct device *dev,
+                              struct device_attribute *attr,
+                              char *buf);
+#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR,  \
+                                          iio_buffer_read_length,      \
+                                          iio_buffer_write_length)
+
+#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR,  \
+                                          iio_buffer_show_enable,      \
+                                          iio_buffer_store_enable)
+
+int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
+
+#else /* CONFIG_IIO_BUFFER */
+
+static inline int iio_buffer_register(struct iio_dev *indio_dev,
+                                          struct iio_chan_spec *channels,
+                                          int num_channels)
+{
+       return 0;
+}
+
+static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
+{};
+
+#endif /* CONFIG_IIO_BUFFER */
+
+#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
new file mode 100644 (file)
index 0000000..1a15e56
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Industrial I/O in kernel consumer interface
+ *
+ * Copyright (c) 2011 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#ifndef _IIO_INKERN_CONSUMER_H_
+#define _IIO_INKERN_CONSUMER_H
+#include <linux/iio/types.h>
+
+struct iio_dev;
+struct iio_chan_spec;
+
+/**
+ * struct iio_channel - everything needed for a consumer to use a channel
+ * @indio_dev:         Device on which the channel exists.
+ * @channel:           Full description of the channel.
+ */
+struct iio_channel {
+       struct iio_dev *indio_dev;
+       const struct iio_chan_spec *channel;
+};
+
+/**
+ * iio_channel_get() - get description of all that is needed to access channel.
+ * @name:              Unique name of the device as provided in the iio_map
+ *                     with which the desired provider to consumer mapping
+ *                     was registered.
+ * @consumer_channel:  Unique name to identify the channel on the consumer
+ *                     side. This typically describes the channels use within
+ *                     the consumer. E.g. 'battery_voltage'
+ */
+struct iio_channel *iio_st_channel_get(const char *name,
+                                      const char *consumer_channel);
+
+/**
+ * iio_st_channel_release() - release channels obtained via iio_st_channel_get
+ * @chan:              The channel to be released.
+ */
+void iio_st_channel_release(struct iio_channel *chan);
+
+/**
+ * iio_st_channel_get_all() - get all channels associated with a client
+ * @name:              name of consumer device.
+ *
+ * Returns an array of iio_channel structures terminated with one with
+ * null iio_dev pointer.
+ * This function is used by fairly generic consumers to get all the
+ * channels registered as having this consumer.
+ */
+struct iio_channel *iio_st_channel_get_all(const char *name);
+
+/**
+ * iio_st_channel_release_all() - reverse iio_st_get_all
+ * @chan:              Array of channels to be released.
+ */
+void iio_st_channel_release_all(struct iio_channel *chan);
+
+/**
+ * iio_st_read_channel_raw() - read from a given channel
+ * @channel:           The channel being queried.
+ * @val:               Value read back.
+ *
+ * Note raw reads from iio channels are in adc counts and hence
+ * scale will need to be applied if standard units required.
+ */
+int iio_st_read_channel_raw(struct iio_channel *chan,
+                           int *val);
+
+/**
+ * iio_st_get_channel_type() - get the type of a channel
+ * @channel:           The channel being queried.
+ * @type:              The type of the channel.
+ *
+ * returns the enum iio_chan_type of the channel
+ */
+int iio_st_get_channel_type(struct iio_channel *channel,
+                           enum iio_chan_type *type);
+
+/**
+ * iio_st_read_channel_scale() - read the scale value for a channel
+ * @channel:           The channel being queried.
+ * @val:               First part of value read back.
+ * @val2:              Second part of value read back.
+ *
+ * Note returns a description of what is in val and val2, such
+ * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
+ * + val2/1e6
+ */
+int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
+                             int *val2);
+
+#endif
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
new file mode 100644 (file)
index 0000000..a4f8b2e
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Industrial I/O in kernel access map interface.
+ *
+ * Copyright (c) 2011 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#ifndef _IIO_INKERN_H_
+#define _IIO_INKERN_H_
+
+struct iio_map;
+
+/**
+ * iio_map_array_register() - tell the core about inkernel consumers
+ * @indio_dev: provider device
+ * @map:       array of mappings specifying association of channel with client
+ */
+int iio_map_array_register(struct iio_dev *indio_dev,
+                          struct iio_map *map);
+
+/**
+ * iio_map_array_unregister() - tell the core to remove consumer mappings
+ * @indio_dev: provider device
+ * @map:       array of mappings to remove. Note these must have same memory
+ *             addresses as those originally added not just equal parameter
+ *             values.
+ */
+int iio_map_array_unregister(struct iio_dev *indio_dev,
+                            struct iio_map *map);
+
+#endif
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
new file mode 100644 (file)
index 0000000..b5acbf9
--- /dev/null
@@ -0,0 +1,105 @@
+/* The industrial I/O - event passing to userspace
+ *
+ * Copyright (c) 2008-2011 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#ifndef _IIO_EVENTS_H_
+#define _IIO_EVENTS_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/iio/types.h>
+
+/**
+ * struct iio_event_data - The actual event being pushed to userspace
+ * @id:                event identifier
+ * @timestamp: best estimate of time of event occurrence (often from
+ *             the interrupt handler)
+ */
+struct iio_event_data {
+       __u64   id;
+       __s64   timestamp;
+};
+
+#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
+
+enum iio_event_type {
+       IIO_EV_TYPE_THRESH,
+       IIO_EV_TYPE_MAG,
+       IIO_EV_TYPE_ROC,
+       IIO_EV_TYPE_THRESH_ADAPTIVE,
+       IIO_EV_TYPE_MAG_ADAPTIVE,
+};
+
+enum iio_event_direction {
+       IIO_EV_DIR_EITHER,
+       IIO_EV_DIR_RISING,
+       IIO_EV_DIR_FALLING,
+};
+
+/**
+ * IIO_EVENT_CODE() - create event identifier
+ * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
+ * @diff:      Whether the event is for an differential channel or not.
+ * @modifier:  Modifier for the channel. Should be one of enum iio_modifier.
+ * @direction: Direction of the event. One of enum iio_event_direction.
+ * @type:      Type of the event. Should be one enum iio_event_type.
+ * @chan:      Channel number for non-differential channels.
+ * @chan1:     First channel number for differential channels.
+ * @chan2:     Second channel number for differential channels.
+ */
+
+#define IIO_EVENT_CODE(chan_type, diff, modifier, direction,           \
+                      type, chan, chan1, chan2)                        \
+       (((u64)type << 56) | ((u64)diff << 55) |                        \
+        ((u64)direction << 48) | ((u64)modifier << 40) |               \
+        ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \
+        ((u16)chan))
+
+
+#define IIO_EV_DIR_MAX 4
+#define IIO_EV_BIT(type, direction)                    \
+       (1 << (type*IIO_EV_DIR_MAX + direction))
+
+/**
+ * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
+ * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
+ * @number:    Channel number.
+ * @modifier:  Modifier for the channel. Should be one of enum iio_modifier.
+ * @type:      Type of the event. Should be one enum iio_event_type.
+ * @direction: Direction of the event. One of enum iio_event_direction.
+ */
+
+#define IIO_MOD_EVENT_CODE(chan_type, number, modifier,                \
+                          type, direction)                             \
+       IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0)
+
+/**
+ * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels
+ * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
+ * @number:    Channel number.
+ * @type:      Type of the event. Should be one enum iio_event_type.
+ * @direction: Direction of the event. One of enum iio_event_direction.
+ */
+
+#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction)       \
+       IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
+
+#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
+
+#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
+
+#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
+
+/* Event code number extraction depends on which type of event we have.
+ * Perhaps review this function in the future*/
+#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
+#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
+
+#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
+#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
+
+#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
new file mode 100644 (file)
index 0000000..9c0908a
--- /dev/null
@@ -0,0 +1,463 @@
+
+/* The industrial I/O core
+ *
+ * Copyright (c) 2008 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#ifndef _INDUSTRIAL_IO_H_
+#define _INDUSTRIAL_IO_H_
+
+#include <linux/device.h>
+#include <linux/cdev.h>
+#include <linux/iio/types.h>
+/* IIO TODO LIST */
+/*
+ * Provide means of adjusting timer accuracy.
+ * Currently assumes nano seconds.
+ */
+
+enum iio_chan_info_enum {
+       IIO_CHAN_INFO_RAW = 0,
+       IIO_CHAN_INFO_PROCESSED,
+       IIO_CHAN_INFO_SCALE,
+       IIO_CHAN_INFO_OFFSET,
+       IIO_CHAN_INFO_CALIBSCALE,
+       IIO_CHAN_INFO_CALIBBIAS,
+       IIO_CHAN_INFO_PEAK,
+       IIO_CHAN_INFO_PEAK_SCALE,
+       IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
+       IIO_CHAN_INFO_AVERAGE_RAW,
+       IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
+       IIO_CHAN_INFO_SAMP_FREQ,
+};
+
+#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
+#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
+
+#define IIO_CHAN_INFO_RAW_SEPARATE_BIT                 \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
+#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT                   \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
+#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT               \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
+#define IIO_CHAN_INFO_SCALE_SHARED_BIT                 \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
+#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT                      \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
+#define IIO_CHAN_INFO_OFFSET_SHARED_BIT                        \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
+#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT                  \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
+#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT                    \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
+#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT                   \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
+#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT                     \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
+#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT                        \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
+#define IIO_CHAN_INFO_PEAK_SHARED_BIT                  \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
+#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT                   \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
+#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT                     \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
+#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT   \
+       IIO_CHAN_INFO_SEPARATE_BIT(                             \
+               IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
+#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT     \
+       IIO_CHAN_INFO_SHARED_BIT(                               \
+               IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
+#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT                 \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
+#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT                   \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
+#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
+       IIO_CHAN_INFO_SHARED_BIT(                              \
+               IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
+#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
+       IIO_CHAN_INFO_SEPARATE_BIT(                            \
+               IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
+#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT           \
+       IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
+#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT                     \
+       IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
+
+enum iio_endian {
+       IIO_CPU,
+       IIO_BE,
+       IIO_LE,
+};
+
+struct iio_chan_spec;
+struct iio_dev;
+
+/**
+ * struct iio_chan_spec_ext_info - Extended channel info attribute
+ * @name:      Info attribute name
+ * @shared:    Whether this attribute is shared between all channels.
+ * @read:      Read callback for this info attribute, may be NULL.
+ * @write:     Write callback for this info attribute, may be NULL.
+ */
+struct iio_chan_spec_ext_info {
+       const char *name;
+       bool shared;
+       ssize_t (*read)(struct iio_dev *, struct iio_chan_spec const *,
+                       char *buf);
+       ssize_t (*write)(struct iio_dev *, struct iio_chan_spec const *,
+                       const char *buf, size_t len);
+};
+
+/**
+ * struct iio_chan_spec - specification of a single channel
+ * @type:              What type of measurement is the channel making.
+ * @channel:           What number or name do we wish to assign the channel.
+ * @channel2:          If there is a second number for a differential
+ *                     channel then this is it. If modified is set then the
+ *                     value here specifies the modifier.
+ * @address:           Driver specific identifier.
+ * @scan_index:        Monotonic index to give ordering in scans when read
+ *                     from a buffer.
+ * @scan_type:         Sign:           's' or 'u' to specify signed or unsigned
+ *                     realbits:       Number of valid bits of data
+ *                     storage_bits:   Realbits + padding
+ *                     shift:          Shift right by this before masking out
+ *                                     realbits.
+ *                     endianness:     little or big endian
+ * @info_mask:         What information is to be exported about this channel.
+ *                     This includes calibbias, scale etc.
+ * @event_mask:        What events can this channel produce.
+ * @ext_info:          Array of extended info attributes for this channel.
+ *                     The array is NULL terminated, the last element should
+ *                     have it's name field set to NULL.
+ * @extend_name:       Allows labeling of channel attributes with an
+ *                     informative name. Note this has no effect codes etc,
+ *                     unlike modifiers.
+ * @datasheet_name:    A name used in in kernel mapping of channels. It should
+ *                     correspond to the first name that the channel is referred
+ *                     to by in the datasheet (e.g. IND), or the nearest
+ *                     possible compound name (e.g. IND-INC).
+ * @modified:          Does a modifier apply to this channel. What these are
+ *                     depends on the channel type.  Modifier is set in
+ *                     channel2. Examples are IIO_MOD_X for axial sensors about
+ *                     the 'x' axis.
+ * @indexed:           Specify the channel has a numerical index. If not,
+ *                     the value in channel will be suppressed for attribute
+ *                     but not for event codes. Typically set it to 0 when
+ *                     the index is false.
+ * @differential:      Channel is differential.
+ */
+struct iio_chan_spec {
+       enum iio_chan_type      type;
+       int                     channel;
+       int                     channel2;
+       unsigned long           address;
+       int                     scan_index;
+       struct {
+               char    sign;
+               u8      realbits;
+               u8      storagebits;
+               u8      shift;
+               enum iio_endian endianness;
+       } scan_type;
+       long                    info_mask;
+       long                    event_mask;
+       const struct iio_chan_spec_ext_info *ext_info;
+       const char              *extend_name;
+       const char              *datasheet_name;
+       unsigned                modified:1;
+       unsigned                indexed:1;
+       unsigned                output:1;
+       unsigned                differential:1;
+};
+
+#define IIO_ST(si, rb, sb, sh)                                         \
+       { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
+
+#define IIO_CHAN_SOFT_TIMESTAMP(_si)                                   \
+       { .type = IIO_TIMESTAMP, .channel = -1,                         \
+                       .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
+
+/**
+ * iio_get_time_ns() - utility function to get a time stamp for events etc
+ **/
+static inline s64 iio_get_time_ns(void)
+{
+       struct timespec ts;
+       /*
+        * calls getnstimeofday.
+        * If hrtimers then up to ns accurate, if not microsecond.
+        */
+       ktime_get_real_ts(&ts);
+
+       return timespec_to_ns(&ts);
+}
+
+/* Device operating modes */
+#define INDIO_DIRECT_MODE              0x01
+#define INDIO_BUFFER_TRIGGERED         0x02
+#define INDIO_BUFFER_HARDWARE          0x08
+
+#define INDIO_ALL_BUFFER_MODES                                 \
+       (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
+
+struct iio_trigger; /* forward declaration */
+struct iio_dev;
+
+/**
+ * struct iio_info - constant information about device
+ * @driver_module:     module structure used to ensure correct
+ *                     ownership of chrdevs etc
+ * @event_attrs:       event control attributes
+ * @attrs:             general purpose device attributes
+ * @read_raw:          function to request a value from the device.
+ *                     mask specifies which value. Note 0 means a reading of
+ *                     the channel in question.  Return value will specify the
+ *                     type of value returned by the device. val and val2 will
+ *                     contain the elements making up the returned value.
+ * @write_raw:         function to write a value to the device.
+ *                     Parameters are the same as for read_raw.
+ * @write_raw_get_fmt: callback function to query the expected
+ *                     format/precision. If not set by the driver, write_raw
+ *                     returns IIO_VAL_INT_PLUS_MICRO.
+ * @read_event_config: find out if the event is enabled.
+ * @write_event_config:        set if the event is enabled.
+ * @read_event_value:  read a value associated with the event. Meaning
+ *                     is event dependant. event_code specifies which event.
+ * @write_event_value: write the value associated with the event.
+ *                     Meaning is event dependent.
+ * @validate_trigger:  function to validate the trigger when the
+ *                     current trigger gets changed.
+ **/
+struct iio_info {
+       struct module                   *driver_module;
+       struct attribute_group          *event_attrs;
+       const struct attribute_group    *attrs;
+
+       int (*read_raw)(struct iio_dev *indio_dev,
+                       struct iio_chan_spec const *chan,
+                       int *val,
+                       int *val2,
+                       long mask);
+
+       int (*write_raw)(struct iio_dev *indio_dev,
+                        struct iio_chan_spec const *chan,
+                        int val,
+                        int val2,
+                        long mask);
+
+       int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
+                        struct iio_chan_spec const *chan,
+                        long mask);
+
+       int (*read_event_config)(struct iio_dev *indio_dev,
+                                u64 event_code);
+
+       int (*write_event_config)(struct iio_dev *indio_dev,
+                                 u64 event_code,
+                                 int state);
+
+       int (*read_event_value)(struct iio_dev *indio_dev,
+                               u64 event_code,
+                               int *val);
+       int (*write_event_value)(struct iio_dev *indio_dev,
+                                u64 event_code,
+                                int val);
+       int (*validate_trigger)(struct iio_dev *indio_dev,
+                               struct iio_trigger *trig);
+       int (*update_scan_mode)(struct iio_dev *indio_dev,
+                               const unsigned long *scan_mask);
+       int (*debugfs_reg_access)(struct iio_dev *indio_dev,
+                                 unsigned reg, unsigned writeval,
+                                 unsigned *readval);
+};
+
+/**
+ * struct iio_buffer_setup_ops - buffer setup related callbacks
+ * @preenable:         [DRIVER] function to run prior to marking buffer enabled
+ * @postenable:                [DRIVER] function to run after marking buffer enabled
+ * @predisable:                [DRIVER] function to run prior to marking buffer
+ *                     disabled
+ * @postdisable:       [DRIVER] function to run after marking buffer disabled
+ */
+struct iio_buffer_setup_ops {
+       int                             (*preenable)(struct iio_dev *);
+       int                             (*postenable)(struct iio_dev *);
+       int                             (*predisable)(struct iio_dev *);
+       int                             (*postdisable)(struct iio_dev *);
+};
+
+/**
+ * struct iio_dev - industrial I/O device
+ * @id:                        [INTERN] used to identify device internally
+ * @modes:             [DRIVER] operating modes supported by device
+ * @currentmode:       [DRIVER] current operating mode
+ * @dev:               [DRIVER] device structure, should be assigned a parent
+ *                     and owner
+ * @event_interface:   [INTERN] event chrdevs associated with interrupt lines
+ * @buffer:            [DRIVER] any buffer present
+ * @scan_bytes:                [INTERN] num bytes captured to be fed to buffer demux
+ * @mlock:             [INTERN] lock used to prevent simultaneous device state
+ *                     changes
+ * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
+ * @masklength:                [INTERN] the length of the mask established from
+ *                     channels
+ * @active_scan_mask:  [INTERN] union of all scan masks requested by buffers
+ * @scan_timestamp:    [INTERN] set if any buffers have requested timestamp
+ * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
+ * @trig:              [INTERN] current device trigger (buffer modes)
+ * @pollfunc:          [DRIVER] function run on trigger being received
+ * @channels:          [DRIVER] channel specification structure table
+ * @num_channels:      [DRIVER] number of chanels specified in @channels.
+ * @channel_attr_list: [INTERN] keep track of automatically created channel
+ *                     attributes
+ * @chan_attr_group:   [INTERN] group for all attrs in base directory
+ * @name:              [DRIVER] name of the device.
+ * @info:              [DRIVER] callbacks and constant info from driver
+ * @info_exist_lock:   [INTERN] lock to prevent use during removal
+ * @setup_ops:         [DRIVER] callbacks to call before and after buffer
+ *                     enable/disable
+ * @chrdev:            [INTERN] associated character device
+ * @groups:            [INTERN] attribute groups
+ * @groupcounter:      [INTERN] index of next attribute group
+ * @flags:             [INTERN] file ops related flags including busy flag.
+ * @debugfs_dentry:    [INTERN] device specific debugfs dentry.
+ * @cached_reg_addr:   [INTERN] cached register address for debugfs reads.
+ */
+struct iio_dev {
+       int                             id;
+
+       int                             modes;
+       int                             currentmode;
+       struct device                   dev;
+
+       struct iio_event_interface      *event_interface;
+
+       struct iio_buffer               *buffer;
+       int                             scan_bytes;
+       struct mutex                    mlock;
+
+       const unsigned long             *available_scan_masks;
+       unsigned                        masklength;
+       const unsigned long             *active_scan_mask;
+       bool                            scan_timestamp;
+       unsigned                        scan_index_timestamp;
+       struct iio_trigger              *trig;
+       struct iio_poll_func            *pollfunc;
+
+       struct iio_chan_spec const      *channels;
+       int                             num_channels;
+
+       struct list_head                channel_attr_list;
+       struct attribute_group          chan_attr_group;
+       const char                      *name;
+       const struct iio_info           *info;
+       struct mutex                    info_exist_lock;
+       const struct iio_buffer_setup_ops       *setup_ops;
+       struct cdev                     chrdev;
+#define IIO_MAX_GROUPS 6
+       const struct attribute_group    *groups[IIO_MAX_GROUPS + 1];
+       int                             groupcounter;
+
+       unsigned long                   flags;
+#if defined(CONFIG_DEBUG_FS)
+       struct dentry                   *debugfs_dentry;
+       unsigned                        cached_reg_addr;
+#endif
+};
+
+/**
+ * iio_find_channel_from_si() - get channel from its scan index
+ * @indio_dev:         device
+ * @si:                        scan index to match
+ */
+const struct iio_chan_spec
+*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
+
+/**
+ * iio_device_register() - register a device with the IIO subsystem
+ * @indio_dev:         Device structure filled by the device driver
+ **/
+int iio_device_register(struct iio_dev *indio_dev);
+
+/**
+ * iio_device_unregister() - unregister a device from the IIO subsystem
+ * @indio_dev:         Device structure representing the device.
+ **/
+void iio_device_unregister(struct iio_dev *indio_dev);
+
+/**
+ * iio_push_event() - try to add event to the list for userspace reading
+ * @indio_dev:         IIO device structure
+ * @ev_code:           What event
+ * @timestamp:         When the event occurred
+ **/
+int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
+
+extern struct bus_type iio_bus_type;
+
+/**
+ * iio_put_device() - reference counted deallocation of struct device
+ * @dev: the iio_device containing the device
+ **/
+static inline void iio_put_device(struct iio_dev *indio_dev)
+{
+       if (indio_dev)
+               put_device(&indio_dev->dev);
+};
+
+/* Can we make this smaller? */
+#define IIO_ALIGN L1_CACHE_BYTES
+/**
+ * iio_allocate_device() - allocate an iio_dev from a driver
+ * @sizeof_priv: Space to allocate for private structure.
+ **/
+struct iio_dev *iio_allocate_device(int sizeof_priv);
+
+static inline void *iio_priv(const struct iio_dev *indio_dev)
+{
+       return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
+}
+
+static inline struct iio_dev *iio_priv_to_dev(void *priv)
+{
+       return (struct iio_dev *)((char *)priv -
+                                 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
+}
+
+/**
+ * iio_free_device() - free an iio_dev from a driver
+ * @dev: the iio_dev associated with the device
+ **/
+void iio_free_device(struct iio_dev *indio_dev);
+
+/**
+ * iio_buffer_enabled() - helper function to test if the buffer is enabled
+ * @indio_dev:         IIO device info structure for device
+ **/
+static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
+{
+       return indio_dev->currentmode
+               & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
+};
+
+/**
+ * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
+ * @indio_dev:         IIO device info structure for device
+ **/
+#if defined(CONFIG_DEBUG_FS)
+static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
+{
+       return indio_dev->debugfs_dentry;
+};
+#else
+static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
+{
+       return NULL;
+};
+#endif
+
+#endif /* _INDUSTRIAL_IO_H_ */
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
new file mode 100644 (file)
index 0000000..014d5a1
--- /dev/null
@@ -0,0 +1,8 @@
+
+#include <linux/kfifo.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
+
+struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
+void iio_kfifo_free(struct iio_buffer *r);
+
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
new file mode 100644 (file)
index 0000000..0b1f19b
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Industrial I/O in kernel access map definitions for board files.
+ *
+ * Copyright (c) 2011 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+/**
+ * struct iio_map - description of link between consumer and device channels
+ * @adc_channel_label: Label used to identify the channel on the provider.
+ *                     This is matched against the datasheet_name element
+ *                     of struct iio_chan_spec.
+ * @consumer_dev_name: Name to uniquely identify the consumer device.
+ * @consumer_channel:  Unique name used to idenitify the channel on the
+ *                     consumer side.
+ */
+struct iio_map {
+       const char *adc_channel_label;
+       const char *consumer_dev_name;
+       const char *consumer_channel;
+};
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
new file mode 100644 (file)
index 0000000..bfedb73
--- /dev/null
@@ -0,0 +1,117 @@
+/* The industrial I/O core
+ *
+ *Copyright (c) 2008 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * General attributes
+ */
+
+#ifndef _INDUSTRIAL_IO_SYSFS_H_
+#define _INDUSTRIAL_IO_SYSFS_H_
+
+struct iio_chan_spec;
+
+/**
+ * struct iio_dev_attr - iio specific device attribute
+ * @dev_attr:  underlying device attribute
+ * @address:   associated register address
+ * @l:         list head for maintaining list of dynamically created attrs.
+ */
+struct iio_dev_attr {
+       struct device_attribute dev_attr;
+       u64 address;
+       struct list_head l;
+       struct iio_chan_spec const *c;
+};
+
+#define to_iio_dev_attr(_dev_attr)                             \
+       container_of(_dev_attr, struct iio_dev_attr, dev_attr)
+
+ssize_t iio_read_const_attr(struct device *dev,
+                           struct device_attribute *attr,
+                           char *len);
+
+/**
+ * struct iio_const_attr - constant device specific attribute
+ *                         often used for things like available modes
+ * @string:    attribute string
+ * @dev_attr:  underlying device attribute
+ */
+struct iio_const_attr {
+       const char *string;
+       struct device_attribute dev_attr;
+};
+
+#define to_iio_const_attr(_dev_attr) \
+       container_of(_dev_attr, struct iio_const_attr, dev_attr)
+
+/* Some attributes will be hard coded (device dependent) and not require an
+   address, in these cases pass a negative */
+#define IIO_ATTR(_name, _mode, _show, _store, _addr)           \
+       { .dev_attr = __ATTR(_name, _mode, _show, _store),      \
+         .address = _addr }
+
+#define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr)    \
+       struct iio_dev_attr iio_dev_attr_##_name                \
+       = IIO_ATTR(_name, _mode, _show, _store, _addr)
+
+#define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
+       struct iio_dev_attr iio_dev_attr_##_vname                       \
+       = IIO_ATTR(_name, _mode, _show, _store, _addr)
+
+#define IIO_CONST_ATTR(_name, _string)                                 \
+       struct iio_const_attr iio_const_attr_##_name                    \
+       = { .string = _string,                                          \
+           .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
+
+#define IIO_CONST_ATTR_NAMED(_vname, _name, _string)                   \
+       struct iio_const_attr iio_const_attr_##_vname                   \
+       = { .string = _string,                                          \
+           .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
+
+/* Generic attributes of onetype or another */
+/**
+ * IIO_DEV_ATTR_RESET: resets the device
+ **/
+#define IIO_DEV_ATTR_RESET(_store)                     \
+       IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
+
+/**
+ * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
+ * @_mode: sysfs file mode/permissions
+ * @_show: output method for the attribute
+ * @_store: input method for the attribute
+ **/
+#define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store)                   \
+       IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
+
+/**
+ * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
+ * @_show: output method for the attribute
+ *
+ * May be mode dependent on some devices
+ **/
+#define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)                            \
+       IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
+/**
+ * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
+ * @_string: frequency string for the attribute
+ *
+ * Constant version
+ **/
+#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string)                        \
+       IIO_CONST_ATTR(sampling_frequency_available, _string)
+
+#define IIO_DEV_ATTR_TEMP_RAW(_show)                   \
+       IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
+
+#define IIO_CONST_ATTR_TEMP_OFFSET(_string)            \
+       IIO_CONST_ATTR(in_temp_offset, _string)
+
+#define IIO_CONST_ATTR_TEMP_SCALE(_string)             \
+       IIO_CONST_ATTR(in_temp_scale, _string)
+
+#endif /* _INDUSTRIAL_IO_SYSFS_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
new file mode 100644 (file)
index 0000000..1cfca23
--- /dev/null
@@ -0,0 +1,119 @@
+/* The industrial I/O core, trigger handling functions
+ *
+ * Copyright (c) 2008 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#include <linux/irq.h>
+#include <linux/module.h>
+
+#ifndef _IIO_TRIGGER_H_
+#define _IIO_TRIGGER_H_
+
+struct iio_subirq {
+       bool enabled;
+};
+
+/**
+ * struct iio_trigger_ops - operations structure for an iio_trigger.
+ * @owner:             used to monitor usage count of the trigger.
+ * @set_trigger_state: switch on/off the trigger on demand
+ * @try_reenable:      function to reenable the trigger when the
+ *                     use count is zero (may be NULL)
+ * @validate_device:   function to validate the device when the
+ *                     current trigger gets changed.
+ *
+ * This is typically static const within a driver and shared by
+ * instances of a given device.
+ **/
+struct iio_trigger_ops {
+       struct module                   *owner;
+       int (*set_trigger_state)(struct iio_trigger *trig, bool state);
+       int (*try_reenable)(struct iio_trigger *trig);
+       int (*validate_device)(struct iio_trigger *trig,
+                              struct iio_dev *indio_dev);
+};
+
+
+/**
+ * struct iio_trigger - industrial I/O trigger device
+ *
+ * @id:                        [INTERN] unique id number
+ * @name:              [DRIVER] unique name
+ * @dev:               [DRIVER] associated device (if relevant)
+ * @private_data:      [DRIVER] device specific data
+ * @list:              [INTERN] used in maintenance of global trigger list
+ * @alloc_list:                [DRIVER] used for driver specific trigger list
+ * @use_count:         use count for the trigger
+ * @subirq_chip:       [INTERN] associate 'virtual' irq chip.
+ * @subirq_base:       [INTERN] base number for irqs provided by trigger.
+ * @subirqs:           [INTERN] information about the 'child' irqs.
+ * @pool:              [INTERN] bitmap of irqs currently in use.
+ * @pool_lock:         [INTERN] protection of the irq pool.
+ **/
+struct iio_trigger {
+       const struct iio_trigger_ops    *ops;
+       int                             id;
+       const char                      *name;
+       struct device                   dev;
+
+       void                            *private_data;
+       struct list_head                list;
+       struct list_head                alloc_list;
+       int use_count;
+
+       struct irq_chip                 subirq_chip;
+       int                             subirq_base;
+
+       struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
+       unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
+       struct mutex                    pool_lock;
+};
+
+
+static inline struct iio_trigger *to_iio_trigger(struct device *d)
+{
+       return container_of(d, struct iio_trigger, dev);
+};
+
+static inline void iio_put_trigger(struct iio_trigger *trig)
+{
+       module_put(trig->ops->owner);
+       put_device(&trig->dev);
+};
+
+static inline void iio_get_trigger(struct iio_trigger *trig)
+{
+       get_device(&trig->dev);
+       __module_get(trig->ops->owner);
+};
+
+/**
+ * iio_trigger_register() - register a trigger with the IIO core
+ * @trig_info: trigger to be registered
+ **/
+int iio_trigger_register(struct iio_trigger *trig_info);
+
+/**
+ * iio_trigger_unregister() - unregister a trigger from the core
+ * @trig_info: trigger to be unregistered
+ **/
+void iio_trigger_unregister(struct iio_trigger *trig_info);
+
+/**
+ * iio_trigger_poll() - called on a trigger occurring
+ * @trig: trigger which occurred
+ *
+ * Typically called in relevant hardware interrupt handler.
+ **/
+void iio_trigger_poll(struct iio_trigger *trig, s64 time);
+void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
+
+irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
+
+__printf(1, 2) struct iio_trigger *iio_allocate_trigger(const char *fmt, ...);
+void iio_free_trigger(struct iio_trigger *trig);
+
+#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
new file mode 100644 (file)
index 0000000..60d64b3
--- /dev/null
@@ -0,0 +1,52 @@
+/* The industrial I/O core, trigger consumer functions
+ *
+ * Copyright (c) 2008-2011 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+/**
+ * struct iio_poll_func - poll function pair
+ *
+ * @indio_dev:                 data specific to device (passed into poll func)
+ * @h:                         the function that is actually run on trigger
+ * @thread:                    threaded interrupt part
+ * @type:                      the type of interrupt (basically if oneshot)
+ * @name:                      name used to identify the trigger consumer.
+ * @irq:                       the corresponding irq as allocated from the
+ *                             trigger pool
+ * @timestamp:                 some devices need a timestamp grabbed as soon
+ *                             as possible after the trigger - hence handler
+ *                             passes it via here.
+ **/
+struct iio_poll_func {
+       struct iio_dev *indio_dev;
+       irqreturn_t (*h)(int irq, void *p);
+       irqreturn_t (*thread)(int irq, void *p);
+       int type;
+       char *name;
+       int irq;
+       s64 timestamp;
+};
+
+
+struct iio_poll_func
+*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
+                   irqreturn_t (*thread)(int irq, void *p),
+                   int type,
+                   struct iio_dev *indio_dev,
+                   const char *fmt,
+                   ...);
+void iio_dealloc_pollfunc(struct iio_poll_func *pf);
+irqreturn_t iio_pollfunc_store_time(int irq, void *p);
+
+void iio_trigger_notify_done(struct iio_trigger *trig);
+
+/*
+ * Two functions for common case where all that happens is a pollfunc
+ * is attached and detached from a trigger
+ */
+int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
+int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
new file mode 100644 (file)
index 0000000..0c32136
--- /dev/null
@@ -0,0 +1,53 @@
+/* industrial I/O data types needed both in and out of kernel
+ *
+ * Copyright (c) 2008 Jonathan Cameron
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#ifndef _IIO_TYPES_H_
+#define _IIO_TYPES_H_
+
+enum iio_chan_type {
+       /* real channel types */
+       IIO_VOLTAGE,
+       IIO_CURRENT,
+       IIO_POWER,
+       IIO_ACCEL,
+       IIO_ANGL_VEL,
+       IIO_MAGN,
+       IIO_LIGHT,
+       IIO_INTENSITY,
+       IIO_PROXIMITY,
+       IIO_TEMP,
+       IIO_INCLI,
+       IIO_ROT,
+       IIO_ANGL,
+       IIO_TIMESTAMP,
+       IIO_CAPACITANCE,
+};
+
+enum iio_modifier {
+       IIO_NO_MOD,
+       IIO_MOD_X,
+       IIO_MOD_Y,
+       IIO_MOD_Z,
+       IIO_MOD_X_AND_Y,
+       IIO_MOD_X_AND_Z,
+       IIO_MOD_Y_AND_Z,
+       IIO_MOD_X_AND_Y_AND_Z,
+       IIO_MOD_X_OR_Y,
+       IIO_MOD_X_OR_Z,
+       IIO_MOD_Y_OR_Z,
+       IIO_MOD_X_OR_Y_OR_Z,
+       IIO_MOD_LIGHT_BOTH,
+       IIO_MOD_LIGHT_IR,
+};
+
+#define IIO_VAL_INT 1
+#define IIO_VAL_INT_PLUS_MICRO 2
+#define IIO_VAL_INT_PLUS_NANO 3
+
+#endif /* _IIO_TYPES_H_ */