From: Stefan Popa <stefan.popa@analog.com>
To: <jic23@kernel.org>, <robh+dt@kernel.org>
Cc: Stefan Popa <stefan.popa@analog.com>,
<Michael.Hennerich@analog.com>, <knaack.h@gmx.de>,
<lars@metafoo.de>, <pmeerw@pmeerw.net>,
<gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>,
<linux-iio@vger.kernel.org>
Subject: [PATCH 1/6] iio: imu: adis16480: Use the default data ready pin configuration
Date: Tue, 19 Feb 2019 19:12:13 +0200 [thread overview]
Message-ID: <1550596338-24220-2-git-send-email-stefan.popa@analog.com> (raw)
In-Reply-To: <1550596338-24220-1-git-send-email-stefan.popa@analog.com>
The FNCTIO_CTRL register, Bits[3:0] provide three configuration options
for the data ready function: on/off, polarity, and DIOx line. The
factory default assigns DIO2 as a positive polarity, data ready signal.
The adis16480_enable_irq() function, overwrites this configuration when
it enables/disables the data ready pin by only setting BIT[3].
As a result, the data ready signal becomes DIO1 pin which is assigned as
negative polarity.
This patch reads the FNCTIO_CTRL register and creates a mask, such that
only data ready enable (BIT[3]) will be modified when
adis16480_enable_irq function is called.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
---
drivers/iio/imu/adis16480.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index a27fe20..d222188 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -9,6 +9,7 @@
*
*/
+#include <linux/bitfield.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/mutex.h>
@@ -107,6 +108,10 @@
#define ADIS16480_FIR_COEF_C(x) ADIS16480_FIR_COEF(0x09, (x))
#define ADIS16480_FIR_COEF_D(x) ADIS16480_FIR_COEF(0x0B, (x))
+/* ADIS16480_REG_FNCTIO_CTRL */
+#define ADIS16480_DRDY_EN_MSK BIT(3)
+#define ADIS16480_DRDY_EN(x) FIELD_PREP(ADIS16480_DRDY_EN_MSK, x)
+
struct adis16480_chip_info {
unsigned int num_channels;
const struct iio_chan_spec *channels;
@@ -741,8 +746,17 @@ static int adis16480_stop_device(struct iio_dev *indio_dev)
static int adis16480_enable_irq(struct adis *adis, bool enable)
{
- return adis_write_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL,
- enable ? BIT(3) : 0);
+ uint16_t val;
+ int ret;
+
+ ret = adis_read_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, &val);
+ if (ret < 0)
+ return ret;
+
+ val &= ~ADIS16480_DRDY_EN_MSK;
+ val |= ADIS16480_DRDY_EN(enable);
+
+ return adis_write_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, val);
}
static int adis16480_initial_setup(struct iio_dev *indio_dev)
--
2.7.4
next prev parent reply other threads:[~2019-02-19 17:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 17:12 [PATCH 0/6] iio: imu: adis16480: Add support for ADIS1649x family of devices Stefan Popa
2019-02-19 17:12 ` Stefan Popa [this message]
2019-02-20 10:20 ` [PATCH 1/6] iio: imu: adis16480: Use the default data ready pin configuration Jonathan Cameron
2019-02-19 17:12 ` [PATCH 2/6] iio: imu: adis16480: Add support for configurable drdy indicator Stefan Popa
2019-02-20 10:29 ` Jonathan Cameron
2019-02-20 10:42 ` Popa, Stefan Serban
2019-02-19 17:12 ` [PATCH 3/6] iio: imu: adis16480: Add OF device ID table Stefan Popa
2019-02-20 10:30 ` Jonathan Cameron
2019-02-19 17:12 ` [PATCH 4/6] iio: imu: adis16480: Treat temperature scale in a generic way Stefan Popa
2019-02-20 10:37 ` Jonathan Cameron
2019-02-19 17:12 ` [PATCH 5/6] iio: imu: adis16480: Add support for ADIS1649x family of devices Stefan Popa
2019-02-20 10:40 ` Jonathan Cameron
2019-02-19 17:12 ` [PATCH 6/6] iio: imu: adis16480: Add docs for ADIS16480 IMU Stefan Popa
2019-02-20 10:46 ` 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=1550596338-24220-2-git-send-email-stefan.popa@analog.com \
--to=stefan.popa@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.org \
/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
all inboxes | Powered by JetHome®