]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: atomisp: gc0310: Move and rename suspend/resume functions
authorHans de Goede <hansg@kernel.org>
Sat, 17 May 2025 11:41:02 +0000 (13:41 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 8 Jul 2025 06:43:31 +0000 (08:43 +0200)
Move the suspend()/resume() functions to above gc0310_detect() and rename
the functions to power_off()/power_on().

No functional changes, this is a preparation patch for reworking
the runtime-pm handling in probe() and remove().

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-20-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c

index 44e834c608f478dff4ac132c4958220789a7c96b..c4d85d65737c6482ae4623285f1c7eaa442e18b6 100644 (file)
@@ -383,6 +383,30 @@ static int gc0310_get_selection(struct v4l2_subdev *sd,
        return 0;
 }
 
+static int gc0310_power_off(struct device *dev)
+{
+       struct v4l2_subdev *sd = dev_get_drvdata(dev);
+       struct gc0310_device *sensor = to_gc0310_sensor(sd);
+
+       gpiod_set_value_cansleep(sensor->powerdown, 1);
+       gpiod_set_value_cansleep(sensor->reset, 1);
+       return 0;
+}
+
+static int gc0310_power_on(struct device *dev)
+{
+       struct v4l2_subdev *sd = dev_get_drvdata(dev);
+       struct gc0310_device *sensor = to_gc0310_sensor(sd);
+
+       fsleep(10 * USEC_PER_MSEC);
+       gpiod_set_value_cansleep(sensor->reset, 0);
+       fsleep(10 * USEC_PER_MSEC);
+       gpiod_set_value_cansleep(sensor->powerdown, 0);
+       fsleep(10 * USEC_PER_MSEC);
+
+       return 0;
+}
+
 static int gc0310_detect(struct gc0310_device *sensor)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
@@ -764,31 +788,8 @@ static int gc0310_probe(struct i2c_client *client)
        return 0;
 }
 
-static int gc0310_suspend(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct gc0310_device *sensor = to_gc0310_sensor(sd);
-
-       gpiod_set_value_cansleep(sensor->powerdown, 1);
-       gpiod_set_value_cansleep(sensor->reset, 1);
-       return 0;
-}
-
-static int gc0310_resume(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct gc0310_device *sensor = to_gc0310_sensor(sd);
-
-       fsleep(10 * USEC_PER_MSEC);
-       gpiod_set_value_cansleep(sensor->reset, 0);
-       fsleep(10 * USEC_PER_MSEC);
-       gpiod_set_value_cansleep(sensor->powerdown, 0);
-       fsleep(10 * USEC_PER_MSEC);
-
-       return 0;
-}
-
-static DEFINE_RUNTIME_DEV_PM_OPS(gc0310_pm_ops, gc0310_suspend, gc0310_resume, NULL);
+static DEFINE_RUNTIME_DEV_PM_OPS(gc0310_pm_ops,
+                                gc0310_power_off, gc0310_power_on, NULL);
 
 static const struct acpi_device_id gc0310_acpi_match[] = {
        {"INT0310"},