diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-04-11 20:42:16 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-04-26 12:44:53 +0300 |
commit | 2eee9581745441080ad0bb4df0e159a44b686fc5 (patch) | |
tree | 12ed0705578aba1cae8935b8ed91fd851b95284d /drivers/staging/media/atomisp/pci/atomisp_ioctl.c | |
parent | c7064fb60932227d6482d5300e06fc3673a4543d (diff) | |
download | linux-2eee9581745441080ad0bb4df0e159a44b686fc5.tar.xz |
media: atomisp: Add atomisp_s_sensor_power() helper
Since the atomisp driver only supports 1 stream / only has 1 asd now,
there is no longer a need to track which stream owns the sensor.
So the asd owner-pointer of struct atomisp_input_subdev can be dropped,
replace this with a simple camera_on boolean and add a new
atomisp_s_sensor_power() helper which takes care of avoiding unbalanced
s_power() subdev calls as well as takes care of handling the special
-ENOIOCTLCMD return for subdevs which don't implement s_power().
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging/media/atomisp/pci/atomisp_ioctl.c')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index d602bda134f9..be1f3f2ee63e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -469,28 +469,15 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) } /* power off the current owned sensor, as it is not used this time */ - if (isp->inputs[asd->input_curr].asd == asd && - asd->input_curr != input) { - ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - core, s_power, 0); - if (ret && ret != -ENOIOCTLCMD) - dev_warn(isp->dev, - "Failed to power-off sensor\n"); - /* clear the asd field to show this camera is not used */ - isp->inputs[asd->input_curr].asd = NULL; - } + if (input != isp->asd.input_curr) + atomisp_s_sensor_power(isp, isp->asd.input_curr, 0); /* powe on the new sensor */ - ret = v4l2_subdev_call(isp->inputs[input].camera, core, s_power, 1); - if (ret && ret != -ENOIOCTLCMD) { - dev_err(isp->dev, "Failed to power-on sensor\n"); + ret = atomisp_s_sensor_power(isp, input, 1); + if (ret) return ret; - } asd->input_curr = input; - /* mark this camera is used by the current stream */ - isp->inputs[input].asd = asd; - return 0; } |