Skip to content

Commit

Permalink
msm: camera: isp: Enable pixel_format_measurement in CSID
Browse files Browse the repository at this point in the history
Enabling format measure helps to find mismatch between
the expected sensor width and height with actual sensor width
and height.
In case of mismatch CSID will give CSID_PATH_ERROR_PIX_COUNT
and CSID_PATH_ERROR_LINE_COUNT.

Change-Id: I11aefe7d073ec47810564442109981d0e46f9844
Signed-off-by: Rishabh Jain <[email protected]>
  • Loading branch information
Rishabh Jain committed Jul 23, 2019
1 parent 71e62c8 commit 7a75626
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3528,6 +3528,75 @@ static int cam_isp_blob_clock_update(
return rc;
}

static int cam_isp_blob_sensor_config(
uint32_t blob_type,
struct cam_isp_generic_blob_info *blob_info,
struct cam_isp_sensor_config *dim_config,
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_ife_sensor_dimension_update_args update_args;
int rc = -EINVAL, found = 0;
uint32_t i, j;
struct cam_isp_sensor_dimension *path_config;

ctx = prepare->ctxt_to_hw_map;

list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
if (!hw_mgr_res->hw_res[i])
continue;
found = 1;
hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
if (hw_intf && hw_intf->hw_ops.process_cmd) {
path_config = &(dim_config->ipp_path);
update_args.ipp_path.width =
path_config->width;
update_args.ipp_path.height =
path_config->height;
update_args.ipp_path.measure_enabled =
path_config->measure_enabled;
path_config = &(dim_config->ppp_path);
update_args.ppp_path.width =
path_config->width;
update_args.ppp_path.height =
path_config->height;
update_args.ppp_path.measure_enabled =
path_config->measure_enabled;
for (j = 0; j < CAM_IFE_RDI_NUM_MAX; j++) {
path_config =
&(dim_config->rdi_path[j]);
update_args.rdi_path[j].width =
path_config->width;
update_args.rdi_path[j].height =
path_config->height;
update_args.rdi_path[j].measure_enabled =
path_config->measure_enabled;
}
rc = hw_intf->hw_ops.process_cmd(
hw_intf->hw_priv,
CAM_IFE_CSID_SET_SENSOR_DIMENSION_CFG,
&update_args,
sizeof(
struct
cam_ife_sensor_dimension_update_args)
);
if (rc)
CAM_ERR(CAM_ISP,
"Dimension Update failed");
} else
CAM_ERR(CAM_ISP, "hw_intf is NULL");
}
if (found)
break;
}

return rc;
}


void fill_res_bitmap(uint32_t resource_type, unsigned long *res_bitmap)
{

Expand Down Expand Up @@ -3620,12 +3689,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
return -EINVAL;
}

if (blob_type >= CAM_ISP_GENERIC_BLOB_TYPE_MAX) {
CAM_WARN(CAM_ISP, "Invalid Blob Type %d Max %d", blob_type,
CAM_ISP_GENERIC_BLOB_TYPE_MAX);
return 0;
}

prepare = blob_info->prepare;
if (!prepare) {
CAM_ERR(CAM_ISP, "Failed. prepare is NULL, blob_type %d",
Expand Down Expand Up @@ -3868,6 +3931,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
CAM_ERR(CAM_ISP, "Init Frame drop Update Failed");
}
break;
case CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG: {
struct cam_isp_sensor_config *csid_dim_config;

if (blob_size < sizeof(struct cam_isp_sensor_config)) {
CAM_ERR(CAM_ISP, "Invalid blob size %u expected %u",
blob_size,
sizeof(struct cam_isp_sensor_config));
return -EINVAL;
}

csid_dim_config =
(struct cam_isp_sensor_config *)blob_data;

rc = cam_isp_blob_sensor_config(blob_type, blob_info,
csid_dim_config, prepare);
if (rc)
CAM_ERR(CAM_ISP,
"Sensor Dimension Update Failed rc: %d", rc);
}
break;
default:
CAM_WARN(CAM_ISP, "Invalid blob type %d", blob_type);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -293,6 +293,10 @@ static struct cam_ife_csid_common_reg_offset
.ppp_irq_mask_all = 0x0,
.measure_en_hbi_vbi_cnt_mask = 0xC,
.format_measure_en_val = 1,
.format_measure_height_mask_val = 0xFFFF,
.format_measure_height_shift_val = 0x10,
.format_measure_width_mask_val = 0xFFFF,
.format_measure_width_shift_val = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_170_reg_offset = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -334,6 +334,10 @@ static struct cam_ife_csid_common_reg_offset
.ppp_irq_mask_all = 0xFFFF,
.measure_en_hbi_vbi_cnt_mask = 0xC,
.format_measure_en_val = 1,
.format_measure_height_mask_val = 0xFFFF,
.format_measure_height_shift_val = 0x10,
.format_measure_width_mask_val = 0xFFFF,
.format_measure_width_shift_val = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_175_reg_offset = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -350,6 +350,10 @@ static struct cam_ife_csid_common_reg_offset
.ppp_irq_mask_all = 0xFFFF,
.measure_en_hbi_vbi_cnt_mask = 0xC,
.format_measure_en_val = 1,
.format_measure_height_mask_val = 0xFFFF,
.format_measure_height_shift_val = 0x10,
.format_measure_width_mask_val = 0xFFFF,
.format_measure_width_shift_val = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_175_200_reg_offset = {
Expand Down
Loading

1 comment on commit 7a75626

@stefanhh0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes of this commit are already included in the commit f5d777a.

Please sign in to comment.