From ab2e87cde116670fbdccc3c311ffca37697d9686 Mon Sep 17 00:00:00 2001 From: Shravya Samala Date: Mon, 21 Sep 2020 19:09:33 +0530 Subject: [PATCH] msm: camera: ife: Adjust epoch configuration In case if calculated epoch is more than last active line, then there is a chance that calculated epoch is closer to EOF. This results in missing Epoch notification at CRM. Check if calculated epoch is greater than half of last active line, then configure epoch at half the active lines. CRs-Fixed: 2781565 Change-Id: Icb44d2e0e72b4ff36bd500ce51016cce418ff205 Signed-off-by: Shravya Samala --- drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c | 8 ++++---- .../isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c | 7 ++++--- .../isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c | 6 ++++-- .../isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c index 60b456e44fd3..b7104c15bf13 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c @@ -1972,10 +1972,10 @@ static int cam_tfe_camif_resource_start( /* Epoch config */ epoch0_irq_mask = (((rsrc_data->last_line + rsrc_data->vbi_value) - - rsrc_data->first_line) / 2) + - rsrc_data->first_line; - if (epoch0_irq_mask > rsrc_data->last_line) - epoch0_irq_mask = rsrc_data->last_line; + rsrc_data->first_line) / 2); + if (epoch0_irq_mask > (rsrc_data->last_line - rsrc_data->first_line)) + epoch0_irq_mask = (rsrc_data->last_line - + rsrc_data->first_line); epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg & 0xFFFF; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c index 14960449e497..4a109ba7802d 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c @@ -426,10 +426,11 @@ static int cam_vfe_camif_resource_start( default: epoch0_irq_mask = (((rsrc_data->last_line + rsrc_data->vbi_value) - - rsrc_data->first_line) / 2) + + rsrc_data->first_line) / 2); + if ((epoch0_irq_mask) > + (rsrc_data->last_line - rsrc_data->first_line)) + epoch0_irq_mask = rsrc_data->last_line - rsrc_data->first_line; - if (epoch0_irq_mask > rsrc_data->last_line) - epoch0_irq_mask = rsrc_data->last_line; epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg & 0xFFFF; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c index 73b0114ba57f..49e76452c165 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c @@ -471,8 +471,10 @@ static int cam_vfe_camif_ver3_resource_start( epoch0_line_cfg = ((rsrc_data->last_line + rsrc_data->vbi_value) - rsrc_data->first_line) / 4; - if (epoch0_line_cfg > rsrc_data->last_line) - epoch0_line_cfg = rsrc_data->last_line; + if ((epoch0_line_cfg * 2) > + (rsrc_data->last_line - rsrc_data->first_line)) + epoch0_line_cfg = (rsrc_data->last_line - + rsrc_data->first_line)/2; /* epoch line cfg will still be configured at midpoint of the * frame width. We use '/ 4' instead of '/ 2' * cause it is multipixel path diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c index 85868105bb74..ec9e48237f75 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c @@ -307,9 +307,9 @@ static int cam_vfe_fe_resource_start( /* epoch config */ epoch0_irq_mask = (((rsrc_data->last_line + rsrc_data->vbi_value) - - rsrc_data->first_line) / 2) + rsrc_data->first_line; - if (epoch0_irq_mask > rsrc_data->last_line) - epoch0_irq_mask = rsrc_data->last_line; + rsrc_data->first_line) / 2); + if (epoch0_irq_mask > (rsrc_data->last_line - rsrc_data->first_line)) + epoch0_irq_mask = rsrc_data->last_line - rsrc_data->first_line; epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg & 0xFFFF; computed_epoch_line_cfg = (epoch0_irq_mask << 16) | epoch1_irq_mask;