From 2f6c60ca4fac5653141f83195a6381be148343cd Mon Sep 17 00:00:00 2001 From: Shubhraprakash Das Date: Mon, 14 Nov 2016 13:52:59 -0800 Subject: [PATCH] msm: camera: isp: Fix stats recovery Stats buffer done was not coming after device reset because the sequence for turning on stats was not right. Follow the same sequence which is followed on start stream for stats during recovery. Also, for vfe 46 version fix the write master offset. CRs-Fixed: 1089758 Change-Id: I47849097022817dc411c31e3aadf037f6cae9a72 Signed-off-by: Shubhraprakash Das --- .../platform/msm/camera_v2/isp/msm_isp40.c | 2 +- .../platform/msm/camera_v2/isp/msm_isp44.c | 2 +- .../platform/msm/camera_v2/isp/msm_isp46.c | 4 +-- .../platform/msm/camera_v2/isp/msm_isp47.c | 2 +- .../msm/camera_v2/isp/msm_isp_stats_util.c | 26 ++++++++++++------- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c index bbabb4a9d723..2d937fc3ed05 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c @@ -754,7 +754,7 @@ static long msm_vfe40_reset_hardware(struct vfe_device *vfe_dev, msm_camera_io_w(0xFEFFFEFF, vfe_dev->vfe_base + 0x34); msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x24); vfe_dev->hw_info->vfe_ops.axi_ops. - reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0001FFFF); + reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0003FFFF); } diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp44.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp44.c index 8fb239045013..15820b5f398b 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp44.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp44.c @@ -587,7 +587,7 @@ static long msm_vfe44_reset_hardware(struct vfe_device *vfe_dev, msm_camera_io_w(0xFEFFFEFF, vfe_dev->vfe_base + 0x34); msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x24); vfe_dev->hw_info->vfe_ops.axi_ops. - reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0001FFFF); + reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0031FFFF); } if (blocking_call) { diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp46.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp46.c index 3b312171fad1..23fbc4f5e33a 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp46.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp46.c @@ -90,7 +90,7 @@ static uint8_t stats_pingpong_offset_map[] = { uint32_t msm_vfe46_ub_reg_offset(struct vfe_device *vfe_dev, int wm_idx) { - return (VFE46_WM_BASE(wm_idx) + 0x18); + return (VFE46_WM_BASE(wm_idx) + 0x10); } uint32_t msm_vfe46_get_ub_size(struct vfe_device *vfe_dev) @@ -526,7 +526,7 @@ static long msm_vfe46_reset_hardware(struct vfe_device *vfe_dev, msm_camera_io_w(0xFFFFFEFF, vfe_dev->vfe_base + 0x68); msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x58); vfe_dev->hw_info->vfe_ops.axi_ops. - reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0001FFFF); + reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0031FFFF); } if (blocking_call) { diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c index d10a6e98d02f..56056849e140 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c @@ -755,7 +755,7 @@ long msm_vfe47_reset_hardware(struct vfe_device *vfe_dev, msm_camera_io_w(0xFFFFFEFF, vfe_dev->vfe_base + 0x68); msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x58); vfe_dev->hw_info->vfe_ops.axi_ops. - reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0001FFFF); + reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0031FFFF); } if (blocking_call) { diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c index c9c68247828a..22a7f6886964 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c @@ -848,7 +848,6 @@ int msm_isp_stats_reset(struct vfe_device *vfe_dev) struct msm_vfe_stats_stream *stream_info = NULL; struct msm_isp_timestamp timestamp; unsigned long flags; - int k; msm_isp_get_timestamp(×tamp, vfe_dev); @@ -877,15 +876,6 @@ int msm_isp_stats_reset(struct vfe_device *vfe_dev) ISP_EVENT_BUF_FATAL_ERROR); return rc; } - for (k = 0; k < stream_info->num_isp; k++) { - struct vfe_device *temp_vfe_dev = - stream_info->vfe_dev[k]; - temp_vfe_dev->hw_info->vfe_ops.stats_ops. - cfg_wm_irq_mask( - temp_vfe_dev, stream_info); - temp_vfe_dev->hw_info->vfe_ops.stats_ops.enable_module( - temp_vfe_dev, BIT(i), 1); - } } return rc; @@ -912,6 +902,22 @@ int msm_isp_stats_restart(struct vfe_device *vfe_dev) stream_info->composite_irq[j] = 0; msm_isp_init_stats_ping_pong_reg( stream_info); + for (j = 0; j < stream_info->num_isp; j++) { + struct vfe_device *temp_vfe_dev = + stream_info->vfe_dev[j]; + uint8_t comp_flag = stream_info->composite_flag; + + temp_vfe_dev->hw_info->vfe_ops.stats_ops.enable_module( + temp_vfe_dev, BIT(i), 1); + if (comp_flag) + temp_vfe_dev->hw_info->vfe_ops.stats_ops. + cfg_comp_mask(temp_vfe_dev, BIT(i), + (comp_flag - 1), 1); + else + temp_vfe_dev->hw_info->vfe_ops.stats_ops. + cfg_wm_irq_mask( + temp_vfe_dev, stream_info); + } spin_unlock_irqrestore(&stream_info->lock, flags); }