From 93cc05f3670163f74a0596311b44e1e20b7da43f Mon Sep 17 00:00:00 2001 From: Ayoung Sim Date: Wed, 14 Mar 2018 09:52:20 +0900 Subject: [PATCH] media: mfc: DRV3.2: support dump call-back function struct s5p_mfc_dump_ops supports the information dump function by call-back. This is for maintain the layer of the driver. Function of any layer can call the dump function using "call_dop()" macro, because it exists in the lowest layer. Change-Id: Ic452aa316d10ddb6194444fe7aa3f707080d49ae Signed-off-by: Ayoung Sim --- drivers/media/platform/exynos/mfc/s5p_mfc.c | 7 +++++-- drivers/media/platform/exynos/mfc/s5p_mfc_common.h | 4 ++++ drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c | 7 +++---- drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h | 6 ++++++ drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c | 5 +---- drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c | 2 -- drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c | 5 ++--- drivers/media/platform/exynos/mfc/s5p_mfc_irq.c | 1 - drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c | 3 +-- drivers/media/platform/exynos/mfc/s5p_mfc_otf.c | 1 - drivers/media/platform/exynos/mfc/s5p_mfc_reg.c | 2 -- drivers/media/platform/exynos/mfc/s5p_mfc_utils.c | 2 -- drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.c | 8 ++++++-- drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.h | 1 - 14 files changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc.c b/drivers/media/platform/exynos/mfc/s5p_mfc.c index 3eadb229fa53..31631127599e 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc.c @@ -635,7 +635,7 @@ static int mfc_wait_close_inst(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx) S5P_FIMV_R2H_CMD_CLOSE_INSTANCE_RET)) { mfc_err_ctx("waiting once more but timed out\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_CLOSE_INST); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); } } @@ -902,7 +902,7 @@ int s5p_mfc_sysmmu_fault_handler(struct iommu_domain *iodmn, struct device *devi dev->logging_data->fault_addr = (unsigned int)addr; s5p_mfc_dump_buffer_info(dev, addr); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); return 0; } @@ -1190,6 +1190,9 @@ static int s5p_mfc_probe(struct platform_device *pdev) } INIT_WORK(&dev->butler_work, s5p_mfc_butler_worker); + /* dump information call-back function */ + dev->dump_ops = &mfc_dump_ops; + #ifdef CONFIG_MFC_USE_BUS_DEVFREQ atomic_set(&dev->qos_req_cur, 0); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h index 7dc722fad617..f39cf55d3985 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h @@ -83,6 +83,10 @@ (((c)->c_ops->op) ? \ ((c)->c_ops->op(args)) : 0) +#define call_dop(d, op, args...) \ + (((d)->dump_ops->op) ? \ + ((d)->dump_ops->op(args)) : 0) + #define MFC_CTRL_TYPE_GET (MFC_CTRL_TYPE_GET_SRC | MFC_CTRL_TYPE_GET_DST) #define MFC_CTRL_TYPE_SRC (MFC_CTRL_TYPE_SET | MFC_CTRL_TYPE_GET_SRC) #define MFC_CTRL_TYPE_DST (MFC_CTRL_TYPE_GET_DST) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c b/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c index ee15f5e2fa88..03422ec28cd7 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c @@ -14,7 +14,6 @@ #include "s5p_mfc_hwlock.h" #include "s5p_mfc_nal_q.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_sync.h" #include "s5p_mfc_pm.h" @@ -259,7 +258,7 @@ int s5p_mfc_sleep(struct s5p_mfc_dev *dev) if (s5p_mfc_wait_for_done_dev(dev, S5P_FIMV_R2H_CMD_SLEEP_RET)) { mfc_err_dev("Failed to SLEEP\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_SLEEP); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); return -EIO; } @@ -335,7 +334,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) if (s5p_mfc_wait_for_done_dev(dev, S5P_FIMV_R2H_CMD_FW_STATUS_RET)) { mfc_err_dev("Failed to RISC_ON\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_RISC_ON); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); return -EIO; } @@ -346,7 +345,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) if (s5p_mfc_wait_for_done_dev(dev, S5P_FIMV_R2H_CMD_WAKEUP_RET)) { mfc_err_dev("Failed to WAKEUP\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_WAKEUP); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); return -EIO; } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h index 6573a38b938d..19dcf6aa1805 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -650,6 +650,11 @@ struct s5p_mfc_perf { int drv_margin; }; +extern struct s5p_mfc_dump_ops mfc_dump_ops; +struct s5p_mfc_dump_ops { + void (*dump_and_stop_always)(struct s5p_mfc_dev *dev); +}; + /** * struct s5p_mfc_dev - The struct containing driver internal parameters. */ @@ -753,6 +758,7 @@ struct s5p_mfc_dev { #endif struct s5p_mfc_debugfs debugfs; + struct s5p_mfc_dump_ops *dump_ops; struct s5p_mfc_perf perf; }; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c index cadcd56f31fa..f5e48ed46678 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c @@ -14,12 +14,9 @@ #include "s5p_mfc_hwlock.h" #include "s5p_mfc_nal_q.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_opr.h" #include "s5p_mfc_sync.h" -#include "s5p_mfc_pm.h" - #include "s5p_mfc_queue.h" #include "s5p_mfc_utils.h" #include "s5p_mfc_buf.h" @@ -531,7 +528,7 @@ static void s5p_mfc_dec_stop_streaming(struct vb2_queue *q) if (s5p_mfc_wait_for_done_ctx(ctx, S5P_FIMV_R2H_CMD_DPB_FLUSH_RET)) { mfc_err_ctx("time out during DPB flush\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_DPB_FLUSH); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); } s5p_mfc_change_state(ctx, prev_state); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c index f31adbc3f3b6..efe7a187e24c 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c @@ -17,8 +17,6 @@ #include "s5p_mfc_opr.h" #include "s5p_mfc_sync.h" -#include "s5p_mfc_pm.h" - #include "s5p_mfc_qos.h" #include "s5p_mfc_queue.h" #include "s5p_mfc_utils.h" diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c index 83e5138bb2fd..21c7beab17cb 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c @@ -14,7 +14,6 @@ #include "s5p_mfc_nal_q.h" #include "s5p_mfc_otf.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_opr.h" #include "s5p_mfc_sync.h" @@ -617,7 +616,7 @@ void s5p_mfc_cache_flush(struct s5p_mfc_dev *dev, int is_drm) if (s5p_mfc_wait_for_done_dev(dev, S5P_FIMV_R2H_CMD_CACHE_FLUSH_RET)) { mfc_err_dev("Failed to CACHE_FLUSH\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_CHACHE_FLUSH); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); } s5p_mfc_pm_clock_off(dev); @@ -696,7 +695,7 @@ static int mfc_nal_q_just_run(struct s5p_mfc_ctx *ctx, int need_cache_flush) S5P_FIMV_R2H_CMD_COMPLETE_QUEUE_RET)) { mfc_err_dev("NAL Q: Failed to stop queue.\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_STOP_NAL_Q); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); } nal_q_handle->nal_q_exception = 0; ret = 1; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 4843b02b8908..957edd69a945 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -15,7 +15,6 @@ #include "s5p_mfc_hwlock.h" #include "s5p_mfc_nal_q.h" #include "s5p_mfc_otf.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_opr.h" #include "s5p_mfc_sync.h" diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c index 02578cf2ca17..d6e097b48d85 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c @@ -12,7 +12,6 @@ #include "s5p_mfc_nal_q.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_sync.h" #include "s5p_mfc_pm.h" @@ -481,7 +480,7 @@ void s5p_mfc_nal_q_stop_if_started(struct s5p_mfc_dev *dev) S5P_FIMV_R2H_CMD_COMPLETE_QUEUE_RET)) { mfc_err_dev("NAL Q: Failed to stop qeueue during get hwlock\n"); dev->logging_data->cause |= (1 << MFC_CAUSE_FAIL_STOP_NAL_Q_FOR_OTHER); - s5p_mfc_dump_info_and_stop_hw(dev); + call_dop(dev, dump_and_stop_always, dev); } mfc_debug_leave(); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_otf.c b/drivers/media/platform/exynos/mfc/s5p_mfc_otf.c index c5be3770fbf6..a54252b656b7 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_otf.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_otf.c @@ -21,7 +21,6 @@ #include "s5p_mfc_otf.h" #include "s5p_mfc_hwfc_internal.h" -#include "s5p_mfc_watchdog.h" #include "s5p_mfc_sync.h" #include "s5p_mfc_inst.h" diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c index 3c515b82746b..e8c77f03de7c 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c @@ -14,8 +14,6 @@ #include "s5p_mfc_reg.h" -#include "s5p_mfc_mem.h" - void s5p_mfc_dbg_enable(struct s5p_mfc_dev *dev) { mfc_debug(2, "MFC debug info enable\n"); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c b/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c index d71512633dd4..4a014a6bc47a 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c @@ -14,8 +14,6 @@ #include "s5p_mfc_utils.h" -#include "s5p_mfc_mem.h" - int s5p_mfc_check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) { if (!fmt) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.c b/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.c index c22b9c3fbc4c..0009f79cdf26 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.c @@ -264,7 +264,7 @@ void s5p_mfc_dump_buffer_info(struct s5p_mfc_dev *dev, unsigned long addr) } } -void s5p_mfc_dump_info_and_stop_hw(struct s5p_mfc_dev *dev) +static void mfc_dump_info_and_stop_hw(struct s5p_mfc_dev *dev) { MFC_TRACE_DEV("** mfc will stop!!!\n"); mfc_display_state(dev); @@ -316,5 +316,9 @@ void s5p_mfc_watchdog_worker(struct work_struct *work) atomic_set(&dev->watchdog_tick_cnt, 0); /* Stop after dumping information */ - s5p_mfc_dump_info_and_stop_hw(dev); + mfc_dump_info_and_stop_hw(dev); } + +struct s5p_mfc_dump_ops mfc_dump_ops = { + .dump_and_stop_always = mfc_dump_info_and_stop_hw, +}; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.h b/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.h index 7867d1229dcc..d72f15634c14 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_watchdog.h @@ -16,7 +16,6 @@ #include "s5p_mfc_common.h" void s5p_mfc_dump_buffer_info(struct s5p_mfc_dev *dev, unsigned long addr); -void s5p_mfc_dump_info_and_stop_hw(struct s5p_mfc_dev *dev); void s5p_mfc_watchdog_worker(struct work_struct *work); #endif /* __S5P_MFC_WATCHDOG_H */ -- 2.20.1