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

media: atomisp: Remove const/fixed camera_caps



The code checks a camera_caps struct in various places, but this always
points to the same const camera_caps struct.

Remove the checks, keeping the code paths which would be taken with
the fixed camera caps struct still in place and remove the camera_caps
struct itself.

Note this completely removes atomisp_pause_buffer_event() because that
only ever does something if camera_caps.sensors[0].is_slave is true and
that never is true.

Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent e226e9a4
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -141,23 +141,6 @@ struct atomisp_platform_data {
	struct intel_v4l2_subdev_table *subdevs;
};

/* Describe the capacities of one single sensor. */
struct atomisp_sensor_caps {
	/* The number of streams this sensor can output. */
	int stream_num;
	bool is_slave;
};

/* Describe the capacities of sensors connected to one camera port. */
struct atomisp_camera_caps {
	/* The number of sensors connected to this camera port. */
	int sensor_num;
	/* The capacities of each sensor. */
	struct atomisp_sensor_caps sensor[MAX_SENSORS_PER_PORT];
	/* Define whether stream control is required for multiple streams. */
	bool multi_stream_ctrl;
};

/*
 *  Sensor of external ISP can send multiple steams with different mipi data
 * type in the same virtual channel. This information needs to come from the
@@ -235,7 +218,6 @@ struct camera_mipi_info {
};

const struct atomisp_platform_data *atomisp_get_platform_data(void);
const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);

/* API from old platform_camera.h, new CPUID implementation */
#define __IS_SOC(x) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \
+3 −108
Original line number Diff line number Diff line
@@ -770,24 +770,6 @@ static struct atomisp_video_pipe *__atomisp_get_pipe(
    enum ia_css_pipe_id css_pipe_id,
    enum ia_css_buffer_type buf_type)
{
	struct atomisp_device *isp = asd->isp;

	if (css_pipe_id == IA_CSS_PIPE_ID_COPY &&
	    isp->inputs[asd->input_curr].camera_caps->
	    sensor[asd->sensor_curr].stream_num > 1) {
		switch (stream_id) {
		case ATOMISP_INPUT_STREAM_PREVIEW:
			return &asd->video_out_preview;
		case ATOMISP_INPUT_STREAM_POSTVIEW:
			return &asd->video_out_vf;
		case ATOMISP_INPUT_STREAM_VIDEO:
			return &asd->video_out_video_capture;
		case ATOMISP_INPUT_STREAM_CAPTURE:
		default:
			return &asd->video_out_capture;
		}
	}

	/* video is same in online as in continuouscapture mode */
	if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_LOWLAT) {
		/*
@@ -5051,12 +5033,7 @@ static void atomisp_check_copy_mode(struct atomisp_sub_device *asd,
	src = atomisp_subdev_get_ffmt(&asd->subdev, NULL,
				      V4L2_SUBDEV_FORMAT_ACTIVE, source_pad);

	if ((sink->code == src->code &&
	     sink->width == f->width &&
	     sink->height == f->height) ||
	    ((asd->isp->inputs[asd->input_curr].type == SOC_CAMERA) &&
	     (asd->isp->inputs[asd->input_curr].camera_caps->
	      sensor[asd->sensor_curr].stream_num > 1)))
	if (sink->code == src->code && sink->width == f->width && sink->height == f->height)
		asd->copy_mode = true;
	else
		asd->copy_mode = false;
@@ -5282,58 +5259,7 @@ int atomisp_set_fmt(struct file *file, void *unused, struct v4l2_format *f)
			f->fmt.pix.height = r.height;
		}

		if (source_pad == ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW &&
		    (asd->isp->inputs[asd->input_curr].type == SOC_CAMERA) &&
		    (asd->isp->inputs[asd->input_curr].camera_caps->
		     sensor[asd->sensor_curr].stream_num > 1)) {
			/* For M10MO outputing YUV preview images. */
			u16 video_index =
			    atomisp_source_pad_to_stream_id(asd,
							    ATOMISP_SUBDEV_PAD_SOURCE_VIDEO);

			ret = atomisp_css_copy_get_output_frame_info(asd,
				video_index, &output_info);
			if (ret) {
				dev_err(isp->dev,
					"copy_get_output_frame_info ret %i", ret);
				return -EINVAL;
			}
			if (!asd->yuvpp_mode) {
				/*
				 * If viewfinder was configured into copy_mode,
				 * we switch to using yuvpp pipe instead.
				 */
				asd->yuvpp_mode = true;
				ret = atomisp_css_copy_configure_output(
					  asd, video_index, 0, 0, 0, 0);
				if (ret) {
					dev_err(isp->dev,
						"failed to disable copy pipe");
					return -EINVAL;
				}
				ret = atomisp_css_yuvpp_configure_output(
					  asd, video_index,
					  output_info.res.width,
					  output_info.res.height,
					  output_info.padded_width,
					  output_info.format);
				if (ret) {
					dev_err(isp->dev,
						"failed to set up yuvpp pipe\n");
					return -EINVAL;
				}
				atomisp_css_video_enable_online(asd, false);
				atomisp_css_preview_enable_online(asd,
								  ATOMISP_INPUT_STREAM_GENERAL, false);
			}
			atomisp_css_yuvpp_configure_viewfinder(asd, video_index,
							       f->fmt.pix.width, f->fmt.pix.height,
							       format_bridge->planar ? f->fmt.pix.bytesperline
							       : f->fmt.pix.bytesperline * 8
							       / format_bridge->depth, format_bridge->sh_fmt);
			atomisp_css_yuvpp_get_viewfinder_frame_info(
			    asd, video_index, &output_info);
		} else if (source_pad == ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW) {
		if (source_pad == ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW) {
			atomisp_css_video_configure_viewfinder(asd,
							       f->fmt.pix.width, f->fmt.pix.height,
							       format_bridge->planar ? f->fmt.pix.bytesperline
@@ -5918,31 +5844,7 @@ int atomisp_flash_enable(struct atomisp_sub_device *asd, int num_frames)
int atomisp_source_pad_to_stream_id(struct atomisp_sub_device *asd,
				    uint16_t source_pad)
{
	int stream_id;
	struct atomisp_device *isp = asd->isp;

	if (isp->inputs[asd->input_curr].camera_caps->
	    sensor[asd->sensor_curr].stream_num == 1)
	return ATOMISP_INPUT_STREAM_GENERAL;

	switch (source_pad) {
	case ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE:
		stream_id = ATOMISP_INPUT_STREAM_CAPTURE;
		break;
	case ATOMISP_SUBDEV_PAD_SOURCE_VF:
		stream_id = ATOMISP_INPUT_STREAM_POSTVIEW;
		break;
	case ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW:
		stream_id = ATOMISP_INPUT_STREAM_PREVIEW;
		break;
	case ATOMISP_SUBDEV_PAD_SOURCE_VIDEO:
		stream_id = ATOMISP_INPUT_STREAM_VIDEO;
		break;
	default:
		stream_id = ATOMISP_INPUT_STREAM_GENERAL;
	}

	return stream_id;
}

bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe)
@@ -6217,13 +6119,6 @@ int atomisp_get_invalid_frame_num(struct video_device *vdev,
	struct ia_css_pipe_info p_info;
	int ret;

	if (asd->isp->inputs[asd->input_curr].camera_caps->
	    sensor[asd->sensor_curr].stream_num > 1) {
		/* External ISP */
		*invalid_frame_num = 0;
		return 0;
	}

	pipe_id = atomisp_get_pipe_id(pipe);
	if (!asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].pipes[pipe_id]) {
		dev_warn(asd->isp->dev,
+0 −44
Original line number Diff line number Diff line
@@ -369,45 +369,6 @@ static int atomisp_get_css_buf_type(struct atomisp_sub_device *asd,
		return IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME;
}

static int atomisp_qbuffers_to_css_for_all_pipes(struct atomisp_sub_device *asd)
{
	enum ia_css_buffer_type buf_type;
	enum ia_css_pipe_id css_capture_pipe_id = IA_CSS_PIPE_ID_COPY;
	enum ia_css_pipe_id css_preview_pipe_id = IA_CSS_PIPE_ID_COPY;
	enum ia_css_pipe_id css_video_pipe_id = IA_CSS_PIPE_ID_COPY;
	enum atomisp_input_stream_id input_stream_id;
	struct atomisp_video_pipe *capture_pipe;
	struct atomisp_video_pipe *preview_pipe;
	struct atomisp_video_pipe *video_pipe;

	capture_pipe = &asd->video_out_capture;
	preview_pipe = &asd->video_out_preview;
	video_pipe = &asd->video_out_video_capture;

	buf_type = atomisp_get_css_buf_type(
		       asd, css_preview_pipe_id,
		       atomisp_subdev_source_pad(&preview_pipe->vdev));
	input_stream_id = ATOMISP_INPUT_STREAM_PREVIEW;
	atomisp_q_video_buffers_to_css(asd, preview_pipe,
				       input_stream_id,
				       buf_type, css_preview_pipe_id);

	buf_type = atomisp_get_css_buf_type(asd, css_capture_pipe_id,
					    atomisp_subdev_source_pad(&capture_pipe->vdev));
	input_stream_id = ATOMISP_INPUT_STREAM_GENERAL;
	atomisp_q_video_buffers_to_css(asd, capture_pipe,
				       input_stream_id,
				       buf_type, css_capture_pipe_id);

	buf_type = atomisp_get_css_buf_type(asd, css_video_pipe_id,
					    atomisp_subdev_source_pad(&video_pipe->vdev));
	input_stream_id = ATOMISP_INPUT_STREAM_VIDEO;
	atomisp_q_video_buffers_to_css(asd, video_pipe,
				       input_stream_id,
				       buf_type, css_video_pipe_id);
	return 0;
}

/* queue all available buffers to css */
int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd)
{
@@ -423,11 +384,6 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd)
	bool raw_mode = atomisp_is_mbuscode_raw(
			    asd->fmt[asd->capture_pad].fmt.code);

	if (asd->isp->inputs[asd->input_curr].camera_caps->
	    sensor[asd->sensor_curr].stream_num == 2 &&
	    !asd->yuvpp_mode)
		return atomisp_qbuffers_to_css_for_all_pipes(asd);

	if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_SCALER) {
		video_pipe = &asd->video_out_video_capture;
		css_video_pipe_id = IA_CSS_PIPE_ID_VIDEO;
+0 −18
Original line number Diff line number Diff line
@@ -134,24 +134,6 @@ static DEFINE_MUTEX(vcm_lock);

static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev);

/*
 * Legacy/stub behavior copied from upstream platform_camera.c.  The
 * atomisp driver relies on these values being non-NULL in a few
 * places, even though they are hard-coded in all current
 * implementations.
 */
const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void)
{
	static const struct atomisp_camera_caps caps = {
		.sensor_num = 1,
		.sensor = {
			{ .stream_num = 1, },
		},
	};
	return &caps;
}
EXPORT_SYMBOL_GPL(atomisp_get_default_camera_caps);

const struct atomisp_platform_data *atomisp_get_platform_data(void)
{
	return &pdata;
+1 −4
Original line number Diff line number Diff line
@@ -127,9 +127,7 @@
 * Moorefield/Baytrail platform.
 */
#define ATOMISP_SOC_CAMERA(asd)  \
	(asd->isp->inputs[asd->input_curr].type == SOC_CAMERA \
	&& asd->isp->inputs[asd->input_curr].camera_caps-> \
	   sensor[asd->sensor_curr].stream_num == 1)
	(asd->isp->inputs[asd->input_curr].type == SOC_CAMERA)

#define ATOMISP_USE_YUVPP(asd)  \
	(ATOMISP_SOC_CAMERA(asd) && ATOMISP_CSS_SUPPORT_YUVPP && \
@@ -162,7 +160,6 @@ struct atomisp_input_subdev {
	 */
	struct atomisp_sub_device *asd;

	const struct atomisp_camera_caps *camera_caps;
	int sensor_index;
};

Loading