Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org (open list:NXP FXAS21002C DRIVER),
	linux-kernel@vger.kernel.org (open list),
	imx@lists.linux.dev
Subject: Re: [PATCH 1/1] iio: gyro: fxas21002c: Fix missing data update in trigger handler
Date: Sat, 23 Nov 2024 15:40:37 +0000	[thread overview]
Message-ID: <20241123154037.05ebcf8a@jic23-huawei> (raw)
In-Reply-To: <20241116152945.4006374-1-Frank.Li@nxp.com>

On Sat, 16 Nov 2024 10:29:45 -0500
Frank Li <Frank.Li@nxp.com> wrote:

> From: Carlos Song <carlos.song@nxp.com>
> 
> The fxas21002c_trigger_handler() may fail to acquire sample data because
> the runtime PM enters the autosuspend state and sensor can not return
> sample data in standby mode..
> 
> Resume the sensor before reading the sample data into the buffer within the
> trigger handler. After the data is read, place the sensor back into the
> autosuspend state.
> 
> Fixes: a0701b6263ae ("iio: gyro: add core driver for fxas21002c")
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Note I'll rebase on rc1 once available before sending a pull request with this in.

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/fxas21002c_core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c
> index 688966129f704..50b908b2419be 100644
> --- a/drivers/iio/gyro/fxas21002c_core.c
> +++ b/drivers/iio/gyro/fxas21002c_core.c
> @@ -730,14 +730,21 @@ static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
>  	int ret;
>  
>  	mutex_lock(&data->lock);
> +	ret = fxas21002c_pm_get(data);
> +	if (ret < 0)
> +		goto out_unlock;
> +
>  	ret = regmap_bulk_read(data->regmap, FXAS21002C_REG_OUT_X_MSB,
>  			       data->buffer, CHANNEL_SCAN_MAX * sizeof(s16));
>  	if (ret < 0)
> -		goto out_unlock;
> +		goto out_pm_put;
>  
>  	iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
>  					   data->timestamp);
>  
> +out_pm_put:
> +	fxas21002c_pm_put(data);
> +
>  out_unlock:
>  	mutex_unlock(&data->lock);
>  


      reply	other threads:[~2024-11-23 15:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 15:29 [PATCH 1/1] iio: gyro: fxas21002c: Fix missing data update in trigger handler Frank Li
2024-11-23 15:40 ` 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=20241123154037.05ebcf8a@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmfrfs@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox