mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 22:53:20 +00:00
media: atomisp: Turn on sensor power from atomisp_set_fmt()
ATM the atomisp driver does not call s_power() at all when no s_input ioctl() is done by the application. This breaks older sensor drivers which rely on s_power() for power-management. Some drivers have worked around this, e.g. commitc5fafbadae
("media: atomisp: gc0310: Power on sensor from set_fmt() callback") and commitb3118a942c
("media: atomisp: ov2722: Power on sensor from set_fmt() callback"), but this really should be fixed in the atomisp driver itself, so that all old drivers can work. A logical place to call s_power() would be from atomisp_start_streaming() / atomisp_stop_streaming(). But some older drivers, e.g. the atomisp-ov2722 driver already write mode related registers on set_fmt() instead of waiting on stream on. So the s_power(1) needs to happen at the first set_fmt(). Add an atomisp_s_sensor_power(..., 1) call just before calling set_fmt() for this. If the power was already enabled through e.g. a s_input ioctl atomisp_s_sensor_power() will skip calling the s_power() v4l2-subdev-op a second time. 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>
This commit is contained in:
parent
2eee958174
commit
61d9b1ffc6
@ -3760,6 +3760,17 @@ static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp,
|
||||
if (!input->camera)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Some old sensor drivers already write the registers on set_fmt
|
||||
* instead of on stream on, power on the sensor now (on newer
|
||||
* sensor drivers the s_power op is a no-op).
|
||||
*/
|
||||
if (which == V4L2_SUBDEV_FORMAT_ACTIVE) {
|
||||
ret = atomisp_s_sensor_power(isp, isp->asd.input_curr, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
sd_state = (which == V4L2_SUBDEV_FORMAT_TRY) ? input->try_sd_state :
|
||||
input->camera->active_state;
|
||||
if (sd_state)
|
||||
|
Loading…
Reference in New Issue
Block a user