From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: linux-iio@vger.kernel.org, linus.walleij@linaro.org,
lorenzo.bianconi@st.com
Subject: Re: [PATCH] iio: magnetometer: st_magn: fix drdy line configuration for LIS3MDL
Date: Sun, 3 Sep 2017 17:39:34 +0100 [thread overview]
Message-ID: <20170903173934.12f32bcb@archlinux> (raw)
In-Reply-To: <20170829114511.14756-1-lorenzo.bianconi@st.com>
On Tue, 29 Aug 2017 13:45:11 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Data-ready line in LIS3MDL is routed to drdy pin and it is not possible
> to select a different INT pin. st_sensors_set_dataready_irq() assumes
> that if drdy int address is not exported in register map, irq trigger
> is not supported by the sensor and hw_irq_trigger is always false.
> Based on this configuration st_sensors_irq_thread does not consume
> generated interrupt causing an unhandled irq.
> Fix this taking into account status register address in
> st_sensors_set_dataready_irq()
>
> Fixes: 90efe0556292 (iio: st_sensors: harden interrupt handling)
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the fixes-togreg-post-rc1 branch of iio.git.
Thanks,
Jonathan.
> ---
> drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++++++++-
> drivers/iio/magnetometer/st_magn_core.c | 4 ++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index d99bb1460fe2..02e833b14db0 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -463,8 +463,17 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
> u8 drdy_mask;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> - if (!sdata->sensor_settings->drdy_irq.addr)
> + if (!sdata->sensor_settings->drdy_irq.addr) {
> + /*
> + * there are some devices (e.g. LIS3MDL) where drdy line is
> + * routed to a given pin and it is not possible to select a
> + * different one. Take into account irq status register
> + * to understand if irq trigger can be properly supported
> + */
> + if (sdata->sensor_settings->drdy_irq.addr_stat_drdy)
> + sdata->hw_irq_trigger = enable;
> return 0;
> + }
>
> /* Enable/Disable the interrupt generator 1. */
> if (sdata->sensor_settings->drdy_irq.ig1.en_addr > 0) {
> diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
> index 83fdd7230917..f7388d265eb0 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -315,6 +315,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
> },
> },
> },
> + .drdy_irq = {
> + /* drdy line is routed drdy pin */
> + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
> + },
> .multi_read_bit = true,
> .bootime = 2,
> },
prev parent reply other threads:[~2017-09-03 16:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 11:45 [PATCH] iio: magnetometer: st_magn: fix drdy line configuration for LIS3MDL Lorenzo Bianconi
2017-09-03 16:39 ` Jonathan Cameron [this message]
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=20170903173934.12f32bcb@archlinux \
--to=jic23@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=lorenzo.bianconi@st.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.