linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Giuseppe Barba <giuseppe.barba@st.com>,
	Denis Ciocca <denis.ciocca@st.com>
Subject: Re: [PATCH 2/4] iio: st_sensors: read each channel individually
Date: Mon, 28 Mar 2016 10:37:25 +0100	[thread overview]
Message-ID: <56F8FB55.5070702@kernel.org> (raw)
In-Reply-To: <CACRpkdZx2L8JZ76iypApN7WCz7vgSVvamBamkzhQfyG+NdUcbw@mail.gmail.com>

On 28/03/16 10:20, Linus Walleij wrote:
> On Mon, Mar 28, 2016 at 10:03 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> 
>> No problem with the patch itself, but I'd like to get a better
>> understanding of the issue.  Are we talking a weird hardware 'bug' that
>> occurs only in these particular circumstances?  Can we pin down which of
>> the above conditions are necessary to make it not work?
> 
> I have. I have the following patch in my tree
> (Giuseppe, tell me if I should send this as patch if you
> want to try it on your designs.):
> 
> From 24fe4792c3bc92f587f44a5c54435be5745e424c Mon Sep 17 00:00:00 2001
> From: Linus Walleij <linus.walleij@linaro.org>
> Date: Thu, 24 Mar 2016 09:21:01 +0100
> Subject: [PATCH] iio: st_sensors: detect residue in channels
> 
> Hack.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/iio/common/st_sensors/st_sensors_buffer.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> index c55898543a47..71c079b50548 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> @@ -83,6 +83,26 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
>      iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data,
>          pf->timestamp);
> 
> +    if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {
> +        u8 status;
> +
> +        len = sdata->tf->read_byte(&sdata->tb, sdata->dev,
> +               sdata->sensor_settings->drdy_irq.addr_stat_drdy,
> +               &status);
> +        if (len < 0)
> +            dev_err(sdata->dev, "could not read channel status\n");
> +
> +        /*
> +         * If this was not caused by any channels on this sensor,
> +         * return IRQ_NONE
> +         */
> +        if (status & (u8)indio_dev->active_scan_mask[0])
> +            dev_err(sdata->dev,
> +                "ERROR residue data status = %02x, scan_mask = %02x\n",
> +                status,
> +                (u8)indio_dev->active_scan_mask[0]);
> +    }
> +
>  st_sensors_get_buffer_element_error:
>      iio_trigger_notify_done(indio_dev->trig);
> 
> This triggers when I use active-low IRQs and open drain setting.
> The register contains 0x07 or 0xee indicating that the X axis status
> bit was cleared but not Y, Z.
> 
>> I'd just like to know if this is a fix that needs to go upstream faster
>> than the open drain support or not.
> 
> I cannot test active-high IRQs on the LIS331DL since it is wired
> up as it is (requireing active-low+open drain). I don't think it's an
> issue with that sensor in general but rather with the active-low+OD
> mode in general but admittedly it is a rough guess.
> 
> It *might* be that LIS331DL needs this to even work properly :/
That was precisely what I was wondering!

Let's see if we can pin this down a bit further.  More info would certainly
help anyone trying to use this with an older kernel.

Jonathan
> 
> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2016-03-28  9:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 13:18 [PATCH 1/4] iio: st_sensors: simplify buffer address handling Linus Walleij
2016-03-24 13:18 ` [PATCH 2/4] iio: st_sensors: read each channel individually Linus Walleij
2016-03-28  8:03   ` Jonathan Cameron
2016-03-28  9:20     ` Linus Walleij
2016-03-28  9:37       ` Jonathan Cameron [this message]
2016-03-29  8:15       ` Linus Walleij
2016-04-10 14:29         ` Jonathan Cameron
2016-04-11  6:50           ` Linus Walleij
2016-04-17 11:22             ` Jonathan Cameron
2016-04-17 18:47               ` Linus Walleij
2016-03-24 13:18 ` [PATCH 3/4] iio: st_sensors: verify interrupt event to status Linus Walleij
2016-03-28  8:09   ` Jonathan Cameron
2016-04-12 12:34     ` Linus Walleij
2016-04-17 11:24       ` Jonathan Cameron
2016-05-03 17:58   ` Crestez Dan Leonard
2016-05-03 20:10     ` Linus Walleij
2016-05-04  7:35       ` Jonathan Cameron
2016-05-04 14:34         ` Linus Walleij
2016-05-04 18:14           ` Crestez Dan Leonard
2016-05-06  9:14             ` Linus Walleij
2016-03-24 13:18 ` [PATCH 4/4] iio: st_sensors: support open drain mode Linus Walleij
2016-03-28  9:12   ` Jonathan Cameron
2016-03-31  8:15     ` Linus Walleij
2016-04-03  9:33       ` Jonathan Cameron
2016-03-28  3:42 ` [PATCH 1/4] iio: st_sensors: simplify buffer address handling Denis Ciocca
2016-03-28  7:52   ` Jonathan Cameron
2016-03-28  8:16     ` Denis Ciocca
2016-03-28  8:27       ` 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=56F8FB55.5070702@kernel.org \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=giuseppe.barba@st.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.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;
as well as URLs for NNTP newsgroup(s).