linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 1/5] iio:adis: Add support for manual self-test flag clear
Date: Fri, 15 Apr 2016 16:59:38 +0200	[thread overview]
Message-ID: <1460732382-6840-1-git-send-email-lars@metafoo.de> (raw)

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>
---
I think we can get away without applying this to stable since the drivers
have been broken since forever and so this is more of a new feature rather
than a regression fix.
---
 drivers/iio/imu/adis.c       | 7 ++++++-
 include/linux/iio/imu/adis.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 911255d..ad6f91d 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -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;
 }
 
 /**
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index fa2d01e..360da7d 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -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;
-- 
2.1.4

             reply	other threads:[~2016-04-15 14:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 14:59 Lars-Peter Clausen [this message]
2016-04-15 14:59 ` [PATCH 2/5] staging:iio:adis16201: Set self_test_no_autoclear flag Lars-Peter Clausen
2016-04-16 12:44   ` Jonathan Cameron
2016-04-15 14:59 ` [PATCH 3/5] staging:iio:adis16203: " Lars-Peter Clausen
2016-04-16 12:44   ` Jonathan Cameron
2016-04-15 14:59 ` [PATCH 4/5] staging:iio:adis16209: " Lars-Peter Clausen
2016-04-16 12:44   ` Jonathan Cameron
2016-04-15 14:59 ` [PATCH 5/5] staging:iio:adis16240: " Lars-Peter Clausen
2016-04-16 12:44   ` Jonathan Cameron
2016-04-16 12:43 ` [PATCH 1/5] iio:adis: Add support for manual self-test flag clear Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460732382-6840-1-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).