[PATCH V9 05/11] iio: imu: inv_icm42607: Add PM support for icm42607

Jonathan Cameron jic23 at kernel.org
Sun May 31 05:21:30 PDT 2026


On Fri, 29 May 2026 22:17:32 -0500
Chris Morgan <macroalpha82 at gmail.com> wrote:

> From: Chris Morgan <macromorgan at hotmail.com>
> 
> Add power management support for the ICM42607 device driver.
> 
> Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
Hi Chris,

https://sashiko.dev/#/patchset/20260530031739.109063-1-macroalpha82%40gmail.com

Points out a deadlock.  Suggests maybe you need a few more test cases!
More generally I think you've misunderstood how force_suspend is used.



> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
> index 3dd4cc8c6b1d..cfdce70ce25d 100644
> --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
> +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c


>  
> +static int inv_icm42607_suspend(struct device *dev)
> +{
> +	struct inv_icm42607_state *st = dev_get_drvdata(dev);
> +	int ret;
> +
> +	guard(mutex)(&st->lock);
> +
> +	if (pm_runtime_suspended(dev))
> +		return 0;

Force suspend will deal with this for everything in there.
I'm a little confused on why runtime suspend effects disabing
vddio_reg.


> +
> +	ret = pm_runtime_force_suspend(dev);

You'll need to do this without holding the lock.
Also take a much closer look at what it does.  

(sashiko points out why what you have here doesn't make sense).


> +	if (ret)
> +		return ret;
> +
> +	ret = inv_icm42607_set_pwr_mgmt0(st, INV_ICM42607_SENSOR_MODE_OFF,
> +					 INV_ICM42607_SENSOR_MODE_OFF,
> +					 false, NULL);
> +	if (ret)
> +		return ret;
> +
> +	inv_icm42607_disable_vddio_reg(st);
> +
> +	return 0;
> +}

> +
> +static int inv_icm42607_runtime_suspend(struct device *dev)
> +{
> +	struct inv_icm42607_state *st = dev_get_drvdata(dev);
> +	int ret;
> +
> +	guard(mutex)(&st->lock);
> +
> +	ret = inv_icm42607_set_pwr_mgmt0(st, INV_ICM42607_SENSOR_MODE_OFF,
> +					 INV_ICM42607_SENSOR_MODE_OFF, false,
> +					 NULL);
> +	if (ret)
> +		return ret;
> +
> +	inv_icm42607_disable_vddio_reg(st);
> +
> +	return 0;
> +}

I cropped the resume cases but they have the same problems..



More information about the Linux-rockchip mailing list