mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 12:13:51 -04:00
media: imx355: Use pm_runtime autosuspend_delay
Avoid powering the sensor up and down unnecessarily by using pm_runtime's autosuspend_delay feature. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
committed by
Sakari Ailus
parent
8a52937cae
commit
a21872acb7
@@ -1074,7 +1074,7 @@ static int imx355_set_stream(struct v4l2_subdev *sd, int enable)
|
||||
goto err_rpm_put;
|
||||
} else {
|
||||
imx355_stop_streaming(imx355);
|
||||
pm_runtime_put(imx355->dev);
|
||||
pm_runtime_put_autosuspend(imx355->dev);
|
||||
}
|
||||
|
||||
/* vflip and hflip cannot change during streaming */
|
||||
@@ -1086,7 +1086,7 @@ static int imx355_set_stream(struct v4l2_subdev *sd, int enable)
|
||||
return ret;
|
||||
|
||||
err_rpm_put:
|
||||
pm_runtime_put(imx355->dev);
|
||||
pm_runtime_put_autosuspend(imx355->dev);
|
||||
err_unlock:
|
||||
mutex_unlock(&imx355->mutex);
|
||||
|
||||
@@ -1436,6 +1436,8 @@ static int imx355_probe(struct i2c_client *client)
|
||||
*/
|
||||
pm_runtime_set_active(imx355->dev);
|
||||
pm_runtime_enable(imx355->dev);
|
||||
pm_runtime_set_autosuspend_delay(imx355->dev, 1000);
|
||||
pm_runtime_use_autosuspend(imx355->dev);
|
||||
|
||||
ret = v4l2_async_register_subdev_sensor(&imx355->sd);
|
||||
if (ret < 0)
|
||||
@@ -1448,6 +1450,7 @@ static int imx355_probe(struct i2c_client *client)
|
||||
error_media_entity_runtime_pm:
|
||||
pm_runtime_disable(imx355->dev);
|
||||
pm_runtime_set_suspended(imx355->dev);
|
||||
pm_runtime_dont_use_autosuspend(imx355->dev);
|
||||
media_entity_cleanup(&imx355->sd.entity);
|
||||
|
||||
error_handler_free:
|
||||
@@ -1478,6 +1481,8 @@ static void imx355_remove(struct i2c_client *client)
|
||||
pm_runtime_set_suspended(imx355->dev);
|
||||
}
|
||||
|
||||
pm_runtime_dont_use_autosuspend(imx355->dev);
|
||||
|
||||
mutex_destroy(&imx355->mutex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user