media: atomisp: get rid of non-Linux error codes

The atomisp driver has its own error codes under the
ia_css_err.h file. On several places, those got already
replaced by standard error codes, but there are still a
lot more to be fixed.

Let's get rid of all of those, mapping them into
the already-existing set of Linux error codes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-05-28 10:01:53 +02:00
Родитель abbd669dbf
Коммит 41022d35dd
71 изменённых файлов: 1578 добавлений и 1600 удалений

Просмотреть файл

@ -559,7 +559,7 @@ int atomisp_acc_set_state(struct atomisp_sub_device *asd,
struct atomisp_acc_fw *acc_fw; struct atomisp_acc_fw *acc_fw;
bool enable = (arg->flags & ATOMISP_STATE_FLAG_ENABLE) != 0; bool enable = (arg->flags & ATOMISP_STATE_FLAG_ENABLE) != 0;
struct ia_css_pipe *pipe; struct ia_css_pipe *pipe;
enum ia_css_err r; int r;
int i; int i;
if (!asd->acc.extension_mode) if (!asd->acc.extension_mode)
@ -581,7 +581,7 @@ int atomisp_acc_set_state(struct atomisp_sub_device *asd,
pipes[acc_flag_to_pipe[i].pipe_id]; pipes[acc_flag_to_pipe[i].pipe_id];
r = ia_css_pipe_set_qos_ext_state(pipe, acc_fw->handle, r = ia_css_pipe_set_qos_ext_state(pipe, acc_fw->handle,
enable); enable);
if (r != IA_CSS_SUCCESS) if (r)
return -EBADRQC; return -EBADRQC;
} }
} }

Просмотреть файл

@ -586,7 +586,7 @@ irqreturn_t atomisp_isr(int irq, void *dev)
if (irq_infos & IA_CSS_IRQ_INFO_ISYS_EVENTS_READY) { if (irq_infos & IA_CSS_IRQ_INFO_ISYS_EVENTS_READY) {
while (ia_css_dequeue_isys_event(&eof_event.event) == while (ia_css_dequeue_isys_event(&eof_event.event) ==
IA_CSS_SUCCESS) { 0) {
/* EOF Event does not have the css_pipe returned */ /* EOF Event does not have the css_pipe returned */
asd = __get_asd_from_port(isp, eof_event.event.port); asd = __get_asd_from_port(isp, eof_event.event.port);
if (!asd) { if (!asd) {
@ -6632,7 +6632,7 @@ int atomisp_get_invalid_frame_num(struct video_device *vdev,
ret = ia_css_pipe_get_info( ret = ia_css_pipe_get_info(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL] asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]
.pipes[pipe_id], &p_info); .pipes[pipe_id], &p_info);
if (ret == IA_CSS_SUCCESS) { if (!ret) {
*invalid_frame_num = p_info.num_invalid_frames; *invalid_frame_num = p_info.num_invalid_frames;
return 0; return 0;
} else { } else {

Просмотреть файл

@ -437,7 +437,7 @@ static int __destroy_stream(struct atomisp_sub_device *asd,
} }
if (stream_env->stream_state == CSS_STREAM_STARTED if (stream_env->stream_state == CSS_STREAM_STARTED
&& ia_css_stream_stop(stream_env->stream) != IA_CSS_SUCCESS) { && ia_css_stream_stop(stream_env->stream) != 0) {
dev_err(isp->dev, "stop stream failed.\n"); dev_err(isp->dev, "stop stream failed.\n");
return -EINVAL; return -EINVAL;
} }
@ -459,7 +459,7 @@ static int __destroy_stream(struct atomisp_sub_device *asd,
stream_env->stream_state = CSS_STREAM_STOPPED; stream_env->stream_state = CSS_STREAM_STOPPED;
if (ia_css_stream_destroy(stream_env->stream) != IA_CSS_SUCCESS) { if (ia_css_stream_destroy(stream_env->stream)) {
dev_err(isp->dev, "destroy stream failed.\n"); dev_err(isp->dev, "destroy stream failed.\n");
return -EINVAL; return -EINVAL;
} }
@ -503,10 +503,10 @@ static int __create_stream(struct atomisp_sub_device *asd,
__dump_stream_config(asd, stream_env); __dump_stream_config(asd, stream_env);
if (ia_css_stream_create(&stream_env->stream_config, if (ia_css_stream_create(&stream_env->stream_config,
pipe_index, multi_pipes, &stream_env->stream) != IA_CSS_SUCCESS) pipe_index, multi_pipes, &stream_env->stream) != 0)
return -EINVAL; return -EINVAL;
if (ia_css_stream_get_info(stream_env->stream, if (ia_css_stream_get_info(stream_env->stream,
&stream_env->stream_info) != IA_CSS_SUCCESS) { &stream_env->stream_info) != 0) {
ia_css_stream_destroy(stream_env->stream); ia_css_stream_destroy(stream_env->stream);
stream_env->stream = NULL; stream_env->stream = NULL;
return -EINVAL; return -EINVAL;
@ -546,7 +546,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd,
!(force || stream_env->update_pipe[i])) !(force || stream_env->update_pipe[i]))
continue; continue;
if (ia_css_pipe_destroy(stream_env->pipes[i]) if (ia_css_pipe_destroy(stream_env->pipes[i])
!= IA_CSS_SUCCESS) { != 0) {
dev_err(isp->dev, dev_err(isp->dev,
"destroy pipe[%d]failed.cannot recover.\n", i); "destroy pipe[%d]failed.cannot recover.\n", i);
ret = -EINVAL; ret = -EINVAL;
@ -731,7 +731,7 @@ static int __create_pipe(struct atomisp_sub_device *asd,
{ {
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
struct ia_css_pipe_extra_config extra_config; struct ia_css_pipe_extra_config extra_config;
enum ia_css_err ret; int ret;
if (pipe_id >= IA_CSS_PIPE_ID_NUM) if (pipe_id >= IA_CSS_PIPE_ID_NUM)
return -EINVAL; return -EINVAL;
@ -761,20 +761,20 @@ static int __create_pipe(struct atomisp_sub_device *asd,
&stream_env->pipe_configs[pipe_id], &stream_env->pipe_configs[pipe_id],
&stream_env->pipe_extra_configs[pipe_id], &stream_env->pipe_extra_configs[pipe_id],
&stream_env->pipes[pipe_id]); &stream_env->pipes[pipe_id]);
if (ret != IA_CSS_SUCCESS) if (ret)
dev_err(isp->dev, "create pipe[%d] error.\n", pipe_id); dev_err(isp->dev, "create pipe[%d] error.\n", pipe_id);
return ret; return ret;
} }
static int __create_pipes(struct atomisp_sub_device *asd) static int __create_pipes(struct atomisp_sub_device *asd)
{ {
enum ia_css_err ret; int ret;
int i, j; int i, j;
for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) {
for (j = 0; j < IA_CSS_PIPE_ID_NUM; j++) { for (j = 0; j < IA_CSS_PIPE_ID_NUM; j++) {
ret = __create_pipe(asd, &asd->stream_env[i], j); ret = __create_pipe(asd, &asd->stream_env[i], j);
if (ret != IA_CSS_SUCCESS) if (ret)
break; break;
} }
if (j < IA_CSS_PIPE_ID_NUM) if (j < IA_CSS_PIPE_ID_NUM)
@ -805,20 +805,20 @@ int atomisp_css_update_stream(struct atomisp_sub_device *asd)
int ret; int ret;
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
if (__destroy_streams(asd, true) != IA_CSS_SUCCESS) if (__destroy_streams(asd, true))
dev_warn(isp->dev, "destroy stream failed.\n"); dev_warn(isp->dev, "destroy stream failed.\n");
if (__destroy_pipes(asd, true) != IA_CSS_SUCCESS) if (__destroy_pipes(asd, true))
dev_warn(isp->dev, "destroy pipe failed.\n"); dev_warn(isp->dev, "destroy pipe failed.\n");
ret = __create_pipes(asd); ret = __create_pipes(asd);
if (ret != IA_CSS_SUCCESS) { if (ret) {
dev_err(isp->dev, "create pipe failed %d.\n", ret); dev_err(isp->dev, "create pipe failed %d.\n", ret);
return -EIO; return -EIO;
} }
ret = __create_streams(asd); ret = __create_streams(asd);
if (ret != IA_CSS_SUCCESS) { if (ret) {
dev_warn(isp->dev, "create stream failed %d.\n", ret); dev_warn(isp->dev, "create stream failed %d.\n", ret);
__destroy_pipes(asd, true); __destroy_pipes(asd, true);
return -EIO; return -EIO;
@ -831,7 +831,7 @@ int atomisp_css_init(struct atomisp_device *isp)
{ {
unsigned int mmu_base_addr; unsigned int mmu_base_addr;
int ret; int ret;
enum ia_css_err err; int err;
ret = hmm_get_mmu_base_addr(&mmu_base_addr); ret = hmm_get_mmu_base_addr(&mmu_base_addr);
if (ret) if (ret)
@ -840,7 +840,7 @@ int atomisp_css_init(struct atomisp_device *isp)
/* Init ISP */ /* Init ISP */
err = ia_css_init(isp->dev, &isp->css_env.isp_css_env, NULL, err = ia_css_init(isp->dev, &isp->css_env.isp_css_env, NULL,
(uint32_t)mmu_base_addr, IA_CSS_IRQ_TYPE_PULSE); (uint32_t)mmu_base_addr, IA_CSS_IRQ_TYPE_PULSE);
if (err != IA_CSS_SUCCESS) { if (err) {
dev_err(isp->dev, "css init failed --- bad firmware?\n"); dev_err(isp->dev, "css init failed --- bad firmware?\n");
return -EINVAL; return -EINVAL;
} }
@ -872,7 +872,7 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt)
int atomisp_css_load_firmware(struct atomisp_device *isp) int atomisp_css_load_firmware(struct atomisp_device *isp)
{ {
enum ia_css_err err; int err;
/* set css env */ /* set css env */
isp->css_env.isp_css_fw.data = (void *)isp->firmware->data; isp->css_env.isp_css_fw.data = (void *)isp->firmware->data;
@ -901,7 +901,7 @@ int atomisp_css_load_firmware(struct atomisp_device *isp)
/* load isp fw into ISP memory */ /* load isp fw into ISP memory */
err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env, err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env,
&isp->css_env.isp_css_fw); &isp->css_env.isp_css_fw);
if (err != IA_CSS_SUCCESS) { if (err) {
dev_err(isp->dev, "css load fw failed.\n"); dev_err(isp->dev, "css load fw failed.\n");
return -EINVAL; return -EINVAL;
} }
@ -959,7 +959,7 @@ int atomisp_css_irq_translate(struct atomisp_device *isp,
int err; int err;
err = ia_css_irq_translate(infos); err = ia_css_irq_translate(infos);
if (err != IA_CSS_SUCCESS) { if (err) {
dev_warn(isp->dev, dev_warn(isp->dev,
"%s:failed to translate irq (err = %d,infos = %d)\n", "%s:failed to translate irq (err = %d,infos = %d)\n",
__func__, err, *infos); __func__, err, *infos);
@ -993,7 +993,7 @@ int atomisp_css_irq_enable(struct atomisp_device *isp,
dev_dbg(isp->dev, "%s: css irq info 0x%08x: %s.\n", dev_dbg(isp->dev, "%s: css irq info 0x%08x: %s.\n",
__func__, info, __func__, info,
enable ? "enable" : "disable"); enable ? "enable" : "disable");
if (ia_css_irq_enable(info, enable) != IA_CSS_SUCCESS) { if (ia_css_irq_enable(info, enable)) {
dev_warn(isp->dev, "%s:Invalid irq info: 0x%08x when %s.\n", dev_warn(isp->dev, "%s:Invalid irq info: 0x%08x when %s.\n",
__func__, info, __func__, info,
enable ? "enabling" : "disabling"); enable ? "enabling" : "disabling");
@ -1029,14 +1029,14 @@ int atomisp_q_video_buffer_to_css(struct atomisp_sub_device *asd,
{ {
struct atomisp_stream_env *stream_env = &asd->stream_env[stream_id]; struct atomisp_stream_env *stream_env = &asd->stream_env[stream_id];
struct ia_css_buffer css_buf = {0}; struct ia_css_buffer css_buf = {0};
enum ia_css_err err; int err;
css_buf.type = css_buf_type; css_buf.type = css_buf_type;
css_buf.data.frame = vm_mem->vaddr; css_buf.data.frame = vm_mem->vaddr;
err = ia_css_pipe_enqueue_buffer( err = ia_css_pipe_enqueue_buffer(
stream_env->pipes[css_pipe_id], &css_buf); stream_env->pipes[css_pipe_id], &css_buf);
if (err != IA_CSS_SUCCESS) if (err)
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -1164,7 +1164,7 @@ int atomisp_css_start(struct atomisp_sub_device *asd,
} else { } else {
if (!sh_css_hrt_system_is_idle()) if (!sh_css_hrt_system_is_idle())
dev_err(isp->dev, "CSS HW not idle before starting SP\n"); dev_err(isp->dev, "CSS HW not idle before starting SP\n");
if (ia_css_start_sp() != IA_CSS_SUCCESS) { if (ia_css_start_sp()) {
dev_err(isp->dev, "start sp error.\n"); dev_err(isp->dev, "start sp error.\n");
ret = -EINVAL; ret = -EINVAL;
goto start_err; goto start_err;
@ -1176,7 +1176,7 @@ int atomisp_css_start(struct atomisp_sub_device *asd,
for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) {
if (asd->stream_env[i].stream) { if (asd->stream_env[i].stream) {
if (ia_css_stream_start(asd->stream_env[i] if (ia_css_stream_start(asd->stream_env[i]
.stream) != IA_CSS_SUCCESS) { .stream) != 0) {
dev_err(isp->dev, "stream[%d] start error.\n", i); dev_err(isp->dev, "stream[%d] start error.\n", i);
ret = -EINVAL; ret = -EINVAL;
goto start_err; goto start_err;
@ -1233,7 +1233,7 @@ void atomisp_css_update_isp_params(struct atomisp_sub_device *asd)
void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd, void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd,
struct ia_css_pipe *pipe) struct ia_css_pipe *pipe)
{ {
enum ia_css_err ret; int ret;
if (!pipe) { if (!pipe) {
atomisp_css_update_isp_params(asd); atomisp_css_update_isp_params(asd);
@ -1248,7 +1248,7 @@ void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd,
ret = ia_css_stream_set_isp_config_on_pipe( ret = ia_css_stream_set_isp_config_on_pipe(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
&asd->params.config, pipe); &asd->params.config, pipe);
if (ret != IA_CSS_SUCCESS) if (ret)
dev_warn(asd->isp->dev, "%s: ia_css_stream_set_isp_config_on_pipe failed %d\n", dev_warn(asd->isp->dev, "%s: ia_css_stream_set_isp_config_on_pipe failed %d\n",
__func__, ret); __func__, ret);
memset(&asd->params.config, 0, sizeof(asd->params.config)); memset(&asd->params.config, 0, sizeof(asd->params.config));
@ -1263,7 +1263,7 @@ int atomisp_css_queue_buffer(struct atomisp_sub_device *asd,
if (ia_css_pipe_enqueue_buffer( if (ia_css_pipe_enqueue_buffer(
asd->stream_env[stream_id].pipes[pipe_id], asd->stream_env[stream_id].pipes[pipe_id],
&isp_css_buffer->css_buffer) &isp_css_buffer->css_buffer)
!= IA_CSS_SUCCESS) != 0)
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -1276,12 +1276,12 @@ int atomisp_css_dequeue_buffer(struct atomisp_sub_device *asd,
struct atomisp_css_buffer *isp_css_buffer) struct atomisp_css_buffer *isp_css_buffer)
{ {
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
enum ia_css_err err; int err;
err = ia_css_pipe_dequeue_buffer( err = ia_css_pipe_dequeue_buffer(
asd->stream_env[stream_id].pipes[pipe_id], asd->stream_env[stream_id].pipes[pipe_id],
&isp_css_buffer->css_buffer); &isp_css_buffer->css_buffer);
if (err != IA_CSS_SUCCESS) { if (err) {
dev_err(isp->dev, dev_err(isp->dev,
"ia_css_pipe_dequeue_buffer failed: 0x%x\n", err); "ia_css_pipe_dequeue_buffer failed: 0x%x\n", err);
return -EINVAL; return -EINVAL;
@ -1481,7 +1481,7 @@ int atomisp_css_get_grid_info(struct atomisp_sub_device *asd,
if (ia_css_pipe_get_info( if (ia_css_pipe_get_info(
asd->stream_env[stream_index].pipes[pipe_id], asd->stream_env[stream_index].pipes[pipe_id],
&p_info) != IA_CSS_SUCCESS) { &p_info) != 0) {
dev_err(isp->dev, "ia_css_pipe_get_info failed\n"); dev_err(isp->dev, "ia_css_pipe_get_info failed\n");
return -EINVAL; return -EINVAL;
} }
@ -1635,7 +1635,7 @@ void atomisp_css_get_dis_statistics(struct atomisp_sub_device *asd,
int atomisp_css_dequeue_event(struct atomisp_css_event *current_event) int atomisp_css_dequeue_event(struct atomisp_css_event *current_event)
{ {
if (ia_css_dequeue_event(&current_event->event) != IA_CSS_SUCCESS) if (ia_css_dequeue_event(&current_event->event))
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -1959,7 +1959,7 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd,
s_config->input_config.format, s_config->input_config.format,
true, true,
0x13000, 0x13000,
&size_mem_words) != IA_CSS_SUCCESS) { &size_mem_words) != 0) {
if (intel_mid_identify_cpu() == if (intel_mid_identify_cpu() ==
INTEL_MID_CPU_CHIP_TANGIER) INTEL_MID_CPU_CHIP_TANGIER)
size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_2; size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_2;
@ -2106,7 +2106,7 @@ int atomisp_css_frame_allocate(struct ia_css_frame **frame,
unsigned int raw_bit_depth) unsigned int raw_bit_depth)
{ {
if (ia_css_frame_allocate(frame, width, height, format, if (ia_css_frame_allocate(frame, width, height, format,
padded_width, raw_bit_depth) != IA_CSS_SUCCESS) padded_width, raw_bit_depth) != 0)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -2115,7 +2115,7 @@ int atomisp_css_frame_allocate(struct ia_css_frame **frame,
int atomisp_css_frame_allocate_from_info(struct ia_css_frame **frame, int atomisp_css_frame_allocate_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info) const struct ia_css_frame_info *info)
{ {
if (ia_css_frame_allocate_from_info(frame, info) != IA_CSS_SUCCESS) if (ia_css_frame_allocate_from_info(frame, info))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -2132,7 +2132,7 @@ int atomisp_css_frame_map(struct ia_css_frame **frame,
unsigned int pgnr) unsigned int pgnr)
{ {
if (ia_css_frame_map(frame, info, data, attribute, pgnr) if (ia_css_frame_map(frame, info, data, attribute, pgnr)
!= IA_CSS_SUCCESS) != 0)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -2143,7 +2143,7 @@ int atomisp_css_set_black_frame(struct atomisp_sub_device *asd,
{ {
if (sh_css_set_black_frame( if (sh_css_set_black_frame(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
raw_black_frame) != IA_CSS_SUCCESS) raw_black_frame) != 0)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -2154,7 +2154,7 @@ int atomisp_css_allocate_continuous_frames(bool init_time,
{ {
if (ia_css_alloc_continuous_frame_remain( if (ia_css_alloc_continuous_frame_remain(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream) asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream)
!= IA_CSS_SUCCESS) != 0)
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
@ -2754,7 +2754,7 @@ static int __get_frame_info(struct atomisp_sub_device *asd,
enum ia_css_pipe_id pipe_id) enum ia_css_pipe_id pipe_id)
{ {
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
enum ia_css_err ret; int ret;
struct ia_css_pipe_info p_info; struct ia_css_pipe_info p_info;
/* FIXME! No need to destroy/recreate all streams */ /* FIXME! No need to destroy/recreate all streams */
@ -2773,7 +2773,7 @@ static int __get_frame_info(struct atomisp_sub_device *asd,
ret = ia_css_pipe_get_info( ret = ia_css_pipe_get_info(
asd->stream_env[stream_index] asd->stream_env[stream_index]
.pipes[pipe_id], &p_info); .pipes[pipe_id], &p_info);
if (ret == IA_CSS_SUCCESS) { if (!ret) {
switch (type) { switch (type) {
case ATOMISP_CSS_VF_FRAME: case ATOMISP_CSS_VF_FRAME:
*info = p_info.vf_output_info[0]; *info = p_info.vf_output_info[0];
@ -2867,7 +2867,7 @@ int atomisp_get_css_frame_info(struct atomisp_sub_device *asd,
atomisp_source_pad_to_stream_id(asd, source_pad); atomisp_source_pad_to_stream_id(asd, source_pad);
} }
if (IA_CSS_SUCCESS != ia_css_pipe_get_info(asd->stream_env[stream_index] if (0 != ia_css_pipe_get_info(asd->stream_env[stream_index]
.pipes[pipe_index], &info)) { .pipes[pipe_index], &info)) {
dev_err(isp->dev, "ia_css_pipe_get_info FAILED"); dev_err(isp->dev, "ia_css_pipe_get_info FAILED");
return -EINVAL; return -EINVAL;
@ -3239,7 +3239,7 @@ int atomisp_css_video_configure_pp_input(
int atomisp_css_offline_capture_configure(struct atomisp_sub_device *asd, int atomisp_css_offline_capture_configure(struct atomisp_sub_device *asd,
int num_captures, unsigned int skip, int offset) int num_captures, unsigned int skip, int offset)
{ {
enum ia_css_err ret; int ret;
dev_dbg(asd->isp->dev, "%s num_capture:%d skip:%d offset:%d\n", dev_dbg(asd->isp->dev, "%s num_capture:%d skip:%d offset:%d\n",
__func__, num_captures, skip, offset); __func__, num_captures, skip, offset);
@ -3247,7 +3247,7 @@ int atomisp_css_offline_capture_configure(struct atomisp_sub_device *asd,
ret = ia_css_stream_capture( ret = ia_css_stream_capture(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
num_captures, skip, offset); num_captures, skip, offset);
if (ret != IA_CSS_SUCCESS) if (ret)
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -3255,15 +3255,15 @@ int atomisp_css_offline_capture_configure(struct atomisp_sub_device *asd,
int atomisp_css_exp_id_capture(struct atomisp_sub_device *asd, int exp_id) int atomisp_css_exp_id_capture(struct atomisp_sub_device *asd, int exp_id)
{ {
enum ia_css_err ret; int ret;
ret = ia_css_stream_capture_frame( ret = ia_css_stream_capture_frame(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
exp_id); exp_id);
if (ret == IA_CSS_ERR_QUEUE_IS_FULL) { if (ret == -ENOBUFS) {
/* capture cmd queue is full */ /* capture cmd queue is full */
return -EBUSY; return -EBUSY;
} else if (ret != IA_CSS_SUCCESS) { } else if (ret) {
return -EIO; return -EIO;
} }
@ -3272,14 +3272,14 @@ int atomisp_css_exp_id_capture(struct atomisp_sub_device *asd, int exp_id)
int atomisp_css_exp_id_unlock(struct atomisp_sub_device *asd, int exp_id) int atomisp_css_exp_id_unlock(struct atomisp_sub_device *asd, int exp_id)
{ {
enum ia_css_err ret; int ret;
ret = ia_css_unlock_raw_frame( ret = ia_css_unlock_raw_frame(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
exp_id); exp_id);
if (ret == IA_CSS_ERR_QUEUE_IS_FULL) if (ret == -ENOBUFS)
return -EAGAIN; return -EAGAIN;
else if (ret != IA_CSS_SUCCESS) else if (ret)
return -EIO; return -EIO;
return 0; return 0;
@ -4236,14 +4236,14 @@ int atomisp_css_create_acc_pipe(struct atomisp_sub_device *asd)
if (stream_env->acc_stream) { if (stream_env->acc_stream) {
if (stream_env->acc_stream_state == CSS_STREAM_STARTED) { if (stream_env->acc_stream_state == CSS_STREAM_STARTED) {
if (ia_css_stream_stop(stream_env->acc_stream) if (ia_css_stream_stop(stream_env->acc_stream)
!= IA_CSS_SUCCESS) { != 0) {
dev_err(isp->dev, "stop acc_stream failed.\n"); dev_err(isp->dev, "stop acc_stream failed.\n");
return -EBUSY; return -EBUSY;
} }
} }
if (ia_css_stream_destroy(stream_env->acc_stream) if (ia_css_stream_destroy(stream_env->acc_stream)
!= IA_CSS_SUCCESS) { != 0) {
dev_err(isp->dev, "destroy acc_stream failed.\n"); dev_err(isp->dev, "destroy acc_stream failed.\n");
return -EBUSY; return -EBUSY;
} }
@ -4277,7 +4277,7 @@ int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd)
&stream_env->pipe_configs[IA_CSS_PIPE_ID_ACC]; &stream_env->pipe_configs[IA_CSS_PIPE_ID_ACC];
if (ia_css_pipe_create(pipe_config, if (ia_css_pipe_create(pipe_config,
&stream_env->pipes[IA_CSS_PIPE_ID_ACC]) != IA_CSS_SUCCESS) { &stream_env->pipes[IA_CSS_PIPE_ID_ACC]) != 0) {
dev_err(isp->dev, "%s: ia_css_pipe_create failed\n", dev_err(isp->dev, "%s: ia_css_pipe_create failed\n",
__func__); __func__);
return -EBADE; return -EBADE;
@ -4287,7 +4287,7 @@ int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd)
sizeof(struct ia_css_stream_config)); sizeof(struct ia_css_stream_config));
if (ia_css_stream_create(&stream_env->acc_stream_config, 1, if (ia_css_stream_create(&stream_env->acc_stream_config, 1,
&stream_env->pipes[IA_CSS_PIPE_ID_ACC], &stream_env->pipes[IA_CSS_PIPE_ID_ACC],
&stream_env->acc_stream) != IA_CSS_SUCCESS) { &stream_env->acc_stream) != 0) {
dev_err(isp->dev, "%s: create acc_stream error.\n", __func__); dev_err(isp->dev, "%s: create acc_stream error.\n", __func__);
return -EINVAL; return -EINVAL;
} }
@ -4298,13 +4298,13 @@ int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd)
atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_MAX, false); atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_MAX, false);
if (ia_css_start_sp() != IA_CSS_SUCCESS) { if (ia_css_start_sp()) {
dev_err(isp->dev, "start sp error.\n"); dev_err(isp->dev, "start sp error.\n");
return -EIO; return -EIO;
} }
if (ia_css_stream_start(stream_env->acc_stream) if (ia_css_stream_start(stream_env->acc_stream)
!= IA_CSS_SUCCESS) { != 0) {
dev_err(isp->dev, "acc_stream start error.\n"); dev_err(isp->dev, "acc_stream start error.\n");
return -EIO; return -EIO;
} }
@ -4330,7 +4330,7 @@ void atomisp_css_destroy_acc_pipe(struct atomisp_sub_device *asd)
&asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL];
if (stream_env->acc_stream) { if (stream_env->acc_stream) {
if (ia_css_stream_destroy(stream_env->acc_stream) if (ia_css_stream_destroy(stream_env->acc_stream)
!= IA_CSS_SUCCESS) != 0)
dev_warn(asd->isp->dev, dev_warn(asd->isp->dev,
"destroy acc_stream failed.\n"); "destroy acc_stream failed.\n");
stream_env->acc_stream = NULL; stream_env->acc_stream = NULL;
@ -4338,7 +4338,7 @@ void atomisp_css_destroy_acc_pipe(struct atomisp_sub_device *asd)
if (stream_env->pipes[IA_CSS_PIPE_ID_ACC]) { if (stream_env->pipes[IA_CSS_PIPE_ID_ACC]) {
if (ia_css_pipe_destroy(stream_env->pipes[IA_CSS_PIPE_ID_ACC]) if (ia_css_pipe_destroy(stream_env->pipes[IA_CSS_PIPE_ID_ACC])
!= IA_CSS_SUCCESS) != 0)
dev_warn(asd->isp->dev, dev_warn(asd->isp->dev,
"destroy ACC pipe failed.\n"); "destroy ACC pipe failed.\n");
stream_env->pipes[IA_CSS_PIPE_ID_ACC] = NULL; stream_env->pipes[IA_CSS_PIPE_ID_ACC] = NULL;

Просмотреть файл

@ -27,7 +27,7 @@ typedef void (*clear_func)(ia_css_ptr ptr);
* \param[in] size Size of the refcount list. * \param[in] size Size of the refcount list.
* \return ia_css_err * \return ia_css_err
*/ */
enum ia_css_err ia_css_refcount_init(uint32_t size); int ia_css_refcount_init(uint32_t size);
/*! \brief Function for de-initializing refcount list /*! \brief Function for de-initializing refcount list
* *

Просмотреть файл

@ -66,25 +66,25 @@ static struct ia_css_refcount_entry *refcount_find_entry(ia_css_ptr ptr,
return NULL; return NULL;
} }
enum ia_css_err ia_css_refcount_init(uint32_t size) int ia_css_refcount_init(uint32_t size)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
if (size == 0) { if (size == 0) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_refcount_init(): Size of 0 for Ref count init!\n"); "ia_css_refcount_init(): Size of 0 for Ref count init!\n");
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
if (myrefcount.items) { if (myrefcount.items) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_refcount_init(): Ref count is already initialized\n"); "ia_css_refcount_init(): Ref count is already initialized\n");
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
myrefcount.items = myrefcount.items =
kvmalloc(sizeof(struct ia_css_refcount_entry) * size, GFP_KERNEL); kvmalloc(sizeof(struct ia_css_refcount_entry) * size, GFP_KERNEL);
if (!myrefcount.items) if (!myrefcount.items)
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
if (err == IA_CSS_SUCCESS) { if (!err) {
memset(myrefcount.items, 0, memset(myrefcount.items, 0,
sizeof(struct ia_css_refcount_entry) * size); sizeof(struct ia_css_refcount_entry) * size);
myrefcount.size = size; myrefcount.size = size;

Просмотреть файл

@ -59,10 +59,10 @@ void ia_css_pipe_get_vfpp_binarydesc(
* (= The numerator member in the sh_css_bds_factor structure.) * (= The numerator member in the sh_css_bds_factor structure.)
* @param[out] bds_factor_denominator: The denominator of the bayer downscaling factor. * @param[out] bds_factor_denominator: The denominator of the bayer downscaling factor.
* (= The denominator member in the sh_css_bds_factor structure.) * (= The denominator member in the sh_css_bds_factor structure.)
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err sh_css_bds_factor_get_numerator_denominator( int sh_css_bds_factor_get_numerator_denominator(
unsigned int bds_factor, unsigned int bds_factor,
unsigned int *bds_factor_numerator, unsigned int *bds_factor_numerator,
unsigned int *bds_factor_denominator); unsigned int *bds_factor_denominator);
@ -75,10 +75,10 @@ enum ia_css_err sh_css_bds_factor_get_numerator_denominator(
* @param[in/out] bds_out_info * @param[in/out] bds_out_info
* @param[in/out] out_info * @param[in/out] out_info
* @param[in/out] vf_info * @param[in/out] vf_info
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipe_get_preview_binarydesc( int ia_css_pipe_get_preview_binarydesc(
struct ia_css_pipe *const pipe, struct ia_css_pipe *const pipe,
struct ia_css_binary_descr *preview_descr, struct ia_css_binary_descr *preview_descr,
struct ia_css_frame_info *in_info, struct ia_css_frame_info *in_info,
@ -93,10 +93,10 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc(
* @param[in/out] in_info * @param[in/out] in_info
* @param[in/out] bds_out_info * @param[in/out] bds_out_info
* @param[in/out] vf_info * @param[in/out] vf_info
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipe_get_video_binarydesc( int ia_css_pipe_get_video_binarydesc(
struct ia_css_pipe *const pipe, struct ia_css_pipe *const pipe,
struct ia_css_binary_descr *video_descr, struct ia_css_binary_descr *video_descr,
struct ia_css_frame_info *in_info, struct ia_css_frame_info *in_info,
@ -287,9 +287,9 @@ void ia_css_pipe_get_ldc_binarydesc(
* @param[in] input_res * @param[in] input_res
* @param[in] output_res * @param[in] output_res
* @param[in/out] bds_factor * @param[in/out] bds_factor
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
*/ */
enum ia_css_err binarydesc_calculate_bds_factor( int binarydesc_calculate_bds_factor(
struct ia_css_resolution input_res, struct ia_css_resolution input_res,
struct ia_css_resolution output_res, struct ia_css_resolution output_res,
unsigned int *bds_factor); unsigned int *bds_factor);

Просмотреть файл

@ -141,7 +141,7 @@ static struct sh_css_bds_factor bds_factors_list[] = {
{8, 1, SH_CSS_BDS_FACTOR_8_00} {8, 1, SH_CSS_BDS_FACTOR_8_00}
}; };
enum ia_css_err sh_css_bds_factor_get_numerator_denominator( int sh_css_bds_factor_get_numerator_denominator(
unsigned int bds_factor, unsigned int bds_factor,
unsigned int *bds_factor_numerator, unsigned int *bds_factor_numerator,
unsigned int *bds_factor_denominator) unsigned int *bds_factor_denominator)
@ -153,16 +153,16 @@ enum ia_css_err sh_css_bds_factor_get_numerator_denominator(
if (bds_factors_list[i].bds_factor == bds_factor) { if (bds_factors_list[i].bds_factor == bds_factor) {
*bds_factor_numerator = bds_factors_list[i].numerator; *bds_factor_numerator = bds_factors_list[i].numerator;
*bds_factor_denominator = bds_factors_list[i].denominator; *bds_factor_denominator = bds_factors_list[i].denominator;
return IA_CSS_SUCCESS; return 0;
} }
} }
/* Throw an error since bds_factor cannot be found /* Throw an error since bds_factor cannot be found
in bds_factors_list */ in bds_factors_list */
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
enum ia_css_err binarydesc_calculate_bds_factor( int binarydesc_calculate_bds_factor(
struct ia_css_resolution input_res, struct ia_css_resolution input_res,
struct ia_css_resolution output_res, struct ia_css_resolution output_res,
unsigned int *bds_factor) unsigned int *bds_factor)
@ -195,15 +195,15 @@ enum ia_css_err binarydesc_calculate_bds_factor(
if (cond) { if (cond) {
*bds_factor = bds_factors_list[i].bds_factor; *bds_factor = bds_factors_list[i].bds_factor;
return IA_CSS_SUCCESS; return 0;
} }
} }
/* Throw an error since a suitable bds_factor cannot be found */ /* Throw an error since a suitable bds_factor cannot be found */
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
enum ia_css_err ia_css_pipe_get_preview_binarydesc( int ia_css_pipe_get_preview_binarydesc(
struct ia_css_pipe *const pipe, struct ia_css_pipe *const pipe,
struct ia_css_binary_descr *preview_descr, struct ia_css_binary_descr *preview_descr,
struct ia_css_frame_info *in_info, struct ia_css_frame_info *in_info,
@ -211,7 +211,7 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc(
struct ia_css_frame_info *out_info, struct ia_css_frame_info *out_info,
struct ia_css_frame_info *vf_info) struct ia_css_frame_info *vf_info)
{ {
enum ia_css_err err; int err;
struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
int mode = IA_CSS_BINARY_MODE_PREVIEW; int mode = IA_CSS_BINARY_MODE_PREVIEW;
unsigned int i; unsigned int i;
@ -264,7 +264,7 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc(
binarydesc_calculate_bds_factor(in_info->res, binarydesc_calculate_bds_factor(in_info->res,
bds_out_info->res, bds_out_info->res,
&preview_descr->required_bds_factor); &preview_descr->required_bds_factor);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} else { } else {
bds_out_info->res.width = in_info->res.width / 2; bds_out_info->res.width = in_info->res.width / 2;
@ -318,11 +318,11 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc(
preview_descr->enable_dpc = pipe->config.enable_dpc; preview_descr->enable_dpc = pipe->config.enable_dpc;
preview_descr->isp_pipe_version = pipe->config.isp_pipe_version; preview_descr->isp_pipe_version = pipe->config.isp_pipe_version;
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err ia_css_pipe_get_video_binarydesc( int ia_css_pipe_get_video_binarydesc(
struct ia_css_pipe *const pipe, struct ia_css_pipe *const pipe,
struct ia_css_binary_descr *video_descr, struct ia_css_binary_descr *video_descr,
struct ia_css_frame_info *in_info, struct ia_css_frame_info *in_info,
@ -334,7 +334,7 @@ enum ia_css_err ia_css_pipe_get_video_binarydesc(
int mode = IA_CSS_BINARY_MODE_VIDEO; int mode = IA_CSS_BINARY_MODE_VIDEO;
unsigned int i; unsigned int i;
struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
bool stream_dz_config = false; bool stream_dz_config = false;
/* vf_info can be NULL */ /* vf_info can be NULL */
@ -407,7 +407,7 @@ enum ia_css_err ia_css_pipe_get_video_binarydesc(
binarydesc_calculate_bds_factor( binarydesc_calculate_bds_factor(
in_info->res, bds_out_info->res, in_info->res, bds_out_info->res,
&video_descr->required_bds_factor); &video_descr->required_bds_factor);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} else { } else {
bds_out_info->res.width = bds_out_info->res.width =

Просмотреть файл

@ -28,26 +28,26 @@
* @return "ia_css_err" error code * @return "ia_css_err" error code
* *
*/ */
enum ia_css_err ia_css_convert_errno( int ia_css_convert_errno(
int in_err); int in_err);
/* @brief check vf frame info. /* @brief check vf frame info.
* *
* @param[in] info * @param[in] info
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_util_check_vf_info( int ia_css_util_check_vf_info(
const struct ia_css_frame_info *const info); const struct ia_css_frame_info *const info);
/* @brief check input configuration. /* @brief check input configuration.
* *
* @param[in] stream_config * @param[in] stream_config
* @param[in] must_be_raw * @param[in] must_be_raw
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_util_check_input( int ia_css_util_check_input(
const struct ia_css_stream_config *const stream_config, const struct ia_css_stream_config *const stream_config,
bool must_be_raw, bool must_be_raw,
bool must_be_yuv); bool must_be_yuv);
@ -56,10 +56,10 @@ enum ia_css_err ia_css_util_check_input(
* *
* @param[in] out_info * @param[in] out_info
* @param[in] vf_info * @param[in] vf_info
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_util_check_vf_out_info( int ia_css_util_check_vf_out_info(
const struct ia_css_frame_info *const out_info, const struct ia_css_frame_info *const out_info,
const struct ia_css_frame_info *const vf_info); const struct ia_css_frame_info *const vf_info);
@ -67,10 +67,10 @@ enum ia_css_err ia_css_util_check_vf_out_info(
* *
* @param[in] width * @param[in] width
* @param[in] height * @param[in] height
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_util_check_res( int ia_css_util_check_res(
unsigned int width, unsigned int width,
unsigned int height); unsigned int height);

Просмотреть файл

@ -20,30 +20,30 @@
/* for ia_css_binary_max_vf_width() */ /* for ia_css_binary_max_vf_width() */
#include "ia_css_binary.h" #include "ia_css_binary.h"
enum ia_css_err ia_css_convert_errno( int ia_css_convert_errno(
int in_err) int in_err)
{ {
enum ia_css_err out_err; int out_err;
switch (in_err) { switch (in_err) {
case 0: case 0:
out_err = IA_CSS_SUCCESS; out_err = 0;
break; break;
case EINVAL: case EINVAL:
out_err = IA_CSS_ERR_INVALID_ARGUMENTS; out_err = -EINVAL;
break; break;
case ENODATA: case ENODATA:
out_err = IA_CSS_ERR_QUEUE_IS_EMPTY; out_err = -ENODATA;
break; break;
case ENOSYS: case ENOSYS:
case ENOTSUP: case ENOTSUP:
out_err = IA_CSS_ERR_INTERNAL_ERROR; out_err = -EINVAL;
break; break;
case ENOBUFS: case ENOBUFS:
out_err = IA_CSS_ERR_QUEUE_IS_FULL; out_err = -ENOBUFS;
break; break;
default: default:
out_err = IA_CSS_ERR_INTERNAL_ERROR; out_err = -EINVAL;
break; break;
} }
return out_err; return out_err;
@ -113,49 +113,49 @@ unsigned int ia_css_util_input_format_bpp(
return rval; return rval;
} }
enum ia_css_err ia_css_util_check_vf_info( int ia_css_util_check_vf_info(
const struct ia_css_frame_info *const info) const struct ia_css_frame_info *const info)
{ {
enum ia_css_err err; int err;
unsigned int max_vf_width; unsigned int max_vf_width;
assert(info); assert(info);
err = ia_css_frame_check_info(info); err = ia_css_frame_check_info(info);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
max_vf_width = ia_css_binary_max_vf_width(); max_vf_width = ia_css_binary_max_vf_width();
if (max_vf_width != 0 && info->res.width > max_vf_width * 2) if (max_vf_width != 0 && info->res.width > max_vf_width * 2)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err ia_css_util_check_vf_out_info( int ia_css_util_check_vf_out_info(
const struct ia_css_frame_info *const out_info, const struct ia_css_frame_info *const out_info,
const struct ia_css_frame_info *const vf_info) const struct ia_css_frame_info *const vf_info)
{ {
enum ia_css_err err; int err;
assert(out_info); assert(out_info);
assert(vf_info); assert(vf_info);
err = ia_css_frame_check_info(out_info); err = ia_css_frame_check_info(out_info);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
err = ia_css_util_check_vf_info(vf_info); err = ia_css_util_check_vf_info(vf_info);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err ia_css_util_check_res(unsigned int width, unsigned int height) int ia_css_util_check_res(unsigned int width, unsigned int height)
{ {
/* height can be odd number for jpeg/embedded data from ISYS2401 */ /* height can be odd number for jpeg/embedded data from ISYS2401 */
if (((width == 0) || if (((width == 0) ||
(height == 0) || (height == 0) ||
IS_ODD(width))) { IS_ODD(width))) {
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
return IA_CSS_SUCCESS; return 0;
} }
/* ISP2401 */ /* ISP2401 */
@ -200,7 +200,7 @@ bool ia_css_util_is_input_format_yuv(enum atomisp_input_format format)
format == ATOMISP_INPUT_FORMAT_YUV422_16; format == ATOMISP_INPUT_FORMAT_YUV422_16;
} }
enum ia_css_err ia_css_util_check_input( int ia_css_util_check_input(
const struct ia_css_stream_config *const stream_config, const struct ia_css_stream_config *const stream_config,
bool must_be_raw, bool must_be_raw,
bool must_be_yuv) bool must_be_yuv)
@ -208,18 +208,18 @@ enum ia_css_err ia_css_util_check_input(
assert(stream_config); assert(stream_config);
if (!stream_config) if (!stream_config)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if (stream_config->input_config.effective_res.width == 0 || if (stream_config->input_config.effective_res.width == 0 ||
stream_config->input_config.effective_res.height == 0) stream_config->input_config.effective_res.height == 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if (must_be_raw && if (must_be_raw &&
!ia_css_util_is_input_format_raw(stream_config->input_config.format)) !ia_css_util_is_input_format_raw(stream_config->input_config.format))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if (must_be_yuv && if (must_be_yuv &&
!ia_css_util_is_input_format_yuv(stream_config->input_config.format)) !ia_css_util_is_input_format_yuv(stream_config->input_config.format))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -106,7 +106,7 @@ struct ia_css_isp_3a_statistics_map {
* used. * used.
* Always use this function, never copy the buffer directly. * Always use this function, never copy the buffer directly.
*/ */
enum ia_css_err int
ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats, ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats,
const struct ia_css_isp_3a_statistics *isp_stats); const struct ia_css_isp_3a_statistics *isp_stats);

Просмотреть файл

@ -37,15 +37,15 @@
* of the L1 page table. This is a physical * of the L1 page table. This is a physical
* address or index. * address or index.
* @param[in] irq_type The type of interrupt to be used (edge or level) * @param[in] irq_type The type of interrupt to be used (edge or level)
* @return Returns IA_CSS_ERR_INTERNAL_ERROR in case of any * @return Returns -EINVAL in case of any
* errors and IA_CSS_SUCCESS otherwise. * errors and 0 otherwise.
* *
* This function initializes the API which includes allocating and initializing * This function initializes the API which includes allocating and initializing
* internal data structures. This also interprets the firmware package. All * internal data structures. This also interprets the firmware package. All
* contents of this firmware package are copied into local data structures, so * contents of this firmware package are copied into local data structures, so
* the fw pointer could be freed after this function completes. * the fw pointer could be freed after this function completes.
*/ */
enum ia_css_err ia_css_init(struct device *dev, int ia_css_init(struct device *dev,
const struct ia_css_env *env, const struct ia_css_env *env,
const struct ia_css_fw *fw, const struct ia_css_fw *fw,
u32 l1_base, u32 l1_base,
@ -77,7 +77,7 @@ ia_css_uninit(void);
* This function should only be called when the SP is not running, calling it * This function should only be called when the SP is not running, calling it
* when the SP is running will result in an error value being returned. } * when the SP is running will result in an error value being returned. }
*/ */
enum ia_css_err int
ia_css_enable_isys_event_queue(bool enable); ia_css_enable_isys_event_queue(bool enable);
/* @brief Test whether the ISP has started. /* @brief Test whether the ISP has started.
@ -109,23 +109,23 @@ ia_css_sp_has_terminated(void);
/* @brief start SP hardware /* @brief start SP hardware
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* It will boot the SP hardware and start multi-threading infrastructure. * It will boot the SP hardware and start multi-threading infrastructure.
* All threads will be started and blocked by semaphore. This function should * All threads will be started and blocked by semaphore. This function should
* be called before any ia_css_stream_start(). * be called before any ia_css_stream_start().
*/ */
enum ia_css_err int
ia_css_start_sp(void); ia_css_start_sp(void);
/* @brief stop SP hardware /* @brief stop SP hardware
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* This function will terminate all threads and shut down SP. It should be * This function will terminate all threads and shut down SP. It should be
* called after all ia_css_stream_stop(). * called after all ia_css_stream_stop().
*/ */
enum ia_css_err int
ia_css_stop_sp(void); ia_css_stop_sp(void);
#endif /* __IA_CSS_CONTROL_H */ #endif /* __IA_CSS_CONTROL_H */

Просмотреть файл

@ -94,7 +94,7 @@ union ia_css_dvs_statistics_host {
* advised to map the ISP memory into a host-side pointer and use * advised to map the ISP memory into a host-side pointer and use
* the ia_css_translate_dvs_statistics() function instead. * the ia_css_translate_dvs_statistics() function instead.
*/ */
enum ia_css_err int
ia_css_get_dvs_statistics(struct ia_css_dvs_statistics *host_stats, ia_css_get_dvs_statistics(struct ia_css_dvs_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats); const struct ia_css_isp_dvs_statistics *isp_stats);
@ -128,7 +128,7 @@ ia_css_translate_dvs_statistics(
* advised to map the ISP memory into a host-side pointer and use * advised to map the ISP memory into a host-side pointer and use
* the ia_css_translate_dvs2_statistics() function instead. * the ia_css_translate_dvs2_statistics() function instead.
*/ */
enum ia_css_err int
ia_css_get_dvs2_statistics(struct ia_css_dvs2_statistics *host_stats, ia_css_get_dvs2_statistics(struct ia_css_dvs2_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats); const struct ia_css_isp_dvs_statistics *isp_stats);

Просмотреть файл

@ -20,27 +20,6 @@
* functions in the CSS-API. * functions in the CSS-API.
*/ */
/* Errors, these values are used as the return value for most
* functions in this API.
*/
enum ia_css_err {
IA_CSS_SUCCESS,
IA_CSS_ERR_INTERNAL_ERROR,
IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY,
IA_CSS_ERR_INVALID_ARGUMENTS,
IA_CSS_ERR_SYSTEM_NOT_IDLE,
IA_CSS_ERR_MODE_HAS_NO_VIEWFINDER,
IA_CSS_ERR_QUEUE_IS_FULL,
IA_CSS_ERR_QUEUE_IS_EMPTY,
IA_CSS_ERR_RESOURCE_NOT_AVAILABLE,
IA_CSS_ERR_RESOURCE_LIST_TO_SMALL,
IA_CSS_ERR_RESOURCE_ITEMS_STILL_ALLOCATED,
IA_CSS_ERR_RESOURCE_EXHAUSTED,
IA_CSS_ERR_RESOURCE_ALREADY_ALLOCATED,
IA_CSS_ERR_VERSION_MISMATCH,
IA_CSS_ERR_NOT_SUPPORTED
};
/* FW warnings. This enum contains a value for each warning that /* FW warnings. This enum contains a value for each warning that
* the SP FW could indicate potential performance issue * the SP FW could indicate potential performance issue
*/ */

Просмотреть файл

@ -143,9 +143,9 @@ struct ia_css_event {
* *
* @param[out] event Pointer to the event struct which will be filled by * @param[out] event Pointer to the event struct which will be filled by
* this function if an event is available. * this function if an event is available.
* @return IA_CSS_ERR_QUEUE_IS_EMPTY if no events are * @return -ENODATA if no events are
* available or * available or
* IA_CSS_SUCCESS otherwise. * 0 otherwise.
* *
* This function dequeues an event from the PSYS event queue. The queue is * This function dequeues an event from the PSYS event queue. The queue is
* between the Host CPU and the CSS system. This function can be * between the Host CPU and the CSS system. This function can be
@ -153,31 +153,31 @@ struct ia_css_event {
* was available and can be used in a polling-like situation where the NO_EVENT * was available and can be used in a polling-like situation where the NO_EVENT
* return value is used to determine whether an event was available or not. * return value is used to determine whether an event was available or not.
*/ */
enum ia_css_err int
ia_css_dequeue_psys_event(struct ia_css_event *event); ia_css_dequeue_psys_event(struct ia_css_event *event);
/* @brief Dequeue an event from the CSS system. /* @brief Dequeue an event from the CSS system.
* *
* @param[out] event Pointer to the event struct which will be filled by * @param[out] event Pointer to the event struct which will be filled by
* this function if an event is available. * this function if an event is available.
* @return IA_CSS_ERR_QUEUE_IS_EMPTY if no events are * @return -ENODATA if no events are
* available or * available or
* IA_CSS_SUCCESS otherwise. * 0 otherwise.
* *
* deprecated{Use ia_css_dequeue_psys_event instead}. * deprecated{Use ia_css_dequeue_psys_event instead}.
* Unless the isys event queue is explicitly enabled, this function will * Unless the isys event queue is explicitly enabled, this function will
* dequeue both isys (EOF) and psys events (all others). * dequeue both isys (EOF) and psys events (all others).
*/ */
enum ia_css_err int
ia_css_dequeue_event(struct ia_css_event *event); ia_css_dequeue_event(struct ia_css_event *event);
/* @brief Dequeue an ISYS event from the CSS system. /* @brief Dequeue an ISYS event from the CSS system.
* *
* @param[out] event Pointer to the event struct which will be filled by * @param[out] event Pointer to the event struct which will be filled by
* this function if an event is available. * this function if an event is available.
* @return IA_CSS_ERR_QUEUE_IS_EMPTY if no events are * @return -ENODATA if no events are
* available or * available or
* IA_CSS_SUCCESS otherwise. * 0 otherwise.
* *
* This function dequeues an event from the ISYS event queue. The queue is * This function dequeues an event from the ISYS event queue. The queue is
* between host and the CSS system. * between host and the CSS system.
@ -190,7 +190,7 @@ ia_css_dequeue_event(struct ia_css_event *event);
* incurring additional latency due to locks being held by other CSS API * incurring additional latency due to locks being held by other CSS API
* functions. * functions.
*/ */
enum ia_css_err int
ia_css_dequeue_isys_event(struct ia_css_event *event); ia_css_dequeue_isys_event(struct ia_css_event *event);
#endif /* __IA_CSS_EVENT_PUBLIC_H */ #endif /* __IA_CSS_EVENT_PUBLIC_H */

Просмотреть файл

@ -36,8 +36,8 @@ struct ia_css_fw {
* printing. * printing.
* @param[in] fw Firmware package containing the firmware for all * @param[in] fw Firmware package containing the firmware for all
* predefined ISP binaries. * predefined ISP binaries.
* @return Returns IA_CSS_ERR_INTERNAL_ERROR in case of any * @return Returns -EINVAL in case of any
* errors and IA_CSS_SUCCESS otherwise. * errors and 0 otherwise.
* *
* This function interprets the firmware package. All * This function interprets the firmware package. All
* contents of this firmware package are copied into local data structures, so * contents of this firmware package are copied into local data structures, so
@ -47,7 +47,7 @@ struct ia_css_fw {
* speeds up ia_css_init (ia_css_init is called each time a stream is created but the * speeds up ia_css_init (ia_css_init is called each time a stream is created but the
* firmware only needs to be loaded once). * firmware only needs to be loaded once).
*/ */
enum ia_css_err int
ia_css_load_firmware(struct device *dev, const struct ia_css_env *env, ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
const struct ia_css_fw *fw); const struct ia_css_fw *fw);

Просмотреть файл

@ -214,7 +214,7 @@ void ia_css_frame_zero(struct ia_css_frame *frame);
* Allocate a CSS frame structure. The memory for the frame data will be * Allocate a CSS frame structure. The memory for the frame data will be
* allocated in the CSS address space. * allocated in the CSS address space.
*/ */
enum ia_css_err int
ia_css_frame_allocate(struct ia_css_frame **frame, ia_css_frame_allocate(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
@ -232,7 +232,7 @@ ia_css_frame_allocate(struct ia_css_frame **frame,
* This is a convenience function, implemented on top of * This is a convenience function, implemented on top of
* ia_css_frame_allocate(). * ia_css_frame_allocate().
*/ */
enum ia_css_err int
ia_css_frame_allocate_from_info(struct ia_css_frame **frame, ia_css_frame_allocate_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info); const struct ia_css_frame_info *info);
/* @brief Free a CSS frame structure. /* @brief Free a CSS frame structure.
@ -260,7 +260,7 @@ ia_css_frame_free(struct ia_css_frame *frame);
* physically contiguous memory. * physically contiguous memory.
* Deprecated. * Deprecated.
*/ */
enum ia_css_err int
ia_css_frame_allocate_contiguous(struct ia_css_frame **frame, ia_css_frame_allocate_contiguous(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
@ -280,7 +280,7 @@ ia_css_frame_allocate_contiguous(struct ia_css_frame **frame,
* Only for FPGA display driver which needs physically contiguous memory. * Only for FPGA display driver which needs physically contiguous memory.
* Deprecated. * Deprecated.
*/ */
enum ia_css_err int
ia_css_frame_allocate_contiguous_from_info(struct ia_css_frame **frame, ia_css_frame_allocate_contiguous_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info); const struct ia_css_frame_info *info);
@ -293,7 +293,7 @@ ia_css_frame_allocate_contiguous_from_info(struct ia_css_frame **frame,
* Allocate an empty CSS frame with no data buffer using the parameters * Allocate an empty CSS frame with no data buffer using the parameters
* in the frame info. * in the frame info.
*/ */
enum ia_css_err int
ia_css_frame_create_from_info(struct ia_css_frame **frame, ia_css_frame_create_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info); const struct ia_css_frame_info *info);
@ -310,7 +310,7 @@ ia_css_frame_create_from_info(struct ia_css_frame **frame,
* free the mapped_data buffer. However if ia_css_frame_free() is called and * free the mapped_data buffer. However if ia_css_frame_free() is called and
* the frame had a valid data buffer, it would be freed along with the frame. * the frame had a valid data buffer, it would be freed along with the frame.
*/ */
enum ia_css_err int
ia_css_frame_set_data(struct ia_css_frame *frame, ia_css_frame_set_data(struct ia_css_frame *frame,
const ia_css_ptr mapped_data, const ia_css_ptr mapped_data,
size_t data_size_bytes); size_t data_size_bytes);
@ -331,7 +331,7 @@ ia_css_frame_set_data(struct ia_css_frame *frame,
* ia_css_frame_allocate() does, but instead of allocating the memory, it will * ia_css_frame_allocate() does, but instead of allocating the memory, it will
* map the pre-allocated memory into the CSS address space. * map the pre-allocated memory into the CSS address space.
*/ */
enum ia_css_err int
ia_css_frame_map(struct ia_css_frame **frame, ia_css_frame_map(struct ia_css_frame **frame,
const struct ia_css_frame_info *info, const struct ia_css_frame_info *info,
const void __user *data, const void __user *data,

Просмотреть файл

@ -144,14 +144,14 @@ struct ia_css_irq {
* @return If an error is encountered during the interrupt info * @return If an error is encountered during the interrupt info
* and no interrupt could be translated successfully, this * and no interrupt could be translated successfully, this
* will return IA_CSS_INTERNAL_ERROR. Otherwise * will return IA_CSS_INTERNAL_ERROR. Otherwise
* IA_CSS_SUCCESS. * 0.
* *
* This function is expected to be executed after an interrupt has been sent * This function is expected to be executed after an interrupt has been sent
* to the IA from the CSS. This function returns information about the interrupt * to the IA from the CSS. This function returns information about the interrupt
* which is needed by the IA code to properly handle the interrupt. This * which is needed by the IA code to properly handle the interrupt. This
* information includes the image pipe, buffer type etc. * information includes the image pipe, buffer type etc.
*/ */
enum ia_css_err int
ia_css_irq_translate(unsigned int *info); ia_css_irq_translate(unsigned int *info);
/* @brief Get CSI receiver error info. /* @brief Get CSI receiver error info.
@ -227,9 +227,9 @@ ia_css_rx_port_clear_irq_info(enum mipi_port_id port, unsigned int irq_bits);
* @return Returns IA_CSS_INTERNAL_ERROR if this interrupt * @return Returns IA_CSS_INTERNAL_ERROR if this interrupt
* type cannot be enabled/disabled which is true for * type cannot be enabled/disabled which is true for
* CSS internal interrupts. Otherwise returns * CSS internal interrupts. Otherwise returns
* IA_CSS_SUCCESS. * 0.
*/ */
enum ia_css_err int
ia_css_irq_enable(enum ia_css_irq_info type, bool enable); ia_css_irq_enable(enum ia_css_irq_info type, bool enable);
#endif /* __IA_CSS_IRQ_H */ #endif /* __IA_CSS_IRQ_H */

Просмотреть файл

@ -37,7 +37,7 @@
* *
* Specifies a CSS MIPI frame buffer: size in memory words (32B). * Specifies a CSS MIPI frame buffer: size in memory words (32B).
*/ */
enum ia_css_err int
ia_css_mipi_frame_specify(const unsigned int size_mem_words, ia_css_mipi_frame_specify(const unsigned int size_mem_words,
const bool contiguous); const bool contiguous);
@ -54,7 +54,7 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words,
* *
* *
*/ */
enum ia_css_err int
ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
const unsigned int size_mem_words); const unsigned int size_mem_words);
#endif #endif
@ -71,7 +71,7 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
* *
* Calculate the size of a mipi frame, based on the resolution and format. * Calculate the size of a mipi frame, based on the resolution and format.
*/ */
enum ia_css_err int
ia_css_mipi_frame_calculate_size(const unsigned int width, ia_css_mipi_frame_calculate_size(const unsigned int width,
const unsigned int height, const unsigned int height,
const enum atomisp_input_format format, const enum atomisp_input_format format,

Просмотреть файл

@ -181,7 +181,7 @@ struct ia_css_pipe {
void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map); void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map);
enum ia_css_err int
sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe, sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
struct ia_css_isp_parameters *params, struct ia_css_isp_parameters *params,
bool commit, struct ia_css_pipe *pipe); bool commit, struct ia_css_pipe *pipe);

Просмотреть файл

@ -249,44 +249,44 @@ void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config);
/* @brief Create a pipe /* @brief Create a pipe
* @param[in] config The pipe configuration. * @param[in] config The pipe configuration.
* @param[out] pipe The pipe. * @param[out] pipe The pipe.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* This function will create a pipe with the given * This function will create a pipe with the given
* configuration. * configuration.
*/ */
enum ia_css_err int
ia_css_pipe_create(const struct ia_css_pipe_config *config, ia_css_pipe_create(const struct ia_css_pipe_config *config,
struct ia_css_pipe **pipe); struct ia_css_pipe **pipe);
/* @brief Destroy a pipe /* @brief Destroy a pipe
* @param[in] pipe The pipe. * @param[in] pipe The pipe.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* This function will destroy a given pipe. * This function will destroy a given pipe.
*/ */
enum ia_css_err int
ia_css_pipe_destroy(struct ia_css_pipe *pipe); ia_css_pipe_destroy(struct ia_css_pipe *pipe);
/* @brief Provides information about a pipe /* @brief Provides information about a pipe
* @param[in] pipe The pipe. * @param[in] pipe The pipe.
* @param[out] pipe_info The pipe information. * @param[out] pipe_info The pipe information.
* @return IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS. * @return 0 or -EINVAL.
* *
* This function will provide information about a given pipe. * This function will provide information about a given pipe.
*/ */
enum ia_css_err int
ia_css_pipe_get_info(const struct ia_css_pipe *pipe, ia_css_pipe_get_info(const struct ia_css_pipe *pipe,
struct ia_css_pipe_info *pipe_info); struct ia_css_pipe_info *pipe_info);
/* @brief Configure a pipe with filter coefficients. /* @brief Configure a pipe with filter coefficients.
* @param[in] pipe The pipe. * @param[in] pipe The pipe.
* @param[in] config The pointer to ISP configuration. * @param[in] config The pointer to ISP configuration.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* This function configures the filter coefficients for an image * This function configures the filter coefficients for an image
* pipe. * pipe.
*/ */
enum ia_css_err int
ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe, ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
struct ia_css_isp_config *config); struct ia_css_isp_config *config);
@ -304,7 +304,7 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
at the same moment in time. There is no control over at the same moment in time. There is no control over
the order of these events. Once an IRQ has been raised the order of these events. Once an IRQ has been raised
all remembered events are reset. all remembered events are reset.
* @return IA_CSS_SUCCESS. * @return 0.
* *
Controls when the Event generator in the CSS raises an IRQ to the Host. Controls when the Event generator in the CSS raises an IRQ to the Host.
The main purpose of this function is to reduce the amount of interrupts The main purpose of this function is to reduce the amount of interrupts
@ -362,7 +362,7 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
All other events (3A, VF output, pipeline done) will not raise an interrupt All other events (3A, VF output, pipeline done) will not raise an interrupt
to the Host. These events are not lost but always stored in the event queue. to the Host. These events are not lost but always stored in the event queue.
*/ */
enum ia_css_err int
ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe, ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
unsigned int or_mask, unsigned int or_mask,
unsigned int and_mask); unsigned int and_mask);
@ -374,7 +374,7 @@ ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
of enum ia_css_event_irq_mask_type. Pointer may be NULL. of enum ia_css_event_irq_mask_type. Pointer may be NULL.
* @param[out] and_mask Current and_mask.The bits in this mask are a binary or * @param[out] and_mask Current and_mask.The bits in this mask are a binary or
of enum ia_css_event_irq_mask_type. Pointer may be NULL. of enum ia_css_event_irq_mask_type. Pointer may be NULL.
* @return IA_CSS_SUCCESS. * @return 0.
* *
Reads the current event IRQ mask from the CSS. Reading returns the actual Reads the current event IRQ mask from the CSS. Reading returns the actual
values as used by the SP and not any mirrored values stored at the Host.\n values as used by the SP and not any mirrored values stored at the Host.\n
@ -383,7 +383,7 @@ Precondition:\n
SP must be running.\n SP must be running.\n
*/ */
enum ia_css_err int
ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe, ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
unsigned int *or_mask, unsigned int *or_mask,
unsigned int *and_mask); unsigned int *and_mask);
@ -396,7 +396,7 @@ ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
* structure. Only the data pointer within it will * structure. Only the data pointer within it will
* be passed into the internal queues. * be passed into the internal queues.
* @return IA_CSS_INTERNAL_ERROR in case of unexpected errors, * @return IA_CSS_INTERNAL_ERROR in case of unexpected errors,
* IA_CSS_SUCCESS otherwise. * 0 otherwise.
* *
* This function adds a buffer (which has a certain buffer type) to the queue * This function adds a buffer (which has a certain buffer type) to the queue
* for this type. This queue is owned by the image pipe. After this function * for this type. This queue is owned by the image pipe. After this function
@ -406,7 +406,7 @@ ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
* host code via an interrupt. Buffers will be consumed in the same order they * host code via an interrupt. Buffers will be consumed in the same order they
* get queued, but may be returned to the host out of order. * get queued, but may be returned to the host out of order.
*/ */
enum ia_css_err int
ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
const struct ia_css_buffer *buffer); const struct ia_css_buffer *buffer);
@ -418,7 +418,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
* The resulting buffer pointer is written into the dta * The resulting buffer pointer is written into the dta
* field. * field.
* @return IA_CSS_ERR_NO_BUFFER if the queue is empty or * @return IA_CSS_ERR_NO_BUFFER if the queue is empty or
* IA_CSS_SUCCESS otherwise. * 0 otherwise.
* *
* This function dequeues a buffer from a buffer queue. The queue is indicated * This function dequeues a buffer from a buffer queue. The queue is indicated
* by the buffer type argument. This function can be called after an interrupt * by the buffer type argument. This function can be called after an interrupt
@ -426,7 +426,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
* be used in a polling-like situation where the NO_BUFFER return value is used * be used in a polling-like situation where the NO_BUFFER return value is used
* to determine whether a buffer was available or not. * to determine whether a buffer was available or not.
*/ */
enum ia_css_err int
ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
struct ia_css_buffer *buffer); struct ia_css_buffer *buffer);
@ -437,9 +437,9 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
* @param[in] enable Enable Flag (1 to enable ; 0 to disable) * @param[in] enable Enable Flag (1 to enable ; 0 to disable)
* *
* @return * @return
* IA_CSS_SUCCESS : Success * 0 : Success
* IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters * -EINVAL : Invalid Parameters
* IA_CSS_ERR_RESOURCE_NOT_AVAILABLE : Inactive QOS Pipe * -EBUSY : Inactive QOS Pipe
* (No active stream with this pipe) * (No active stream with this pipe)
* *
* This function will request state change (enable or disable) for the Extension * This function will request state change (enable or disable) for the Extension
@ -452,7 +452,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
* 4. State change cannot be guaranteed immediately OR on frame boundary * 4. State change cannot be guaranteed immediately OR on frame boundary
* *
*/ */
enum ia_css_err int
ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe, ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe,
u32 fw_handle, u32 fw_handle,
bool enable); bool enable);
@ -464,9 +464,9 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe,
* @param[out] *enable Enable Flag * @param[out] *enable Enable Flag
* *
* @return * @return
* IA_CSS_SUCCESS : Success * 0 : Success
* IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters * -EINVAL : Invalid Parameters
* IA_CSS_ERR_RESOURCE_NOT_AVAILABLE : Inactive QOS Pipe * -EBUSY : Inactive QOS Pipe
* (No active stream with this pipe) * (No active stream with this pipe)
* *
* This function will query the state of the Extension stage (firmware handle) * This function will query the state of the Extension stage (firmware handle)
@ -478,7 +478,7 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe,
* 3. Initial(Default) state of QOS Extensions is Disabled. * 3. Initial(Default) state of QOS Extensions is Disabled.
* *
*/ */
enum ia_css_err int
ia_css_pipe_get_qos_ext_state(struct ia_css_pipe *pipe, ia_css_pipe_get_qos_ext_state(struct ia_css_pipe *pipe,
u32 fw_handle, u32 fw_handle,
bool *enable); bool *enable);
@ -491,16 +491,16 @@ ia_css_pipe_get_qos_ext_state(struct ia_css_pipe *pipe,
* @param[in] isp_seg Parameter memory descriptors for ISP segments. * @param[in] isp_seg Parameter memory descriptors for ISP segments.
* *
* @return * @return
* IA_CSS_SUCCESS : Success * 0 : Success
* IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters * -EINVAL : Invalid Parameters
* IA_CSS_ERR_RESOURCE_NOT_AVAILABLE : Inactive QOS Pipe * -EBUSY : Inactive QOS Pipe
* (No active stream with this pipe) * (No active stream with this pipe)
* *
* \deprecated{This interface is used to temporarily support a late-developed, * \deprecated{This interface is used to temporarily support a late-developed,
* specific use-case on a specific IPU2 platform. It will not be supported or * specific use-case on a specific IPU2 platform. It will not be supported or
* maintained on IPU3 or further.} * maintained on IPU3 or further.}
*/ */
enum ia_css_err int
ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe,
u32 fw_handle, u32 fw_handle,
struct ia_css_isp_param_css_segments *css_seg, struct ia_css_isp_param_css_segments *css_seg,
@ -521,8 +521,8 @@ ia_css_pipe_get_isp_config(struct ia_css_pipe *pipe,
* @param[in] lut Look up tabel * @param[in] lut Look up tabel
* *
* @return * @return
* IA_CSS_SUCCESS : Success * 0 : Success
* IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters * -EINVAL : Invalid Parameters
* *
* Note: * Note:
* 1) Note that both GDC's are programmed with the same table. * 1) Note that both GDC's are programmed with the same table.
@ -531,7 +531,7 @@ ia_css_pipe_get_isp_config(struct ia_css_pipe *pipe,
* 3) This function must be called before stream start * 3) This function must be called before stream start
* *
*/ */
enum ia_css_err int
ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
const void *lut); const void *lut);
/* @brief Checking of DVS statistics ability /* @brief Checking of DVS statistics ability
@ -550,9 +550,9 @@ bool ia_css_pipe_has_dvs_stats(struct ia_css_pipe_info *pipe_info);
* @param[in] format Format to set * @param[in] format Format to set
* *
* @return * @return
* IA_CSS_SUCCESS : Success * 0 : Success
* IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters * -EINVAL : Invalid Parameters
* IA_CSS_ERR_INTERNAL_ERROR : Pipe misses binary info * -EINVAL : Pipe misses binary info
* *
* Note: * Note:
* 1) This is an optional function to override the formats set in the pipe. * 1) This is an optional function to override the formats set in the pipe.
@ -561,7 +561,7 @@ bool ia_css_pipe_has_dvs_stats(struct ia_css_pipe_info *pipe_info);
* 4) If this function is used, it MUST be called after ia_css_pipe_create. * 4) If this function is used, it MUST be called after ia_css_pipe_create.
* 5) If this function is used, this function MUST be called before ia_css_stream_start. * 5) If this function is used, this function MUST be called before ia_css_stream_start.
*/ */
enum ia_css_err int
ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe, ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe,
int output_pin, int output_pin,
enum ia_css_frame_format format); enum ia_css_frame_format format);

Просмотреть файл

@ -102,7 +102,7 @@ ia_css_get_isp_dvs2_coefficients(struct ia_css_stream *stream,
short *ver_coefs_even_real, short *ver_coefs_even_real,
short *ver_coefs_even_imag); short *ver_coefs_even_imag);
enum ia_css_err int
ia_css_stream_isp_parameters_init(struct ia_css_stream *stream); ia_css_stream_isp_parameters_init(struct ia_css_stream *stream);
void void

Просмотреть файл

@ -171,11 +171,11 @@ void ia_css_stream_config_defaults(struct ia_css_stream_config *stream_config);
* @param[in] num_pipes The number of pipes to incorporate in the stream. * @param[in] num_pipes The number of pipes to incorporate in the stream.
* @param[in] pipes The pipes. * @param[in] pipes The pipes.
* @param[out] stream The stream. * @param[out] stream The stream.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* This function will create a stream with a given configuration and given pipes. * This function will create a stream with a given configuration and given pipes.
*/ */
enum ia_css_err int
ia_css_stream_create(const struct ia_css_stream_config *stream_config, ia_css_stream_create(const struct ia_css_stream_config *stream_config,
int num_pipes, int num_pipes,
struct ia_css_pipe *pipes[], struct ia_css_pipe *pipes[],
@ -183,37 +183,37 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
/* @brief Destroys a stream /* @brief Destroys a stream
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* This function will destroy a given stream. * This function will destroy a given stream.
*/ */
enum ia_css_err int
ia_css_stream_destroy(struct ia_css_stream *stream); ia_css_stream_destroy(struct ia_css_stream *stream);
/* @brief Provides information about a stream /* @brief Provides information about a stream
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[out] stream_info The information about the stream. * @param[out] stream_info The information about the stream.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* This function will destroy a given stream. * This function will destroy a given stream.
*/ */
enum ia_css_err int
ia_css_stream_get_info(const struct ia_css_stream *stream, ia_css_stream_get_info(const struct ia_css_stream *stream,
struct ia_css_stream_info *stream_info); struct ia_css_stream_info *stream_info);
/* @brief load (rebuild) a stream that was unloaded. /* @brief load (rebuild) a stream that was unloaded.
* @param[in] stream The stream * @param[in] stream The stream
* @return IA_CSS_SUCCESS or the error code * @return 0 or the error code
* *
* Rebuild a stream, including allocating structs, setting configuration and * Rebuild a stream, including allocating structs, setting configuration and
* building the required pipes. * building the required pipes.
*/ */
enum ia_css_err int
ia_css_stream_load(struct ia_css_stream *stream); ia_css_stream_load(struct ia_css_stream *stream);
/* @brief Starts the stream. /* @brief Starts the stream.
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* The dynamic data in * The dynamic data in
* the buffers are not used and need to be queued with a separate call * the buffers are not used and need to be queued with a separate call
@ -221,17 +221,17 @@ ia_css_stream_load(struct ia_css_stream *stream);
* NOTE: this function will only send start event to corresponding * NOTE: this function will only send start event to corresponding
* thread and will not start SP any more. * thread and will not start SP any more.
*/ */
enum ia_css_err int
ia_css_stream_start(struct ia_css_stream *stream); ia_css_stream_start(struct ia_css_stream *stream);
/* @brief Stop the stream. /* @brief Stop the stream.
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS or the error code. * @return 0 or the error code.
* *
* NOTE: this function will send stop event to pipes belong to this * NOTE: this function will send stop event to pipes belong to this
* stream but will not terminate threads. * stream but will not terminate threads.
*/ */
enum ia_css_err int
ia_css_stream_stop(struct ia_css_stream *stream); ia_css_stream_stop(struct ia_css_stream *stream);
/* @brief Check if a stream has stopped /* @brief Check if a stream has stopped
@ -245,11 +245,11 @@ ia_css_stream_has_stopped(struct ia_css_stream *stream);
/* @brief destroy a stream according to the stream seed previosly saved in the seed array. /* @brief destroy a stream according to the stream seed previosly saved in the seed array.
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS (no other errors are generated now) * @return 0 (no other errors are generated now)
* *
* Destroy the stream and all the pipes related to it. * Destroy the stream and all the pipes related to it.
*/ */
enum ia_css_err int
ia_css_stream_unload(struct ia_css_stream *stream); ia_css_stream_unload(struct ia_css_stream *stream);
/* @brief Returns stream format /* @brief Returns stream format
@ -278,19 +278,19 @@ ia_css_stream_get_two_pixels_per_clock(const struct ia_css_stream *stream);
* *
* This function will Set the output frame stride (at the last pipe) * This function will Set the output frame stride (at the last pipe)
*/ */
enum ia_css_err int
ia_css_stream_set_output_padded_width(struct ia_css_stream *stream, ia_css_stream_set_output_padded_width(struct ia_css_stream *stream,
unsigned int output_padded_width); unsigned int output_padded_width);
/* @brief Return max number of continuous RAW frames. /* @brief Return max number of continuous RAW frames.
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[out] buffer_depth The maximum number of continuous RAW frames. * @param[out] buffer_depth The maximum number of continuous RAW frames.
* @return IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS * @return 0 or -EINVAL
* *
* This function will return the maximum number of continuous RAW frames * This function will return the maximum number of continuous RAW frames
* the system can support. * the system can support.
*/ */
enum ia_css_err int
ia_css_stream_get_max_buffer_depth(struct ia_css_stream *stream, ia_css_stream_get_max_buffer_depth(struct ia_css_stream *stream,
int *buffer_depth); int *buffer_depth);
@ -298,22 +298,22 @@ ia_css_stream_get_max_buffer_depth(struct ia_css_stream *stream,
* *
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[in] buffer_depth Number of frames to set. * @param[in] buffer_depth Number of frames to set.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* Set the number of continuous frames to use during continuous modes. * Set the number of continuous frames to use during continuous modes.
*/ */
enum ia_css_err int
ia_css_stream_set_buffer_depth(struct ia_css_stream *stream, int buffer_depth); ia_css_stream_set_buffer_depth(struct ia_css_stream *stream, int buffer_depth);
/* @brief Get number of continuous RAW frames to use. /* @brief Get number of continuous RAW frames to use.
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[out] buffer_depth The number of frames to use * @param[out] buffer_depth The number of frames to use
* @return IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS * @return 0 or -EINVAL
* *
* Get the currently set number of continuous frames * Get the currently set number of continuous frames
* to use during continuous modes. * to use during continuous modes.
*/ */
enum ia_css_err int
ia_css_stream_get_buffer_depth(struct ia_css_stream *stream, int *buffer_depth); ia_css_stream_get_buffer_depth(struct ia_css_stream *stream, int *buffer_depth);
/* ===== CAPTURE ===== */ /* ===== CAPTURE ===== */
@ -338,13 +338,13 @@ ia_css_stream_get_buffer_depth(struct ia_css_stream *stream, int *buffer_depth);
* with this offset. This allows the user to * with this offset. This allows the user to
* process RAW frames that were captured in the * process RAW frames that were captured in the
* past or future. * past or future.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* For example, to capture the current frame plus the 2 previous * For example, to capture the current frame plus the 2 previous
* frames and 2 subsequent frames, you would call * frames and 2 subsequent frames, you would call
* ia_css_stream_capture(5, 0, -2). * ia_css_stream_capture(5, 0, -2).
*/ */
enum ia_css_err int
ia_css_stream_capture(struct ia_css_stream *stream, ia_css_stream_capture(struct ia_css_stream *stream,
int num_captures, int num_captures,
unsigned int skip, unsigned int skip,
@ -355,12 +355,12 @@ ia_css_stream_capture(struct ia_css_stream *stream,
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[in] exp_id The exposure id of the raw frame to tag. * @param[in] exp_id The exposure id of the raw frame to tag.
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* This function allows the user to tag a raw frame based on the exposure id * This function allows the user to tag a raw frame based on the exposure id
* found in the viewfinder frames' frame info. * found in the viewfinder frames' frame info.
*/ */
enum ia_css_err int
ia_css_stream_capture_frame(struct ia_css_stream *stream, ia_css_stream_capture_frame(struct ia_css_stream *stream,
unsigned int exp_id); unsigned int exp_id);
@ -492,7 +492,7 @@ ia_css_stream_request_flash(struct ia_css_stream *stream);
* @param[in] config The set of filter coefficients. * @param[in] config The set of filter coefficients.
* @param[in] pipe Pipe to be updated when set isp config, NULL means to * @param[in] pipe Pipe to be updated when set isp config, NULL means to
* update all pipes in the stream. * update all pipes in the stream.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* This function configures the filter coefficients for an image * This function configures the filter coefficients for an image
* stream. For image pipes that do not execute any ISP filters, this * stream. For image pipes that do not execute any ISP filters, this
@ -501,7 +501,7 @@ ia_css_stream_request_flash(struct ia_css_stream *stream);
* in fact this is the expected behavior most of the time. Proper * in fact this is the expected behavior most of the time. Proper
* resource locking and double buffering is in place to allow for this. * resource locking and double buffering is in place to allow for this.
*/ */
enum ia_css_err int
ia_css_stream_set_isp_config_on_pipe(struct ia_css_stream *stream, ia_css_stream_set_isp_config_on_pipe(struct ia_css_stream *stream,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe); struct ia_css_pipe *pipe);
@ -511,7 +511,7 @@ ia_css_stream_set_isp_config_on_pipe(struct ia_css_stream *stream,
* ia_css_pipe_set_isp_config()} * ia_css_pipe_set_isp_config()}
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[in] config The set of filter coefficients. * @param[in] config The set of filter coefficients.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* This function configures the filter coefficients for an image * This function configures the filter coefficients for an image
* stream. For image pipes that do not execute any ISP filters, this * stream. For image pipes that do not execute any ISP filters, this
@ -521,7 +521,7 @@ ia_css_stream_set_isp_config_on_pipe(struct ia_css_stream *stream,
* in fact this is the expected behaviour most of the time. Proper * in fact this is the expected behaviour most of the time. Proper
* resource locking and double buffering is in place to allow for this. * resource locking and double buffering is in place to allow for this.
*/ */
enum ia_css_err int
ia_css_stream_set_isp_config( ia_css_stream_set_isp_config(
struct ia_css_stream *stream, struct ia_css_stream *stream,
const struct ia_css_isp_config *config); const struct ia_css_isp_config *config);
@ -537,37 +537,37 @@ ia_css_stream_get_isp_config(const struct ia_css_stream *stream,
/* @brief allocate continuous raw frames for continuous capture /* @brief allocate continuous raw frames for continuous capture
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS or error code. * @return 0 or error code.
* *
* because this allocation takes a long time (around 120ms per frame), * because this allocation takes a long time (around 120ms per frame),
* we separate the allocation part and update part to let driver call * we separate the allocation part and update part to let driver call
* this function without locking. This function is the allocation part * this function without locking. This function is the allocation part
* and next one is update part * and next one is update part
*/ */
enum ia_css_err int
ia_css_alloc_continuous_frame_remain(struct ia_css_stream *stream); ia_css_alloc_continuous_frame_remain(struct ia_css_stream *stream);
/* @brief allocate continuous raw frames for continuous capture /* @brief allocate continuous raw frames for continuous capture
* @param[in] stream The stream. * @param[in] stream The stream.
* @return IA_CSS_SUCCESS or error code. * @return 0 or error code.
* *
* because this allocation takes a long time (around 120ms per frame), * because this allocation takes a long time (around 120ms per frame),
* we separate the allocation part and update part to let driver call * we separate the allocation part and update part to let driver call
* this function without locking. This function is the update part * this function without locking. This function is the update part
*/ */
enum ia_css_err int
ia_css_update_continuous_frames(struct ia_css_stream *stream); ia_css_update_continuous_frames(struct ia_css_stream *stream);
/* @brief ia_css_unlock_raw_frame . unlock a raw frame (HALv3 Support) /* @brief ia_css_unlock_raw_frame . unlock a raw frame (HALv3 Support)
* @param[in] stream The stream. * @param[in] stream The stream.
* @param[in] exp_id exposure id that uniquely identifies the locked Raw Frame Buffer * @param[in] exp_id exposure id that uniquely identifies the locked Raw Frame Buffer
* @return ia_css_err IA_CSS_SUCCESS or error code * @return ia_css_err 0 or error code
* *
* As part of HALv3 Feature requirement, SP locks raw buffer until the Application * As part of HALv3 Feature requirement, SP locks raw buffer until the Application
* releases its reference to a raw buffer (which are managed by SP), this function allows * releases its reference to a raw buffer (which are managed by SP), this function allows
* application to explicitly unlock that buffer in SP. * application to explicitly unlock that buffer in SP.
*/ */
enum ia_css_err int
ia_css_unlock_raw_frame(struct ia_css_stream *stream, uint32_t exp_id); ia_css_unlock_raw_frame(struct ia_css_stream *stream, uint32_t exp_id);
/* @brief ia_css_en_dz_capt_pipe . Enable/Disable digital zoom for capture pipe /* @brief ia_css_en_dz_capt_pipe . Enable/Disable digital zoom for capture pipe

Просмотреть файл

@ -58,10 +58,10 @@ struct ia_css_time_meas {
/* @brief API to fetch timer count directly /* @brief API to fetch timer count directly
* *
* @param curr_ts [out] measured count value * @param curr_ts [out] measured count value
* @return IA_CSS_SUCCESS if success * @return 0 if success
* *
*/ */
enum ia_css_err int
ia_css_timer_get_current_tick( ia_css_timer_get_current_tick(
struct ia_css_clock_tick *curr_ts); struct ia_css_clock_tick *curr_ts);

Просмотреть файл

@ -34,7 +34,7 @@
* This function generates and returns the version string. If FW is loaded, it * This function generates and returns the version string. If FW is loaded, it
* attaches the FW version. * attaches the FW version.
*/ */
enum ia_css_err int
ia_css_get_version(char *version, int max_size); ia_css_get_version(char *version, int max_size);
#endif /* __IA_CSS_VERSION_H */ #endif /* __IA_CSS_VERSION_H */

Просмотреть файл

@ -271,7 +271,7 @@ convert_allocate_dvs_6axis_config(
return me; return me;
} }
enum ia_css_err int
store_dvs_6axis_config( store_dvs_6axis_config(
const struct ia_css_dvs_6axis_config *dvs_6axis_config, const struct ia_css_dvs_6axis_config *dvs_6axis_config,
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
@ -289,8 +289,8 @@ store_dvs_6axis_config(
if (!me) if (!me)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
ia_css_params_store_ia_css_host_data( ia_css_params_store_ia_css_host_data(
@ -298,5 +298,5 @@ store_dvs_6axis_config(
me); me);
ia_css_host_data_free(me); ia_css_host_data_free(me);
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -50,7 +50,7 @@ convert_allocate_dvs_6axis_config(
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
const struct ia_css_frame_info *dvs_in_frame_info); const struct ia_css_frame_info *dvs_in_frame_info);
enum ia_css_err int
store_dvs_6axis_config( store_dvs_6axis_config(
const struct ia_css_dvs_6axis_config *dvs_6axis_config, const struct ia_css_dvs_6axis_config *dvs_6axis_config,
const struct ia_css_binary *binary, const struct ia_css_binary *binary,

Просмотреть файл

@ -37,7 +37,7 @@ ia_css_iterator_config(
ia_css_resolution_to_sp_resolution(&to->dvs_envelope, from->dvs_envelope); ia_css_resolution_to_sp_resolution(&to->dvs_envelope, from->dvs_envelope);
} }
enum ia_css_err int
ia_css_iterator_configure( ia_css_iterator_configure(
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
const struct ia_css_frame_info *in_info) { const struct ia_css_frame_info *in_info) {
@ -76,5 +76,5 @@ ia_css_iterator_configure(
ia_css_configure_iterator(binary, &config); ia_css_configure_iterator(binary, &config);
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -26,7 +26,7 @@ ia_css_iterator_config(
const struct ia_css_iterator_configuration *from, const struct ia_css_iterator_configuration *from,
unsigned int size); unsigned int size);
enum ia_css_err int
ia_css_iterator_configure( ia_css_iterator_configure(
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
const struct ia_css_frame_info *in_info); const struct ia_css_frame_info *in_info);

Просмотреть файл

@ -235,12 +235,12 @@ void ia_css_sdis_clear_coefficients(
dvs_coefs->ver_coefs = NULL; dvs_coefs->ver_coefs = NULL;
} }
enum ia_css_err int
ia_css_get_dvs_statistics( ia_css_get_dvs_statistics(
struct ia_css_dvs_statistics *host_stats, struct ia_css_dvs_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats) { const struct ia_css_isp_dvs_statistics *isp_stats) {
struct ia_css_isp_dvs_statistics_map *map; struct ia_css_isp_dvs_statistics_map *map;
enum ia_css_err ret = IA_CSS_SUCCESS; int ret = 0;
IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats); IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats);
@ -256,7 +256,7 @@ ia_css_get_dvs_statistics(
} else } else
{ {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
ret = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; ret = -ENOMEM;
} }
IA_CSS_LEAVE_ERR(ret); IA_CSS_LEAVE_ERR(ret);

Просмотреть файл

@ -53,7 +53,7 @@ void ia_css_get_isp_dis_coefficients(
short *horizontal_coefficients, short *horizontal_coefficients,
short *vertical_coefficients); short *vertical_coefficients);
enum ia_css_err int
ia_css_get_dvs_statistics( ia_css_get_dvs_statistics(
struct ia_css_dvs_statistics *host_stats, struct ia_css_dvs_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats); const struct ia_css_isp_dvs_statistics *isp_stats);

Просмотреть файл

@ -175,12 +175,12 @@ void ia_css_sdis2_clear_coefficients(
dvs2_coefs->ver_coefs.even_imag = NULL; dvs2_coefs->ver_coefs.even_imag = NULL;
} }
enum ia_css_err int
ia_css_get_dvs2_statistics( ia_css_get_dvs2_statistics(
struct ia_css_dvs2_statistics *host_stats, struct ia_css_dvs2_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats) { const struct ia_css_isp_dvs_statistics *isp_stats) {
struct ia_css_isp_dvs_statistics_map *map; struct ia_css_isp_dvs_statistics_map *map;
enum ia_css_err ret = IA_CSS_SUCCESS; int ret = 0;
IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats); IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats);
@ -196,7 +196,7 @@ ia_css_get_dvs2_statistics(
} else } else
{ {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
ret = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; ret = -ENOMEM;
} }
IA_CSS_LEAVE_ERR(ret); IA_CSS_LEAVE_ERR(ret);

Просмотреть файл

@ -62,7 +62,7 @@ void ia_css_get_isp_dvs2_coefficients(
void ia_css_sdis2_clear_coefficients( void ia_css_sdis2_clear_coefficients(
struct ia_css_dvs2_coefficients *dvs2_coefs); struct ia_css_dvs2_coefficients *dvs2_coefs);
enum ia_css_err int
ia_css_get_dvs2_statistics( ia_css_get_dvs2_statistics(
struct ia_css_dvs2_statistics *host_stats, struct ia_css_dvs2_statistics *host_stats,
const struct ia_css_isp_dvs_statistics *isp_stats); const struct ia_css_isp_dvs_statistics *isp_stats);

Просмотреть файл

@ -49,7 +49,7 @@ ia_css_vf_config(
* to the requested viewfinder resolution on the upper side. The output cannot * to the requested viewfinder resolution on the upper side. The output cannot
* be smaller than the requested viewfinder resolution. * be smaller than the requested viewfinder resolution.
*/ */
enum ia_css_err int
sh_css_vf_downscale_log2( sh_css_vf_downscale_log2(
const struct ia_css_frame_info *out_info, const struct ia_css_frame_info *out_info,
const struct ia_css_frame_info *vf_info, const struct ia_css_frame_info *vf_info,
@ -58,12 +58,12 @@ sh_css_vf_downscale_log2(
unsigned int out_width; unsigned int out_width;
if ((!out_info) | (!vf_info)) if ((!out_info) | (!vf_info))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
out_width = out_info->res.width; out_width = out_info->res.width;
if (out_width == 0) if (out_width == 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* downscale until width smaller than the viewfinder width. We don't /* downscale until width smaller than the viewfinder width. We don't
* test for the height since the vmem buffers only put restrictions on * test for the height since the vmem buffers only put restrictions on
@ -79,26 +79,26 @@ sh_css_vf_downscale_log2(
ds_log2--; ds_log2--;
/* TODO: use actual max input resolution of vf_pp binary */ /* TODO: use actual max input resolution of vf_pp binary */
if ((out_info->res.width >> ds_log2) >= 2 * ia_css_binary_max_vf_width()) if ((out_info->res.width >> ds_log2) >= 2 * ia_css_binary_max_vf_width())
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
*downscale_log2 = ds_log2; *downscale_log2 = ds_log2;
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err static int
configure_kernel( configure_kernel(
const struct ia_css_binary_info *info, const struct ia_css_binary_info *info,
const struct ia_css_frame_info *out_info, const struct ia_css_frame_info *out_info,
const struct ia_css_frame_info *vf_info, const struct ia_css_frame_info *vf_info,
unsigned int *downscale_log2, unsigned int *downscale_log2,
struct ia_css_vf_configuration *config) { struct ia_css_vf_configuration *config) {
enum ia_css_err err; int err;
unsigned int vf_log_ds = 0; unsigned int vf_log_ds = 0;
/* First compute value */ /* First compute value */
if (vf_info) if (vf_info)
{ {
err = sh_css_vf_downscale_log2(out_info, vf_info, &vf_log_ds); err = sh_css_vf_downscale_log2(out_info, vf_info, &vf_log_ds);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} }
vf_log_ds = min(vf_log_ds, info->vf_dec.max_log_downscale); vf_log_ds = min(vf_log_ds, info->vf_dec.max_log_downscale);
@ -106,7 +106,7 @@ configure_kernel(
/* Then store it in isp config section */ /* Then store it in isp config section */
config->vf_downscale_bits = vf_log_ds; config->vf_downscale_bits = vf_log_ds;
return IA_CSS_SUCCESS; return 0;
} }
static void static void
@ -117,13 +117,13 @@ configure_dma(
config->info = vf_info; config->info = vf_info;
} }
enum ia_css_err int
ia_css_vf_configure( ia_css_vf_configure(
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
const struct ia_css_frame_info *out_info, const struct ia_css_frame_info *out_info,
struct ia_css_frame_info *vf_info, struct ia_css_frame_info *vf_info,
unsigned int *downscale_log2) { unsigned int *downscale_log2) {
enum ia_css_err err; int err;
struct ia_css_vf_configuration config; struct ia_css_vf_configuration config;
const struct ia_css_binary_info *info = &binary->info->sp; const struct ia_css_binary_info *info = &binary->info->sp;
@ -134,5 +134,5 @@ ia_css_vf_configure(
vf_info->raw_bit_depth = info->dma.vfdec_bits_per_pixel; vf_info->raw_bit_depth = info->dma.vfdec_bits_per_pixel;
ia_css_configure_vf(binary, &config); ia_css_configure_vf(binary, &config);
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -25,7 +25,7 @@
* to the requested viewfinder resolution on the upper side. The output cannot * to the requested viewfinder resolution on the upper side. The output cannot
* be smaller than the requested viewfinder resolution. * be smaller than the requested viewfinder resolution.
*/ */
enum ia_css_err int
sh_css_vf_downscale_log2( sh_css_vf_downscale_log2(
const struct ia_css_frame_info *out_info, const struct ia_css_frame_info *out_info,
const struct ia_css_frame_info *vf_info, const struct ia_css_frame_info *vf_info,
@ -37,7 +37,7 @@ ia_css_vf_config(
const struct ia_css_vf_configuration *from, const struct ia_css_vf_configuration *from,
unsigned int size); unsigned int size);
enum ia_css_err int
ia_css_vf_configure( ia_css_vf_configure(
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
const struct ia_css_frame_info *out_info, const struct ia_css_frame_info *out_info,

Просмотреть файл

@ -152,13 +152,13 @@ struct ia_css_binary {
.vf_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .vf_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
} }
enum ia_css_err int
ia_css_binary_init_infos(void); ia_css_binary_init_infos(void);
enum ia_css_err int
ia_css_binary_uninit(void); ia_css_binary_uninit(void);
enum ia_css_err int
ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
bool online, bool online,
bool two_ppc, bool two_ppc,
@ -172,7 +172,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
int stream_config_left_padding, int stream_config_left_padding,
bool accelerator); bool accelerator);
enum ia_css_err int
ia_css_binary_find(struct ia_css_binary_descr *descr, ia_css_binary_find(struct ia_css_binary_descr *descr,
struct ia_css_binary *binary); struct ia_css_binary *binary);
@ -188,10 +188,10 @@ ia_css_binary_find(struct ia_css_binary_descr *descr,
* the shading table directly required from ISP. * the shading table directly required from ISP.
* @param[out] pipe_config: The pipe configuration. * @param[out] pipe_config: The pipe configuration.
* The shading information related to ISP (but, not necessary as API) is stored in the pipe_config. * The shading information related to ISP (but, not necessary as API) is stored in the pipe_config.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err int
ia_css_binary_get_shading_info(const struct ia_css_binary *binary, ia_css_binary_get_shading_info(const struct ia_css_binary *binary,
enum ia_css_shading_correction_type type, enum ia_css_shading_correction_type type,
unsigned int required_bds_factor, unsigned int required_bds_factor,
@ -199,7 +199,7 @@ ia_css_binary_get_shading_info(const struct ia_css_binary *binary,
struct ia_css_shading_info *shading_info, struct ia_css_shading_info *shading_info,
struct ia_css_pipe_config *pipe_config); struct ia_css_pipe_config *pipe_config);
enum ia_css_err int
ia_css_binary_3a_grid_info(const struct ia_css_binary *binary, ia_css_binary_3a_grid_info(const struct ia_css_binary *binary,
struct ia_css_grid_info *info, struct ia_css_grid_info *info,
struct ia_css_pipe *pipe); struct ia_css_pipe *pipe);

Просмотреть файл

@ -134,7 +134,7 @@ struct sh_css_binary_sc_requirements {
}; };
/* Get the requirements for the shading correction. */ /* Get the requirements for the shading correction. */
static enum ia_css_err static int
#ifndef ISP2401 #ifndef ISP2401
ia_css_binary_compute_shading_table_bayer_origin( ia_css_binary_compute_shading_table_bayer_origin(
const struct ia_css_binary *binary, /* [in] */ const struct ia_css_binary *binary, /* [in] */
@ -149,7 +149,7 @@ sh_css_binary_get_sc_requirements(
struct sh_css_binary_sc_requirements *scr) /* [out] */ struct sh_css_binary_sc_requirements *scr) /* [out] */
#endif #endif
{ {
enum ia_css_err err; int err;
#ifndef ISP2401 #ifndef ISP2401
/* Numerator and denominator of the fixed bayer downscaling factor. /* Numerator and denominator of the fixed bayer downscaling factor.
@ -198,7 +198,7 @@ sh_css_binary_get_sc_requirements(
/* Get the numerator and denominator of bayer downscaling factor. */ /* Get the numerator and denominator of bayer downscaling factor. */
err = sh_css_bds_factor_get_numerator_denominator err = sh_css_bds_factor_get_numerator_denominator
(required_bds_factor, &bds_num, &bds_den); (required_bds_factor, &bds_num, &bds_den);
if (err != IA_CSS_SUCCESS) if (err)
#else #else
/* Flags corresponding to NEED_BDS_FACTOR_2_00/NEED_BDS_FACTOR_1_50/NEED_BDS_FACTOR_1_25 macros /* Flags corresponding to NEED_BDS_FACTOR_2_00/NEED_BDS_FACTOR_1_50/NEED_BDS_FACTOR_1_25 macros
* defined in isp kernels. */ * defined in isp kernels. */
@ -228,7 +228,7 @@ sh_css_binary_get_sc_requirements(
/* Get the numerator and denominator of the required bayer downscaling factor. */ /* Get the numerator and denominator of the required bayer downscaling factor. */
err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, &bds_num, &bds_den); err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, &bds_num, &bds_den);
if (err != IA_CSS_SUCCESS) if (err)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
#endif #endif
@ -481,7 +481,7 @@ return err;
} }
/* Get the shading information of Shading Correction Type 1. */ /* Get the shading information of Shading Correction Type 1. */
static enum ia_css_err static int
ia_css_binary_get_shading_info_type_1(const struct ia_css_binary ia_css_binary_get_shading_info_type_1(const struct ia_css_binary
*binary, /* [in] */ *binary, /* [in] */
unsigned int required_bds_factor, /* [in] */ unsigned int required_bds_factor, /* [in] */
@ -493,7 +493,7 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary
struct ia_css_pipe_config *pipe_config) /* [out] */ struct ia_css_pipe_config *pipe_config) /* [out] */
#endif #endif
{ {
enum ia_css_err err; int err;
#ifndef ISP2401 #ifndef ISP2401
struct sh_css_shading_table_bayer_origin_compute_results res; struct sh_css_shading_table_bayer_origin_compute_results res;
#else #else
@ -547,12 +547,12 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary
required_bds_factor, required_bds_factor,
stream_config, stream_config,
&res); &res);
if (err != IA_CSS_SUCCESS) if (err)
#else #else
*shading_info = DEFAULT_SHADING_INFO_TYPE_1; *shading_info = DEFAULT_SHADING_INFO_TYPE_1;
err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr); err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr);
if (err != IA_CSS_SUCCESS) if (err)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
#endif #endif
@ -641,8 +641,8 @@ IA_CSS_LOG("adjust_width_bqs=%d, adjust_height_bqs=%d", adjust_width_bqs, adjust
if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs) if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR); IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL);
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
/* Origin of the internal frame on the shading table. */ /* Origin of the internal frame on the shading table. */
@ -700,7 +700,7 @@ IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
enum ia_css_err int
ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */ ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */
enum ia_css_shading_correction_type type, /* [in] */ enum ia_css_shading_correction_type type, /* [in] */
unsigned int required_bds_factor, /* [in] */ unsigned int required_bds_factor, /* [in] */
@ -708,7 +708,7 @@ ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */
struct ia_css_shading_info *shading_info, /* [out] */ struct ia_css_shading_info *shading_info, /* [out] */
struct ia_css_pipe_config *pipe_config) /* [out] */ struct ia_css_pipe_config *pipe_config) /* [out] */
{ {
enum ia_css_err err; int err;
assert(binary); assert(binary);
assert(shading_info); assert(shading_info);
@ -728,7 +728,7 @@ ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */
/* Other function calls can be added here when other shading correction types will be added in the future. */ /* Other function calls can be added here when other shading correction types will be added in the future. */
else else
err = IA_CSS_ERR_NOT_SUPPORTED; err = -ENOTSUPP;
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
@ -786,12 +786,12 @@ ia_css_binary_dvs_stat_grid_info(
return; return;
} }
enum ia_css_err int
ia_css_binary_3a_grid_info(const struct ia_css_binary *binary, ia_css_binary_3a_grid_info(const struct ia_css_binary *binary,
struct ia_css_grid_info *info, struct ia_css_grid_info *info,
struct ia_css_pipe *pipe) { struct ia_css_pipe *pipe) {
struct ia_css_3a_grid_info *s3a_info; struct ia_css_3a_grid_info *s3a_info;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
IA_CSS_ENTER_PRIVATE("binary=%p, info=%p, pipe=%p", IA_CSS_ENTER_PRIVATE("binary=%p, info=%p, pipe=%p",
binary, info, pipe); binary, info, pipe);
@ -882,52 +882,52 @@ supports_bds_factor(u32 supported_factors,
return ((supported_factors & PACK_BDS_FACTOR(bds_factor)) != 0); return ((supported_factors & PACK_BDS_FACTOR(bds_factor)) != 0);
} }
static enum ia_css_err static int
binary_init_info(struct ia_css_binary_xinfo *info, unsigned int i, binary_init_info(struct ia_css_binary_xinfo *info, unsigned int i,
bool *binary_found) { bool *binary_found) {
const unsigned char *blob = sh_css_blob_info[i].blob; const unsigned char *blob = sh_css_blob_info[i].blob;
unsigned int size = sh_css_blob_info[i].header.blob.size; unsigned int size = sh_css_blob_info[i].header.blob.size;
if ((!info) || (!binary_found)) if ((!info) || (!binary_found))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
*info = sh_css_blob_info[i].header.info.isp; *info = sh_css_blob_info[i].header.info.isp;
*binary_found = blob; *binary_found = blob;
info->blob_index = i; info->blob_index = i;
/* we don't have this binary, skip it */ /* we don't have this binary, skip it */
if (!size) if (!size)
return IA_CSS_SUCCESS; return 0;
info->xmem_addr = sh_css_load_blob(blob, size); info->xmem_addr = sh_css_load_blob(blob, size);
if (!info->xmem_addr) if (!info->xmem_addr)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
return IA_CSS_SUCCESS; return 0;
} }
/* When binaries are put at the beginning, they will only /* When binaries are put at the beginning, they will only
* be selected if no other primary matches. * be selected if no other primary matches.
*/ */
enum ia_css_err int
ia_css_binary_init_infos(void) { ia_css_binary_init_infos(void) {
unsigned int i; unsigned int i;
unsigned int num_of_isp_binaries = sh_css_num_binaries - NUM_OF_SPS - NUM_OF_BLS; unsigned int num_of_isp_binaries = sh_css_num_binaries - NUM_OF_SPS - NUM_OF_BLS;
if (num_of_isp_binaries == 0) if (num_of_isp_binaries == 0)
return IA_CSS_SUCCESS; return 0;
all_binaries = kvmalloc(num_of_isp_binaries * sizeof(*all_binaries), all_binaries = kvmalloc(num_of_isp_binaries * sizeof(*all_binaries),
GFP_KERNEL); GFP_KERNEL);
if (!all_binaries) if (!all_binaries)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
for (i = 0; i < num_of_isp_binaries; i++) for (i = 0; i < num_of_isp_binaries; i++)
{ {
enum ia_css_err ret; int ret;
struct ia_css_binary_xinfo *binary = &all_binaries[i]; struct ia_css_binary_xinfo *binary = &all_binaries[i];
bool binary_found; bool binary_found;
ret = binary_init_info(binary, i, &binary_found); ret = binary_init_info(binary, i, &binary_found);
if (ret != IA_CSS_SUCCESS) if (ret)
return ret; return ret;
if (!binary_found) if (!binary_found)
continue; continue;
@ -937,10 +937,10 @@ ia_css_binary_init_infos(void) {
binary->blob = &sh_css_blob_info[i]; binary->blob = &sh_css_blob_info[i];
binary->mem_offsets = sh_css_blob_info[i].mem_offsets; binary->mem_offsets = sh_css_blob_info[i].mem_offsets;
} }
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err int
ia_css_binary_uninit(void) { ia_css_binary_uninit(void) {
unsigned int i; unsigned int i;
struct ia_css_binary_xinfo *b; struct ia_css_binary_xinfo *b;
@ -955,7 +955,7 @@ ia_css_binary_uninit(void) {
binary_infos[i] = NULL; binary_infos[i] = NULL;
} }
kvfree(all_binaries); kvfree(all_binaries);
return IA_CSS_SUCCESS; return 0;
} }
/* @brief Compute decimation factor for 3A statistics and shading correction. /* @brief Compute decimation factor for 3A statistics and shading correction.
@ -1073,7 +1073,7 @@ binary_in_frame_padded_width(int in_frame_width,
return rval; return rval;
} }
enum ia_css_err int
ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
bool online, bool online,
bool two_ppc, bool two_ppc,
@ -1104,7 +1104,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
bool need_scaling = false; bool need_scaling = false;
struct ia_css_resolution binary_dvs_env, internal_res; struct ia_css_resolution binary_dvs_env, internal_res;
enum ia_css_err err; int err;
unsigned int i; unsigned int i;
const struct ia_css_frame_info *bin_out_info = NULL; const struct ia_css_frame_info *bin_out_info = NULL;
@ -1118,7 +1118,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
err = ia_css_isp_param_allocate_isp_parameters( err = ia_css_isp_param_allocate_isp_parameters(
&binary->mem_params, &binary->css_params, &binary->mem_params, &binary->css_params,
&info->mem_initializers); &info->mem_initializers);
if (err != IA_CSS_SUCCESS) { if (err) {
return err; return err;
} }
} }
@ -1221,7 +1221,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
{ {
err = ia_css_vf_configure(binary, bin_out_info, err = ia_css_vf_configure(binary, bin_out_info,
(struct ia_css_frame_info *)vf_info, &vf_log_ds); (struct ia_css_frame_info *)vf_info, &vf_log_ds);
if (err != IA_CSS_SUCCESS) { if (err) {
if (!accelerator) { if (!accelerator) {
ia_css_isp_param_destroy_isp_parameters( ia_css_isp_param_destroy_isp_parameters(
&binary->mem_params, &binary->mem_params,
@ -1242,7 +1242,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
binary->vf_frame_info.format = vf_info->format; binary->vf_frame_info.format = vf_info->format;
if (!bin_out_info) if (!bin_out_info)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
vf_out_vecs = __ISP_VF_OUTPUT_WIDTH_VECS(bin_out_info->padded_width, vf_out_vecs = __ISP_VF_OUTPUT_WIDTH_VECS(bin_out_info->padded_width,
vf_log_ds); vf_log_ds);
vf_out_width = _ISP_VF_OUTPUT_WIDTH(vf_out_vecs); vf_out_width = _ISP_VF_OUTPUT_WIDTH(vf_out_vecs);
@ -1372,10 +1372,10 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
else else
binary->left_padding = 0; binary->left_padding = 0;
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err int
ia_css_binary_find(struct ia_css_binary_descr *descr, ia_css_binary_find(struct ia_css_binary_descr *descr,
struct ia_css_binary *binary) { struct ia_css_binary *binary) {
int mode; int mode;
@ -1403,7 +1403,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr,
#ifdef ISP2401 #ifdef ISP2401
bool enable_luma_only; bool enable_luma_only;
#endif #endif
enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR; int err = -EINVAL;
bool continuous; bool continuous;
unsigned int isp_pipe_version; unsigned int isp_pipe_version;
struct ia_css_resolution dvs_env, internal_res; struct ia_css_resolution dvs_env, internal_res;
@ -1431,7 +1431,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr,
req_bin_out_info = req_out_info[i]; req_bin_out_info = req_out_info[i];
} }
if (!req_bin_out_info) if (!req_bin_out_info)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
#ifndef ISP2401 #ifndef ISP2401
req_vf_info = descr->vf_info; req_vf_info = descr->vf_info;
#else #else
@ -1780,7 +1780,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr,
descr->stream_config_left_padding, descr->stream_config_left_padding,
false); false);
if (err != IA_CSS_SUCCESS) if (err)
break; break;
binary_init_metrics(&binary->metrics, &binary->info->sp); binary_init_metrics(&binary->metrics, &binary->info->sp);
break; break;

Просмотреть файл

@ -77,10 +77,10 @@ void ia_css_bufq_init(void);
* *
* @param queue_id[in] Index of the queue in the specified thread * @param queue_id[in] Index of the queue in the specified thread
* @param item[in] Object to enqueue. * @param item[in] Object to enqueue.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_enqueue_buffer( int ia_css_bufq_enqueue_buffer(
int thread_index, int thread_index,
int queue_id, int queue_id,
uint32_t item); uint32_t item);
@ -91,10 +91,10 @@ enum ia_css_err ia_css_bufq_enqueue_buffer(
* @param queue_id[in] Specifies the index of the queue in the list where * @param queue_id[in] Specifies the index of the queue in the list where
* the item has to be read. * the item has to be read.
* @paramitem [out] Object to be dequeued into this item. * @paramitem [out] Object to be dequeued into this item.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_dequeue_buffer( int ia_css_bufq_dequeue_buffer(
int queue_id, int queue_id,
uint32_t *item); uint32_t *item);
@ -105,10 +105,10 @@ enum ia_css_err ia_css_bufq_dequeue_buffer(
* @param[in] evt_payload_0 The event payload. * @param[in] evt_payload_0 The event payload.
* @param[in] evt_payload_1 The event payload. * @param[in] evt_payload_1 The event payload.
* @param[in] evt_payload_2 The event payload. * @param[in] evt_payload_2 The event payload.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_enqueue_psys_event( int ia_css_bufq_enqueue_psys_event(
u8 evt_id, u8 evt_id,
u8 evt_payload_0, u8 evt_payload_0,
u8 evt_payload_1, u8 evt_payload_1,
@ -119,10 +119,10 @@ enum ia_css_err ia_css_bufq_enqueue_psys_event(
* @brief Dequeue an item from SP to host communication event queue. * @brief Dequeue an item from SP to host communication event queue.
* *
* @param item Object to be dequeued into this item. * @param item Object to be dequeued into this item.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_dequeue_psys_event( int ia_css_bufq_dequeue_psys_event(
u8 item[BUFQ_EVENT_SIZE] u8 item[BUFQ_EVENT_SIZE]
); );
@ -131,10 +131,10 @@ enum ia_css_err ia_css_bufq_dequeue_psys_event(
* @brief Enqueue an event item into host to SP EOF event queue. * @brief Enqueue an event item into host to SP EOF event queue.
* *
* @param[in] evt_id The event ID. * @param[in] evt_id The event ID.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_enqueue_isys_event( int ia_css_bufq_enqueue_isys_event(
uint8_t evt_id); uint8_t evt_id);
/** /**
@ -142,29 +142,29 @@ enum ia_css_err ia_css_bufq_enqueue_isys_event(
* *
* @param item Object to be dequeued into this item. * @param item Object to be dequeued into this item.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_dequeue_isys_event( int ia_css_bufq_dequeue_isys_event(
u8 item[BUFQ_EVENT_SIZE]); u8 item[BUFQ_EVENT_SIZE]);
/** /**
* @brief Enqueue a tagger command item into tagger command queue.. * @brief Enqueue a tagger command item into tagger command queue..
* *
* @param item Object to be enqueue. * @param item Object to be enqueue.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_enqueue_tag_cmd( int ia_css_bufq_enqueue_tag_cmd(
uint32_t item); uint32_t item);
/** /**
* @brief Uninitializes bufq module. * @brief Uninitializes bufq module.
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_bufq_deinit(void); int ia_css_bufq_deinit(void);
/** /**
* @brief Dump queue states * @brief Dump queue states

Просмотреть файл

@ -329,19 +329,19 @@ void ia_css_bufq_init(void)
IA_CSS_LEAVE_PRIVATE(""); IA_CSS_LEAVE_PRIVATE("");
} }
enum ia_css_err ia_css_bufq_enqueue_buffer( int ia_css_bufq_enqueue_buffer(
int thread_index, int thread_index,
int queue_id, int queue_id,
uint32_t item) uint32_t item)
{ {
enum ia_css_err return_err = IA_CSS_SUCCESS; int return_err = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
int error; int error;
IA_CSS_ENTER_PRIVATE("queue_id=%d", queue_id); IA_CSS_ENTER_PRIVATE("queue_id=%d", queue_id);
if ((thread_index >= SH_CSS_MAX_SP_THREADS) || (thread_index < 0) || if ((thread_index >= SH_CSS_MAX_SP_THREADS) || (thread_index < 0) ||
(queue_id == SH_CSS_INVALID_QUEUE_ID)) (queue_id == SH_CSS_INVALID_QUEUE_ID))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* Get the queue for communication */ /* Get the queue for communication */
q = bufq_get_qhandle(sh_css_host2sp_buffer_queue, q = bufq_get_qhandle(sh_css_host2sp_buffer_queue,
@ -352,18 +352,18 @@ enum ia_css_err ia_css_bufq_enqueue_buffer(
return_err = ia_css_convert_errno(error); return_err = ia_css_convert_errno(error);
} else { } else {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return_err = IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return_err = -EBUSY;
} }
IA_CSS_LEAVE_ERR_PRIVATE(return_err); IA_CSS_LEAVE_ERR_PRIVATE(return_err);
return return_err; return return_err;
} }
enum ia_css_err ia_css_bufq_dequeue_buffer( int ia_css_bufq_dequeue_buffer(
int queue_id, int queue_id,
uint32_t *item) uint32_t *item)
{ {
enum ia_css_err return_err; int return_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -372,7 +372,7 @@ enum ia_css_err ia_css_bufq_dequeue_buffer(
(queue_id <= SH_CSS_INVALID_QUEUE_ID) || (queue_id <= SH_CSS_INVALID_QUEUE_ID) ||
(queue_id >= SH_CSS_MAX_NUM_QUEUES) (queue_id >= SH_CSS_MAX_NUM_QUEUES)
) )
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
q = bufq_get_qhandle(sh_css_sp2host_buffer_queue, q = bufq_get_qhandle(sh_css_sp2host_buffer_queue,
queue_id, queue_id,
@ -382,20 +382,20 @@ enum ia_css_err ia_css_bufq_dequeue_buffer(
return_err = ia_css_convert_errno(error); return_err = ia_css_convert_errno(error);
} else { } else {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return_err = IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return_err = -EBUSY;
} }
IA_CSS_LEAVE_ERR_PRIVATE(return_err); IA_CSS_LEAVE_ERR_PRIVATE(return_err);
return return_err; return return_err;
} }
enum ia_css_err ia_css_bufq_enqueue_psys_event( int ia_css_bufq_enqueue_psys_event(
u8 evt_id, u8 evt_id,
u8 evt_payload_0, u8 evt_payload_0,
u8 evt_payload_1, u8 evt_payload_1,
uint8_t evt_payload_2) uint8_t evt_payload_2)
{ {
enum ia_css_err return_err; int return_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -403,7 +403,7 @@ enum ia_css_err ia_css_bufq_enqueue_psys_event(
q = bufq_get_qhandle(sh_css_host2sp_psys_event_queue, -1, -1); q = bufq_get_qhandle(sh_css_host2sp_psys_event_queue, -1, -1);
if (!q) { if (!q) {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
error = ia_css_eventq_send(q, error = ia_css_eventq_send(q,
@ -414,10 +414,9 @@ enum ia_css_err ia_css_bufq_enqueue_psys_event(
return return_err; return return_err;
} }
enum ia_css_err ia_css_bufq_dequeue_psys_event( int ia_css_bufq_dequeue_psys_event(
u8 item[BUFQ_EVENT_SIZE]) u8 item[BUFQ_EVENT_SIZE])
{ {
enum ia_css_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -425,23 +424,22 @@ enum ia_css_err ia_css_bufq_dequeue_psys_event(
* by some test apps. Enablign logging here floods the log * by some test apps. Enablign logging here floods the log
* files which may cause timeouts. */ * files which may cause timeouts. */
if (!item) if (!item)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
q = bufq_get_qhandle(sh_css_sp2host_psys_event_queue, -1, -1); q = bufq_get_qhandle(sh_css_sp2host_psys_event_queue, -1, -1);
if (!q) { if (!q) {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
error = ia_css_eventq_recv(q, item); error = ia_css_eventq_recv(q, item);
return ia_css_convert_errno(error); return ia_css_convert_errno(error);
} }
enum ia_css_err ia_css_bufq_dequeue_isys_event( int ia_css_bufq_dequeue_isys_event(
u8 item[BUFQ_EVENT_SIZE]) u8 item[BUFQ_EVENT_SIZE])
{ {
#if !defined(HAS_NO_INPUT_SYSTEM) #if !defined(HAS_NO_INPUT_SYSTEM)
enum ia_css_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -449,25 +447,25 @@ enum ia_css_err ia_css_bufq_dequeue_isys_event(
* by some test apps. Enablign logging here floods the log * by some test apps. Enablign logging here floods the log
* files which may cause timeouts. */ * files which may cause timeouts. */
if (!item) if (!item)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
q = bufq_get_qhandle(sh_css_sp2host_isys_event_queue, -1, -1); q = bufq_get_qhandle(sh_css_sp2host_isys_event_queue, -1, -1);
if (!q) { if (!q) {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
error = ia_css_eventq_recv(q, item); error = ia_css_eventq_recv(q, item);
return ia_css_convert_errno(error); return ia_css_convert_errno(error);
#else #else
(void)item; (void)item;
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
#endif #endif
} }
enum ia_css_err ia_css_bufq_enqueue_isys_event(uint8_t evt_id) int ia_css_bufq_enqueue_isys_event(uint8_t evt_id)
{ {
#if !defined(HAS_NO_INPUT_SYSTEM) #if !defined(HAS_NO_INPUT_SYSTEM)
enum ia_css_err return_err; int return_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -475,7 +473,7 @@ enum ia_css_err ia_css_bufq_enqueue_isys_event(uint8_t evt_id)
q = bufq_get_qhandle(sh_css_host2sp_isys_event_queue, -1, -1); q = bufq_get_qhandle(sh_css_host2sp_isys_event_queue, -1, -1);
if (!q) { if (!q) {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
error = ia_css_eventq_send(q, evt_id, 0, 0, 0); error = ia_css_eventq_send(q, evt_id, 0, 0, 0);
@ -484,15 +482,15 @@ enum ia_css_err ia_css_bufq_enqueue_isys_event(uint8_t evt_id)
return return_err; return return_err;
#else #else
(void)evt_id; (void)evt_id;
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
#endif #endif
} }
enum ia_css_err ia_css_bufq_enqueue_tag_cmd( int ia_css_bufq_enqueue_tag_cmd(
uint32_t item) uint32_t item)
{ {
#if !defined(HAS_NO_INPUT_SYSTEM) #if !defined(HAS_NO_INPUT_SYSTEM)
enum ia_css_err return_err; int return_err;
int error = 0; int error = 0;
ia_css_queue_t *q; ia_css_queue_t *q;
@ -500,7 +498,7 @@ enum ia_css_err ia_css_bufq_enqueue_tag_cmd(
q = bufq_get_qhandle(sh_css_host2sp_tag_cmd_queue, -1, -1); q = bufq_get_qhandle(sh_css_host2sp_tag_cmd_queue, -1, -1);
if (!q) { if (!q) {
IA_CSS_ERROR("queue is not initialized"); IA_CSS_ERROR("queue is not initialized");
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
error = ia_css_queue_enqueue(q, item); error = ia_css_queue_enqueue(q, item);
@ -509,13 +507,13 @@ enum ia_css_err ia_css_bufq_enqueue_tag_cmd(
return return_err; return return_err;
#else #else
(void)item; (void)item;
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
#endif #endif
} }
enum ia_css_err ia_css_bufq_deinit(void) int ia_css_bufq_deinit(void)
{ {
return IA_CSS_SUCCESS; return 0;
} }
static void bufq_dump_queue_info(const char *prefix, ia_css_queue_t *qhandle) static void bufq_dump_queue_info(const char *prefix, ia_css_queue_t *qhandle)

Просмотреть файл

@ -91,7 +91,7 @@ enum ia_css_debug_enable_param_dump {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, \ ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, \
"%s(): leave: " fmt "\n", __func__, ##__VA_ARGS__) "%s(): leave: " fmt "\n", __func__, ##__VA_ARGS__)
/* Shorthand for returning an enum ia_css_err return value */ /* Shorthand for returning an int return value */
#define IA_CSS_LEAVE_ERR(__err) \ #define IA_CSS_LEAVE_ERR(__err) \
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, \ ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, \
"%s() %d: leave: return_err=%d\n", __func__, __LINE__, __err) "%s() %d: leave: return_err=%d\n", __func__, __LINE__, __err)
@ -112,7 +112,7 @@ enum ia_css_debug_enable_param_dump {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, \ ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, \
"%s(): leave: " fmt "\n", __func__, ##__VA_ARGS__) "%s(): leave: " fmt "\n", __func__, ##__VA_ARGS__)
/* Shorthand for returning an enum ia_css_err return value */ /* Shorthand for returning an int return value */
#define IA_CSS_LEAVE_ERR_PRIVATE(__err) \ #define IA_CSS_LEAVE_ERR_PRIVATE(__err) \
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, \ ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, \
"%s() %d: leave: return_err=%d\n", __func__, __LINE__, __err) "%s() %d: leave: return_err=%d\n", __func__, __LINE__, __err)

Просмотреть файл

@ -80,7 +80,7 @@ bool ia_css_frame_info_is_same_resolution(
* @param[in] info The frame attributes to be initialized * @param[in] info The frame attributes to be initialized
* @return The error code. * @return The error code.
*/ */
enum ia_css_err ia_css_frame_check_info(const struct ia_css_frame_info *info); int ia_css_frame_check_info(const struct ia_css_frame_info *info);
/********************************************************************* /*********************************************************************
**** Frame APIs **** Frame APIs
@ -92,7 +92,7 @@ enum ia_css_err ia_css_frame_check_info(const struct ia_css_frame_info *info);
* @param[in] frame The frame attributes to be initialized * @param[in] frame The frame attributes to be initialized
* @return The error code. * @return The error code.
*/ */
enum ia_css_err ia_css_frame_init_planes(struct ia_css_frame *frame); int ia_css_frame_init_planes(struct ia_css_frame *frame);
/* @brief Free an array of frames /* @brief Free an array of frames
* *
@ -114,7 +114,7 @@ void ia_css_frame_free_multiple(unsigned int num_frames,
* Allocate a frame using the given size in bytes. * Allocate a frame using the given size in bytes.
* The frame structure is partially null initialized. * The frame structure is partially null initialized.
*/ */
enum ia_css_err ia_css_frame_allocate_with_buffer_size( int ia_css_frame_allocate_with_buffer_size(
struct ia_css_frame **frame, struct ia_css_frame **frame,
const unsigned int size_bytes, const unsigned int size_bytes,
const bool contiguous); const bool contiguous);
@ -153,9 +153,9 @@ void ia_css_dma_configure_from_info(
* @param[in] in_res Resolution of input image * @param[in] in_res Resolution of input image
* @param[in] out_res Resolution of output image * @param[in] out_res Resolution of output image
* @param[out] crop_res Crop resolution of input image * @param[out] crop_res Crop resolution of input image
* @return Returns IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS on error * @return Returns 0 or -EINVAL on error
*/ */
enum ia_css_err int
ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res, ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
const struct ia_css_resolution *out_res, const struct ia_css_resolution *out_res,
struct ia_css_resolution *crop_res); struct ia_css_resolution *crop_res);

Просмотреть файл

@ -69,9 +69,9 @@ static void frame_init_rgb_planes(struct ia_css_frame *frame,
static void frame_init_qplane6_planes(struct ia_css_frame *frame); static void frame_init_qplane6_planes(struct ia_css_frame *frame);
static enum ia_css_err frame_allocate_buffer_data(struct ia_css_frame *frame); static int frame_allocate_buffer_data(struct ia_css_frame *frame);
static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame, static int frame_allocate_with_data(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
enum ia_css_frame_format format, enum ia_css_frame_format format,
@ -101,13 +101,13 @@ void ia_css_frame_zero(struct ia_css_frame *frame)
hmm_set(frame->data, 0, frame->data_bytes); hmm_set(frame->data, 0, frame->data_bytes);
} }
enum ia_css_err ia_css_frame_allocate_from_info(struct ia_css_frame **frame, int ia_css_frame_allocate_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info) const struct ia_css_frame_info *info)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
if (!frame || !info) if (!frame || !info)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_allocate_from_info() enter:\n"); "ia_css_frame_allocate_from_info() enter:\n");
err = err =
@ -119,17 +119,17 @@ enum ia_css_err ia_css_frame_allocate_from_info(struct ia_css_frame **frame,
return err; return err;
} }
enum ia_css_err ia_css_frame_allocate(struct ia_css_frame **frame, int ia_css_frame_allocate(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
enum ia_css_frame_format format, enum ia_css_frame_format format,
unsigned int padded_width, unsigned int padded_width,
unsigned int raw_bit_depth) unsigned int raw_bit_depth)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
if (!frame || width == 0 || height == 0) if (!frame || width == 0 || height == 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_allocate() enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n", "ia_css_frame_allocate() enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n",
@ -138,7 +138,7 @@ enum ia_css_err ia_css_frame_allocate(struct ia_css_frame **frame,
err = frame_allocate_with_data(frame, width, height, format, err = frame_allocate_with_data(frame, width, height, format,
padded_width, raw_bit_depth, false); padded_width, raw_bit_depth, false);
if ((*frame) && err == IA_CSS_SUCCESS) if ((*frame) && err == 0)
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_allocate() leave: frame=%p, data(DDR address)=0x%x\n", *frame, "ia_css_frame_allocate() leave: frame=%p, data(DDR address)=0x%x\n", *frame,
(*frame)->data); (*frame)->data);
@ -150,13 +150,13 @@ enum ia_css_err ia_css_frame_allocate(struct ia_css_frame **frame,
return err; return err;
} }
enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, int ia_css_frame_map(struct ia_css_frame **frame,
const struct ia_css_frame_info *info, const struct ia_css_frame_info *info,
const void __user *data, const void __user *data,
u16 attribute, u16 attribute,
unsigned int pgnr) unsigned int pgnr)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_frame *me; struct ia_css_frame *me;
assert(frame); assert(frame);
@ -164,10 +164,10 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame,
/* Create the frame structure */ /* Create the frame structure */
err = ia_css_frame_create_from_info(&me, info); err = ia_css_frame_create_from_info(&me, info);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
if (err == IA_CSS_SUCCESS) { if (!err) {
if (pgnr < ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { if (pgnr < ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) {
dev_err(atomisp_dev, dev_err(atomisp_dev,
"user space memory size is less than the expected size..\n"); "user space memory size is less than the expected size..\n");
@ -184,11 +184,11 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame,
attribute & ATOMISP_MAP_FLAG_CACHED); attribute & ATOMISP_MAP_FLAG_CACHED);
if (me->data == mmgr_NULL) if (me->data == mmgr_NULL)
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
} }
error: error:
if (err != IA_CSS_SUCCESS) { if (err) {
kvfree(me); kvfree(me);
me = NULL; me = NULL;
} }
@ -198,10 +198,10 @@ error:
return err; return err;
} }
enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame, int ia_css_frame_create_from_info(struct ia_css_frame **frame,
const struct ia_css_frame_info *info) const struct ia_css_frame_info *info)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_frame *me; struct ia_css_frame *me;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@ -209,7 +209,7 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame,
if (!frame || !info) { if (!frame || !info) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_create_from_info() leave: invalid arguments\n"); "ia_css_frame_create_from_info() leave: invalid arguments\n");
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
me = frame_create(info->res.width, me = frame_create(info->res.width,
@ -222,12 +222,12 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame,
if (!me) { if (!me) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_create_from_info() leave: frame create failed\n"); "ia_css_frame_create_from_info() leave: frame create failed\n");
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
err = ia_css_frame_init_planes(me); err = ia_css_frame_init_planes(me);
if (err != IA_CSS_SUCCESS) { if (err) {
kvfree(me); kvfree(me);
me = NULL; me = NULL;
} }
@ -240,18 +240,18 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame,
return err; return err;
} }
enum ia_css_err ia_css_frame_set_data(struct ia_css_frame *frame, int ia_css_frame_set_data(struct ia_css_frame *frame,
const ia_css_ptr mapped_data, const ia_css_ptr mapped_data,
size_t data_bytes) size_t data_bytes)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_set_data() enter:\n"); "ia_css_frame_set_data() enter:\n");
if (!frame) { if (!frame) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_set_data() leave: NULL frame\n"); "ia_css_frame_set_data() leave: NULL frame\n");
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
/* If we are setting a valid data. /* If we are setting a valid data.
@ -261,7 +261,7 @@ enum ia_css_err ia_css_frame_set_data(struct ia_css_frame *frame,
if ((mapped_data != mmgr_NULL) && (frame->data_bytes > data_bytes)) { if ((mapped_data != mmgr_NULL) && (frame->data_bytes > data_bytes)) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_set_data() leave: invalid arguments\n"); "ia_css_frame_set_data() leave: invalid arguments\n");
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
frame->data = mapped_data; frame->data = mapped_data;
@ -271,14 +271,14 @@ enum ia_css_err ia_css_frame_set_data(struct ia_css_frame *frame,
return err; return err;
} }
enum ia_css_err ia_css_frame_allocate_contiguous(struct ia_css_frame **frame, int ia_css_frame_allocate_contiguous(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
enum ia_css_frame_format format, enum ia_css_frame_format format,
unsigned int padded_width, unsigned int padded_width,
unsigned int raw_bit_depth) unsigned int raw_bit_depth)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_allocate_contiguous() enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n", "ia_css_frame_allocate_contiguous() enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n",
@ -294,11 +294,11 @@ enum ia_css_err ia_css_frame_allocate_contiguous(struct ia_css_frame **frame,
return err; return err;
} }
enum ia_css_err ia_css_frame_allocate_contiguous_from_info( int ia_css_frame_allocate_contiguous_from_info(
struct ia_css_frame **frame, struct ia_css_frame **frame,
const struct ia_css_frame_info *info) const struct ia_css_frame_info *info)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
assert(frame); assert(frame);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@ -330,15 +330,15 @@ void ia_css_frame_free(struct ia_css_frame *frame)
** Module public functions ** Module public functions
**************************************************************************/ **************************************************************************/
enum ia_css_err ia_css_frame_check_info(const struct ia_css_frame_info *info) int ia_css_frame_check_info(const struct ia_css_frame_info *info)
{ {
assert(info); assert(info);
if (info->res.width == 0 || info->res.height == 0) if (info->res.width == 0 || info->res.height == 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err ia_css_frame_init_planes(struct ia_css_frame *frame) int ia_css_frame_init_planes(struct ia_css_frame *frame)
{ {
assert(frame); assert(frame);
@ -443,9 +443,9 @@ enum ia_css_err ia_css_frame_init_planes(struct ia_css_frame *frame)
frame->planes.binary.size = 0; frame->planes.binary.size = 0;
break; break;
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
return IA_CSS_SUCCESS; return 0;
} }
void ia_css_frame_info_set_width(struct ia_css_frame_info *info, void ia_css_frame_info_set_width(struct ia_css_frame_info *info,
@ -530,26 +530,26 @@ void ia_css_frame_free_multiple(unsigned int num_frames,
} }
} }
enum ia_css_err ia_css_frame_allocate_with_buffer_size( int ia_css_frame_allocate_with_buffer_size(
struct ia_css_frame **frame, struct ia_css_frame **frame,
const unsigned int buffer_size_bytes, const unsigned int buffer_size_bytes,
const bool contiguous) const bool contiguous)
{ {
/* AM: Body coppied from frame_allocate_with_data(). */ /* AM: Body coppied from frame_allocate_with_data(). */
enum ia_css_err err; int err;
struct ia_css_frame *me = frame_create(0, 0, struct ia_css_frame *me = frame_create(0, 0,
IA_CSS_FRAME_FORMAT_NUM,/* Not valid format yet */ IA_CSS_FRAME_FORMAT_NUM,/* Not valid format yet */
0, 0, contiguous, false); 0, 0, contiguous, false);
if (!me) if (!me)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
/* Get the data size */ /* Get the data size */
me->data_bytes = buffer_size_bytes; me->data_bytes = buffer_size_bytes;
err = frame_allocate_buffer_data(me); err = frame_allocate_buffer_data(me);
if (err != IA_CSS_SUCCESS) { if (err) {
kvfree(me); kvfree(me);
me = NULL; me = NULL;
} }
@ -795,7 +795,7 @@ static void frame_init_qplane6_planes(struct ia_css_frame *frame)
return; return;
} }
static enum ia_css_err frame_allocate_buffer_data(struct ia_css_frame *frame) static int frame_allocate_buffer_data(struct ia_css_frame *frame)
{ {
#ifdef ISP2401 #ifdef ISP2401
IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes); IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes);
@ -806,11 +806,11 @@ static enum ia_css_err frame_allocate_buffer_data(struct ia_css_frame *frame)
ATOMISP_MAP_FLAG_CONTIGUOUS : 0); ATOMISP_MAP_FLAG_CONTIGUOUS : 0);
if (frame->data == mmgr_NULL) if (frame->data == mmgr_NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame, static int frame_allocate_with_data(struct ia_css_frame **frame,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
enum ia_css_frame_format format, enum ia_css_frame_format format,
@ -818,7 +818,7 @@ static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame,
unsigned int raw_bit_depth, unsigned int raw_bit_depth,
bool contiguous) bool contiguous)
{ {
enum ia_css_err err; int err;
struct ia_css_frame *me = frame_create(width, struct ia_css_frame *me = frame_create(width,
height, height,
format, format,
@ -828,14 +828,14 @@ static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame,
true); true);
if (!me) if (!me)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
err = ia_css_frame_init_planes(me); err = ia_css_frame_init_planes(me);
if (err == IA_CSS_SUCCESS) if (!err)
err = frame_allocate_buffer_data(me); err = frame_allocate_buffer_data(me);
if (err != IA_CSS_SUCCESS) { if (err) {
kvfree(me); kvfree(me);
#ifndef ISP2401 #ifndef ISP2401
return err; return err;
@ -932,7 +932,7 @@ void ia_css_resolution_to_sp_resolution(
} }
/* ISP2401 */ /* ISP2401 */
enum ia_css_err int
ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res, ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
const struct ia_css_resolution *out_res, const struct ia_css_resolution *out_res,
struct ia_css_resolution *crop_res) { struct ia_css_resolution *crop_res) {
@ -940,7 +940,7 @@ ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
u32 in_ratio, out_ratio; u32 in_ratio, out_ratio;
if ((!in_res) || (!out_res) || (!crop_res)) if ((!in_res) || (!out_res) || (!crop_res))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
IA_CSS_ENTER_PRIVATE("in(%ux%u) -> out(%ux%u)", in_res->width, IA_CSS_ENTER_PRIVATE("in(%ux%u) -> out(%ux%u)", in_res->width,
in_res->height, out_res->width, out_res->height); in_res->height, out_res->width, out_res->height);
@ -949,11 +949,11 @@ ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
|| (in_res->height == 0) || (in_res->height == 0)
|| (out_res->width == 0) || (out_res->width == 0)
|| (out_res->height == 0)) || (out_res->height == 0))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if ((out_res->width > in_res->width) || if ((out_res->width > in_res->width) ||
(out_res->height > in_res->height)) (out_res->height > in_res->height))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* If aspect ratio (width/height) of out_res is higher than the aspect /* If aspect ratio (width/height) of out_res is higher than the aspect
* ratio of the in_res, then we crop vertically, otherwise we crop * ratio of the in_res, then we crop vertically, otherwise we crop
@ -998,5 +998,5 @@ ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
IA_CSS_LEAVE_PRIVATE("in(%ux%u) -> out(%ux%u)", crop_res->width, IA_CSS_LEAVE_PRIVATE("in(%ux%u) -> out(%ux%u)", crop_res->width,
crop_res->height, out_res->width, out_res->height); crop_res->height, out_res->width, out_res->height);
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -27,7 +27,7 @@ unsigned int ia_css_ifmtr_lines_needed_for_bayer_order(
unsigned int ia_css_ifmtr_columns_needed_for_bayer_order( unsigned int ia_css_ifmtr_columns_needed_for_bayer_order(
const struct ia_css_stream_config *config); const struct ia_css_stream_config *config);
enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, int ia_css_ifmtr_configure(struct ia_css_stream_config *config,
struct ia_css_binary *binary); struct ia_css_binary *binary);
#endif /* __IA_CSS_IFMTR_H__ */ #endif /* __IA_CSS_IFMTR_H__ */

Просмотреть файл

@ -28,12 +28,12 @@
/************************************************************ /************************************************************
* Static functions declarations * Static functions declarations
************************************************************/ ************************************************************/
static enum ia_css_err ifmtr_start_column( static int ifmtr_start_column(
const struct ia_css_stream_config *config, const struct ia_css_stream_config *config,
unsigned int bin_in, unsigned int bin_in,
unsigned int *start_column); unsigned int *start_column);
static enum ia_css_err ifmtr_input_start_line( static int ifmtr_input_start_line(
const struct ia_css_stream_config *config, const struct ia_css_stream_config *config,
unsigned int bin_in, unsigned int bin_in,
unsigned int *start_line); unsigned int *start_line);
@ -71,7 +71,7 @@ unsigned int ia_css_ifmtr_columns_needed_for_bayer_order(
return 0; return 0;
} }
enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, int ia_css_ifmtr_configure(struct ia_css_stream_config *config,
struct ia_css_binary *binary) struct ia_css_binary *binary)
{ {
unsigned int start_line, start_column = 0, unsigned int start_line, start_column = 0,
@ -97,7 +97,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config,
left_padding = 0; left_padding = 0;
input_formatter_cfg_t if_a_config, if_b_config; input_formatter_cfg_t if_a_config, if_b_config;
enum atomisp_input_format input_format; enum atomisp_input_format input_format;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
u8 if_config_index; u8 if_config_index;
/* Determine which input formatter config set is targeted. */ /* Determine which input formatter config set is targeted. */
@ -142,10 +142,10 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config,
* columns. * columns.
*/ */
err = ifmtr_input_start_line(config, cropped_height, &start_line); err = ifmtr_input_start_line(config, cropped_height, &start_line);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
err = ifmtr_start_column(config, cropped_width, &start_column); err = ifmtr_start_column(config, cropped_width, &start_column);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
if (config->left_padding == -1) if (config->left_padding == -1)
@ -358,7 +358,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config,
break; break;
} }
if (width_a == 0) if (width_a == 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if (two_ppc) if (two_ppc)
left_padding /= 2; left_padding /= 2;
@ -459,7 +459,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config,
} }
} }
return IA_CSS_SUCCESS; return 0;
} }
bool ifmtr_set_if_blocking_mode_reset = true; bool ifmtr_set_if_blocking_mode_reset = true;
@ -496,7 +496,7 @@ static void ifmtr_set_if_blocking_mode(
return; return;
} }
static enum ia_css_err ifmtr_start_column( static int ifmtr_start_column(
const struct ia_css_stream_config *config, const struct ia_css_stream_config *config,
unsigned int bin_in, unsigned int bin_in,
unsigned int *start_column) unsigned int *start_column)
@ -505,7 +505,7 @@ static enum ia_css_err ifmtr_start_column(
for_bayer = ia_css_ifmtr_columns_needed_for_bayer_order(config); for_bayer = ia_css_ifmtr_columns_needed_for_bayer_order(config);
if (bin_in + 2 * for_bayer > in) if (bin_in + 2 * for_bayer > in)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* On the hardware, we want to use the middle of the input, so we /* On the hardware, we want to use the middle of the input, so we
* divide the start column by 2. */ * divide the start column by 2. */
@ -519,10 +519,10 @@ static enum ia_css_err ifmtr_start_column(
*/ */
start += for_bayer; start += for_bayer;
*start_column = start; *start_column = start;
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err ifmtr_input_start_line( static int ifmtr_input_start_line(
const struct ia_css_stream_config *config, const struct ia_css_stream_config *config,
unsigned int bin_in, unsigned int bin_in,
unsigned int *start_line) unsigned int *start_line)
@ -531,7 +531,7 @@ static enum ia_css_err ifmtr_input_start_line(
for_bayer = ia_css_ifmtr_lines_needed_for_bayer_order(config); for_bayer = ia_css_ifmtr_lines_needed_for_bayer_order(config);
if (bin_in + 2 * for_bayer > in) if (bin_in + 2 * for_bayer > in)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* On the hardware, we want to use the middle of the input, so we /* On the hardware, we want to use the middle of the input, so we
* divide the start line by 2. On the simulator, we cannot handle extra * divide the start line by 2. On the simulator, we cannot handle extra
@ -546,7 +546,7 @@ static enum ia_css_err ifmtr_input_start_line(
/* now we add the one line (if needed) to correct for the bayer order */ /* now we add the one line (if needed) to correct for the bayer order */
start += for_bayer; start += for_bayer;
*start_line = start; *start_line = start;
return IA_CSS_SUCCESS; return 0;
} }
#endif #endif

Просмотреть файл

@ -67,7 +67,7 @@ ia_css_init_memory_interface(
const struct ia_css_isp_param_css_segments *css_params); const struct ia_css_isp_param_css_segments *css_params);
/* Allocate memory parameters */ /* Allocate memory parameters */
enum ia_css_err int
ia_css_isp_param_allocate_isp_parameters( ia_css_isp_param_allocate_isp_parameters(
struct ia_css_isp_param_host_segments *mem_params, struct ia_css_isp_param_host_segments *mem_params,
struct ia_css_isp_param_css_segments *css_params, struct ia_css_isp_param_css_segments *css_params,
@ -88,7 +88,7 @@ ia_css_isp_param_load_fw_params(
bool init); bool init);
/* Copy host parameter images to ddr */ /* Copy host parameter images to ddr */
enum ia_css_err int
ia_css_isp_param_copy_isp_mem_if_to_ddr( ia_css_isp_param_copy_isp_mem_if_to_ddr(
struct ia_css_isp_param_css_segments *ddr, struct ia_css_isp_param_css_segments *ddr,
const struct ia_css_isp_param_host_segments *host, const struct ia_css_isp_param_host_segments *host,

Просмотреть файл

@ -101,12 +101,12 @@ ia_css_init_memory_interface(
} }
} }
enum ia_css_err int
ia_css_isp_param_allocate_isp_parameters( ia_css_isp_param_allocate_isp_parameters(
struct ia_css_isp_param_host_segments *mem_params, struct ia_css_isp_param_host_segments *mem_params,
struct ia_css_isp_param_css_segments *css_params, struct ia_css_isp_param_css_segments *css_params,
const struct ia_css_isp_param_isp_segments *mem_initializers) { const struct ia_css_isp_param_isp_segments *mem_initializers) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
unsigned int mem, pclass; unsigned int mem, pclass;
pclass = IA_CSS_PARAM_CLASS_PARAM; pclass = IA_CSS_PARAM_CLASS_PARAM;
@ -126,13 +126,13 @@ ia_css_isp_param_allocate_isp_parameters(
size, size,
GFP_KERNEL); GFP_KERNEL);
if (!mem_params->params[pclass][mem].address) { if (!mem_params->params[pclass][mem].address) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto cleanup; goto cleanup;
} }
if (pclass != IA_CSS_PARAM_CLASS_PARAM) { if (pclass != IA_CSS_PARAM_CLASS_PARAM) {
css_params->params[pclass][mem].address = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, 0); css_params->params[pclass][mem].address = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, 0);
if (!css_params->params[pclass][mem].address) { if (!css_params->params[pclass][mem].address) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto cleanup; goto cleanup;
} }
} }
@ -180,7 +180,7 @@ ia_css_isp_param_load_fw_params(
} }
} }
enum ia_css_err int
ia_css_isp_param_copy_isp_mem_if_to_ddr( ia_css_isp_param_copy_isp_mem_if_to_ddr(
struct ia_css_isp_param_css_segments *ddr, struct ia_css_isp_param_css_segments *ddr,
const struct ia_css_isp_param_host_segments *host, const struct ia_css_isp_param_host_segments *host,
@ -194,12 +194,12 @@ ia_css_isp_param_copy_isp_mem_if_to_ddr(
char *host_mem_ptr = host->params[pclass][mem].address; char *host_mem_ptr = host->params[pclass][mem].address;
if (size != ddr->params[pclass][mem].size) if (size != ddr->params[pclass][mem].size)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (!size) if (!size)
continue; continue;
hmm_store(ddr_mem_ptr, host_mem_ptr, size); hmm_store(ddr_mem_ptr, host_mem_ptr, size);
} }
return IA_CSS_SUCCESS; return 0;
} }
void void

Просмотреть файл

@ -48,10 +48,10 @@ enum mipi_port_id ia_css_isys_port_to_mipi_port(
* @param[in] port CSI port * @param[in] port CSI port
* @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id() * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
* Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
* @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if * @return 0 if successful, -EINVAL if
* there is already a stream registered with the same handle * there is already a stream registered with the same handle
*/ */
enum ia_css_err ia_css_isys_csi_rx_register_stream( int ia_css_isys_csi_rx_register_stream(
enum mipi_port_id port, enum mipi_port_id port,
uint32_t isys_stream_id); uint32_t isys_stream_id);
@ -63,14 +63,14 @@ enum ia_css_err ia_css_isys_csi_rx_register_stream(
* @param[in] port CSI port * @param[in] port CSI port
* @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id() * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
* Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
* @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if * @return 0 if successful, -EINVAL if
* there is no stream registered with that handle * there is no stream registered with that handle
*/ */
enum ia_css_err ia_css_isys_csi_rx_unregister_stream( int ia_css_isys_csi_rx_unregister_stream(
enum mipi_port_id port, enum mipi_port_id port,
uint32_t isys_stream_id); uint32_t isys_stream_id);
enum ia_css_err ia_css_isys_convert_compressed_format( int ia_css_isys_convert_compressed_format(
struct ia_css_csi2_compression *comp, struct ia_css_csi2_compression *comp,
struct input_system_cfg_s *cfg); struct input_system_cfg_s *cfg);
unsigned int ia_css_csi2_calculate_input_system_alignment( unsigned int ia_css_csi2_calculate_input_system_alignment(
@ -107,7 +107,7 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits);
* This is normally done by the sensor, but when using the input fifo, this * This is normally done by the sensor, but when using the input fifo, this
* format type must be sumitted correctly by the application. * format type must be sumitted correctly by the application.
*/ */
enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( int ia_css_isys_convert_stream_format_to_mipi_format(
enum atomisp_input_format input_format, enum atomisp_input_format input_format,
mipi_predictor_t compression, mipi_predictor_t compression,
unsigned int *fmt_type); unsigned int *fmt_type);

Просмотреть файл

@ -126,11 +126,11 @@ void ia_css_isys_csi_rx_lut_rmgr_release(
} }
} }
enum ia_css_err ia_css_isys_csi_rx_register_stream( int ia_css_isys_csi_rx_register_stream(
enum mipi_port_id port, enum mipi_port_id port,
uint32_t isys_stream_id) uint32_t isys_stream_id)
{ {
enum ia_css_err retval = IA_CSS_ERR_INTERNAL_ERROR; int retval = -EINVAL;
if ((port < N_INPUT_SYSTEM_CSI_PORT) && if ((port < N_INPUT_SYSTEM_CSI_PORT) &&
(isys_stream_id < SH_CSS_MAX_ISYS_CHANNEL_NODES)) { (isys_stream_id < SH_CSS_MAX_ISYS_CHANNEL_NODES)) {
@ -140,17 +140,17 @@ enum ia_css_err ia_css_isys_csi_rx_register_stream(
if (bitop_getbit(pipe_io_status->active[port], isys_stream_id) == 0) { if (bitop_getbit(pipe_io_status->active[port], isys_stream_id) == 0) {
bitop_setbit(pipe_io_status->active[port], isys_stream_id); bitop_setbit(pipe_io_status->active[port], isys_stream_id);
pipe_io_status->running[port] = 0; pipe_io_status->running[port] = 0;
retval = IA_CSS_SUCCESS; retval = 0;
} }
} }
return retval; return retval;
} }
enum ia_css_err ia_css_isys_csi_rx_unregister_stream( int ia_css_isys_csi_rx_unregister_stream(
enum mipi_port_id port, enum mipi_port_id port,
uint32_t isys_stream_id) uint32_t isys_stream_id)
{ {
enum ia_css_err retval = IA_CSS_ERR_INTERNAL_ERROR; int retval = -EINVAL;
if ((port < N_INPUT_SYSTEM_CSI_PORT) && if ((port < N_INPUT_SYSTEM_CSI_PORT) &&
(isys_stream_id < SH_CSS_MAX_ISYS_CHANNEL_NODES)) { (isys_stream_id < SH_CSS_MAX_ISYS_CHANNEL_NODES)) {
@ -159,7 +159,7 @@ enum ia_css_err ia_css_isys_csi_rx_unregister_stream(
pipe_io_status = ia_css_pipeline_get_pipe_io_status(); pipe_io_status = ia_css_pipeline_get_pipe_io_status();
if (bitop_getbit(pipe_io_status->active[port], isys_stream_id) == 1) { if (bitop_getbit(pipe_io_status->active[port], isys_stream_id) == 1) {
bitop_clearbit(pipe_io_status->active[port], isys_stream_id); bitop_clearbit(pipe_io_status->active[port], isys_stream_id);
retval = IA_CSS_SUCCESS; retval = 0;
} }
} }
return retval; return retval;

Просмотреть файл

@ -216,7 +216,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port,
} }
#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ #endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */
enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( int ia_css_isys_convert_stream_format_to_mipi_format(
enum atomisp_input_format input_format, enum atomisp_input_format input_format,
mipi_predictor_t compression, mipi_predictor_t compression,
unsigned int *fmt_type) unsigned int *fmt_type)
@ -254,9 +254,9 @@ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format(
*fmt_type = 16; *fmt_type = 16;
break; break;
default: default:
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
return IA_CSS_SUCCESS; return 0;
} }
/* /*
* This mapping comes from the Arasan CSS function spec * This mapping comes from the Arasan CSS function spec
@ -356,9 +356,9 @@ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format(
case ATOMISP_INPUT_FORMAT_YUV420_16: case ATOMISP_INPUT_FORMAT_YUV420_16:
case ATOMISP_INPUT_FORMAT_YUV422_16: case ATOMISP_INPUT_FORMAT_YUV422_16:
default: default:
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
return IA_CSS_SUCCESS; return 0;
} }
#if defined(USE_INPUT_SYSTEM_VERSION_2401) #if defined(USE_INPUT_SYSTEM_VERSION_2401)
@ -379,11 +379,11 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor(
return predictor; return predictor;
} }
enum ia_css_err ia_css_isys_convert_compressed_format( int ia_css_isys_convert_compressed_format(
struct ia_css_csi2_compression *comp, struct ia_css_csi2_compression *comp,
struct input_system_cfg_s *cfg) struct input_system_cfg_s *cfg)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
assert(comp); assert(comp);
assert(cfg); assert(cfg);
@ -414,7 +414,7 @@ enum ia_css_err ia_css_isys_convert_compressed_format(
cfg->csi_port_attr.comp_scheme = MIPI_COMPRESSOR_10_8_10; cfg->csi_port_attr.comp_scheme = MIPI_COMPRESSOR_10_8_10;
break; break;
default: default:
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
} }
} else if (comp->uncompressed_bits_per_pixel == } else if (comp->uncompressed_bits_per_pixel ==
UNCOMPRESSED_BITS_PER_PIXEL_12) { UNCOMPRESSED_BITS_PER_PIXEL_12) {
@ -429,10 +429,10 @@ enum ia_css_err ia_css_isys_convert_compressed_format(
cfg->csi_port_attr.comp_scheme = MIPI_COMPRESSOR_12_8_12; cfg->csi_port_attr.comp_scheme = MIPI_COMPRESSOR_12_8_12;
break; break;
default: default:
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
} }
} else } else
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
cfg->csi_port_attr.comp_predictor = cfg->csi_port_attr.comp_predictor =
sh_css_csi2_compression_type_2_mipi_predictor(comp->type); sh_css_csi2_compression_type_2_mipi_predictor(comp->type);
cfg->csi_port_attr.comp_enable = true; cfg->csi_port_attr.comp_enable = true;

Просмотреть файл

@ -94,13 +94,13 @@ void ia_css_pipeline_init(void);
* @param[out] pipeline structure to be initialized with defaults * @param[out] pipeline structure to be initialized with defaults
* @param[in] pipe_id * @param[in] pipe_id
* @param[in] pipe_num Number that uniquely identifies a pipeline. * @param[in] pipe_num Number that uniquely identifies a pipeline.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* Initializes the pipeline structure with a set of default values. * Initializes the pipeline structure with a set of default values.
* This API is expected to be used when a pipeline structure is allocated * This API is expected to be used when a pipeline structure is allocated
* externally and needs sane defaults * externally and needs sane defaults
*/ */
enum ia_css_err ia_css_pipeline_create( int ia_css_pipeline_create(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
enum ia_css_pipe_id pipe_id, enum ia_css_pipe_id pipe_id,
unsigned int pipe_num, unsigned int pipe_num,
@ -127,10 +127,10 @@ void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id,
/* @brief Request to stop a pipeline /* @brief Request to stop a pipeline
* *
* @param[in] pipeline * @param[in] pipeline
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline); int ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline);
/* @brief Check whether pipeline has stopped /* @brief Check whether pipeline has stopped
* *
@ -153,13 +153,13 @@ void ia_css_pipeline_clean(struct ia_css_pipeline *pipeline);
* @param pipeline Pointer to the pipeline to be added to. * @param pipeline Pointer to the pipeline to be added to.
* @param[in] stage_desc The description of the stage * @param[in] stage_desc The description of the stage
* @param[out] stage The successor of the stage. * @param[out] stage The successor of the stage.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* Add a new stage to a non-NULL pipeline. * Add a new stage to a non-NULL pipeline.
* The stage consists of an ISP binary or firmware and input and output * The stage consists of an ISP binary or firmware and input and output
* arguments. * arguments.
*/ */
enum ia_css_err ia_css_pipeline_create_and_add_stage( int ia_css_pipeline_create_and_add_stage(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
struct ia_css_pipeline_stage_desc *stage_desc, struct ia_css_pipeline_stage_desc *stage_desc,
struct ia_css_pipeline_stage **stage); struct ia_css_pipeline_stage **stage);
@ -177,10 +177,10 @@ void ia_css_pipeline_finalize_stages(struct ia_css_pipeline *pipeline,
/* @brief gets a stage from the pipeline /* @brief gets a stage from the pipeline
* *
* @param[in] pipeline * @param[in] pipeline
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline, int ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline,
int mode, int mode,
struct ia_css_pipeline_stage **stage); struct ia_css_pipeline_stage **stage);
@ -190,10 +190,10 @@ enum ia_css_err ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline,
* @param[in] fw_handle * @param[in] fw_handle
* @param[out] stage Pointer to Stage * @param[out] stage Pointer to Stage
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline int ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline
*pipeline, *pipeline,
u32 fw_handle, u32 fw_handle,
struct ia_css_pipeline_stage **stage); struct ia_css_pipeline_stage **stage);
@ -204,10 +204,10 @@ enum ia_css_err ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline
* @param[in] stage_num * @param[in] stage_num
* @param[out] fw_handle * @param[out] fw_handle
* *
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline int ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline
*pipeline, *pipeline,
u32 stage_num, u32 stage_num,
uint32_t *fw_handle); uint32_t *fw_handle);
@ -215,10 +215,10 @@ enum ia_css_err ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline
/* @brief gets the output stage from the pipeline /* @brief gets the output stage from the pipeline
* *
* @param[in] pipeline * @param[in] pipeline
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
*/ */
enum ia_css_err ia_css_pipeline_get_output_stage( int ia_css_pipeline_get_output_stage(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
int mode, int mode,
struct ia_css_pipeline_stage **stage); struct ia_css_pipeline_stage **stage);

Просмотреть файл

@ -46,7 +46,7 @@ static void pipeline_init_defaults(
unsigned int dvs_frame_delay); unsigned int dvs_frame_delay);
static void pipeline_stage_destroy(struct ia_css_pipeline_stage *stage); static void pipeline_stage_destroy(struct ia_css_pipeline_stage *stage);
static enum ia_css_err pipeline_stage_create( static int pipeline_stage_create(
struct ia_css_pipeline_stage_desc *stage_desc, struct ia_css_pipeline_stage_desc *stage_desc,
struct ia_css_pipeline_stage **new_stage); struct ia_css_pipeline_stage **new_stage);
static void ia_css_pipeline_set_zoom_stage(struct ia_css_pipeline *pipeline); static void ia_css_pipeline_set_zoom_stage(struct ia_css_pipeline *pipeline);
@ -61,7 +61,7 @@ void ia_css_pipeline_init(void)
pipeline_init_sp_thread_map(); pipeline_init_sp_thread_map();
} }
enum ia_css_err ia_css_pipeline_create( int ia_css_pipeline_create(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
enum ia_css_pipe_id pipe_id, enum ia_css_pipe_id pipe_id,
unsigned int pipe_num, unsigned int pipe_num,
@ -71,14 +71,14 @@ enum ia_css_err ia_css_pipeline_create(
IA_CSS_ENTER_PRIVATE("pipeline = %p, pipe_id = %d, pipe_num = %d, dvs_frame_delay = %d", IA_CSS_ENTER_PRIVATE("pipeline = %p, pipe_id = %d, pipe_num = %d, dvs_frame_delay = %d",
pipeline, pipe_id, pipe_num, dvs_frame_delay); pipeline, pipe_id, pipe_num, dvs_frame_delay);
if (!pipeline) { if (!pipeline) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INVALID_ARGUMENTS); IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL);
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
pipeline_init_defaults(pipeline, pipe_id, pipe_num, dvs_frame_delay); pipeline_init_defaults(pipeline, pipe_id, pipe_num, dvs_frame_delay);
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
void ia_css_pipeline_map(unsigned int pipe_num, bool map) void ia_css_pipeline_map(unsigned int pipe_num, bool map)
@ -196,15 +196,15 @@ void ia_css_pipeline_dump_thread_map_info(void)
} }
} }
enum ia_css_err ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline) int ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
unsigned int thread_id; unsigned int thread_id;
assert(pipeline); assert(pipeline);
if (!pipeline) if (!pipeline)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_pipeline_request_stop() enter: pipeline=%p\n", "ia_css_pipeline_request_stop() enter: pipeline=%p\n",
@ -219,7 +219,7 @@ enum ia_css_err ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline)
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_pipeline_request_stop() leaving\n"); "ia_css_pipeline_request_stop() leaving\n");
/* queues are invalid */ /* queues are invalid */
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
ia_css_bufq_enqueue_psys_event(IA_CSS_PSYS_SW_EVENT_STOP_STREAM, ia_css_bufq_enqueue_psys_event(IA_CSS_PSYS_SW_EVENT_STOP_STREAM,
(uint8_t)thread_id, (uint8_t)thread_id,
@ -264,19 +264,19 @@ void ia_css_pipeline_clean(struct ia_css_pipeline *pipeline)
* @param pipeline Pointer to the pipeline to be added to. * @param pipeline Pointer to the pipeline to be added to.
* @param[in] stage_desc The description of the stage * @param[in] stage_desc The description of the stage
* @param[out] stage The successor of the stage. * @param[out] stage The successor of the stage.
* @return IA_CSS_SUCCESS or error code upon error. * @return 0 or error code upon error.
* *
* Add a new stage to a non-NULL pipeline. * Add a new stage to a non-NULL pipeline.
* The stage consists of an ISP binary or firmware and input and * The stage consists of an ISP binary or firmware and input and
* output arguments. * output arguments.
*/ */
enum ia_css_err ia_css_pipeline_create_and_add_stage( int ia_css_pipeline_create_and_add_stage(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
struct ia_css_pipeline_stage_desc *stage_desc, struct ia_css_pipeline_stage_desc *stage_desc,
struct ia_css_pipeline_stage **stage) struct ia_css_pipeline_stage **stage)
{ {
struct ia_css_pipeline_stage *last, *new_stage = NULL; struct ia_css_pipeline_stage *last, *new_stage = NULL;
enum ia_css_err err; int err;
/* other arguments can be NULL */ /* other arguments can be NULL */
assert(pipeline); assert(pipeline);
@ -290,7 +290,7 @@ enum ia_css_err ia_css_pipeline_create_and_add_stage(
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_pipeline_create_and_add_stage() done: Invalid args\n"); "ia_css_pipeline_create_and_add_stage() done: Invalid args\n");
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
/* Find the last stage */ /* Find the last stage */
@ -309,12 +309,12 @@ enum ia_css_err ia_css_pipeline_create_and_add_stage(
stage_desc->in_frame = last->args.out_frame[0]; stage_desc->in_frame = last->args.out_frame[0];
if (!stage_desc->in_frame) if (!stage_desc->in_frame)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
/* Create the new stage */ /* Create the new stage */
err = pipeline_stage_create(stage_desc, &new_stage); err = pipeline_stage_create(stage_desc, &new_stage);
if (err != IA_CSS_SUCCESS) { if (err) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_pipeline_create_and_add_stage() done: stage_create_failed\n"); "ia_css_pipeline_create_and_add_stage() done: stage_create_failed\n");
return err; return err;
@ -331,7 +331,7 @@ enum ia_css_err ia_css_pipeline_create_and_add_stage(
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_pipeline_create_and_add_stage() done:\n"); "ia_css_pipeline_create_and_add_stage() done:\n");
return IA_CSS_SUCCESS; return 0;
} }
void ia_css_pipeline_finalize_stages(struct ia_css_pipeline *pipeline, void ia_css_pipeline_finalize_stages(struct ia_css_pipeline *pipeline,
@ -351,7 +351,7 @@ void ia_css_pipeline_finalize_stages(struct ia_css_pipeline *pipeline,
ia_css_pipeline_configure_inout_port(pipeline, continuous); ia_css_pipeline_configure_inout_port(pipeline, continuous);
} }
enum ia_css_err ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline, int ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline,
int mode, int mode,
struct ia_css_pipeline_stage **stage) struct ia_css_pipeline_stage **stage)
{ {
@ -364,13 +364,13 @@ enum ia_css_err ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline,
for (s = pipeline->stages; s; s = s->next) { for (s = pipeline->stages; s; s = s->next) {
if (s->mode == mode) { if (s->mode == mode) {
*stage = s; *stage = s;
return IA_CSS_SUCCESS; return 0;
} }
} }
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
enum ia_css_err ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline int ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline
*pipeline, *pipeline,
u32 fw_handle, u32 fw_handle,
struct ia_css_pipeline_stage **stage) struct ia_css_pipeline_stage **stage)
@ -383,13 +383,13 @@ enum ia_css_err ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline
for (s = pipeline->stages; s; s = s->next) { for (s = pipeline->stages; s; s = s->next) {
if ((s->firmware) && (s->firmware->handle == fw_handle)) { if ((s->firmware) && (s->firmware->handle == fw_handle)) {
*stage = s; *stage = s;
return IA_CSS_SUCCESS; return 0;
} }
} }
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
enum ia_css_err ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline int ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline
*pipeline, *pipeline,
u32 stage_num, u32 stage_num,
uint32_t *fw_handle) uint32_t *fw_handle)
@ -398,18 +398,18 @@ enum ia_css_err ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%s()\n", __func__); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%s()\n", __func__);
if ((!pipeline) || (!fw_handle)) if ((!pipeline) || (!fw_handle))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
for (s = pipeline->stages; s; s = s->next) { for (s = pipeline->stages; s; s = s->next) {
if ((s->stage_num == stage_num) && (s->firmware)) { if ((s->stage_num == stage_num) && (s->firmware)) {
*fw_handle = s->firmware->handle; *fw_handle = s->firmware->handle;
return IA_CSS_SUCCESS; return 0;
} }
} }
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
enum ia_css_err ia_css_pipeline_get_output_stage( int ia_css_pipeline_get_output_stage(
struct ia_css_pipeline *pipeline, struct ia_css_pipeline *pipeline,
int mode, int mode,
struct ia_css_pipeline_stage **stage) struct ia_css_pipeline_stage **stage)
@ -429,7 +429,7 @@ enum ia_css_err ia_css_pipeline_get_output_stage(
*stage = s; *stage = s;
} }
if (*stage) if (*stage)
return IA_CSS_SUCCESS; return 0;
/* If no firmware, find binary in pipe */ /* If no firmware, find binary in pipe */
return ia_css_pipeline_get_stage(pipeline, mode, stage); return ia_css_pipeline_get_stage(pipeline, mode, stage);
} }
@ -567,11 +567,11 @@ static void pipeline_unmap_num_to_sp_thread(unsigned int pipe_num)
pipeline_sp_thread_list[thread_id] = PIPELINE_SP_THREAD_EMPTY_TOKEN; pipeline_sp_thread_list[thread_id] = PIPELINE_SP_THREAD_EMPTY_TOKEN;
} }
static enum ia_css_err pipeline_stage_create( static int pipeline_stage_create(
struct ia_css_pipeline_stage_desc *stage_desc, struct ia_css_pipeline_stage_desc *stage_desc,
struct ia_css_pipeline_stage **new_stage) struct ia_css_pipeline_stage **new_stage)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_pipeline_stage *stage = NULL; struct ia_css_pipeline_stage *stage = NULL;
struct ia_css_binary *binary; struct ia_css_binary *binary;
struct ia_css_frame *vf_frame; struct ia_css_frame *vf_frame;
@ -582,7 +582,7 @@ static enum ia_css_err pipeline_stage_create(
/* Verify input parameters*/ /* Verify input parameters*/
if (!(stage_desc->in_frame) && !(stage_desc->firmware) if (!(stage_desc->in_frame) && !(stage_desc->firmware)
&& (stage_desc->binary) && !(stage_desc->binary->online)) { && (stage_desc->binary) && !(stage_desc->binary->online)) {
err = IA_CSS_ERR_INTERNAL_ERROR; err = -EINVAL;
goto ERR; goto ERR;
} }
@ -595,7 +595,7 @@ static enum ia_css_err pipeline_stage_create(
stage = kvzalloc(sizeof(*stage), GFP_KERNEL); stage = kvzalloc(sizeof(*stage), GFP_KERNEL);
if (!stage) { if (!stage) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto ERR; goto ERR;
} }
@ -627,7 +627,7 @@ static enum ia_css_err pipeline_stage_create(
&& (binary->out_frame_info[i].res.width)) { && (binary->out_frame_info[i].res.width)) {
err = ia_css_frame_allocate_from_info(&out_frame[i], err = ia_css_frame_allocate_from_info(&out_frame[i],
&binary->out_frame_info[i]); &binary->out_frame_info[i]);
if (err != IA_CSS_SUCCESS) if (err)
goto ERR; goto ERR;
stage->out_frame_allocated[i] = true; stage->out_frame_allocated[i] = true;
} }
@ -641,7 +641,7 @@ static enum ia_css_err pipeline_stage_create(
) { ) {
err = ia_css_frame_allocate_from_info(&vf_frame, err = ia_css_frame_allocate_from_info(&vf_frame,
&binary->vf_frame_info); &binary->vf_frame_info);
if (err != IA_CSS_SUCCESS) if (err)
goto ERR; goto ERR;
stage->vf_frame_allocated = true; stage->vf_frame_allocated = true;
} }
@ -690,30 +690,30 @@ static void pipeline_init_defaults(
static void ia_css_pipeline_set_zoom_stage(struct ia_css_pipeline *pipeline) static void ia_css_pipeline_set_zoom_stage(struct ia_css_pipeline *pipeline)
{ {
struct ia_css_pipeline_stage *stage = NULL; struct ia_css_pipeline_stage *stage = NULL;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
assert(pipeline); assert(pipeline);
if (pipeline->pipe_id == IA_CSS_PIPE_ID_PREVIEW) { if (pipeline->pipe_id == IA_CSS_PIPE_ID_PREVIEW) {
/* in preview pipeline, vf_pp stage should do zoom */ /* in preview pipeline, vf_pp stage should do zoom */
err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_VF_PP, &stage); err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_VF_PP, &stage);
if (err == IA_CSS_SUCCESS) if (!err)
stage->enable_zoom = true; stage->enable_zoom = true;
} else if (pipeline->pipe_id == IA_CSS_PIPE_ID_CAPTURE) { } else if (pipeline->pipe_id == IA_CSS_PIPE_ID_CAPTURE) {
/* in capture pipeline, capture_pp stage should do zoom */ /* in capture pipeline, capture_pp stage should do zoom */
err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP, err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP,
&stage); &stage);
if (err == IA_CSS_SUCCESS) if (!err)
stage->enable_zoom = true; stage->enable_zoom = true;
} else if (pipeline->pipe_id == IA_CSS_PIPE_ID_VIDEO) { } else if (pipeline->pipe_id == IA_CSS_PIPE_ID_VIDEO) {
/* in video pipeline, video stage should do zoom */ /* in video pipeline, video stage should do zoom */
err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_VIDEO, &stage); err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_VIDEO, &stage);
if (err == IA_CSS_SUCCESS) if (!err)
stage->enable_zoom = true; stage->enable_zoom = true;
} else if (pipeline->pipe_id == IA_CSS_PIPE_ID_YUVPP) { } else if (pipeline->pipe_id == IA_CSS_PIPE_ID_YUVPP) {
/* in yuvpp pipeline, first yuv_scaler stage should do zoom */ /* in yuvpp pipeline, first yuv_scaler stage should do zoom */
err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP, err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP,
&stage); &stage);
if (err == IA_CSS_SUCCESS) if (!err)
stage->enable_zoom = true; stage->enable_zoom = true;
} }
} }

Просмотреть файл

@ -28,7 +28,7 @@
/** /**
* @brief Initialize resource manager (host/common) * @brief Initialize resource manager (host/common)
*/ */
enum ia_css_err ia_css_rmgr_init(void); int ia_css_rmgr_init(void);
/** /**
* @brief Uninitialize resource manager (host/common) * @brief Uninitialize resource manager (host/common)

Просмотреть файл

@ -52,7 +52,7 @@ extern struct ia_css_rmgr_vbuf_pool *hmm_buffer_pool;
* *
* @param pool The pointer to the pool * @param pool The pointer to the pool
*/ */
STORAGE_CLASS_RMGR_H enum ia_css_err ia_css_rmgr_init_vbuf( STORAGE_CLASS_RMGR_H int ia_css_rmgr_init_vbuf(
struct ia_css_rmgr_vbuf_pool *pool); struct ia_css_rmgr_vbuf_pool *pool);
/** /**

Просмотреть файл

@ -14,16 +14,16 @@
#include "ia_css_rmgr.h" #include "ia_css_rmgr.h"
enum ia_css_err ia_css_rmgr_init(void) int ia_css_rmgr_init(void)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
err = ia_css_rmgr_init_vbuf(vbuf_ref); err = ia_css_rmgr_init_vbuf(vbuf_ref);
if (err == IA_CSS_SUCCESS) if (!err)
err = ia_css_rmgr_init_vbuf(vbuf_write); err = ia_css_rmgr_init_vbuf(vbuf_write);
if (err == IA_CSS_SUCCESS) if (!err)
err = ia_css_rmgr_init_vbuf(hmm_buffer_pool); err = ia_css_rmgr_init_vbuf(hmm_buffer_pool);
if (err != IA_CSS_SUCCESS) if (err)
ia_css_rmgr_uninit(); ia_css_rmgr_uninit();
return err; return err;
} }

Просмотреть файл

@ -137,15 +137,15 @@ void ia_css_rmgr_refcount_release_vbuf(struct ia_css_rmgr_vbuf_handle **handle)
* *
* @param pool The pointer to the pool * @param pool The pointer to the pool
*/ */
enum ia_css_err ia_css_rmgr_init_vbuf(struct ia_css_rmgr_vbuf_pool *pool) int ia_css_rmgr_init_vbuf(struct ia_css_rmgr_vbuf_pool *pool)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
size_t bytes_needed; size_t bytes_needed;
rmgr_refcount_init_vbuf(); rmgr_refcount_init_vbuf();
assert(pool); assert(pool);
if (!pool) if (!pool)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* initialize the recycle pool if used */ /* initialize the recycle pool if used */
if (pool->recycle && pool->size) { if (pool->recycle && pool->size) {
/* allocate memory for storing the handles */ /* allocate memory for storing the handles */
@ -156,7 +156,7 @@ enum ia_css_err ia_css_rmgr_init_vbuf(struct ia_css_rmgr_vbuf_pool *pool)
if (pool->handles) if (pool->handles)
memset(pool->handles, 0, bytes_needed); memset(pool->handles, 0, bytes_needed);
else else
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
} else { } else {
/* just in case, set the size to 0 */ /* just in case, set the size to 0 */
pool->size = 0; pool->size = 0;

Просмотреть файл

@ -38,7 +38,7 @@ ia_css_ptr get_sp_code_addr(sp_ID_t sp_id);
/* ! Load firmware on to specfied SP /* ! Load firmware on to specfied SP
*/ */
enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, int ia_css_spctrl_load_fw(sp_ID_t sp_id,
ia_css_spctrl_cfg *spctrl_cfg); ia_css_spctrl_cfg *spctrl_cfg);
/* ISP2401 */ /* ISP2401 */
@ -47,15 +47,15 @@ void sh_css_spctrl_reload_fw(sp_ID_t sp_id);
/*! Unload/release any memory allocated to hold the firmware /*! Unload/release any memory allocated to hold the firmware
*/ */
enum ia_css_err ia_css_spctrl_unload_fw(sp_ID_t sp_id); int ia_css_spctrl_unload_fw(sp_ID_t sp_id);
/*! Intilaize dmem_cfg in SP dmem and start SP program /*! Intilaize dmem_cfg in SP dmem and start SP program
*/ */
enum ia_css_err ia_css_spctrl_start(sp_ID_t sp_id); int ia_css_spctrl_start(sp_ID_t sp_id);
/*! stop spctrl /*! stop spctrl
*/ */
enum ia_css_err ia_css_spctrl_stop(sp_ID_t sp_id); int ia_css_spctrl_stop(sp_ID_t sp_id);
/*! Query the state of SP /*! Query the state of SP
*/ */

Просмотреть файл

@ -36,14 +36,14 @@ static struct spctrl_context_info spctrl_cofig_info[N_SP_ID];
static bool spctrl_loaded[N_SP_ID] = {0}; static bool spctrl_loaded[N_SP_ID] = {0};
/* Load firmware */ /* Load firmware */
enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, int ia_css_spctrl_load_fw(sp_ID_t sp_id,
ia_css_spctrl_cfg *spctrl_cfg) ia_css_spctrl_cfg *spctrl_cfg)
{ {
ia_css_ptr code_addr = mmgr_NULL; ia_css_ptr code_addr = mmgr_NULL;
struct ia_css_sp_init_dmem_cfg *init_dmem_cfg; struct ia_css_sp_init_dmem_cfg *init_dmem_cfg;
if ((sp_id >= N_SP_ID) || (!spctrl_cfg)) if ((sp_id >= N_SP_ID) || (!spctrl_cfg))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
spctrl_cofig_info[sp_id].code_addr = mmgr_NULL; spctrl_cofig_info[sp_id].code_addr = mmgr_NULL;
@ -66,7 +66,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id,
*/ */
code_addr = hmm_alloc(spctrl_cfg->code_size, HMM_BO_PRIVATE, 0, NULL, 0); code_addr = hmm_alloc(spctrl_cfg->code_size, HMM_BO_PRIVATE, 0, NULL, 0);
if (code_addr == mmgr_NULL) if (code_addr == mmgr_NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
hmm_store(code_addr, spctrl_cfg->code, spctrl_cfg->code_size); hmm_store(code_addr, spctrl_cfg->code, spctrl_cfg->code_size);
if (sizeof(ia_css_ptr) > sizeof(hrt_data)) { if (sizeof(ia_css_ptr) > sizeof(hrt_data)) {
@ -74,7 +74,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id,
"size of ia_css_ptr can not be greater than hrt_data\n"); "size of ia_css_ptr can not be greater than hrt_data\n");
hmm_free(code_addr); hmm_free(code_addr);
code_addr = mmgr_NULL; code_addr = mmgr_NULL;
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
init_dmem_cfg->ddr_data_addr = code_addr + spctrl_cfg->ddr_data_offset; init_dmem_cfg->ddr_data_addr = code_addr + spctrl_cfg->ddr_data_offset;
@ -83,7 +83,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id,
"DDR address pointer is not properly aligned for DMA transfer\n"); "DDR address pointer is not properly aligned for DMA transfer\n");
hmm_free(code_addr); hmm_free(code_addr);
code_addr = mmgr_NULL; code_addr = mmgr_NULL;
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
spctrl_cofig_info[sp_id].sp_entry = spctrl_cfg->sp_entry; spctrl_cofig_info[sp_id].sp_entry = spctrl_cfg->sp_entry;
@ -97,7 +97,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id,
(hrt_data)spctrl_cofig_info[sp_id].code_addr); (hrt_data)spctrl_cofig_info[sp_id].code_addr);
sp_ctrl_setbit(sp_id, SP_ICACHE_INV_REG, SP_ICACHE_INV_BIT); sp_ctrl_setbit(sp_id, SP_ICACHE_INV_REG, SP_ICACHE_INV_BIT);
spctrl_loaded[sp_id] = true; spctrl_loaded[sp_id] = true;
return IA_CSS_SUCCESS; return 0;
} }
/* ISP2401 */ /* ISP2401 */
@ -118,10 +118,10 @@ ia_css_ptr get_sp_code_addr(sp_ID_t sp_id)
return spctrl_cofig_info[sp_id].code_addr; return spctrl_cofig_info[sp_id].code_addr;
} }
enum ia_css_err ia_css_spctrl_unload_fw(sp_ID_t sp_id) int ia_css_spctrl_unload_fw(sp_ID_t sp_id)
{ {
if ((sp_id >= N_SP_ID) || ((sp_id < N_SP_ID) && (!spctrl_loaded[sp_id]))) if ((sp_id >= N_SP_ID) || ((sp_id < N_SP_ID) && (!spctrl_loaded[sp_id])))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* freeup the resource */ /* freeup the resource */
if (spctrl_cofig_info[sp_id].code_addr) { if (spctrl_cofig_info[sp_id].code_addr) {
@ -129,14 +129,14 @@ enum ia_css_err ia_css_spctrl_unload_fw(sp_ID_t sp_id)
spctrl_cofig_info[sp_id].code_addr = mmgr_NULL; spctrl_cofig_info[sp_id].code_addr = mmgr_NULL;
} }
spctrl_loaded[sp_id] = false; spctrl_loaded[sp_id] = false;
return IA_CSS_SUCCESS; return 0;
} }
/* Initialize dmem_cfg in SP dmem and start SP program*/ /* Initialize dmem_cfg in SP dmem and start SP program*/
enum ia_css_err ia_css_spctrl_start(sp_ID_t sp_id) int ia_css_spctrl_start(sp_ID_t sp_id)
{ {
if ((sp_id >= N_SP_ID) || ((sp_id < N_SP_ID) && (!spctrl_loaded[sp_id]))) if ((sp_id >= N_SP_ID) || ((sp_id < N_SP_ID) && (!spctrl_loaded[sp_id])))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* Set descr in the SP to initialize the SP DMEM */ /* Set descr in the SP to initialize the SP DMEM */
/* /*
@ -155,7 +155,7 @@ enum ia_css_err ia_css_spctrl_start(sp_ID_t sp_id)
(hrt_data)spctrl_cofig_info[sp_id].sp_entry); (hrt_data)spctrl_cofig_info[sp_id].sp_entry);
sp_ctrl_setbit(sp_id, SP_SC_REG, SP_RUN_BIT); sp_ctrl_setbit(sp_id, SP_SC_REG, SP_RUN_BIT);
sp_ctrl_setbit(sp_id, SP_SC_REG, SP_START_BIT); sp_ctrl_setbit(sp_id, SP_SC_REG, SP_START_BIT);
return IA_CSS_SUCCESS; return 0;
} }
/* Query the state of SP1 */ /* Query the state of SP1 */

Просмотреть файл

@ -18,14 +18,14 @@
#include "gp_timer.h" /*gp_timer_read()*/ #include "gp_timer.h" /*gp_timer_read()*/
#include "assert_support.h" #include "assert_support.h"
enum ia_css_err int
ia_css_timer_get_current_tick( ia_css_timer_get_current_tick(
struct ia_css_clock_tick *curr_ts) { struct ia_css_clock_tick *curr_ts) {
assert(curr_ts); assert(curr_ts);
if (!curr_ts) if (!curr_ts)
{ {
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
curr_ts->ticks = (clock_value_t)gp_timer_read(GP_TIMER_SEL); curr_ts->ticks = (clock_value_t)gp_timer_read(GP_TIMER_SEL);
return IA_CSS_SUCCESS; return 0;
} }

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -75,13 +75,13 @@ char *sh_css_get_fw_version(void)
*/ */
/* Setup sp/sp1 binary */ /* Setup sp/sp1 binary */
static enum ia_css_err static int
setup_binary(struct ia_css_fw_info *fw, const char *fw_data, setup_binary(struct ia_css_fw_info *fw, const char *fw_data,
struct ia_css_fw_info *sh_css_fw, unsigned int binary_id) { struct ia_css_fw_info *sh_css_fw, unsigned int binary_id) {
const char *blob_data; const char *blob_data;
if ((!fw) || (!fw_data)) if ((!fw) || (!fw_data))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
blob_data = fw_data + fw->blob.offset; blob_data = fw_data + fw->blob.offset;
@ -89,16 +89,16 @@ setup_binary(struct ia_css_fw_info *fw, const char *fw_data,
sh_css_fw->blob.code = vmalloc(fw->blob.size); sh_css_fw->blob.code = vmalloc(fw->blob.size);
if (!sh_css_fw->blob.code) if (!sh_css_fw->blob.code)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
memcpy((void *)sh_css_fw->blob.code, blob_data, fw->blob.size); memcpy((void *)sh_css_fw->blob.code, blob_data, fw->blob.size);
sh_css_fw->blob.data = (char *)sh_css_fw->blob.code + fw->blob.data_source; sh_css_fw->blob.data = (char *)sh_css_fw->blob.code + fw->blob.data_source;
fw_minibuffer[binary_id].buffer = sh_css_fw->blob.code; fw_minibuffer[binary_id].buffer = sh_css_fw->blob.code;
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err int
sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
struct ia_css_blob_descr *bd, struct ia_css_blob_descr *bd,
unsigned int index) { unsigned int index) {
@ -106,7 +106,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
const unsigned char *blob; const unsigned char *blob;
if ((!fw) || (!bd)) if ((!fw) || (!bd))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
/* Special case: only one binary in fw */ /* Special case: only one binary in fw */
if (!bi) bi = (const struct ia_css_fw_info *)fw; if (!bi) bi = (const struct ia_css_fw_info *)fw;
@ -118,11 +118,11 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
if (bi->blob.size != bi->blob.text_size + bi->blob.icache_size + bi->blob.data_size + bi->blob.padding_size) if (bi->blob.size != bi->blob.text_size + bi->blob.icache_size + bi->blob.data_size + bi->blob.padding_size)
{ {
/* sanity check, note the padding bytes added for section to DDR alignment */ /* sanity check, note the padding bytes added for section to DDR alignment */
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
if ((bi->blob.offset % (1UL << (ISP_PMEM_WIDTH_LOG2 - 3))) != 0) if ((bi->blob.offset % (1UL << (ISP_PMEM_WIDTH_LOG2 - 3))) != 0)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
bd->blob = blob; bd->blob = blob;
bd->header = *bi; bd->header = *bi;
@ -133,7 +133,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
namebuffer = kstrdup(name, GFP_KERNEL); namebuffer = kstrdup(name, GFP_KERNEL);
if (!namebuffer) if (!namebuffer)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
bd->name = fw_minibuffer[index].name = namebuffer; bd->name = fw_minibuffer[index].name = namebuffer;
} else } else
{ {
@ -150,7 +150,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
statestruct_size, statestruct_size,
GFP_KERNEL); GFP_KERNEL);
if (!parambuf) if (!parambuf)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
bd->mem_offsets.array[IA_CSS_PARAM_CLASS_PARAM].ptr = NULL; bd->mem_offsets.array[IA_CSS_PARAM_CLASS_PARAM].ptr = NULL;
bd->mem_offsets.array[IA_CSS_PARAM_CLASS_CONFIG].ptr = NULL; bd->mem_offsets.array[IA_CSS_PARAM_CLASS_CONFIG].ptr = NULL;
@ -178,7 +178,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
bd->mem_offsets.array[IA_CSS_PARAM_CLASS_STATE].ptr = parambuf + bd->mem_offsets.array[IA_CSS_PARAM_CLASS_STATE].ptr = parambuf +
paramstruct_size + configstruct_size; paramstruct_size + configstruct_size;
} }
return IA_CSS_SUCCESS; return 0;
} }
bool bool
@ -206,7 +206,7 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data)
return 0; return 0;
} }
enum ia_css_err int
sh_css_load_firmware(struct device *dev, const char *fw_data, sh_css_load_firmware(struct device *dev, const char *fw_data,
unsigned int fw_size) { unsigned int fw_size) {
unsigned int i; unsigned int i;
@ -228,17 +228,17 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
if (ret) { if (ret) {
IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!", IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!",
file_header->version, release_version); file_header->version, release_version);
return IA_CSS_ERR_VERSION_MISMATCH; return -EINVAL;
} else { } else {
IA_CSS_LOG("successfully load firmware version %s", release_version); IA_CSS_LOG("successfully load firmware version %s", release_version);
} }
/* some sanity checks */ /* some sanity checks */
if (!fw_data || fw_size < sizeof(struct sh_css_fw_bi_file_h)) if (!fw_data || fw_size < sizeof(struct sh_css_fw_bi_file_h))
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (file_header->h_size != sizeof(struct sh_css_fw_bi_file_h)) if (file_header->h_size != sizeof(struct sh_css_fw_bi_file_h))
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
sh_css_num_binaries = file_header->binary_nr; sh_css_num_binaries = file_header->binary_nr;
/* Only allocate memory for ISP blob info */ /* Only allocate memory for ISP blob info */
@ -248,7 +248,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
(sh_css_num_binaries - NUM_OF_SPS) * (sh_css_num_binaries - NUM_OF_SPS) *
sizeof(*sh_css_blob_info), GFP_KERNEL); sizeof(*sh_css_blob_info), GFP_KERNEL);
if (!sh_css_blob_info) if (!sh_css_blob_info)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} else { } else {
sh_css_blob_info = NULL; sh_css_blob_info = NULL;
} }
@ -256,7 +256,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param), fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param),
GFP_KERNEL); GFP_KERNEL);
if (!fw_minibuffer) if (!fw_minibuffer)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
for (i = 0; i < sh_css_num_binaries; i++) for (i = 0; i < sh_css_num_binaries; i++)
{ {
@ -266,36 +266,36 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
cause issues for drivers cause issues for drivers
*/ */
static struct ia_css_blob_descr bd; static struct ia_css_blob_descr bd;
enum ia_css_err err; int err;
err = sh_css_load_blob_info(fw_data, bi, &bd, i); err = sh_css_load_blob_info(fw_data, bi, &bd, i);
if (err != IA_CSS_SUCCESS) if (err)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (bi->blob.offset + bi->blob.size > fw_size) if (bi->blob.offset + bi->blob.size > fw_size)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (bi->type == ia_css_sp_firmware) { if (bi->type == ia_css_sp_firmware) {
if (i != SP_FIRMWARE) if (i != SP_FIRMWARE)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
err = setup_binary(bi, fw_data, &sh_css_sp_fw, i); err = setup_binary(bi, fw_data, &sh_css_sp_fw, i);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} else { } else {
/* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS) are ISP firmware */ /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS) are ISP firmware */
if (i < NUM_OF_SPS) if (i < NUM_OF_SPS)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (bi->type != ia_css_isp_firmware) if (bi->type != ia_css_isp_firmware)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (!sh_css_blob_info) /* cannot happen but KW does not see this */ if (!sh_css_blob_info) /* cannot happen but KW does not see this */
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
sh_css_blob_info[i - NUM_OF_SPS] = bd; sh_css_blob_info[i - NUM_OF_SPS] = bd;
} }
} }
return IA_CSS_SUCCESS; return 0;
} }
void sh_css_unload_firmware(void) void sh_css_unload_firmware(void)

Просмотреть файл

@ -40,7 +40,7 @@ char
bool bool
sh_css_check_firmware_version(struct device *dev, const char *fw_data); sh_css_check_firmware_version(struct device *dev, const char *fw_data);
enum ia_css_err int
sh_css_load_firmware(struct device *dev, const char *fw_data, sh_css_load_firmware(struct device *dev, const char *fw_data,
unsigned int fw_size); unsigned int fw_size);
@ -48,7 +48,7 @@ void sh_css_unload_firmware(void);
ia_css_ptr sh_css_load_blob(const unsigned char *blob, unsigned int size); ia_css_ptr sh_css_load_blob(const unsigned char *blob, unsigned int size);
enum ia_css_err int
sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
struct ia_css_blob_descr *bd, unsigned int i); struct ia_css_blob_descr *bd, unsigned int i);

Просмотреть файл

@ -61,7 +61,7 @@ bool sh_css_hrt_system_is_idle(void)
return !not_idle; return !not_idle;
} }
enum ia_css_err sh_css_hrt_sp_wait(void) int sh_css_hrt_sp_wait(void)
{ {
#if defined(HAS_IRQ_MAP_VERSION_2) #if defined(HAS_IRQ_MAP_VERSION_2)
irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID; irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID;
@ -81,5 +81,5 @@ enum ia_css_err sh_css_hrt_sp_wait(void)
hrt_sleep(); hrt_sleep();
} }
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -27,7 +27,7 @@ void sh_css_hrt_sp_start_copy_frame(void);
void sh_css_hrt_sp_start_isp(void); void sh_css_hrt_sp_start_isp(void);
enum ia_css_err sh_css_hrt_sp_wait(void); int sh_css_hrt_sp_wait(void);
bool sh_css_hrt_system_is_idle(void); bool sh_css_hrt_system_is_idle(void);

Просмотреть файл

@ -962,7 +962,7 @@ sh_css_vprint(const char *fmt, va_list args)
*/ */
ia_css_ptr sh_css_params_ddr_address_map(void); ia_css_ptr sh_css_params_ddr_address_map(void);
enum ia_css_err int
sh_css_params_init(void); sh_css_params_init(void);
void void

Просмотреть файл

@ -45,7 +45,7 @@ struct ia_css_pipe_extra_config {
bool disable_vf_pp; bool disable_vf_pp;
}; };
enum ia_css_err int
ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,
const struct ia_css_pipe_extra_config *extra_config, const struct ia_css_pipe_extra_config *extra_config,
struct ia_css_pipe **pipe); struct ia_css_pipe **pipe);
@ -54,12 +54,12 @@ void
ia_css_pipe_extra_config_defaults(struct ia_css_pipe_extra_config ia_css_pipe_extra_config_defaults(struct ia_css_pipe_extra_config
*extra_config); *extra_config);
enum ia_css_err int
ia_css_temp_pipe_to_pipe_id(const struct ia_css_pipe *pipe, ia_css_temp_pipe_to_pipe_id(const struct ia_css_pipe *pipe,
enum ia_css_pipe_id *pipe_id); enum ia_css_pipe_id *pipe_id);
/* DEPRECATED. FPN is not supported. */ /* DEPRECATED. FPN is not supported. */
enum ia_css_err int
sh_css_set_black_frame(struct ia_css_stream *stream, sh_css_set_black_frame(struct ia_css_stream *stream,
const struct ia_css_frame *raw_black_frame); const struct ia_css_frame *raw_black_frame);

Просмотреть файл

@ -34,10 +34,10 @@ static u32
ref_count_mipi_allocation[N_CSI_PORTS]; /* Initialized in mipi_init */ ref_count_mipi_allocation[N_CSI_PORTS]; /* Initialized in mipi_init */
#endif #endif
enum ia_css_err int
ia_css_mipi_frame_specify(const unsigned int size_mem_words, ia_css_mipi_frame_specify(const unsigned int size_mem_words,
const bool contiguous) { const bool contiguous) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
my_css.size_mem_words = size_mem_words; my_css.size_mem_words = size_mem_words;
(void)contiguous; (void)contiguous;
@ -97,14 +97,14 @@ static bool ia_css_mipi_is_source_port_valid(struct ia_css_pipe *pipe,
* etc.). * etc.).
* Result is given in DDR mem words, 32B or 256 bits * Result is given in DDR mem words, 32B or 256 bits
*/ */
enum ia_css_err int
ia_css_mipi_frame_calculate_size(const unsigned int width, ia_css_mipi_frame_calculate_size(const unsigned int width,
const unsigned int height, const unsigned int height,
const enum atomisp_input_format format, const enum atomisp_input_format format,
const bool hasSOLandEOL, const bool hasSOLandEOL,
const unsigned int embedded_data_size_words, const unsigned int embedded_data_size_words,
unsigned int *size_mem_words) { unsigned int *size_mem_words) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
unsigned int bits_per_pixel = 0; unsigned int bits_per_pixel = 0;
unsigned int even_line_bytes = 0; unsigned int even_line_bytes = 0;
@ -182,7 +182,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
case ATOMISP_INPUT_FORMAT_YUV422_16: /* Not supported */ case ATOMISP_INPUT_FORMAT_YUV422_16: /* Not supported */
case ATOMISP_INPUT_FORMAT_RAW_16: /* TODO: not specified in MIPI SPEC, check */ case ATOMISP_INPUT_FORMAT_RAW_16: /* TODO: not specified in MIPI SPEC, check */
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */
@ -246,12 +246,12 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
} }
#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) #if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
enum ia_css_err int
ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
const unsigned int size_mem_words) { const unsigned int size_mem_words) {
u32 idx; u32 idx;
enum ia_css_err err = IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; int err = -EBUSY;
OP___assert(port < N_CSI_PORTS); OP___assert(port < N_CSI_PORTS);
OP___assert(size_mem_words != 0); OP___assert(size_mem_words != 0);
@ -264,7 +264,7 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
if (idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT) if (idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT)
{ {
my_css.mipi_sizes_for_check[port][idx] = size_mem_words; my_css.mipi_sizes_for_check[port][idx] = size_mem_words;
err = IA_CSS_SUCCESS; err = 0;
} }
return err; return err;
@ -282,12 +282,12 @@ mipi_init(void)
#endif #endif
} }
enum ia_css_err int
calculate_mipi_buff_size( calculate_mipi_buff_size(
struct ia_css_stream_config *stream_cfg, struct ia_css_stream_config *stream_cfg,
unsigned int *size_mem_words) { unsigned int *size_mem_words) {
#if !defined(USE_INPUT_SYSTEM_VERSION_2401) #if !defined(USE_INPUT_SYSTEM_VERSION_2401)
enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR; int err = -EINVAL;
(void)stream_cfg; (void)stream_cfg;
(void)size_mem_words; (void)size_mem_words;
#else #else
@ -310,7 +310,7 @@ calculate_mipi_buff_size(
unsigned int mem_words_per_buff_line = 0; unsigned int mem_words_per_buff_line = 0;
unsigned int mem_words_per_buff = 0; unsigned int mem_words_per_buff = 0;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
/** /**
* zhengjie.lu@intel.com * zhengjie.lu@intel.com
@ -354,7 +354,7 @@ calculate_mipi_buff_size(
bits_per_pixel = bits_per_pixel =
(format == ATOMISP_INPUT_FORMAT_RAW_10 && pack_raw_pixels) ? bits_per_pixel : 16; (format == ATOMISP_INPUT_FORMAT_RAW_10 && pack_raw_pixels) ? bits_per_pixel : 16;
if (bits_per_pixel == 0) if (bits_per_pixel == 0)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */
@ -405,11 +405,11 @@ static bool buffers_needed(struct ia_css_pipe *pipe)
return true; return true;
} }
enum ia_css_err int
allocate_mipi_frames(struct ia_css_pipe *pipe, allocate_mipi_frames(struct ia_css_pipe *pipe,
struct ia_css_stream_info *info) { struct ia_css_stream_info *info) {
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR; int err = -EINVAL;
unsigned int port; unsigned int port;
struct ia_css_frame_info mipi_intermediate_info; struct ia_css_frame_info mipi_intermediate_info;
@ -423,7 +423,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: pipe or stream is null.\n", "allocate_mipi_frames(%p) exit: pipe or stream is null.\n",
pipe); pipe);
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
#ifdef USE_INPUT_SYSTEM_VERSION_2401 #ifdef USE_INPUT_SYSTEM_VERSION_2401
@ -432,7 +432,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: no buffers needed for 2401 pipe mode.\n", "allocate_mipi_frames(%p) exit: no buffers needed for 2401 pipe mode.\n",
pipe); pipe);
return IA_CSS_SUCCESS; return 0;
} }
#endif #endif
@ -441,7 +441,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: no buffers needed for pipe mode.\n", "allocate_mipi_frames(%p) exit: no buffers needed for pipe mode.\n",
pipe); pipe);
return IA_CSS_SUCCESS; /* AM TODO: Check */ return 0; /* AM TODO: Check */
} }
if (!atomisp_hw_is_isp2401) if (!atomisp_hw_is_isp2401)
@ -455,7 +455,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n", "allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n",
pipe, port); pipe, port);
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
#ifdef USE_INPUT_SYSTEM_VERSION_2401 #ifdef USE_INPUT_SYSTEM_VERSION_2401
@ -470,7 +470,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n", "allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n",
pipe, port); pipe, port);
return IA_CSS_SUCCESS; return 0;
} }
#else #else
/* 2401 system allows multiple streams to use same physical port. This is not /* 2401 system allows multiple streams to use same physical port. This is not
@ -484,7 +484,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n", "allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n",
pipe, port); pipe, port);
return IA_CSS_SUCCESS; return 0;
} }
#endif #endif
@ -522,7 +522,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
&my_css.mipi_frames[port][i], &my_css.mipi_frames[port][i],
my_css.mipi_frame_size[port] * HIVE_ISP_DDR_WORD_BYTES, my_css.mipi_frame_size[port] * HIVE_ISP_DDR_WORD_BYTES,
false); false);
if (err != IA_CSS_SUCCESS) { if (err) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (my_css.mipi_frames[port][j]) { if (my_css.mipi_frames[port][j]) {
ia_css_frame_free(my_css.mipi_frames[port][j]); ia_css_frame_free(my_css.mipi_frames[port][j]);
@ -562,14 +562,14 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
#else #else
(void)pipe; (void)pipe;
(void)info; (void)info;
return IA_CSS_SUCCESS; return 0;
#endif #endif
} }
enum ia_css_err int
free_mipi_frames(struct ia_css_pipe *pipe) { free_mipi_frames(struct ia_css_pipe *pipe) {
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR; int err = -EINVAL;
unsigned int port; unsigned int port;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
@ -583,7 +583,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"free_mipi_frames(%p) exit: error: pipe or stream is null.\n", "free_mipi_frames(%p) exit: error: pipe or stream is null.\n",
pipe); pipe);
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
if (!buffers_needed(pipe)) { if (!buffers_needed(pipe)) {
@ -677,13 +677,13 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
#else #else
(void)pipe; (void)pipe;
#endif #endif
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err int
send_mipi_frames(struct ia_css_pipe *pipe) { send_mipi_frames(struct ia_css_pipe *pipe) {
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR; int err = -EINVAL;
unsigned int i; unsigned int i;
#ifndef ISP2401 #ifndef ISP2401
unsigned int port; unsigned int port;
@ -698,14 +698,14 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
if (!pipe || !pipe->stream) if (!pipe || !pipe->stream)
{ {
IA_CSS_ERROR("pipe or stream is null"); IA_CSS_ERROR("pipe or stream is null");
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
/* multi stream video needs mipi buffers */ /* multi stream video needs mipi buffers */
/* nothing to be done in other cases. */ /* nothing to be done in other cases. */
if (!buffers_needed(pipe)) { if (!buffers_needed(pipe)) {
IA_CSS_LOG("nothing to be done for this mode"); IA_CSS_LOG("nothing to be done for this mode");
return IA_CSS_SUCCESS; return 0;
/* TODO: AM: maybe this should be returning an error. */ /* TODO: AM: maybe this should be returning an error. */
} }
@ -749,9 +749,9 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
(uint8_t)port, (uint8_t)port,
(uint8_t)my_css.num_mipi_frames[port], (uint8_t)my_css.num_mipi_frames[port],
0 /* not used */); 0 /* not used */);
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
#else #else
(void)pipe; (void)pipe;
#endif #endif
return IA_CSS_SUCCESS; return 0;
} }

Просмотреть файл

@ -22,13 +22,13 @@
void void
mipi_init(void); mipi_init(void);
enum ia_css_err int
allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info); allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info);
enum ia_css_err int
free_mipi_frames(struct ia_css_pipe *pipe); free_mipi_frames(struct ia_css_pipe *pipe);
enum ia_css_err int
send_mipi_frames(struct ia_css_pipe *pipe); send_mipi_frames(struct ia_css_pipe *pipe);
/** /**
@ -41,7 +41,7 @@ send_mipi_frames(struct ia_css_pipe *pipe);
* *
* @return * @return
*/ */
enum ia_css_err int
calculate_mipi_buff_size( calculate_mipi_buff_size(
struct ia_css_stream_config *stream_cfg, struct ia_css_stream_config *stream_cfg,
unsigned int *size_mem_words); unsigned int *size_mem_words);

Просмотреть файл

@ -27,14 +27,14 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
unsigned int height_y = 0; unsigned int height_y = 0;
unsigned int width_uv = 0; unsigned int width_uv = 0;
unsigned int height_uv = 0; unsigned int height_uv = 0;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_dvs_6axis_config *dvs_config = NULL; struct ia_css_dvs_6axis_config *dvs_config = NULL;
dvs_config = kvmalloc(sizeof(struct ia_css_dvs_6axis_config), dvs_config = kvmalloc(sizeof(struct ia_css_dvs_6axis_config),
GFP_KERNEL); GFP_KERNEL);
if (!dvs_config) { if (!dvs_config) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
} else { } else {
/*Initialize new struct with latest config settings*/ /*Initialize new struct with latest config settings*/
if (dvs_config_src) { if (dvs_config_src) {
@ -61,7 +61,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
GFP_KERNEL); GFP_KERNEL);
if (!dvs_config->xcoords_y) { if (!dvs_config->xcoords_y) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto exit; goto exit;
} }
@ -69,7 +69,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
GFP_KERNEL); GFP_KERNEL);
if (!dvs_config->ycoords_y) { if (!dvs_config->ycoords_y) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto exit; goto exit;
} }
@ -80,7 +80,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
GFP_KERNEL); GFP_KERNEL);
if (!dvs_config->xcoords_uv) { if (!dvs_config->xcoords_uv) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
goto exit; goto exit;
} }
@ -88,10 +88,10 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
GFP_KERNEL); GFP_KERNEL);
if (!dvs_config->ycoords_uv) { if (!dvs_config->ycoords_uv) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
} }
exit: exit:
if (err != IA_CSS_SUCCESS) { if (err) {
free_dvs_6axis_table( free_dvs_6axis_table(
&dvs_config); /* we might have allocated some memory, release this */ &dvs_config); /* we might have allocated some memory, release this */
dvs_config = NULL; dvs_config = NULL;

Просмотреть файл

@ -1227,20 +1227,20 @@ struct ia_css_isp_skc_dvs_statistics {
ia_css_ptr p_data; ia_css_ptr p_data;
}; };
static enum ia_css_err static int
ref_sh_css_ddr_address_map( ref_sh_css_ddr_address_map(
struct sh_css_ddr_address_map *map, struct sh_css_ddr_address_map *map,
struct sh_css_ddr_address_map *out); struct sh_css_ddr_address_map *out);
static enum ia_css_err static int
write_ia_css_isp_parameter_set_info_to_ddr( write_ia_css_isp_parameter_set_info_to_ddr(
struct ia_css_isp_parameter_set_info *me, struct ia_css_isp_parameter_set_info *me,
ia_css_ptr *out); ia_css_ptr *out);
static enum ia_css_err static int
free_ia_css_isp_parameter_set_info(ia_css_ptr ptr); free_ia_css_isp_parameter_set_info(ia_css_ptr ptr);
static enum ia_css_err static int
sh_css_params_write_to_ddr_internal( sh_css_params_write_to_ddr_internal(
struct ia_css_pipe *pipe, struct ia_css_pipe *pipe,
unsigned int pipe_id, unsigned int pipe_id,
@ -1249,7 +1249,7 @@ sh_css_params_write_to_ddr_internal(
struct sh_css_ddr_address_map *ddr_map, struct sh_css_ddr_address_map *ddr_map,
struct sh_css_ddr_address_map_size *ddr_map_size); struct sh_css_ddr_address_map_size *ddr_map_size);
static enum ia_css_err static int
sh_css_create_isp_params(struct ia_css_stream *stream, sh_css_create_isp_params(struct ia_css_stream *stream,
struct ia_css_isp_parameters **isp_params_out); struct ia_css_isp_parameters **isp_params_out);
@ -1259,27 +1259,27 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
bool use_default_config, bool use_default_config,
struct ia_css_pipe *pipe_in); struct ia_css_pipe *pipe_in);
static enum ia_css_err static int
sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe, sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params, struct ia_css_isp_parameters *params,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe_in); struct ia_css_pipe *pipe_in);
static enum ia_css_err static int
sh_css_set_global_isp_config_on_pipe( sh_css_set_global_isp_config_on_pipe(
struct ia_css_pipe *curr_pipe, struct ia_css_pipe *curr_pipe,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe); struct ia_css_pipe *pipe);
#if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS) #if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS)
static enum ia_css_err static int
sh_css_set_per_frame_isp_config_on_pipe( sh_css_set_per_frame_isp_config_on_pipe(
struct ia_css_stream *stream, struct ia_css_stream *stream,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe); struct ia_css_pipe *pipe);
#endif #endif
static enum ia_css_err static int
sh_css_update_uds_and_crop_info_based_on_zoom_region( sh_css_update_uds_and_crop_info_based_on_zoom_region(
const struct ia_css_binary_info *info, const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info, const struct ia_css_frame_info *in_frame_info,
@ -1349,7 +1349,7 @@ convert_allocate_fpntbl(struct ia_css_isp_parameters *params)
return me; return me;
} }
static enum ia_css_err static int
store_fpntbl(struct ia_css_isp_parameters *params, ia_css_ptr ptr) { store_fpntbl(struct ia_css_isp_parameters *params, ia_css_ptr ptr) {
struct ia_css_host_data *isp_data; struct ia_css_host_data *isp_data;
@ -1359,13 +1359,13 @@ store_fpntbl(struct ia_css_isp_parameters *params, ia_css_ptr ptr) {
isp_data = convert_allocate_fpntbl(params); isp_data = convert_allocate_fpntbl(params);
if (!isp_data) if (!isp_data)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
ia_css_params_store_ia_css_host_data(ptr, isp_data); ia_css_params_store_ia_css_host_data(ptr, isp_data);
ia_css_host_data_free(isp_data); ia_css_host_data_free(isp_data);
return IA_CSS_SUCCESS; return 0;
} }
static void static void
@ -1429,10 +1429,10 @@ ia_css_process_kernel(struct ia_css_stream *stream,
} }
} }
static enum ia_css_err static int
sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe, sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe,
bool *is_dp_10bpp) { bool *is_dp_10bpp) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
/* Currently we check if 10bpp DPC configuration is required based /* Currently we check if 10bpp DPC configuration is required based
* on the use case,i.e. if BDS and DPC is both enabled. The more cleaner * on the use case,i.e. if BDS and DPC is both enabled. The more cleaner
* design choice would be to expose the type of DPC (either 10bpp or 13bpp) * design choice would be to expose the type of DPC (either 10bpp or 13bpp)
@ -1442,8 +1442,8 @@ sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe,
*/ */
if ((!pipe) || (!is_dp_10bpp)) if ((!pipe) || (!is_dp_10bpp))
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR); IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL);
err = IA_CSS_ERR_INTERNAL_ERROR; err = -EINVAL;
} else } else
{ {
*is_dp_10bpp = false; *is_dp_10bpp = false;
@ -1455,7 +1455,7 @@ sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe,
if ((pipe->config.bayer_ds_out_res.width != 0) && if ((pipe->config.bayer_ds_out_res.width != 0) &&
(pipe->config.bayer_ds_out_res.height != 0)) { (pipe->config.bayer_ds_out_res.height != 0)) {
if (IA_CSS_SUCCESS == binarydesc_calculate_bds_factor( if (0 == binarydesc_calculate_bds_factor(
pipe->config.input_effective_res, pipe->config.input_effective_res,
pipe->config.bayer_ds_out_res, pipe->config.bayer_ds_out_res,
&required_bds_factor)) { &required_bds_factor)) {
@ -1471,7 +1471,7 @@ sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe,
return err; return err;
} }
enum ia_css_err int
sh_css_set_black_frame(struct ia_css_stream *stream, sh_css_set_black_frame(struct ia_css_stream *stream,
const struct ia_css_frame *raw_black_frame) { const struct ia_css_frame *raw_black_frame) {
struct ia_css_isp_parameters *params; struct ia_css_isp_parameters *params;
@ -1505,8 +1505,8 @@ sh_css_set_black_frame(struct ia_css_stream *stream,
sizeof(short), GFP_KERNEL); sizeof(short), GFP_KERNEL);
if (!params->fpn_config.data) { if (!params->fpn_config.data) {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
params->fpn_config.width = width; params->fpn_config.width = width;
params->fpn_config.height = height; params->fpn_config.height = height;
@ -1544,9 +1544,9 @@ sh_css_set_black_frame(struct ia_css_stream *stream,
/* overwrite isp parameter */ /* overwrite isp parameter */
ia_css_process_kernel(stream, params, ia_css_kernel_process_param[IA_CSS_FPN_ID]); ia_css_process_kernel(stream, params, ia_css_kernel_process_param[IA_CSS_FPN_ID]);
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
bool bool
@ -1675,7 +1675,7 @@ ia_css_params_alloc_convert_sctbl(
return sctbl; return sctbl;
} }
enum ia_css_err ia_css_params_store_sctbl( int ia_css_params_store_sctbl(
const struct ia_css_pipeline_stage *stage, const struct ia_css_pipeline_stage *stage,
ia_css_ptr sc_tbl, ia_css_ptr sc_tbl,
const struct ia_css_shading_table *sc_config) const struct ia_css_shading_table *sc_config)
@ -1686,13 +1686,13 @@ enum ia_css_err ia_css_params_store_sctbl(
if (!sc_config) { if (!sc_config) {
IA_CSS_LEAVE_PRIVATE("void"); IA_CSS_LEAVE_PRIVATE("void");
return IA_CSS_SUCCESS; return 0;
} }
isp_sc_tbl = ia_css_params_alloc_convert_sctbl(stage, sc_config); isp_sc_tbl = ia_css_params_alloc_convert_sctbl(stage, sc_config);
if (!isp_sc_tbl) { if (!isp_sc_tbl) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
/* store the shading table to ddr */ /* store the shading table to ddr */
ia_css_params_store_ia_css_host_data(sc_tbl, isp_sc_tbl); ia_css_params_store_ia_css_host_data(sc_tbl, isp_sc_tbl);
@ -1700,7 +1700,7 @@ enum ia_css_err ia_css_params_store_sctbl(
IA_CSS_LEAVE_PRIVATE("void"); IA_CSS_LEAVE_PRIVATE("void");
return IA_CSS_SUCCESS; return 0;
} }
static void static void
@ -1716,13 +1716,13 @@ sh_css_enable_pipeline(const struct ia_css_binary *binary)
IA_CSS_LEAVE_PRIVATE("void"); IA_CSS_LEAVE_PRIVATE("void");
} }
static enum ia_css_err static int
ia_css_process_zoom_and_motion( ia_css_process_zoom_and_motion(
struct ia_css_isp_parameters *params, struct ia_css_isp_parameters *params,
const struct ia_css_pipeline_stage *first_stage) { const struct ia_css_pipeline_stage *first_stage) {
/* first_stage can be NULL */ /* first_stage can be NULL */
const struct ia_css_pipeline_stage *stage; const struct ia_css_pipeline_stage *stage;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_resolution pipe_in_res; struct ia_css_resolution pipe_in_res;
pipe_in_res.width = 0; pipe_in_res.width = 0;
@ -1798,7 +1798,7 @@ ia_css_process_zoom_and_motion(
&params->uds[stage->stage_num].crop_pos, &params->uds[stage->stage_num].crop_pos,
pipe_in_res, pipe_in_res,
stage->enable_zoom); stage->enable_zoom);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} }
} }
@ -1965,7 +1965,7 @@ struct ia_css_morph_table *ia_css_morph_table_allocate(
return me; return me;
} }
static enum ia_css_err sh_css_params_default_morph_table( static int sh_css_params_default_morph_table(
struct ia_css_morph_table **table, struct ia_css_morph_table **table,
const struct ia_css_binary *binary) const struct ia_css_binary *binary)
{ {
@ -1986,7 +1986,7 @@ static enum ia_css_err sh_css_params_default_morph_table(
tab = ia_css_morph_table_allocate(width, height); tab = ia_css_morph_table_allocate(width, height);
if (!tab) if (!tab)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) { for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
short val_y = start_y[i]; short val_y = start_y[i];
@ -2015,9 +2015,9 @@ static enum ia_css_err sh_css_params_default_morph_table(
} }
*table = tab; *table = tab;
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
static void static void
@ -2118,11 +2118,11 @@ err:
return NULL; return NULL;
} }
enum ia_css_err int
ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats, ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats,
const struct ia_css_isp_3a_statistics *isp_stats) { const struct ia_css_isp_3a_statistics *isp_stats) {
struct ia_css_isp_3a_statistics_map *map; struct ia_css_isp_3a_statistics_map *map;
enum ia_css_err ret = IA_CSS_SUCCESS; int ret = 0;
IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats); IA_CSS_ENTER("host_stats=%p, isp_stats=%p", host_stats, isp_stats);
@ -2138,7 +2138,7 @@ ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats,
} else } else
{ {
IA_CSS_ERROR("out of memory"); IA_CSS_ERROR("out of memory");
ret = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; ret = -ENOMEM;
} }
IA_CSS_LEAVE_ERR(ret); IA_CSS_LEAVE_ERR(ret);
@ -2430,22 +2430,22 @@ sh_css_pipe_isp_config_get(struct ia_css_pipe *pipe)
return pipe->config.p_isp_config; return pipe->config.p_isp_config;
} }
enum ia_css_err int
ia_css_stream_set_isp_config( ia_css_stream_set_isp_config(
struct ia_css_stream *stream, struct ia_css_stream *stream,
const struct ia_css_isp_config *config) { const struct ia_css_isp_config *config) {
return ia_css_stream_set_isp_config_on_pipe(stream, config, NULL); return ia_css_stream_set_isp_config_on_pipe(stream, config, NULL);
} }
enum ia_css_err int
ia_css_stream_set_isp_config_on_pipe( ia_css_stream_set_isp_config_on_pipe(
struct ia_css_stream *stream, struct ia_css_stream *stream,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe) { struct ia_css_pipe *pipe) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
if ((!stream) || (!config)) if ((!stream) || (!config))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
IA_CSS_ENTER("stream=%p, config=%p, pipe=%p", stream, config, pipe); IA_CSS_ENTER("stream=%p, config=%p, pipe=%p", stream, config, pipe);
@ -2460,16 +2460,16 @@ ia_css_stream_set_isp_config_on_pipe(
return err; return err;
} }
enum ia_css_err int
ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe, ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
struct ia_css_isp_config *config) { struct ia_css_isp_config *config) {
struct ia_css_pipe *pipe_in = pipe; struct ia_css_pipe *pipe_in = pipe;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
IA_CSS_ENTER("pipe=%p", pipe); IA_CSS_ENTER("pipe=%p", pipe);
if ((!pipe) || (!pipe->stream)) if ((!pipe) || (!pipe->stream))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "config=%p\n", config); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "config=%p\n", config);
@ -2483,14 +2483,14 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
return err; return err;
} }
static enum ia_css_err static int
sh_css_set_global_isp_config_on_pipe( sh_css_set_global_isp_config_on_pipe(
struct ia_css_pipe *curr_pipe, struct ia_css_pipe *curr_pipe,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe) { struct ia_css_pipe *pipe) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
enum ia_css_err err1 = IA_CSS_SUCCESS; int err1 = 0;
enum ia_css_err err2 = IA_CSS_SUCCESS; int err2 = 0;
IA_CSS_ENTER_PRIVATE("stream=%p, config=%p, pipe=%p", curr_pipe, config, pipe); IA_CSS_ENTER_PRIVATE("stream=%p, config=%p, pipe=%p", curr_pipe, config, pipe);
@ -2505,24 +2505,24 @@ sh_css_set_global_isp_config_on_pipe(
* but instead continue with updating the ISP params to enable testing of features * but instead continue with updating the ISP params to enable testing of features
* which are currently in TR phase. */ * which are currently in TR phase. */
err = (err1 != IA_CSS_SUCCESS) ? err1 : ((err2 != IA_CSS_SUCCESS) ? err2 : err); err = (err1 != 0) ? err1 : ((err2 != 0) ? err2 : err);
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
#if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS) #if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS)
static enum ia_css_err static int
sh_css_set_per_frame_isp_config_on_pipe( sh_css_set_per_frame_isp_config_on_pipe(
struct ia_css_stream *stream, struct ia_css_stream *stream,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe) { struct ia_css_pipe *pipe) {
unsigned int i; unsigned int i;
bool per_frame_config_created = false; bool per_frame_config_created = false;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
enum ia_css_err err1 = IA_CSS_SUCCESS; int err1 = 0;
enum ia_css_err err2 = IA_CSS_SUCCESS; int err2 = 0;
enum ia_css_err err3 = IA_CSS_SUCCESS; int err3 = 0;
struct sh_css_ddr_address_map *ddr_ptrs; struct sh_css_ddr_address_map *ddr_ptrs;
struct sh_css_ddr_address_map_size *ddr_ptrs_size; struct sh_css_ddr_address_map_size *ddr_ptrs_size;
@ -2532,7 +2532,7 @@ sh_css_set_per_frame_isp_config_on_pipe(
if (!pipe) if (!pipe)
{ {
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
goto exit; goto exit;
} }
@ -2543,7 +2543,7 @@ sh_css_set_per_frame_isp_config_on_pipe(
{ {
err = sh_css_create_isp_params(stream, err = sh_css_create_isp_params(stream,
&stream->per_frame_isp_params_configs); &stream->per_frame_isp_params_configs);
if (err != IA_CSS_SUCCESS) if (err)
goto exit; goto exit;
per_frame_config_created = true; per_frame_config_created = true;
} }
@ -2553,7 +2553,7 @@ sh_css_set_per_frame_isp_config_on_pipe(
/* update new ISP params object with the new config */ /* update new ISP params object with the new config */
if (!sh_css_init_isp_params_from_global(stream, params, false, pipe)) if (!sh_css_init_isp_params_from_global(stream, params, false, pipe))
{ {
err1 = IA_CSS_ERR_INVALID_ARGUMENTS; err1 = -EINVAL;
} }
err2 = sh_css_init_isp_params_from_config(stream->pipes[0], params, config, pipe); err2 = sh_css_init_isp_params_from_config(stream->pipes[0], params, config, pipe);
@ -2577,21 +2577,21 @@ sh_css_set_per_frame_isp_config_on_pipe(
* The CSS API must pass this error information to the caller, ie. the host. * The CSS API must pass this error information to the caller, ie. the host.
* We do not return this error immediately, but instead continue with updating the ISP params * We do not return this error immediately, but instead continue with updating the ISP params
* to enable testing of features which are currently in TR phase. */ * to enable testing of features which are currently in TR phase. */
err = (err1 != IA_CSS_SUCCESS) ? err1 : err = (err1 != 0) ? err1 :
(err2 != IA_CSS_SUCCESS) ? err2 : (err2 != 0) ? err2 :
(err3 != IA_CSS_SUCCESS) ? err3 : err; (err3 != 0) ? err3 : err;
exit: exit:
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
#endif #endif
static enum ia_css_err static int
sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe, sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params, struct ia_css_isp_parameters *params,
const struct ia_css_isp_config *config, const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe_in) { struct ia_css_pipe *pipe_in) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
bool is_dp_10bpp = true; bool is_dp_10bpp = true;
assert(pipe); assert(pipe);
@ -2634,7 +2634,7 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
ia_css_set_param_exceptions(pipe, params); ia_css_set_param_exceptions(pipe, params);
} }
if (IA_CSS_SUCCESS == if (0 ==
sh_css_select_dp_10bpp_config(pipe, &is_dp_10bpp)) sh_css_select_dp_10bpp_config(pipe, &is_dp_10bpp))
{ {
/* return an error when both DPC and BDS is enabled by the /* return an error when both DPC and BDS is enabled by the
@ -2642,11 +2642,11 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
/* we do not exit from this point immediately to allow internal /* we do not exit from this point immediately to allow internal
* firmware feature testing. */ * firmware feature testing. */
if (is_dp_10bpp) { if (is_dp_10bpp) {
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
} }
} else } else
{ {
err = IA_CSS_ERR_INTERNAL_ERROR; err = -EINVAL;
goto exit; goto exit;
} }
@ -2712,12 +2712,12 @@ static bool realloc_isp_css_mm_buf(
size_t *curr_size, size_t *curr_size,
size_t needed_size, size_t needed_size,
bool force, bool force,
enum ia_css_err *err, int *err,
uint16_t mmgr_attribute) uint16_t mmgr_attribute)
{ {
s32 id; s32 id;
*err = IA_CSS_SUCCESS; *err = 0;
/* Possible optimization: add a function sh_css_isp_css_mm_realloc() /* Possible optimization: add a function sh_css_isp_css_mm_realloc()
* and implement on top of hmm. */ * and implement on top of hmm. */
@ -2741,7 +2741,7 @@ static bool realloc_isp_css_mm_buf(
mmgr_attribute)); mmgr_attribute));
if (!*curr_buf) { if (!*curr_buf) {
*err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; *err = -ENOMEM;
*curr_size = 0; *curr_size = 0;
} else { } else {
*curr_size = needed_size; *curr_size = needed_size;
@ -2755,7 +2755,7 @@ static bool reallocate_buffer(
size_t *curr_size, size_t *curr_size,
size_t needed_size, size_t needed_size,
bool force, bool force,
enum ia_css_err *err) int *err)
{ {
bool ret; bool ret;
@ -2897,9 +2897,9 @@ ia_css_metadata_free_multiple(unsigned int num_bufs,
static unsigned int g_param_buffer_dequeue_count; static unsigned int g_param_buffer_dequeue_count;
static unsigned int g_param_buffer_enqueue_count; static unsigned int g_param_buffer_enqueue_count;
enum ia_css_err int
ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) { ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
unsigned int i; unsigned int i;
struct sh_css_ddr_address_map *ddr_ptrs; struct sh_css_ddr_address_map *ddr_ptrs;
struct sh_css_ddr_address_map_size *ddr_ptrs_size; struct sh_css_ddr_address_map_size *ddr_ptrs_size;
@ -2910,8 +2910,8 @@ ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) {
if (!stream) if (!stream)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INVALID_ARGUMENTS); IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL);
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
/* TMP: tracking of paramsets */ /* TMP: tracking of paramsets */
g_param_buffer_dequeue_count = 0; g_param_buffer_dequeue_count = 0;
@ -2920,7 +2920,7 @@ ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) {
stream->per_frame_isp_params_configs = NULL; stream->per_frame_isp_params_configs = NULL;
err = sh_css_create_isp_params(stream, err = sh_css_create_isp_params(stream,
&stream->isp_params_configs); &stream->isp_params_configs);
if (err != IA_CSS_SUCCESS) if (err)
goto ERR; goto ERR;
params = stream->isp_params_configs; params = stream->isp_params_configs;
@ -2928,7 +2928,7 @@ ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) {
{ {
/* we do not return the error immediately to enable internal /* we do not return the error immediately to enable internal
* firmware feature testing */ * firmware feature testing */
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
} }
ddr_ptrs = &params->ddr_ptrs; ddr_ptrs = &params->ddr_ptrs;
@ -2968,14 +2968,14 @@ ia_css_set_sdis2_config(
ia_css_set_sdis2_vertproj_config(params, dvs2_coefs); ia_css_set_sdis2_vertproj_config(params, dvs2_coefs);
} }
static enum ia_css_err static int
sh_css_create_isp_params(struct ia_css_stream *stream, sh_css_create_isp_params(struct ia_css_stream *stream,
struct ia_css_isp_parameters **isp_params_out) { struct ia_css_isp_parameters **isp_params_out) {
bool succ = true; bool succ = true;
unsigned int i; unsigned int i;
struct sh_css_ddr_address_map *ddr_ptrs; struct sh_css_ddr_address_map *ddr_ptrs;
struct sh_css_ddr_address_map_size *ddr_ptrs_size; struct sh_css_ddr_address_map_size *ddr_ptrs_size;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
size_t params_size; size_t params_size;
struct ia_css_isp_parameters *params = struct ia_css_isp_parameters *params =
kvmalloc(sizeof(struct ia_css_isp_parameters), GFP_KERNEL); kvmalloc(sizeof(struct ia_css_isp_parameters), GFP_KERNEL);
@ -2983,7 +2983,7 @@ sh_css_create_isp_params(struct ia_css_stream *stream,
if (!params) if (!params)
{ {
*isp_params_out = NULL; *isp_params_out = NULL;
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
IA_CSS_ERROR("%s:%d error: cannot allocate memory", __FILE__, __LINE__); IA_CSS_ERROR("%s:%d error: cannot allocate memory", __FILE__, __LINE__);
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
@ -3073,7 +3073,7 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
} else { } else {
for (i = 0; i < stream->num_pipes; i++) { for (i = 0; i < stream->num_pipes; i++) {
if (sh_css_select_dp_10bpp_config(stream->pipes[i], if (sh_css_select_dp_10bpp_config(stream->pipes[i],
&is_dp_10bpp) == IA_CSS_SUCCESS) { &is_dp_10bpp) == 0) {
/* set the return value as false if both DPC and /* set the return value as false if both DPC and
* BDS is enabled by the user. But we do not return * BDS is enabled by the user. But we do not return
* the value immediately to enable internal firmware * the value immediately to enable internal firmware
@ -3180,7 +3180,7 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
ia_css_set_formats_config(params, &stream_params->formats_config); ia_css_set_formats_config(params, &stream_params->formats_config);
for (i = 0; i < stream->num_pipes; i++) { for (i = 0; i < stream->num_pipes; i++) {
if (IA_CSS_SUCCESS == if (0 ==
sh_css_select_dp_10bpp_config(stream->pipes[i], &is_dp_10bpp)) { sh_css_select_dp_10bpp_config(stream->pipes[i], &is_dp_10bpp)) {
/* set the return value as false if both DPC and /* set the return value as false if both DPC and
* BDS is enabled by the user. But we do not return * BDS is enabled by the user. But we do not return
@ -3252,7 +3252,7 @@ exit:
return retval; return retval;
} }
enum ia_css_err int
sh_css_params_init(void) { sh_css_params_init(void) {
int i, p; int i, p;
@ -3279,8 +3279,8 @@ sh_css_params_init(void) {
if ((xmem_sp_stage_ptrs[p][i] == mmgr_NULL) || if ((xmem_sp_stage_ptrs[p][i] == mmgr_NULL) ||
(xmem_isp_stage_ptrs[p][i] == mmgr_NULL)) { (xmem_isp_stage_ptrs[p][i] == mmgr_NULL)) {
sh_css_params_uninit(); sh_css_params_uninit();
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
} }
} }
@ -3304,11 +3304,11 @@ sh_css_params_init(void) {
(xmem_sp_group_ptrs == mmgr_NULL)) (xmem_sp_group_ptrs == mmgr_NULL))
{ {
ia_css_uninit(); ia_css_uninit();
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
static void host_lut_store(const void *lut) static void host_lut_store(const void *lut)
@ -3331,16 +3331,16 @@ inline void sh_css_params_free_gdc_lut(ia_css_ptr addr)
hmm_free(addr); hmm_free(addr);
} }
enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, int ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
const void *lut) const void *lut)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
bool stream_started = false; bool stream_started = false;
IA_CSS_ENTER("pipe=%p lut=%p", pipe, lut); IA_CSS_ENTER("pipe=%p lut=%p", pipe, lut);
if (!lut || !pipe) { if (!lut || !pipe) {
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
IA_CSS_LEAVE("err=%d", err); IA_CSS_LEAVE("err=%d", err);
return err; return err;
} }
@ -3353,7 +3353,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
"unable to set scaler lut since stream has started\n"); "unable to set scaler lut since stream has started\n");
stream_started = true; stream_started = true;
err = IA_CSS_ERR_NOT_SUPPORTED; err = -ENOTSUPP;
} }
/* Free any existing tables. */ /* Free any existing tables. */
@ -3369,7 +3369,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
if (pipe->scaler_pp_lut == mmgr_NULL) { if (pipe->scaler_pp_lut == mmgr_NULL) {
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
"unable to allocate scaler_pp_lut\n"); "unable to allocate scaler_pp_lut\n");
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
} else { } else {
gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])lut, gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])lut,
interleaved_lut_temp); interleaved_lut_temp);
@ -3394,9 +3394,9 @@ ia_css_ptr sh_css_pipe_get_pp_gdc_lut(const struct ia_css_pipe *pipe)
return sh_css_params_get_default_gdc_lut(); return sh_css_params_get_default_gdc_lut();
} }
enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void) int sh_css_params_map_and_store_default_gdc_lut(void)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
IA_CSS_ENTER_PRIVATE("void"); IA_CSS_ENTER_PRIVATE("void");
@ -3412,7 +3412,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void)
default_gdc_lut = sh_css_params_alloc_gdc_lut(); default_gdc_lut = sh_css_params_alloc_gdc_lut();
if (default_gdc_lut == mmgr_NULL) if (default_gdc_lut == mmgr_NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])zoom_table, gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])zoom_table,
interleaved_lut_temp); interleaved_lut_temp);
@ -3609,7 +3609,7 @@ convert_allocate_morph_plane(
me = ia_css_host_data_allocate((size_t)isp_data_size); me = ia_css_host_data_allocate((size_t)isp_data_size);
if (!me) { if (!me) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return NULL; return NULL;
} }
@ -3628,7 +3628,7 @@ convert_allocate_morph_plane(
return me; return me;
} }
static enum ia_css_err static int
store_morph_plane( store_morph_plane(
unsigned short *data, unsigned short *data,
unsigned int width, unsigned int width,
@ -3642,13 +3642,13 @@ store_morph_plane(
isp_data = convert_allocate_morph_plane(data, width, height, aligned_width); isp_data = convert_allocate_morph_plane(data, width, height, aligned_width);
if (!isp_data) if (!isp_data)
{ {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
ia_css_params_store_ia_css_host_data(dest, isp_data); ia_css_params_store_ia_css_host_data(dest, isp_data);
ia_css_host_data_free(isp_data); ia_css_host_data_free(isp_data);
return IA_CSS_SUCCESS; return 0;
} }
static void sh_css_update_isp_params_to_ddr( static void sh_css_update_isp_params_to_ddr(
@ -3703,7 +3703,7 @@ void ia_css_dequeue_param_buffers(/*unsigned int pipe_num*/ void)
cpy = (ia_css_ptr)0; cpy = (ia_css_ptr)0;
/* clean-up old copy */ /* clean-up old copy */
while (ia_css_bufq_dequeue_buffer(param_queue_ids[i], while (ia_css_bufq_dequeue_buffer(param_queue_ids[i],
(uint32_t *)&cpy) == IA_CSS_SUCCESS) { (uint32_t *)&cpy) == 0) {
/* TMP: keep track of dequeued param set count /* TMP: keep track of dequeued param set count
*/ */
g_param_buffer_dequeue_count++; g_param_buffer_dequeue_count++;
@ -3757,12 +3757,12 @@ process_kernel_parameters(unsigned int pipe_id,
} }
} }
enum ia_css_err int
sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe, sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
struct ia_css_isp_parameters *params, struct ia_css_isp_parameters *params,
bool commit, bool commit,
struct ia_css_pipe *pipe_in) { struct ia_css_pipe *pipe_in) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
ia_css_ptr cpy; ia_css_ptr cpy;
int i; int i;
unsigned int raw_bit_depth = 10; unsigned int raw_bit_depth = 10;
@ -3813,7 +3813,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
#endif #endif
if (!sh_css_sp_is_running()) { if (!sh_css_sp_is_running()) {
/* SP is not running. The queues are not valid */ /* SP is not running. The queues are not valid */
err = IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; err = -EBUSY;
break; break;
} }
cur_map = &params->pipe_ddr_ptrs[pipeline->pipe_id]; cur_map = &params->pipe_ddr_ptrs[pipeline->pipe_id];
@ -3829,7 +3829,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
/* the processing is a.o. resolution dependent */ /* the processing is a.o. resolution dependent */
err = ia_css_process_zoom_and_motion(params, err = ia_css_process_zoom_and_motion(params,
pipeline->stages); pipeline->stages);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
} }
/* check if to actually update the parameters for this pipe */ /* check if to actually update the parameters for this pipe */
@ -3860,14 +3860,14 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
cur_map, cur_map,
cur_map_size); cur_map_size);
if (err != IA_CSS_SUCCESS) if (err)
break; break;
for (mem = 0; mem < IA_CSS_NUM_MEMORIES; mem++) { for (mem = 0; mem < IA_CSS_NUM_MEMORIES; mem++) {
params->isp_mem_params_changed params->isp_mem_params_changed
[pipeline->pipe_id][stage->stage_num][mem] = false; [pipeline->pipe_id][stage->stage_num][mem] = false;
} }
} /* for */ } /* for */
if (err != IA_CSS_SUCCESS) if (err)
break; break;
/* update isp_params to pipe specific copies */ /* update isp_params to pipe specific copies */
if (params->isp_params_changed) { if (params->isp_params_changed) {
@ -3876,7 +3876,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
cur_map_size->isp_param, cur_map_size->isp_param,
true, true,
&err); &err);
if (err != IA_CSS_SUCCESS) if (err)
break; break;
sh_css_update_isp_params_to_ddr(params, cur_map->isp_param); sh_css_update_isp_params_to_ddr(params, cur_map->isp_param);
} }
@ -3885,7 +3885,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
err = ref_sh_css_ddr_address_map( err = ref_sh_css_ddr_address_map(
cur_map, cur_map,
&isp_params_info.mem_map); &isp_params_info.mem_map);
if (err != IA_CSS_SUCCESS) if (err)
break; break;
/* Update Parameters ID */ /* Update Parameters ID */
@ -3897,14 +3897,14 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
/* now write the copy to ddr */ /* now write the copy to ddr */
err = write_ia_css_isp_parameter_set_info_to_ddr(&isp_params_info, &cpy); err = write_ia_css_isp_parameter_set_info_to_ddr(&isp_params_info, &cpy);
if (err != IA_CSS_SUCCESS) if (err)
break; break;
/* enqueue the set to sp */ /* enqueue the set to sp */
IA_CSS_LOG("queue param set %x to %d", cpy, thread_id); IA_CSS_LOG("queue param set %x to %d", cpy, thread_id);
err = ia_css_bufq_enqueue_buffer(thread_id, queue_id, (uint32_t)cpy); err = ia_css_bufq_enqueue_buffer(thread_id, queue_id, (uint32_t)cpy);
if (err != IA_CSS_SUCCESS) { if (err) {
free_ia_css_isp_parameter_set_info(cpy); free_ia_css_isp_parameter_set_info(cpy);
#if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS) #if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS)
IA_CSS_LOG("pfp: FAILED to add config id %d for OF %d to q %d on thread %d", IA_CSS_LOG("pfp: FAILED to add config id %d for OF %d to q %d on thread %d",
@ -3925,8 +3925,8 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
*/ */
if (!sh_css_sp_is_running()) { if (!sh_css_sp_is_running()) {
/* SP is not running. The queues are not valid */ /* SP is not running. The queues are not valid */
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_RESOURCE_NOT_AVAILABLE); IA_CSS_LEAVE_ERR_PRIVATE(-EBUSY);
return IA_CSS_ERR_RESOURCE_NOT_AVAILABLE; return -EBUSY;
} }
ia_css_bufq_enqueue_psys_event( ia_css_bufq_enqueue_psys_event(
IA_CSS_PSYS_SW_EVENT_BUFFER_ENQUEUED, IA_CSS_PSYS_SW_EVENT_BUFFER_ENQUEUED,
@ -3963,7 +3963,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
return err; return err;
} }
static enum ia_css_err static int
sh_css_params_write_to_ddr_internal( sh_css_params_write_to_ddr_internal(
struct ia_css_pipe *pipe, struct ia_css_pipe *pipe,
unsigned int pipe_id, unsigned int pipe_id,
@ -3971,7 +3971,7 @@ sh_css_params_write_to_ddr_internal(
const struct ia_css_pipeline_stage *stage, const struct ia_css_pipeline_stage *stage,
struct sh_css_ddr_address_map *ddr_map, struct sh_css_ddr_address_map *ddr_map,
struct sh_css_ddr_address_map_size *ddr_map_size) { struct sh_css_ddr_address_map_size *ddr_map_size) {
enum ia_css_err err; int err;
const struct ia_css_binary *binary; const struct ia_css_binary *binary;
unsigned int stage_num; unsigned int stage_num;
@ -3999,14 +3999,14 @@ sh_css_params_write_to_ddr_internal(
(size_t)(FPNTBL_BYTES(binary)), (size_t)(FPNTBL_BYTES(binary)),
params->config_changed[IA_CSS_FPN_ID], params->config_changed[IA_CSS_FPN_ID],
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
if (params->config_changed[IA_CSS_FPN_ID] || buff_realloced) { if (params->config_changed[IA_CSS_FPN_ID] || buff_realloced) {
if (params->fpn_config.enabled) { if (params->fpn_config.enabled) {
err = store_fpntbl(params, ddr_map->fpn_tbl); err = store_fpntbl(params, ddr_map->fpn_tbl);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4031,7 +4031,7 @@ sh_css_params_write_to_ddr_internal(
bytes, bytes,
params->sc_table_changed, params->sc_table_changed,
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4042,7 +4042,7 @@ sh_css_params_write_to_ddr_internal(
if (params->sc_table) { if (params->sc_table) {
/* store the shading table to ddr */ /* store the shading table to ddr */
err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_table); err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_table);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4060,13 +4060,13 @@ sh_css_params_write_to_ddr_internal(
binary->sctbl_width_per_color, binary->sctbl_width_per_color,
binary->sctbl_height); binary->sctbl_height);
if (!params->sc_config) { if (!params->sc_config) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
/* store the shading table to ddr */ /* store the shading table to ddr */
err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_config); err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_config);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4091,13 +4091,13 @@ sh_css_params_write_to_ddr_internal(
&params->sc_config, &params->sc_config,
binary, pipe->required_bds_factor); binary, pipe->required_bds_factor);
if (!params->sc_config) { if (!params->sc_config) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
/* store the shading table to ddr */ /* store the shading table to ddr */
err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_config); err = ia_css_params_store_sctbl(stage, ddr_map->sc_tbl, params->sc_config);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4177,7 +4177,7 @@ sh_css_params_write_to_ddr_internal(
ddr_map_size->macc_tbl, ddr_map_size->macc_tbl,
true, true,
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4198,7 +4198,7 @@ sh_css_params_write_to_ddr_internal(
(size_t)((DVS_6AXIS_BYTES(binary) / 2) * 3), (size_t)((DVS_6AXIS_BYTES(binary) / 2) * 3),
params->pipe_dvs_6axis_config_changed[pipe_id], params->pipe_dvs_6axis_config_changed[pipe_id],
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4231,8 +4231,8 @@ sh_css_params_write_to_ddr_internal(
params->pipe_dvs_6axis_config[pipe_id] = params->pipe_dvs_6axis_config[pipe_id] =
generate_dvs_6axis_table(&binary->out_frame_info[0].res, &dvs_offset); generate_dvs_6axis_table(&binary->out_frame_info[0].res, &dvs_offset);
if (!params->pipe_dvs_6axis_config[pipe_id]) { if (!params->pipe_dvs_6axis_config[pipe_id]) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return -ENOMEM;
} }
params->pipe_dvs_6axis_config_changed[pipe_id] = true; params->pipe_dvs_6axis_config_changed[pipe_id] = true;
@ -4298,7 +4298,7 @@ sh_css_params_write_to_ddr_internal(
(MORPH_PLANE_BYTES(binary)), (MORPH_PLANE_BYTES(binary)),
params->morph_table_changed, params->morph_table_changed,
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4309,7 +4309,7 @@ sh_css_params_write_to_ddr_internal(
(MORPH_PLANE_BYTES(binary)), (MORPH_PLANE_BYTES(binary)),
params->morph_table_changed, params->morph_table_changed,
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4326,7 +4326,7 @@ sh_css_params_write_to_ddr_internal(
if (!table) { if (!table) {
err = sh_css_params_default_morph_table(&id_table, err = sh_css_params_default_morph_table(&id_table,
binary); binary);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4364,7 +4364,7 @@ sh_css_params_write_to_ddr_internal(
size, size,
params->isp_mem_params_changed[pipe_id][stage_num][mem], params->isp_mem_params_changed[pipe_id][stage_num][mem],
&err); &err);
if (err != IA_CSS_SUCCESS) { if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4375,8 +4375,8 @@ sh_css_params_write_to_ddr_internal(
} }
} }
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); IA_CSS_LEAVE_ERR_PRIVATE(0);
return IA_CSS_SUCCESS; return 0;
} }
const struct ia_css_fpn_table *ia_css_get_fpn_table(struct ia_css_stream const struct ia_css_fpn_table *ia_css_get_fpn_table(struct ia_css_stream
@ -4498,11 +4498,11 @@ ia_css_ptr sh_css_store_isp_stage_to_ddr(
return xmem_isp_stage_ptrs[pipe][stage]; return xmem_isp_stage_ptrs[pipe][stage];
} }
static enum ia_css_err ref_sh_css_ddr_address_map( static int ref_sh_css_ddr_address_map(
struct sh_css_ddr_address_map *map, struct sh_css_ddr_address_map *map,
struct sh_css_ddr_address_map *out) struct sh_css_ddr_address_map *out)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
unsigned int i; unsigned int i;
/* we will use a union to copy things; overlaying an array /* we will use a union to copy things; overlaying an array
@ -4538,11 +4538,11 @@ static enum ia_css_err ref_sh_css_ddr_address_map(
return err; return err;
} }
static enum ia_css_err write_ia_css_isp_parameter_set_info_to_ddr( static int write_ia_css_isp_parameter_set_info_to_ddr(
struct ia_css_isp_parameter_set_info *me, struct ia_css_isp_parameter_set_info *me,
ia_css_ptr *out) ia_css_ptr *out)
{ {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
bool succ; bool succ;
IA_CSS_ENTER_PRIVATE("void"); IA_CSS_ENTER_PRIVATE("void");
@ -4557,16 +4557,16 @@ static enum ia_css_err write_ia_css_isp_parameter_set_info_to_ddr(
hmm_store(*out, hmm_store(*out,
me, sizeof(struct ia_css_isp_parameter_set_info)); me, sizeof(struct ia_css_isp_parameter_set_info));
else else
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = -ENOMEM;
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
static enum ia_css_err static int
free_ia_css_isp_parameter_set_info( free_ia_css_isp_parameter_set_info(
ia_css_ptr ptr) { ia_css_ptr ptr) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
struct ia_css_isp_parameter_set_info isp_params_info; struct ia_css_isp_parameter_set_info isp_params_info;
unsigned int i; unsigned int i;
ia_css_ptr *addrs = (ia_css_ptr *)&isp_params_info.mem_map; ia_css_ptr *addrs = (ia_css_ptr *)&isp_params_info.mem_map;
@ -4578,7 +4578,7 @@ free_ia_css_isp_parameter_set_info(
{ {
IA_CSS_ERROR("%s: IA_CSS_REFCOUNT_PARAM_SET_POOL(0x%x) invalid arg", __func__, IA_CSS_ERROR("%s: IA_CSS_REFCOUNT_PARAM_SET_POOL(0x%x) invalid arg", __func__,
ptr); ptr);
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
@ -4595,7 +4595,7 @@ free_ia_css_isp_parameter_set_info(
if (!ia_css_refcount_is_valid(addrs[i])) { if (!ia_css_refcount_is_valid(addrs[i])) {
IA_CSS_ERROR("%s: IA_CSS_REFCOUNT_PARAM_BUFFER(0x%x) invalid arg", __func__, IA_CSS_ERROR("%s: IA_CSS_REFCOUNT_PARAM_BUFFER(0x%x) invalid arg", __func__,
ptr); ptr);
err = IA_CSS_ERR_INVALID_ARGUMENTS; err = -EINVAL;
continue; continue;
} }
@ -4783,7 +4783,7 @@ sh_css_update_uds_and_crop_info(
IA_CSS_LEAVE_PRIVATE("void"); IA_CSS_LEAVE_PRIVATE("void");
} }
static enum ia_css_err static int
sh_css_update_uds_and_crop_info_based_on_zoom_region( sh_css_update_uds_and_crop_info_based_on_zoom_region(
const struct ia_css_binary_info *info, const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info, const struct ia_css_frame_info *in_frame_info,
@ -4796,7 +4796,7 @@ sh_css_update_uds_and_crop_info_based_on_zoom_region(
struct ia_css_resolution pipe_in_res, struct ia_css_resolution pipe_in_res,
bool enable_zoom) { bool enable_zoom) {
unsigned int x0 = 0, y0 = 0, x1 = 0, y1 = 0; unsigned int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
/* Note: /* Note:
* Filter_Envelope = 0 for NND/LUT * Filter_Envelope = 0 for NND/LUT
* Filter_Envelope = 1 for BCI * Filter_Envelope = 1 for BCI
@ -4823,7 +4823,7 @@ sh_css_update_uds_and_crop_info_based_on_zoom_region(
y1 = zoom->zoom_region.resolution.height + y0; y1 = zoom->zoom_region.resolution.height + y0;
if ((x0 > x1) || (y0 > y1) || (x1 > pipe_in_res.width) || (y1 > pipe_in_res.height)) if ((x0 > x1) || (y0 > y1) || (x1 > pipe_in_res.width) || (y1 > pipe_in_res.height))
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
if (!enable_zoom) if (!enable_zoom)
{ {
@ -4835,7 +4835,7 @@ sh_css_update_uds_and_crop_info_based_on_zoom_region(
{ {
/* Zoom region is only supported by the UDS module on ISP /* Zoom region is only supported by the UDS module on ISP
* 2 and higher. It is not supported in video mode on ISP 1 */ * 2 and higher. It is not supported in video mode on ISP 1 */
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} else } else
{ {
if (enable_zoom) { if (enable_zoom) {
@ -5260,7 +5260,7 @@ ia_css_en_dz_capt_pipe(struct ia_css_stream *stream, bool enable)
struct ia_css_pipeline *pipeline; struct ia_css_pipeline *pipeline;
struct ia_css_pipeline_stage *stage; struct ia_css_pipeline_stage *stage;
enum ia_css_pipe_id pipe_id; enum ia_css_pipe_id pipe_id;
enum ia_css_err err; int err;
int i; int i;
if (!stream) if (!stream)
@ -5274,7 +5274,7 @@ ia_css_en_dz_capt_pipe(struct ia_css_stream *stream, bool enable)
if (pipe_id == IA_CSS_PIPE_ID_CAPTURE) { if (pipe_id == IA_CSS_PIPE_ID_CAPTURE) {
err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP, err = ia_css_pipeline_get_stage(pipeline, IA_CSS_BINARY_MODE_CAPTURE_PP,
&stage); &stage);
if (err == IA_CSS_SUCCESS) if (!err)
stage->enable_zoom = enable; stage->enable_zoom = enable;
break; break;
} }

Просмотреть файл

@ -153,7 +153,7 @@ ia_css_params_store_ia_css_host_data(
ia_css_ptr ddr_addr, ia_css_ptr ddr_addr,
struct ia_css_host_data *data); struct ia_css_host_data *data);
enum ia_css_err int
ia_css_params_store_sctbl( ia_css_params_store_sctbl(
const struct ia_css_pipeline_stage *stage, const struct ia_css_pipeline_stage *stage,
ia_css_ptr ddr_addr, ia_css_ptr ddr_addr,
@ -173,7 +173,7 @@ sh_css_params_alloc_gdc_lut(void);
void void
sh_css_params_free_gdc_lut(ia_css_ptr addr); sh_css_params_free_gdc_lut(ia_css_ptr addr);
enum ia_css_err int
sh_css_params_map_and_store_default_gdc_lut(void); sh_css_params_map_and_store_default_gdc_lut(void);
void void

Просмотреть файл

@ -76,7 +76,7 @@ static struct sh_css_sp_per_frame_data per_frame_data;
/* TODO: add code that sets this bool to false */ /* TODO: add code that sets this bool to false */
static bool sp_running; static bool sp_running;
static enum ia_css_err static int
set_output_frame_buffer(const struct ia_css_frame *frame, set_output_frame_buffer(const struct ia_css_frame *frame,
unsigned int idx); unsigned int idx);
@ -536,10 +536,10 @@ sh_css_copy_frame_to_spframe(struct ia_css_frame_sp *sp_frame_out,
} }
} }
static enum ia_css_err static int
set_input_frame_buffer(const struct ia_css_frame *frame) { set_input_frame_buffer(const struct ia_css_frame *frame) {
if (!frame) if (!frame)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
switch (frame->info.format) switch (frame->info.format)
{ {
@ -559,18 +559,18 @@ set_input_frame_buffer(const struct ia_css_frame *frame) {
case IA_CSS_FRAME_FORMAT_CSI_MIPI_YUV420_10: case IA_CSS_FRAME_FORMAT_CSI_MIPI_YUV420_10:
break; break;
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.in, frame); sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.in, frame);
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err static int
set_output_frame_buffer(const struct ia_css_frame *frame, set_output_frame_buffer(const struct ia_css_frame *frame,
unsigned int idx) { unsigned int idx) {
if (!frame) if (!frame)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
switch (frame->info.format) switch (frame->info.format)
{ {
@ -602,16 +602,16 @@ set_output_frame_buffer(const struct ia_css_frame *frame,
case IA_CSS_FRAME_FORMAT_BINARY_8: case IA_CSS_FRAME_FORMAT_BINARY_8:
break; break;
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.out[idx], frame); sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.out[idx], frame);
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err static int
set_view_finder_buffer(const struct ia_css_frame *frame) { set_view_finder_buffer(const struct ia_css_frame *frame) {
if (!frame) if (!frame)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
switch (frame->info.format) switch (frame->info.format)
{ {
@ -631,11 +631,11 @@ set_view_finder_buffer(const struct ia_css_frame *frame) {
case IA_CSS_FRAME_FORMAT_YUV_LINE: case IA_CSS_FRAME_FORMAT_YUV_LINE:
break; break;
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
} }
sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.out_vf, frame); sh_css_copy_frame_to_spframe(&sh_css_sp_stage.frames.out_vf, frame);
return IA_CSS_SUCCESS; return 0;
} }
#if !defined(HAS_NO_INPUT_FORMATTER) #if !defined(HAS_NO_INPUT_FORMATTER)
@ -737,26 +737,26 @@ sh_css_sp_set_disable_continuous_viewfinder(bool flag)
sh_css_sp_group.config.disable_cont_vf = flag; sh_css_sp_group.config.disable_cont_vf = flag;
} }
static enum ia_css_err static int
sh_css_sp_write_frame_pointers(const struct sh_css_binary_args *args) { sh_css_sp_write_frame_pointers(const struct sh_css_binary_args *args) {
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
int i; int i;
assert(args); assert(args);
if (args->in_frame) if (args->in_frame)
err = set_input_frame_buffer(args->in_frame); err = set_input_frame_buffer(args->in_frame);
if (err == IA_CSS_SUCCESS && args->out_vf_frame) if (!err && args->out_vf_frame)
err = set_view_finder_buffer(args->out_vf_frame); err = set_view_finder_buffer(args->out_vf_frame);
for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++)
{ {
if (err == IA_CSS_SUCCESS && args->out_frame[i]) if (!err && args->out_frame[i])
err = set_output_frame_buffer(args->out_frame[i], i); err = set_output_frame_buffer(args->out_frame[i], i);
} }
/* we don't pass this error back to the upper layer, so we add a assert here /* we don't pass this error back to the upper layer, so we add a assert here
because we actually hit the error here but it still works by accident... */ because we actually hit the error here but it still works by accident... */
if (err != IA_CSS_SUCCESS) assert(false); if (err) assert(false);
return err; return err;
} }
@ -791,23 +791,23 @@ sh_css_stage_write_binary_info(struct ia_css_binary_info *info)
sh_css_isp_stage.binary_info = *info; sh_css_isp_stage.binary_info = *info;
} }
static enum ia_css_err static int
copy_isp_mem_if_to_ddr(struct ia_css_binary *binary) { copy_isp_mem_if_to_ddr(struct ia_css_binary *binary) {
enum ia_css_err err; int err;
err = ia_css_isp_param_copy_isp_mem_if_to_ddr( err = ia_css_isp_param_copy_isp_mem_if_to_ddr(
&binary->css_params, &binary->css_params,
&binary->mem_params, &binary->mem_params,
IA_CSS_PARAM_CLASS_CONFIG); IA_CSS_PARAM_CLASS_CONFIG);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
err = ia_css_isp_param_copy_isp_mem_if_to_ddr( err = ia_css_isp_param_copy_isp_mem_if_to_ddr(
&binary->css_params, &binary->css_params,
&binary->mem_params, &binary->mem_params,
IA_CSS_PARAM_CLASS_STATE); IA_CSS_PARAM_CLASS_STATE);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
return IA_CSS_SUCCESS; return 0;
} }
static bool static bool
@ -817,7 +817,7 @@ is_sp_stage(struct ia_css_pipeline_stage *stage)
return stage->sp_func != IA_CSS_PIPELINE_NO_FUNC; return stage->sp_func != IA_CSS_PIPELINE_NO_FUNC;
} }
static enum ia_css_err static int
configure_isp_from_args( configure_isp_from_args(
const struct sh_css_sp_pipeline *pipeline, const struct sh_css_sp_pipeline *pipeline,
const struct ia_css_binary *binary, const struct ia_css_binary *binary,
@ -853,7 +853,7 @@ configure_isp_from_args(
ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay); ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay);
ia_css_tnr_configure(binary, args->tnr_frames); ia_css_tnr_configure(binary, args->tnr_frames);
ia_css_bayer_io_config(binary, args); ia_css_bayer_io_config(binary, args);
return IA_CSS_SUCCESS; return 0;
} }
static void static void
@ -892,7 +892,7 @@ initialize_stage_frames(struct ia_css_frames_sp *frames)
#endif #endif
} }
static enum ia_css_err static int
sh_css_sp_init_stage(struct ia_css_binary *binary, sh_css_sp_init_stage(struct ia_css_binary *binary,
const char *binary_name, const char *binary_name,
const struct ia_css_blob_info *blob_info, const struct ia_css_blob_info *blob_info,
@ -905,7 +905,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
bool two_ppc) { bool two_ppc) {
const struct ia_css_binary_xinfo *xinfo; const struct ia_css_binary_xinfo *xinfo;
const struct ia_css_binary_info *info; const struct ia_css_binary_info *info;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
int i; int i;
struct ia_css_pipe *pipe = NULL; struct ia_css_pipe *pipe = NULL;
unsigned int thread_id; unsigned int thread_id;
@ -937,7 +937,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
if (!info) if (!info)
{ {
sh_css_sp_group.pipe[thread_id].sp_stage_addr[stage] = mmgr_NULL; sh_css_sp_group.pipe[thread_id].sp_stage_addr[stage] = mmgr_NULL;
return IA_CSS_SUCCESS; return 0;
} }
#if defined(USE_INPUT_SYSTEM_VERSION_2401) #if defined(USE_INPUT_SYSTEM_VERSION_2401)
@ -1023,14 +1023,14 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_METADATA, thread_id, &queue_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_METADATA, thread_id, &queue_id);
sh_css_copy_buffer_attr_to_spbuffer(&sh_css_sp_stage.frames.metadata_buf, queue_id, mmgr_EXCEPTION, IA_CSS_BUFFER_TYPE_METADATA); sh_css_copy_buffer_attr_to_spbuffer(&sh_css_sp_stage.frames.metadata_buf, queue_id, mmgr_EXCEPTION, IA_CSS_BUFFER_TYPE_METADATA);
#endif #endif
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
#ifdef USE_INPUT_SYSTEM_VERSION_2401 #ifdef USE_INPUT_SYSTEM_VERSION_2401
if (stage == 0) { if (stage == 0) {
pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
if (!pipe) if (!pipe)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
if (args->in_frame) if (args->in_frame)
ia_css_get_crop_offsets(pipe, &args->in_frame->info); ia_css_get_crop_offsets(pipe, &args->in_frame->info);
@ -1043,7 +1043,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
err = configure_isp_from_args(&sh_css_sp_group.pipe[thread_id], err = configure_isp_from_args(&sh_css_sp_group.pipe[thread_id],
binary, args, two_ppc, sh_css_sp_stage.deinterleaved); binary, args, two_ppc, sh_css_sp_stage.deinterleaved);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
initialize_isp_states(binary); initialize_isp_states(binary);
@ -1065,13 +1065,13 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
<<= binary->vf_downscale_log2; <<= binary->vf_downscale_log2;
} }
err = copy_isp_mem_if_to_ddr(binary); err = copy_isp_mem_if_to_ddr(binary);
if (err != IA_CSS_SUCCESS) if (err)
return err; return err;
return IA_CSS_SUCCESS; return 0;
} }
static enum ia_css_err static int
sp_init_stage(struct ia_css_pipeline_stage *stage, sp_init_stage(struct ia_css_pipeline_stage *stage,
unsigned int pipe_num, unsigned int pipe_num,
bool xnr, bool xnr,
@ -1103,7 +1103,7 @@ sp_init_stage(struct ia_css_pipeline_stage *stage,
*/ */
struct ia_css_isp_param_css_segments *mem_if = &isp_mem_if; struct ia_css_isp_param_css_segments *mem_if = &isp_mem_if;
enum ia_css_err err = IA_CSS_SUCCESS; int err = 0;
assert(stage); assert(stage);
@ -1148,7 +1148,7 @@ sp_init_stage(struct ia_css_pipeline_stage *stage,
These will be passed to sh_css_sp_init_stage These will be passed to sh_css_sp_init_stage
and dereferenced there, so passing a NULL and dereferenced there, so passing a NULL
pointer is no good. return an error */ pointer is no good. return an error */
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
} }
err = sh_css_sp_init_stage(binary, err = sh_css_sp_init_stage(binary,
@ -1601,7 +1601,7 @@ sh_css_event_init_irq_mask(void)
} }
} }
enum ia_css_err int
ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe, ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
unsigned int or_mask, unsigned int or_mask,
unsigned int and_mask) { unsigned int and_mask) {
@ -1629,7 +1629,7 @@ ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
pipe_num = ia_css_pipe_get_pipe_num(pipe); pipe_num = ia_css_pipe_get_pipe_num(pipe);
if (pipe_num >= IA_CSS_PIPE_ID_NUM) if (pipe_num >= IA_CSS_PIPE_ID_NUM)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
offset = (unsigned int)offsetof(struct host_sp_communication, offset = (unsigned int)offsetof(struct host_sp_communication,
host2sp_event_irq_mask[pipe_num]); host2sp_event_irq_mask[pipe_num]);
assert(offset % HRT_BUS_BYTES == 0); assert(offset % HRT_BUS_BYTES == 0);
@ -1637,10 +1637,10 @@ ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
(unsigned int)sp_address_of(host_sp_com) + offset, (unsigned int)sp_address_of(host_sp_com) + offset,
&event_irq_mask, sizeof(event_irq_mask)); &event_irq_mask, sizeof(event_irq_mask));
return IA_CSS_SUCCESS; return 0;
} }
enum ia_css_err int
ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe, ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
unsigned int *or_mask, unsigned int *or_mask,
unsigned int *and_mask) { unsigned int *and_mask) {
@ -1658,7 +1658,7 @@ ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
pipe_num = ia_css_pipe_get_pipe_num(pipe); pipe_num = ia_css_pipe_get_pipe_num(pipe);
if (pipe_num >= IA_CSS_PIPE_ID_NUM) if (pipe_num >= IA_CSS_PIPE_ID_NUM)
return IA_CSS_ERR_INTERNAL_ERROR; return -EINVAL;
offset = (unsigned int)offsetof(struct host_sp_communication, offset = (unsigned int)offsetof(struct host_sp_communication,
host2sp_event_irq_mask[pipe_num]); host2sp_event_irq_mask[pipe_num]);
assert(offset % HRT_BUS_BYTES == 0); assert(offset % HRT_BUS_BYTES == 0);
@ -1672,7 +1672,7 @@ ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
if (and_mask) if (and_mask)
*and_mask = event_irq_mask.and_mask; *and_mask = event_irq_mask.and_mask;
return IA_CSS_SUCCESS; return 0;
} }
void void

Просмотреть файл

@ -18,7 +18,7 @@
#include "ia_css_err.h" #include "ia_css_err.h"
#include "sh_css_firmware.h" #include "sh_css_firmware.h"
enum ia_css_err int
ia_css_get_version(char *version, int max_size) { ia_css_get_version(char *version, int max_size) {
char *css_version; char *css_version;
@ -28,10 +28,10 @@ ia_css_get_version(char *version, int max_size) {
css_version = ISP2401_CSS_VERSION_STRING; css_version = ISP2401_CSS_VERSION_STRING;
if (max_size <= (int)strlen(css_version) + (int)strlen(sh_css_get_fw_version()) + 5) if (max_size <= (int)strlen(css_version) + (int)strlen(sh_css_get_fw_version()) + 5)
return IA_CSS_ERR_INVALID_ARGUMENTS; return -EINVAL;
strcpy(version, css_version); strcpy(version, css_version);
strcat(version, "FW:"); strcat(version, "FW:");
strcat(version, sh_css_get_fw_version()); strcat(version, sh_css_get_fw_version());
strcat(version, "; "); strcat(version, "; ");
return IA_CSS_SUCCESS; return 0;
} }