mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jean-Baptiste Maneyrol via B4 Relay
	<devnull+jean-baptiste.maneyrol.tdk.com@kernel.org>
Cc: jean-baptiste.maneyrol@tdk.com,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/3] iio: imu: inv_icm42600: add WoM support
Date: Sun, 6 Jul 2025 17:20:57 +0100	[thread overview]
Message-ID: <20250706172057.4252378c@jic23-huawei> (raw)
In-Reply-To: <20250630-losd-3-inv-icm42600-add-wom-support-v6-2-5bb0c84800d9@tdk.com>

On Mon, 30 Jun 2025 21:47:30 +0200
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:

> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
> 
> Add WoM as accel roc rising x|y|z event.
> 
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
This will probably cross with the removal of explicit
pm_runtime_mark_last_busy() but we can deal with that as a follow up.

Given I haven't yet picked up the precursor for that we can't just fix
it whilst applying this.  It's harmless to have too many calls to that
though so not a problem


> +
> +static int inv_icm42600_accel_enable_wom(struct iio_dev *indio_dev)
> +{
> +	struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
> +	struct device *pdev = regmap_get_device(st->map);
> +	int ret;
> +
> +	ret = pm_runtime_resume_and_get(pdev);
> +	if (ret)
> +		return ret;
> +
> +	ret = _inv_icm42600_accel_enable_wom(indio_dev);
> +	if (ret) {
> +		pm_runtime_mark_last_busy(pdev);
Here.

> +		pm_runtime_put_autosuspend(pdev);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
>
> +
> +static int inv_icm42600_accel_disable_wom(struct iio_dev *indio_dev)
> +{
> +	struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
> +	struct device *pdev = regmap_get_device(st->map);
> +	int ret;
> +
> +	ret = _inv_icm42600_accel_disable_wom(indio_dev);
> +
> +	pm_runtime_mark_last_busy(pdev);
and here.
> +	pm_runtime_put_autosuspend(pdev);
> +
> +	return ret;
> +}
> +
>
> +static int inv_icm42600_accel_write_event_value(struct iio_dev *indio_dev,
> +						const struct iio_chan_spec *chan,
> +						enum iio_event_type type,
> +						enum iio_event_direction dir,
> +						enum iio_event_info info,
> +						int val, int val2)
> +{
> +	struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
> +	struct device *dev = regmap_get_device(st->map);
> +	int ret;
> +
> +	/* handle only WoM (roc rising) event value */
> +	if (type != IIO_EV_TYPE_ROC || dir != IIO_EV_DIR_RISING)
> +		return -EINVAL;
> +
> +	if (val < 0 || val2 < 0)
> +		return -EINVAL;
> +
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = _inv_icm42600_accel_wom_value(st, val, val2);
> +
> +	pm_runtime_mark_last_busy(dev);
and here.

> +	pm_runtime_put_autosuspend(dev);
> +
> +	return ret;
> +}
> +
>

  reply	other threads:[~2025-07-06 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 19:47 [PATCH v6 0/3] Add support for WoM (Wake-on-Motion) feature Jean-Baptiste Maneyrol via B4 Relay
2025-06-30 19:47 ` [PATCH v6 1/3] iio: imu: inv_icm42600: reorganize DMA aligned buffers in structure Jean-Baptiste Maneyrol via B4 Relay
2025-06-30 19:47 ` [PATCH v6 2/3] iio: imu: inv_icm42600: add WoM support Jean-Baptiste Maneyrol via B4 Relay
2025-07-06 16:20   ` Jonathan Cameron [this message]
2025-06-30 19:47 ` [PATCH v6 3/3] iio: imu: inv_icm42600: add wakeup functionality for Wake-on-Motion Jean-Baptiste Maneyrol via B4 Relay
2025-07-07 15:06   ` Sean Nyekjaer
2025-07-06 16:21 ` [PATCH v6 0/3] Add support for WoM (Wake-on-Motion) feature 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=20250706172057.4252378c@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=devnull+jean-baptiste.maneyrol.tdk.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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

all inboxes | Powered by JetHome®