iio:adis: Add support for manual self-test flag clear
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 15 Apr 2016 14:59:38 +0000 (16:59 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sat, 16 Apr 2016 12:42:43 +0000 (13:42 +0100)
Some variants of the devices from the ADIS family don't auto-clear the
self-test bit after the self-test has completed. Instead we have to
manually clear. Add support for this to the ADIS library.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/adis.c
include/linux/iio/imu/adis.h

index 911255d41c1a43460e2cfbd94f019d77edfffa34..ad6f91d061855ec12cf577c8de05b83431022f24 100644 (file)
@@ -324,7 +324,12 @@ static int adis_self_test(struct adis *adis)
 
        msleep(adis->data->startup_delay);
 
-       return adis_check_status(adis);
+       ret = adis_check_status(adis);
+
+       if (adis->data->self_test_no_autoclear)
+               adis_write_reg_16(adis, adis->data->msc_ctrl_reg, 0x00);
+
+       return ret;
 }
 
 /**
index fa2d01ef8f55aac718ce7df66df33f6ca651fde6..360da7d18a3d011e630bc0fff1790485150ca78b 100644 (file)
@@ -41,6 +41,7 @@ struct adis_data {
        unsigned int diag_stat_reg;
 
        unsigned int self_test_mask;
+       bool self_test_no_autoclear;
        unsigned int startup_delay;
 
        const char * const *status_error_msgs;