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

media: atomisp: remove unused atomisp_*css_* functions

With the removal of the ACC ioctls and atomisp_acc.c a whole bunch
of atomisp_*css_* functions is no longer used, remove them.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-21-hdegoede@redhat.com


Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 868088a0
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -442,33 +442,8 @@ int atomisp_css_get_dis_stat(struct atomisp_sub_device *asd,

int atomisp_css_update_stream(struct atomisp_sub_device *asd);

int atomisp_css_create_acc_pipe(struct atomisp_sub_device *asd);

int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd);

int atomisp_css_stop_acc_pipe(struct atomisp_sub_device *asd);

void atomisp_css_destroy_acc_pipe(struct atomisp_sub_device *asd);

int atomisp_css_load_acc_extension(struct atomisp_sub_device *asd,
				   struct ia_css_fw_info *fw,
				   enum ia_css_pipe_id pipe_id,
				   unsigned int type);

void atomisp_css_unload_acc_extension(struct atomisp_sub_device *asd,
				      struct ia_css_fw_info *fw,
				      enum ia_css_pipe_id pipe_id);

int atomisp_css_wait_acc_finish(struct atomisp_sub_device *asd);

void atomisp_css_acc_done(struct atomisp_sub_device *asd);

int atomisp_css_load_acc_binary(struct atomisp_sub_device *asd,
				struct ia_css_fw_info *fw,
				unsigned int index);

void atomisp_css_unload_acc_binary(struct atomisp_sub_device *asd);

struct atomisp_acc_fw;
int atomisp_css_set_acc_parameters(struct atomisp_acc_fw *acc_fw);

+0 −217
Original line number Diff line number Diff line
@@ -3828,25 +3828,6 @@ void atomisp_css_acc_done(struct atomisp_sub_device *asd)
	complete(&asd->acc.acc_done);
}

int atomisp_css_wait_acc_finish(struct atomisp_sub_device *asd)
{
	int ret = 0;
	struct atomisp_device *isp = asd->isp;

	/* Unlock the isp mutex taken in IOCTL handler before sleeping! */
	rt_mutex_unlock(&isp->mutex);
	if (wait_for_completion_interruptible_timeout(&asd->acc.acc_done,
		ATOMISP_ISP_TIMEOUT_DURATION) == 0) {
		dev_err(isp->dev, "<%s: completion timeout\n", __func__);
		ia_css_debug_dump_sp_sw_debug_info();
		ia_css_debug_dump_debug_info(__func__);
		ret = -EIO;
	}
	rt_mutex_lock(&isp->mutex);

	return ret;
}

/* Set the ACC binary arguments */
int atomisp_css_set_acc_parameters(struct atomisp_acc_fw *acc_fw)
{
@@ -3865,204 +3846,6 @@ int atomisp_css_set_acc_parameters(struct atomisp_acc_fw *acc_fw)
	return 0;
}

/* Load acc binary extension */
int atomisp_css_load_acc_extension(struct atomisp_sub_device *asd,
				   struct ia_css_fw_info *fw,
				   enum ia_css_pipe_id pipe_id,
				   unsigned int type)
{
	struct ia_css_fw_info **hd;

	fw->next = NULL;
	hd = &(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
	       .pipe_configs[pipe_id].acc_extension);
	while (*hd)
		hd = &(*hd)->next;
	*hd = fw;

	asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
	.update_pipe[pipe_id] = true;
	return 0;
}

/* Unload acc binary extension */
void atomisp_css_unload_acc_extension(struct atomisp_sub_device *asd,
				      struct ia_css_fw_info *fw,
				      enum ia_css_pipe_id pipe_id)
{
	struct ia_css_fw_info **hd;

	hd = &(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
	       .pipe_configs[pipe_id].acc_extension);
	while (*hd && *hd != fw)
		hd = &(*hd)->next;
	if (!*hd) {
		dev_err(asd->isp->dev, "did not find acc fw for removal\n");
		return;
	}
	*hd = fw->next;
	fw->next = NULL;

	asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
	.update_pipe[pipe_id] = true;
}

int atomisp_css_create_acc_pipe(struct atomisp_sub_device *asd)
{
	struct atomisp_device *isp = asd->isp;
	struct ia_css_pipe_config *pipe_config;
	struct atomisp_stream_env *stream_env =
		    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL];

	if (stream_env->acc_stream) {
		if (stream_env->acc_stream_state == CSS_STREAM_STARTED) {
			if (ia_css_stream_stop(stream_env->acc_stream)
			    != 0) {
				dev_err(isp->dev, "stop acc_stream failed.\n");
				return -EBUSY;
			}
		}

		if (ia_css_stream_destroy(stream_env->acc_stream)
		    != 0) {
			dev_err(isp->dev, "destroy acc_stream failed.\n");
			return -EBUSY;
		}
		stream_env->acc_stream = NULL;
	}

	pipe_config = &stream_env->pipe_configs[IA_CSS_PIPE_ID_ACC];
	ia_css_pipe_config_defaults(pipe_config);
	asd->acc.acc_stages = kzalloc(MAX_ACC_STAGES *
				      sizeof(void *), GFP_KERNEL);
	if (!asd->acc.acc_stages)
		return -ENOMEM;
	pipe_config->acc_stages = asd->acc.acc_stages;
	pipe_config->mode = IA_CSS_PIPE_MODE_ACC;
	pipe_config->num_acc_stages = 0;

	/*
	 * We delay the ACC pipeline creation to atomisp_css_start_acc_pipe,
	 * because pipe configuration will soon be changed by
	 * atomisp_css_load_acc_binary()
	 */
	return 0;
}

int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd)
{
	struct atomisp_device *isp = asd->isp;
	struct atomisp_stream_env *stream_env =
		    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL];
	struct ia_css_pipe_config *pipe_config =
		    &stream_env->pipe_configs[IA_CSS_PIPE_ID_ACC];

	if (ia_css_pipe_create(pipe_config,
			       &stream_env->pipes[IA_CSS_PIPE_ID_ACC]) != 0) {
		dev_err(isp->dev, "%s: ia_css_pipe_create failed\n",
			__func__);
		return -EBADE;
	}

	memset(&stream_env->acc_stream_config, 0,
	       sizeof(struct ia_css_stream_config));
	if (ia_css_stream_create(&stream_env->acc_stream_config, 1,
				 &stream_env->pipes[IA_CSS_PIPE_ID_ACC],
				 &stream_env->acc_stream) != 0) {
		dev_err(isp->dev, "%s: create acc_stream error.\n", __func__);
		return -EINVAL;
	}
	stream_env->acc_stream_state = CSS_STREAM_CREATED;

	init_completion(&asd->acc.acc_done);
	asd->acc.pipeline = stream_env->pipes[IA_CSS_PIPE_ID_ACC];

	atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_MAX, false);

	if (ia_css_start_sp()) {
		dev_err(isp->dev, "start sp error.\n");
		return -EIO;
	}

	if (ia_css_stream_start(stream_env->acc_stream)
	    != 0) {
		dev_err(isp->dev, "acc_stream start error.\n");
		return -EIO;
	}

	stream_env->acc_stream_state = CSS_STREAM_STARTED;
	return 0;
}

int atomisp_css_stop_acc_pipe(struct atomisp_sub_device *asd)
{
	struct atomisp_stream_env *stream_env =
		    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL];
	if (stream_env->acc_stream_state == CSS_STREAM_STARTED) {
		ia_css_stream_stop(stream_env->acc_stream);
		stream_env->acc_stream_state = CSS_STREAM_STOPPED;
	}
	return 0;
}

void atomisp_css_destroy_acc_pipe(struct atomisp_sub_device *asd)
{
	struct atomisp_stream_env *stream_env =
		    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL];
	if (stream_env->acc_stream) {
		if (ia_css_stream_destroy(stream_env->acc_stream)
		    != 0)
			dev_warn(asd->isp->dev,
				 "destroy acc_stream failed.\n");
		stream_env->acc_stream = NULL;
	}

	if (stream_env->pipes[IA_CSS_PIPE_ID_ACC]) {
		if (ia_css_pipe_destroy(stream_env->pipes[IA_CSS_PIPE_ID_ACC])
		    != 0)
			dev_warn(asd->isp->dev,
				 "destroy ACC pipe failed.\n");
		stream_env->pipes[IA_CSS_PIPE_ID_ACC] = NULL;
		stream_env->update_pipe[IA_CSS_PIPE_ID_ACC] = false;
		ia_css_pipe_config_defaults(
		    &stream_env->pipe_configs[IA_CSS_PIPE_ID_ACC]);
		ia_css_pipe_extra_config_defaults(
		    &stream_env->pipe_extra_configs[IA_CSS_PIPE_ID_ACC]);
	}
	asd->acc.pipeline = NULL;

	/* css 2.0 API limitation: ia_css_stop_sp() could be only called after
	 * destroy all pipes
	 */
	ia_css_stop_sp();

	kfree(asd->acc.acc_stages);
	asd->acc.acc_stages = NULL;

	atomisp_freq_scaling(asd->isp, ATOMISP_DFS_MODE_LOW, false);
}

int atomisp_css_load_acc_binary(struct atomisp_sub_device *asd,
				struct ia_css_fw_info *fw,
				unsigned int index)
{
	struct ia_css_pipe_config *pipe_config =
		    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
		    .pipe_configs[IA_CSS_PIPE_ID_ACC];

	if (index >= MAX_ACC_STAGES) {
		dev_dbg(asd->isp->dev, "%s: index(%d) out of range\n",
			__func__, index);
		return -ENOMEM;
	}

	pipe_config->acc_stages[index] = fw;
	pipe_config->num_acc_stages = index + 1;
	pipe_config->acc_num_execs = 1;

	return 0;
}

static struct atomisp_sub_device *__get_atomisp_subdev(
    struct ia_css_pipe *css_pipe,
    struct atomisp_device *isp,
+0 −1
Original line number Diff line number Diff line
@@ -325,7 +325,6 @@ struct atomisp_sub_device {
	struct {
		struct ia_css_pipe *pipeline;
		struct completion acc_done;
		void *acc_stages;
	} acc;

	struct atomisp_subdev_params params;