summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-11-20 13:36:00 +0000
committerJonathan Cameron <jic23@kernel.org>2012-11-20 18:47:21 +0000
commit78026a6fde8f7b0ca77c059da11f476d69dfde3b (patch)
treeabb879862232984c237630668a85e93ba9bd7bf3 /drivers/iio
parent709ab36e9559ff5c7df6e6f2d9e3c4a4410f8d49 (diff)
downloadtalos-op-linux-78026a6fde8f7b0ca77c059da11f476d69dfde3b.tar.gz
talos-op-linux-78026a6fde8f7b0ca77c059da11f476d69dfde3b.zip
iio:imu:adis: Add debugfs register access support
Provide a IIO debugfs register access function for the ADIS library. This function can be used by individual drivers to allow raw register access via debugfs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/imu/adis.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 8259b774078f..28d4df2fe76a 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -135,6 +135,29 @@ error_ret:
}
EXPORT_SYMBOL_GPL(adis_read_reg_16);
+#ifdef CONFIG_DEBUG_FS
+
+int adis_debugfs_reg_access(struct iio_dev *indio_dev,
+ unsigned int reg, unsigned int writeval, unsigned int *readval)
+{
+ struct adis *adis = iio_device_get_drvdata(indio_dev);
+
+ if (readval) {
+ uint16_t val16;
+ int ret;
+
+ ret = adis_read_reg_16(adis, reg, &val16);
+ *readval = val16;
+
+ return ret;
+ } else {
+ return adis_write_reg_16(adis, reg, writeval);
+ }
+}
+EXPORT_SYMBOL(adis_debugfs_reg_access);
+
+#endif
+
/**
* adis_enable_irq() - Enable or disable data ready IRQ
* @adis: The adis device
OpenPOWER on IntegriCloud