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

media: atomisp: Remove depth-mode support

Remove support for depth mode. This is a special mode where 2 streams
(from 2 different sensors) can be setup and then starting/stopping
1 will automatically also start/stop the other.

Like many of these special features I'm pretty sure that if the queue
setup is not done exactly right things will crash and there is no error
checking for this.

This seems to be for stereoscopic vision and the only known hw which
actually supports this is the Intel Aero board/SDK, all other 1000+
BYT/CHT models don't need this.

This false outside of the standard webcam use scenario which we are
trying to get working and this involves a bunch of hacks / special
exceptions all over the code, so lets remove this.

Link: https://lore.kernel.org/linux-media/ea81b17b-7d1f-a5e1-11dd-04db310e1e50@redhat.com/
Link: https://lore.kernel.org/r/20230221145906.8113-2-hdegoede@redhat.com



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 4db7f7a0
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1107,8 +1107,6 @@ struct atomisp_sensor_ae_bracketing_lut {
/* Lock and unlock raw buffer */
#define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29)

#define V4L2_CID_DEPTH_MODE		(V4L2_CID_CAMERA_LASTP1 + 30)

#define V4L2_CID_EXPOSURE_ZONE_NUM	(V4L2_CID_CAMERA_LASTP1 + 31)
/* Disable digital zoom */
#define V4L2_CID_DISABLE_DZ		(V4L2_CID_CAMERA_LASTP1 + 32)
+1 −23
Original line number Diff line number Diff line
@@ -1114,9 +1114,8 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
	struct pci_dev *pdev = to_pci_dev(isp->dev);
	enum ia_css_pipe_id css_pipe_id;
	bool stream_restart[MAX_STREAM_NUM] = {0};
	bool depth_mode = false;
	int i, ret, depth_cnt = 0;
	unsigned long flags;
	int i, ret;

	lockdep_assert_held(&isp->mutex);

@@ -1134,8 +1133,6 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
		    !asd->stream_prepared)
			continue;

		depth_cnt++;

		if (asd->delayed_init == ATOMISP_DELAYED_INIT_QUEUED)
			cancel_work_sync(&asd->delayed_init_work);

@@ -1186,13 +1183,6 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
	atomisp_reset(isp);
	isp->isp_timeout = false;

	if (!isp_timeout) {
		for (i = 0; i < isp->num_of_streams; i++) {
			if (isp->asd[i].depth_mode->val)
				return;
		}
	}

	for (i = 0; i < isp->num_of_streams; i++) {
		struct atomisp_sub_device *asd = &isp->asd[i];

@@ -1248,12 +1238,6 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
		atomisp_recover_params_queue(&asd->video_out_preview);
		atomisp_recover_params_queue(&asd->video_out_video_capture);

		if ((asd->depth_mode->val) &&
		    (depth_cnt == ATOMISP_DEPTH_SENSOR_STREAMON_COUNT)) {
			depth_mode = true;
			continue;
		}

		ret = v4l2_subdev_call(
			  isp->inputs[asd->input_curr].camera, video,
			  s_stream, 1);
@@ -1261,12 +1245,6 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
			dev_warn(isp->dev,
				 "can't start streaming on sensor!\n");
	}

	if (depth_mode) {
		if (atomisp_stream_on_master_slave_sensor(isp, true))
			dev_warn(isp->dev,
				 "master slave sensor stream on failed!\n");
	}
}

void atomisp_assert_recovery_work(struct work_struct *work)
+0 −5
Original line number Diff line number Diff line
@@ -133,11 +133,6 @@
	(ATOMISP_SOC_CAMERA(asd) && ATOMISP_CSS_SUPPORT_YUVPP && \
	!asd->copy_mode)

#define ATOMISP_DEPTH_SENSOR_STREAMON_COUNT 2

#define ATOMISP_DEPTH_DEFAULT_MASTER_SENSOR 0
#define ATOMISP_DEPTH_DEFAULT_SLAVE_SENSOR 1

/* ISP2401 */
#define ATOMISP_ION_DEVICE_FD_OFFSET   16
#define ATOMISP_ION_SHARED_FD_MASK     (0xFFFF)
+0 −59
Original line number Diff line number Diff line
@@ -1173,51 +1173,6 @@ static unsigned int atomisp_sensor_start_stream(struct atomisp_sub_device *asd)
		return 1;
}

int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp,
	bool isp_timeout)
{
	unsigned int master, slave, delay_slave = 0;
	int ret;

	master = ATOMISP_DEPTH_DEFAULT_MASTER_SENSOR;
	slave = ATOMISP_DEPTH_DEFAULT_SLAVE_SENSOR;
	dev_warn(isp->dev,
		 "depth mode use default master=%s.slave=%s.\n",
		 isp->inputs[master].camera->name,
		 isp->inputs[slave].camera->name);

	ret = v4l2_subdev_call(isp->inputs[master].camera, core,
			       ioctl, ATOMISP_IOC_G_DEPTH_SYNC_COMP,
			       &delay_slave);
	if (ret)
		dev_warn(isp->dev,
			 "get depth sensor %s compensation delay failed.\n",
			 isp->inputs[master].camera->name);

	ret = v4l2_subdev_call(isp->inputs[master].camera,
			       video, s_stream, 1);
	if (ret) {
		dev_err(isp->dev, "depth mode master sensor %s stream-on failed.\n",
			isp->inputs[master].camera->name);
		return -EINVAL;
	}

	if (delay_slave != 0)
		udelay(delay_slave);

	ret = v4l2_subdev_call(isp->inputs[slave].camera,
			       video, s_stream, 1);
	if (ret) {
		dev_err(isp->dev, "depth mode slave sensor %s stream-on failed.\n",
			isp->inputs[slave].camera->name);
		v4l2_subdev_call(isp->inputs[master].camera, video, s_stream, 0);

		return -EINVAL;
	}

	return 0;
}

/* Input system HW workaround */
/* Input system address translation corrupts burst during */
/* invalidate. SW workaround for this is to set burst length */
@@ -1396,19 +1351,6 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count)
			dev_dbg(isp->dev, "DFS auto mode failed!\n");
	}

	if (asd->depth_mode->val && atomisp_streaming_count(isp) ==
	    ATOMISP_DEPTH_SENSOR_STREAMON_COUNT) {
		ret = atomisp_stream_on_master_slave_sensor(isp, false);
		if (ret) {
			dev_err(isp->dev, "master slave sensor stream on failed!\n");
			goto out_unlock;
		}
		goto start_delay_wq;
	} else if (asd->depth_mode->val && (atomisp_streaming_count(isp) <
					    ATOMISP_DEPTH_SENSOR_STREAMON_COUNT)) {
		goto start_delay_wq;
	}

	/* Enable the CSI interface on ANN B0/K0 */
	if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<
					    ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) {
@@ -1427,7 +1369,6 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count)
		goto out_unlock;
	}

start_delay_wq:
	if (asd->continuous_mode->val) {
		atomisp_subdev_get_ffmt(&asd->subdev, NULL,
				        V4L2_SUBDEV_FORMAT_ACTIVE,
+0 −3
Original line number Diff line number Diff line
@@ -53,9 +53,6 @@ unsigned int atomisp_streaming_count(struct atomisp_device *isp);
long atomisp_compat_ioctl32(struct file *file,
			    unsigned int cmd, unsigned long arg);

int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp,
	bool isp_timeout);

int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count);
void atomisp_stop_streaming(struct vb2_queue *vq);

Loading