This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: ccs: Ensure control handlers have been set up after probe
Author:  Sakari Ailus <sakari.ai...@linux.intel.com>
Date:    Sat Oct 14 20:56:00 2023 +0300

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 <sakari.ai...@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 drivers/media/i2c/ccs/ccs-core.c | 5 ++++-
 drivers/media/i2c/ccs/ccs.h      | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

---

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)
diff --git a/drivers/media/i2c/ccs/ccs.h b/drivers/media/i2c/ccs/ccs.h
index 9c3587b2fbe7..2c013d96adcc 100644
--- a/drivers/media/i2c/ccs/ccs.h
+++ b/drivers/media/i2c/ccs/ccs.h
@@ -236,6 +236,7 @@ struct ccs_sensor {
 
        bool streaming;
        bool dev_init_done;
+       bool handler_setup_needed;
        u8 compressed_min_bpp;
 
        struct ccs_module_info minfo;

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to