From: Ayoung Sim Date: Mon, 2 Apr 2018 04:49:38 +0000 (+0900) Subject: media: mfc: DRV3.2: expand debugging mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c554d86b1ada42fca7fd5bc1ea994c4455720d6;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git media: mfc: DRV3.2: expand debugging mode Change-Id: I817e12b450ea0229b6cc9985c774012ac4974767 Signed-off-by: Ayoung Sim --- diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc.c b/drivers/media/platform/exynos/mfc/s5p_mfc.c index 31631127599e..17e66ca69d8e 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc.c @@ -341,6 +341,7 @@ static int mfc_init_instance(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx) dev->drm_fw_buf.daddr, 0, 0); if (ret != DRMDRV_OK) { mfc_err_ctx("failed MFC DRM F/W prot(%#x)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); dev->fw.drm_status = 0; } else { dev->fw.drm_status = 1; @@ -410,8 +411,10 @@ err_context_alloc: /* Request buffer unprotection for DRM F/W */ smc_ret = exynos_smc(SMC_DRM_PPMP_MFCFW_UNPROT, dev->drm_fw_buf.daddr, 0, 0); - if (smc_ret != DRMDRV_OK) + if (smc_ret != DRMDRV_OK) { mfc_err_ctx("failed MFC DRM F/W unprot(%#x)\n", smc_ret); + call_dop(dev, dump_and_stop_debug_mode, dev); + } } #endif @@ -720,6 +723,7 @@ static int s5p_mfc_release(struct file *file) dev->drm_fw_buf.daddr, 0, 0); if (ret != DRMDRV_OK) { mfc_err_ctx("failed MFC DRM F/W unprot(%#x)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_release; } } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index af512fa88347..6ca13cafa96c 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -1261,6 +1261,18 @@ static int mfc_handle_seq_enc(struct s5p_mfc_ctx *ctx) return 0; } +static inline int is_err_condition(unsigned int err) +{ + if (err == S5P_FIMV_ERR_NO_AVAILABLE_DPB || + err == S5P_FIMV_ERR_INSUFFICIENT_DPB_SIZE || + err == S5P_FIMV_ERR_INSUFFICIENT_NUM_DPB || + err == S5P_FIMV_ERR_INSUFFICIENT_MV_BUF_SIZE || + err == S5P_FIMV_ERR_INSUFFICIENT_SCRATCH_BUF_SIZE) + return 1; + + return 0; +} + irqreturn_t s5p_mfc_top_half_irq(int irq, void *priv) { struct s5p_mfc_dev *dev = priv; @@ -1524,6 +1536,7 @@ irqreturn_t s5p_mfc_irq(int irq, void *priv) if (s5p_mfc_pm_get_pwr_ref_cnt(dev) == 0) { mfc_err_dev("no mfc power on\n"); + call_dop(dev, dump_and_stop_debug_mode, dev); goto irq_end; } @@ -1545,6 +1558,9 @@ irqreturn_t s5p_mfc_irq(int irq, void *priv) (err && (reason != S5P_FIMV_R2H_CMD_ERR_RET))) call_dop(dev, dump_regs, dev); + if (is_err_condition(err)) + call_dop(dev, dump_and_stop_debug_mode, dev); + #ifdef NAL_Q_ENABLE if (dev->nal_q_handle) { ret = mfc_nal_q_irq(dev, reason, err); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_mem.c b/drivers/media/platform/exynos/mfc/s5p_mfc_mem.c index 9fe6c624b133..a5deb58065b0 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_mem.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_mem.c @@ -114,6 +114,7 @@ int s5p_mfc_mem_ion_alloc(struct s5p_mfc_dev *dev, if (IS_ERR(special_buf->dma_buf)) { mfc_err_ctx("Failed to allocate buffer (err %ld)\n", PTR_ERR(special_buf->dma_buf)); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_ion_alloc; } @@ -121,6 +122,7 @@ int s5p_mfc_mem_ion_alloc(struct s5p_mfc_dev *dev, if (IS_ERR(special_buf->attachment)) { mfc_err_ctx("Failed to get dma_buf_attach (err %ld)\n", PTR_ERR(special_buf->attachment)); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_attach; } @@ -129,6 +131,7 @@ int s5p_mfc_mem_ion_alloc(struct s5p_mfc_dev *dev, if (IS_ERR(special_buf->sgt)) { mfc_err_ctx("Failed to get sgt (err %ld)\n", PTR_ERR(special_buf->sgt)); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_map; } @@ -137,6 +140,7 @@ int s5p_mfc_mem_ion_alloc(struct s5p_mfc_dev *dev, if (IS_ERR_VALUE(special_buf->daddr)) { mfc_err_ctx("Failed to allocate iova (err 0x%p)\n", &special_buf->daddr); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_iovmm; } @@ -144,6 +148,7 @@ int s5p_mfc_mem_ion_alloc(struct s5p_mfc_dev *dev, if (IS_ERR(special_buf->vaddr)) { mfc_err_ctx("Failed to get vaddr (err 0x%p)\n", &special_buf->vaddr); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_vaddr; } @@ -222,6 +227,7 @@ int s5p_mfc_bufcon_get_daddr(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *mfc_bu if (IS_ERR(mfc_buf->dmabufs[i][plane])) { mfc_err_ctx("Failed to get dma_buf (err %ld)", PTR_ERR(mfc_buf->dmabufs[i][plane])); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_get_daddr; } @@ -229,6 +235,7 @@ int s5p_mfc_bufcon_get_daddr(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *mfc_bu if (IS_ERR(mfc_buf->attachments[i][plane])) { mfc_err_ctx("Failed to get dma_buf_attach (err %ld)", PTR_ERR(mfc_buf->attachments[i][plane])); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_get_daddr; } @@ -237,6 +244,7 @@ int s5p_mfc_bufcon_get_daddr(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *mfc_bu if (IS_ERR_VALUE(mfc_buf->addr[i][plane])) { mfc_err_ctx("Failed to allocate iova (err %pa)", &mfc_buf->addr[i][plane]); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_get_daddr; } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_pm.c b/drivers/media/platform/exynos/mfc/s5p_mfc_pm.c index 59a81b12f96a..e301b539022a 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_pm.c @@ -48,6 +48,7 @@ int s5p_mfc_pm_clock_on(struct s5p_mfc_dev *dev) ret = clk_enable(dev->pm.clock); if (ret < 0) { mfc_err_dev("clk_enable failed (%d)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); return ret; } dev->pm.clock_on_steps |= 0x1 << 1; @@ -67,6 +68,7 @@ int s5p_mfc_pm_clock_on(struct s5p_mfc_dev *dev) dev->pm.clock_on_steps |= 0x1 << 3; if (ret != DRMDRV_OK) { mfc_err_dev("Protection Enable failed! ret(%u)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); spin_unlock_irqrestore(&dev->pm.clklock, flags); clk_disable(dev->pm.clock); return -EACCES; @@ -125,6 +127,7 @@ void s5p_mfc_pm_clock_off(struct s5p_mfc_dev *dev) dev->id, SMC_PROTECTION_DISABLE); if (ret != DRMDRV_OK) { mfc_err_dev("Protection Disable failed! ret(%u)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); spin_unlock_irqrestore(&dev->pm.clklock, flags); clk_disable(dev->pm.clock); return; @@ -152,6 +155,7 @@ int s5p_mfc_pm_power_on(struct s5p_mfc_dev *dev) ret = pm_runtime_get_sync(dev->pm.device); if (ret < 0) { mfc_err_dev("Failed to get power: ret(%d)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); goto err_power_on; } @@ -196,6 +200,7 @@ int s5p_mfc_pm_power_off(struct s5p_mfc_dev *dev) ret = pm_runtime_put_sync(dev->pm.device); if (ret < 0) { mfc_err_dev("Failed to put power: ret(%d)\n", ret); + call_dop(dev, dump_and_stop_debug_mode, dev); return ret; } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_regs_v10.h b/drivers/media/platform/exynos/mfc/s5p_mfc_regs_v10.h index 25613bd5451b..af8ce4faab72 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_regs_v10.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_regs_v10.h @@ -524,9 +524,14 @@ #define S5P_FIMV_WARN_STATUS_MASK 0xFFFF #define S5P_FIMV_WARN_STATUS_SHIFT 16 /* Error number */ +#define S5P_FIMV_ERR_NO_AVAILABLE_DPB 33 #define S5P_FIMV_ERR_NO_KEY_FRAME 34 #define S5P_FIMV_ERR_VPS_ONLY_ERROR 42 +#define S5P_FIMV_ERR_INSUFFICIENT_DPB_SIZE 57 +#define S5P_FIMV_ERR_INSUFFICIENT_NUM_DPB 58 +#define S5P_FIMV_ERR_INSUFFICIENT_MV_BUF_SIZE 60 #define S5P_FIMV_ERR_NULL_SCRATCH 61 +#define S5P_FIMV_ERR_INSUFFICIENT_SCRATCH_BUF_SIZE 62 #define S5P_FIMV_ERR_UNSUPPORTED_FEATURE 100 #define S5P_FIMV_ERR_UNSUPPORTED_RESOLUTION 101