Skip to content

Commit 7a75626

Browse files
author
Rishabh Jain
committed
msm: camera: isp: Enable pixel_format_measurement in CSID
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]>
1 parent 71e62c8 commit 7a75626

File tree

8 files changed

+372
-21
lines changed

8 files changed

+372
-21
lines changed

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

Lines changed: 89 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,6 +3528,75 @@ static int cam_isp_blob_clock_update(
35283528
return rc;
35293529
}
35303530

3531+
static int cam_isp_blob_sensor_config(
3532+
uint32_t blob_type,
3533+
struct cam_isp_generic_blob_info *blob_info,
3534+
struct cam_isp_sensor_config *dim_config,
3535+
struct cam_hw_prepare_update_args *prepare)
3536+
{
3537+
struct cam_ife_hw_mgr_ctx *ctx = NULL;
3538+
struct cam_ife_hw_mgr_res *hw_mgr_res;
3539+
struct cam_hw_intf *hw_intf;
3540+
struct cam_ife_sensor_dimension_update_args update_args;
3541+
int rc = -EINVAL, found = 0;
3542+
uint32_t i, j;
3543+
struct cam_isp_sensor_dimension *path_config;
3544+
3545+
ctx = prepare->ctxt_to_hw_map;
3546+
3547+
list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
3548+
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
3549+
if (!hw_mgr_res->hw_res[i])
3550+
continue;
3551+
found = 1;
3552+
hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
3553+
if (hw_intf && hw_intf->hw_ops.process_cmd) {
3554+
path_config = &(dim_config->ipp_path);
3555+
update_args.ipp_path.width =
3556+
path_config->width;
3557+
update_args.ipp_path.height =
3558+
path_config->height;
3559+
update_args.ipp_path.measure_enabled =
3560+
path_config->measure_enabled;
3561+
path_config = &(dim_config->ppp_path);
3562+
update_args.ppp_path.width =
3563+
path_config->width;
3564+
update_args.ppp_path.height =
3565+
path_config->height;
3566+
update_args.ppp_path.measure_enabled =
3567+
path_config->measure_enabled;
3568+
for (j = 0; j < CAM_IFE_RDI_NUM_MAX; j++) {
3569+
path_config =
3570+
&(dim_config->rdi_path[j]);
3571+
update_args.rdi_path[j].width =
3572+
path_config->width;
3573+
update_args.rdi_path[j].height =
3574+
path_config->height;
3575+
update_args.rdi_path[j].measure_enabled =
3576+
path_config->measure_enabled;
3577+
}
3578+
rc = hw_intf->hw_ops.process_cmd(
3579+
hw_intf->hw_priv,
3580+
CAM_IFE_CSID_SET_SENSOR_DIMENSION_CFG,
3581+
&update_args,
3582+
sizeof(
3583+
struct
3584+
cam_ife_sensor_dimension_update_args)
3585+
);
3586+
if (rc)
3587+
CAM_ERR(CAM_ISP,
3588+
"Dimension Update failed");
3589+
} else
3590+
CAM_ERR(CAM_ISP, "hw_intf is NULL");
3591+
}
3592+
if (found)
3593+
break;
3594+
}
3595+
3596+
return rc;
3597+
}
3598+
3599+
35313600
void fill_res_bitmap(uint32_t resource_type, unsigned long *res_bitmap)
35323601
{
35333602

@@ -3620,12 +3689,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
36203689
return -EINVAL;
36213690
}
36223691

3623-
if (blob_type >= CAM_ISP_GENERIC_BLOB_TYPE_MAX) {
3624-
CAM_WARN(CAM_ISP, "Invalid Blob Type %d Max %d", blob_type,
3625-
CAM_ISP_GENERIC_BLOB_TYPE_MAX);
3626-
return 0;
3627-
}
3628-
36293692
prepare = blob_info->prepare;
36303693
if (!prepare) {
36313694
CAM_ERR(CAM_ISP, "Failed. prepare is NULL, blob_type %d",
@@ -3868,6 +3931,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
38683931
CAM_ERR(CAM_ISP, "Init Frame drop Update Failed");
38693932
}
38703933
break;
3934+
case CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG: {
3935+
struct cam_isp_sensor_config *csid_dim_config;
3936+
3937+
if (blob_size < sizeof(struct cam_isp_sensor_config)) {
3938+
CAM_ERR(CAM_ISP, "Invalid blob size %u expected %u",
3939+
blob_size,
3940+
sizeof(struct cam_isp_sensor_config));
3941+
return -EINVAL;
3942+
}
3943+
3944+
csid_dim_config =
3945+
(struct cam_isp_sensor_config *)blob_data;
3946+
3947+
rc = cam_isp_blob_sensor_config(blob_type, blob_info,
3948+
csid_dim_config, prepare);
3949+
if (rc)
3950+
CAM_ERR(CAM_ISP,
3951+
"Sensor Dimension Update Failed rc: %d", rc);
3952+
}
3953+
break;
38713954
default:
38723955
CAM_WARN(CAM_ISP, "Invalid blob type %d", blob_type);
38733956
break;

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid170.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
1+
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
22
*
33
* This program is free software; you can redistribute it and/or modify
44
* it under the terms of the GNU General Public License version 2 and
@@ -293,6 +293,10 @@ static struct cam_ife_csid_common_reg_offset
293293
.ppp_irq_mask_all = 0x0,
294294
.measure_en_hbi_vbi_cnt_mask = 0xC,
295295
.format_measure_en_val = 1,
296+
.format_measure_height_mask_val = 0xFFFF,
297+
.format_measure_height_shift_val = 0x10,
298+
.format_measure_width_mask_val = 0xFFFF,
299+
.format_measure_width_shift_val = 0x0,
296300
};
297301

298302
static struct cam_ife_csid_reg_offset cam_ife_csid_170_reg_offset = {

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid175.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
1+
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
22
*
33
* This program is free software; you can redistribute it and/or modify
44
* it under the terms of the GNU General Public License version 2 and
@@ -334,6 +334,10 @@ static struct cam_ife_csid_common_reg_offset
334334
.ppp_irq_mask_all = 0xFFFF,
335335
.measure_en_hbi_vbi_cnt_mask = 0xC,
336336
.format_measure_en_val = 1,
337+
.format_measure_height_mask_val = 0xFFFF,
338+
.format_measure_height_shift_val = 0x10,
339+
.format_measure_width_mask_val = 0xFFFF,
340+
.format_measure_width_shift_val = 0x0,
337341
};
338342

339343
static struct cam_ife_csid_reg_offset cam_ife_csid_175_reg_offset = {

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid175_200.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
1+
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
22
*
33
* This program is free software; you can redistribute it and/or modify
44
* it under the terms of the GNU General Public License version 2 and
@@ -350,6 +350,10 @@ static struct cam_ife_csid_common_reg_offset
350350
.ppp_irq_mask_all = 0xFFFF,
351351
.measure_en_hbi_vbi_cnt_mask = 0xC,
352352
.format_measure_en_val = 1,
353+
.format_measure_height_mask_val = 0xFFFF,
354+
.format_measure_height_shift_val = 0x10,
355+
.format_measure_width_mask_val = 0xFFFF,
356+
.format_measure_width_shift_val = 0x0,
353357
};
354358

355359
static struct cam_ife_csid_reg_offset cam_ife_csid_175_200_reg_offset = {

0 commit comments

Comments
 (0)