[PATCH 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend()

From: Robert Ijtsma via B4 Relay

Date: Fri Nov 27 2026 - 15:30:38 EST


From: Robert Ijtsma <robertijtsma@xxxxxxxxx>

ov7251_probe() configures runtime PM autosuspend with a 1000 ms delay,
but ov7251_s_ctrl() and ov7251_s_stream() call pm_runtime_put() without
updating last_busy or using autosuspend, immediately powering down the
sensor on stream stop or control writes.

Use pm_runtime_mark_last_busy() and pm_runtime_put_autosuspend() in
ov7251_s_ctrl() and ov7251_s_stream() so the configured autosuspend
window is honored across back-to-back captures.

Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
Signed-off-by: Robert Ijtsma <robertijtsma@xxxxxxxxx>
---
drivers/media/i2c/ov7251.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 77ac60fad62209eda0444015196e52564a0e947d..5a50a5100c1e995714201fb509fb207fa03c5f39 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1074,7 +1074,8 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
break;
}

- pm_runtime_put(ov7251->dev);
+ pm_runtime_mark_last_busy(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);

return ret;
}
@@ -1378,14 +1379,16 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
} else {
ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
OV7251_SC_MODE_SELECT_SW_STANDBY);
- pm_runtime_put(ov7251->dev);
+ pm_runtime_mark_last_busy(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);
}

mutex_unlock(&ov7251->lock);
return ret;

err_power_down:
- pm_runtime_put(ov7251->dev);
+ pm_runtime_mark_last_busy(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);
mutex_unlock(&ov7251->lock);
return ret;
}

--
2.47.3