mirror of https://github.com/torvalds/linux.git
media: atomisp: gc0310: Move and rename suspend/resume functions
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>
This commit is contained in:
parent
0f8b9632fa
commit
4d697daae8
|
|
@ -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"},
|
||||
|
|
|
|||
Loading…
Reference in New Issue