diff mbox series

[41/57] media: i2c: imx214: Drop system suspend and resume handlers

Message ID 20230914181704.4811-42-laurent.pinchart@ideasonboard.com
State Accepted
Commit 0484cde1dfaacbf8748eb89ea23c274b72466fe3
Headers show
Series [01/57] media: v4l2-subdev: Document .s_stream() operation requirements | expand

Commit Message

Laurent Pinchart Sept. 14, 2023, 6:16 p.m. UTC
Stopping streaming on a camera pipeline at system suspend time, and
restarting it at system resume time, requires coordinated action between
the bridge driver and the camera sensor driver. This is handled by the
bridge driver calling the sensor's .s_stream() handler at system suspend
and resume time. There is thus no need for the sensor to independently
implement system sleep PM operations. Drop them.

The streaming field of the driver's private structure is now unused,
drop it as well.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/imx214.c | 37 -------------------------------------
 1 file changed, 37 deletions(-)

Comments

Ricardo Ribalda Delgado Sept. 18, 2023, 7:53 a.m. UTC | #1
Hi Laurent

On Thu, Sep 14, 2023 at 8:17 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Stopping streaming on a camera pipeline at system suspend time, and
> restarting it at system resume time, requires coordinated action between
> the bridge driver and the camera sensor driver. This is handled by the
> bridge driver calling the sensor's .s_stream() handler at system suspend
> and resume time. There is thus no need for the sensor to independently
> implement system sleep PM operations. Drop them.
>
> The streaming field of the driver's private structure is now unused,
> drop it as well.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/i2c/imx214.c | 37 -------------------------------------
>  1 file changed, 37 deletions(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index e2805173f4b1..4f77ea02cc27 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -58,8 +58,6 @@ struct imx214 {
>          * and start streaming.
>          */
>         struct mutex mutex;
> -
> -       bool streaming;
>  };
>
>  struct reg_8 {
> @@ -790,7 +788,6 @@ static int imx214_s_stream(struct v4l2_subdev *subdev, int enable)
>                 pm_runtime_put(imx214->dev);
>         }
>
> -       imx214->streaming = enable;
>         return 0;
>
>  err_rpm_put:
> @@ -906,39 +903,6 @@ static int imx214_parse_fwnode(struct device *dev)
>         return ret;
>  }
>
> -static int __maybe_unused imx214_suspend(struct device *dev)
> -{
> -       struct i2c_client *client = to_i2c_client(dev);
> -       struct v4l2_subdev *sd = i2c_get_clientdata(client);
> -       struct imx214 *imx214 = to_imx214(sd);
> -
> -       if (imx214->streaming)
> -               imx214_stop_streaming(imx214);
> -
> -       return 0;
> -}
> -
> -static int __maybe_unused imx214_resume(struct device *dev)
> -{
> -       struct i2c_client *client = to_i2c_client(dev);
> -       struct v4l2_subdev *sd = i2c_get_clientdata(client);
> -       struct imx214 *imx214 = to_imx214(sd);
> -       int ret;
> -
> -       if (imx214->streaming) {
> -               ret = imx214_start_streaming(imx214);
> -               if (ret)
> -                       goto error;
> -       }
> -
> -       return 0;
> -
> -error:
> -       imx214_stop_streaming(imx214);
> -       imx214->streaming = 0;
> -       return ret;
> -}
> -
>  static int imx214_probe(struct i2c_client *client)
>  {
>         struct device *dev = &client->dev;
> @@ -1099,7 +1063,6 @@ static const struct of_device_id imx214_of_match[] = {
>  MODULE_DEVICE_TABLE(of, imx214_of_match);
>
>  static const struct dev_pm_ops imx214_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(imx214_suspend, imx214_resume)
>         SET_RUNTIME_PM_OPS(imx214_power_off, imx214_power_on, NULL)
>  };
>
> --
> Regards,
>
> Laurent Pinchart
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index e2805173f4b1..4f77ea02cc27 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -58,8 +58,6 @@  struct imx214 {
 	 * and start streaming.
 	 */
 	struct mutex mutex;
-
-	bool streaming;
 };
 
 struct reg_8 {
@@ -790,7 +788,6 @@  static int imx214_s_stream(struct v4l2_subdev *subdev, int enable)
 		pm_runtime_put(imx214->dev);
 	}
 
-	imx214->streaming = enable;
 	return 0;
 
 err_rpm_put:
@@ -906,39 +903,6 @@  static int imx214_parse_fwnode(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused imx214_suspend(struct device *dev)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	struct v4l2_subdev *sd = i2c_get_clientdata(client);
-	struct imx214 *imx214 = to_imx214(sd);
-
-	if (imx214->streaming)
-		imx214_stop_streaming(imx214);
-
-	return 0;
-}
-
-static int __maybe_unused imx214_resume(struct device *dev)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	struct v4l2_subdev *sd = i2c_get_clientdata(client);
-	struct imx214 *imx214 = to_imx214(sd);
-	int ret;
-
-	if (imx214->streaming) {
-		ret = imx214_start_streaming(imx214);
-		if (ret)
-			goto error;
-	}
-
-	return 0;
-
-error:
-	imx214_stop_streaming(imx214);
-	imx214->streaming = 0;
-	return ret;
-}
-
 static int imx214_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -1099,7 +1063,6 @@  static const struct of_device_id imx214_of_match[] = {
 MODULE_DEVICE_TABLE(of, imx214_of_match);
 
 static const struct dev_pm_ops imx214_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx214_suspend, imx214_resume)
 	SET_RUNTIME_PM_OPS(imx214_power_off, imx214_power_on, NULL)
 };