media: i2c: ov2740: Drop system suspend and resume handlers
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 14 Sep 2023 18:16:59 +0000 (21:16 +0300)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 27 Sep 2023 07:40:00 +0000 (09:40 +0200)
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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/i2c/ov2740.c

index 59356dd9afd81b22a39f3b8c55269aad564bd5fd..3a9700fbbe8cb3fb6273102520a0edd93b3b23d5 100644 (file)
@@ -339,9 +339,6 @@ struct ov2740 {
        /* To serialize asynchronus callbacks */
        struct mutex mutex;
 
-       /* Streaming on/off */
-       bool streaming;
-
        /* NVM data inforamtion */
        struct nvm_data *nvm;
 
@@ -813,47 +810,11 @@ static int ov2740_set_stream(struct v4l2_subdev *sd, int enable)
                pm_runtime_put(&client->dev);
        }
 
-       ov2740->streaming = enable;
        mutex_unlock(&ov2740->mutex);
 
        return ret;
 }
 
-static int ov2740_suspend(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct ov2740 *ov2740 = to_ov2740(sd);
-
-       mutex_lock(&ov2740->mutex);
-       if (ov2740->streaming)
-               ov2740_stop_streaming(ov2740);
-
-       mutex_unlock(&ov2740->mutex);
-
-       return 0;
-}
-
-static int ov2740_resume(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct ov2740 *ov2740 = to_ov2740(sd);
-       int ret = 0;
-
-       mutex_lock(&ov2740->mutex);
-       if (!ov2740->streaming)
-               goto exit;
-
-       ret = ov2740_start_streaming(ov2740);
-       if (ret) {
-               ov2740->streaming = false;
-               ov2740_stop_streaming(ov2740);
-       }
-
-exit:
-       mutex_unlock(&ov2740->mutex);
-       return ret;
-}
-
 static int ov2740_set_format(struct v4l2_subdev *sd,
                             struct v4l2_subdev_state *sd_state,
                             struct v4l2_subdev_format *fmt)
@@ -1197,8 +1158,6 @@ probe_error_v4l2_ctrl_handler_free:
        return ret;
 }
 
-static DEFINE_SIMPLE_DEV_PM_OPS(ov2740_pm_ops, ov2740_suspend, ov2740_resume);
-
 static const struct acpi_device_id ov2740_acpi_ids[] = {
        {"INT3474"},
        {}
@@ -1209,7 +1168,6 @@ MODULE_DEVICE_TABLE(acpi, ov2740_acpi_ids);
 static struct i2c_driver ov2740_i2c_driver = {
        .driver = {
                .name = "ov2740",
-               .pm = pm_sleep_ptr(&ov2740_pm_ops),
                .acpi_match_table = ov2740_acpi_ids,
        },
        .probe = ov2740_probe,