diff options
| author | Sakari Ailus <[email protected]> | 2023-10-14 17:56:00 +0000 |
|---|---|---|
| committer | Hans Verkuil <[email protected]> | 2023-11-22 09:56:34 +0000 |
| commit | a274f4d1e5af404fcc7b5554521913590c9d7b08 (patch) | |
| tree | d5a183fcb88fbcf457410efd87673782388eb8e9 /drivers/media/i2c/ccs/ccs-core.c | |
| parent | media: meson-ir-tx: Drop usage of platform_driver_probe() (diff) | |
| download | kernel-a274f4d1e5af404fcc7b5554521913590c9d7b08.tar.gz kernel-a274f4d1e5af404fcc7b5554521913590c9d7b08.zip | |
media: ccs: Ensure control handlers have been set up after probe
If the sensor remains powered on after probe when it is needed again and
the runtime PM usage_count is incremented, the control handler setup for
neither control handler is run.
As this is, in most cases, a needless operation in probe, track the status
of sensor power handling after probe and set up control handlers even if
the device was already active right after probe.
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Diffstat (limited to 'drivers/media/i2c/ccs/ccs-core.c')
| -rw-r--r-- | drivers/media/i2c/ccs/ccs-core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 12e6f0a26fc8..31769ff95d67 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1878,9 +1878,11 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor) goto error; /* Device was already active, so don't set controls */ - if (rval == 1) + if (rval == 1 && !sensor->handler_setup_needed) return 0; + sensor->handler_setup_needed = false; + /* Restore V4L2 controls to the previously suspended device */ rval = v4l2_ctrl_handler_setup(&sensor->pixel_array->ctrl_handler); if (rval) @@ -3532,6 +3534,7 @@ static int ccs_probe(struct i2c_client *client) sensor->streaming = false; sensor->dev_init_done = true; + sensor->handler_setup_needed = true; rval = ccs_write_msr_regs(sensor); if (rval) |
