Commit 5141562b authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

media: atomisp: Do not turn off sensor when the atomisp-sub-dev does not own it



The atomisp driver creates 8 /dev/video# device nodes. 4 nodes (preview /
video / viewfinder / capture) for each of 2 possible streams aka
atomisp-sub-device-s (asd-s).

Both streams start with asd->input_curr set to 0 (to the first sensor),
opening + releasing a file-handle on one of the nodes of an asd,
while streaming from the other asd causes the sensor to get turned off,
leading to the stream failing.

The atomisp-code already tracks which asd "owns" a specific sensor,
use this to only turn the sensor off if it is owned by the asd.

Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent d24a42b9
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -828,6 +828,8 @@ static int atomisp_release(struct file *file)

	atomisp_css_free_stat_buffers(asd);
	atomisp_free_internal_buffers(asd);

	if (isp->inputs[asd->input_curr].asd == asd) {
		ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
				       core, s_power, 0);
		if (ret)
@@ -835,6 +837,8 @@ static int atomisp_release(struct file *file)

		/* clear the asd field to show this camera is not used */
		isp->inputs[asd->input_curr].asd = NULL;
	}

	spin_lock_irqsave(&isp->lock, flags);
	asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;
	spin_unlock_irqrestore(&isp->lock, flags);