[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250706172057.4252378c@jic23-huawei>
Date: Sun, 6 Jul 2025 17:20:57 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Jean-Baptiste Maneyrol via B4 Relay
<devnull+jean-baptiste.maneyrol.tdk.com@...nel.org>
Cc: jean-baptiste.maneyrol@....com, Lars-Peter Clausen <lars@...afoo.de>,
David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/3] iio: imu: inv_icm42600: add WoM support
On Mon, 30 Jun 2025 21:47:30 +0200
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@...nel.org> wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>
>
> Add WoM as accel roc rising x|y|z event.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....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;
> +}
> +
>
Powered by blists - more mailing lists