diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-04-11 18:56:47 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-04-26 10:48:40 +0100 |
commit | 1a1ce0c308136e2bfdf326e1100809fe34558a4e (patch) | |
tree | 505f76d2d68da0ef97fdac10d63bbdbc3dfe5234 /drivers/staging/media/atomisp/pci/atomisp_subdev.c | |
parent | 61d9b1ffc68f109f987811e6d31d6440608f6e5c (diff) | |
download | linux-1a1ce0c308136e2bfdf326e1100809fe34558a4e.tar.gz linux-1a1ce0c308136e2bfdf326e1100809fe34558a4e.tar.bz2 linux-1a1ce0c308136e2bfdf326e1100809fe34558a4e.zip |
media: atomisp: Add atomisp_select_input() helper
When switching input/sensor the s_power() callback must be called
for old sensor drivers to power on the new sensor and power off
the previous sensor.
atomisp_s_input() already does this but atomisp_link_setup()
did not do this.
Add a new atomisp_select_input() helper which does this and use this
in both atomisp_s_input() and atomisp_link_setup() for consistent
behavior.
Also make atomisp_link_setup() turn the sensor back off when
a link gets disabled.
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_subdev.c')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_subdev.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index c36aae69d6f7..aabffd6a424d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -663,9 +663,6 @@ static int atomisp_link_setup(struct media_entity *entity, return -EINVAL; } - /* Ignore disables, input_curr should only be updated on enables */ - if (!(flags & MEDIA_LNK_FL_ENABLED)) - return 0; for (i = 0; i < isp->input_cnt; i++) { if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx]) @@ -679,11 +676,17 @@ static int atomisp_link_setup(struct media_entity *entity, mutex_lock(&isp->mutex); ret = atomisp_pipe_check(&asd->video_out, true); - if (ret == 0) - asd->input_curr = i; mutex_unlock(&isp->mutex); + if (ret) + return ret; - return ret; + /* Turn off the sensor on link disable */ + if (!(flags & MEDIA_LNK_FL_ENABLED)) { + atomisp_s_sensor_power(isp, i, 0); + return 0; + } + + return atomisp_select_input(isp, i); } static const struct media_entity_operations isp_subdev_media_ops = { |