From 393227672bff876f83e40d13c50defbb4bcb026b Mon Sep 17 00:00:00 2001 From: Jeonghee Kim Date: Thu, 17 May 2018 19:37:07 +0900 Subject: [PATCH] [COMMON] media: mfc: parse dts for checking nal_q Change-Id: I39f8dd4fcdd601d7489c3c8208ffd1960c8a3dc0 Signed-off-by: Jeonghee Kim --- drivers/media/platform/exynos/mfc/s5p_mfc.c | 15 ++++++--------- .../platform/exynos/mfc/s5p_mfc_data_struct.h | 3 +-- .../media/platform/exynos/mfc/s5p_mfc_hwlock.c | 11 +++-------- drivers/media/platform/exynos/mfc/s5p_mfc_irq.c | 4 ---- drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c | 2 -- 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc.c b/drivers/media/platform/exynos/mfc/s5p_mfc.c index ba4c8566ed99..b7aae8e2571c 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc.c @@ -393,11 +393,11 @@ static int mfc_init_instance(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx) s5p_mfc_release_hwlock_dev(dev); -#ifdef NAL_Q_ENABLE - dev->nal_q_handle = s5p_mfc_nal_q_create(dev); - if (dev->nal_q_handle == NULL) - mfc_err_dev("NAL Q: Can't create nal q\n"); -#endif + if (dev->pdata->nal_q) { + dev->nal_q_handle = s5p_mfc_nal_q_create(dev); + if (dev->nal_q_handle == NULL) + mfc_err_dev("NAL Q: Can't create nal q\n"); + } return ret; @@ -737,7 +737,6 @@ static int s5p_mfc_release(struct file *file) } #endif -#ifdef NAL_Q_ENABLE if (dev->nal_q_handle) { ret = s5p_mfc_nal_q_destroy(dev, dev->nal_q_handle); if (ret) { @@ -745,7 +744,6 @@ static int s5p_mfc_release(struct file *file) goto err_release; } } -#endif } s5p_mfc_qos_off(ctx); @@ -796,12 +794,10 @@ static int s5p_mfc_release(struct file *file) mutex_unlock(&dev->mfc_mutex); return ret; -#if defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) || defined(NAL_Q_ENABLE) err_release: s5p_mfc_release_hwlock_ctx(ctx); mutex_unlock(&dev->mfc_mutex); return ret; -#endif err_release_try: s5p_mfc_release_hwlock_ctx(ctx); @@ -948,6 +944,7 @@ static void mfc_parse_dt(struct device_node *np, struct s5p_mfc_dev *mfc) of_property_read_u32(np, "ip_ver", &pdata->ip_ver); of_property_read_u32(np, "debug_mode", &pdata->debug_mode); + of_property_read_u32(np, "nal_q", &pdata->nal_q); #ifdef CONFIG_MFC_USE_BUS_DEVFREQ of_property_read_u32(np, "num_qos_steps", &pdata->num_qos_steps); of_property_read_u32(np, "max_qos_steps", &pdata->max_qos_steps); 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 b1faf6930c7a..1d738dbbc4a5 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -372,6 +372,7 @@ struct s5p_mfc_qos { struct s5p_mfc_platdata { int ip_ver; int debug_mode; + int nal_q; #ifdef CONFIG_MFC_USE_BUS_DEVFREQ int num_qos_steps; int max_qos_steps; @@ -381,8 +382,6 @@ struct s5p_mfc_platdata { }; /************************ NAL_Q data structure ************************/ -#define NAL_Q_ENABLE 1 - #define NAL_Q_IN_ENTRY_SIZE 256 #define NAL_Q_OUT_ENTRY_SIZE 256 diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c index d4e394f06113..62ea0d64ab05 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c @@ -200,11 +200,10 @@ int s5p_mfc_get_hwlock_dev(struct s5p_mfc_dev *dev) mutex_unlock(&dev->hwlock_wq.wait_mutex); } -#ifdef NAL_Q_ENABLE /* Stop NAL-Q after getting hwlock */ if (dev->nal_q_handle) s5p_mfc_nal_q_stop_if_started(dev); -#endif + return 0; } @@ -293,11 +292,10 @@ int s5p_mfc_get_hwlock_ctx(struct s5p_mfc_ctx *curr_ctx) mutex_unlock(&curr_ctx->hwlock_wq.wait_mutex); } -#ifdef NAL_Q_ENABLE /* Stop NAL-Q after getting hwlock */ if (dev->nal_q_handle) s5p_mfc_nal_q_stop_if_started(dev); -#endif + return 0; } @@ -624,7 +622,6 @@ void s5p_mfc_cache_flush(struct s5p_mfc_dev *dev, int is_drm) s5p_mfc_pm_clock_on_with_base(dev, (is_drm ? MFCBUF_DRM : MFCBUF_NORMAL)); } -#ifdef NAL_Q_ENABLE /* * Return value description * 0: NAL-Q is handled successfully @@ -725,7 +722,6 @@ static int mfc_nal_q_just_run(struct s5p_mfc_ctx *ctx, int need_cache_flush) return ret; } -#endif static int mfc_just_run_dec(struct s5p_mfc_ctx *ctx) { @@ -864,7 +860,6 @@ int s5p_mfc_just_run(struct s5p_mfc_dev *dev, int new_ctx_index) mfc_debug(2, "need_cache_flush = %d, is_drm = %d\n", need_cache_flush, ctx->is_drm); -#ifdef NAL_Q_ENABLE if (dev->nal_q_handle) { ret = mfc_nal_q_just_run(ctx, need_cache_flush); if (ret == 0) { @@ -877,7 +872,7 @@ int s5p_mfc_just_run(struct s5p_mfc_dev *dev, int new_ctx_index) return ret; } } -#endif + mfc_debug(2, "continue_clock_on = %d\n", dev->continue_clock_on); if (!dev->continue_clock_on) { s5p_mfc_pm_clock_on(dev); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 61cd0bf355c5..afd50772dc48 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -1215,7 +1215,6 @@ irqreturn_t s5p_mfc_top_half_irq(int irq, void *priv) return IRQ_WAKE_THREAD; } -#ifdef NAL_Q_ENABLE /* * Return value description * 0: NAL-Q is handled successfully @@ -1286,7 +1285,6 @@ static inline int mfc_nal_q_irq(struct s5p_mfc_dev *dev, return ret; } -#endif static inline int mfc_handle_done_frame(struct s5p_mfc_ctx *ctx, unsigned int reason, unsigned int err) @@ -1489,7 +1487,6 @@ irqreturn_t s5p_mfc_irq(int irq, void *priv) 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); if (ret == 0) { @@ -1503,7 +1500,6 @@ irqreturn_t s5p_mfc_irq(int irq, void *priv) goto irq_end; } } -#endif ret = mfc_irq_dev(dev, reason, err); if (!ret) 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 894a3f7317d5..052fb4615317 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c @@ -24,7 +24,6 @@ #include "s5p_mfc_buf.h" #include "s5p_mfc_mem.h" -#ifdef NAL_Q_ENABLE #define CBR_I_LIMIT_MAX 5 int s5p_mfc_nal_q_check_enable(struct s5p_mfc_dev *dev) { @@ -1974,4 +1973,3 @@ void s5p_mfc_nal_q_flush_DecoderOutputStr(struct s5p_mfc_dev *dev, DecoderOutput MFC_WRITEL(pStr->PictureTimeBot, S5P_FIMV_D_RET_PICTURE_TIME_BOT); // 0xF680 } #endif -#endif -- 2.20.1