[COMMON] media: mfc: parse dts for checking nal_q
authorJeonghee Kim <jhhhh.kim@samsung.com>
Thu, 17 May 2018 10:37:07 +0000 (19:37 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Tue, 29 May 2018 06:59:18 +0000 (15:59 +0900)
Change-Id: I39f8dd4fcdd601d7489c3c8208ffd1960c8a3dc0
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc.c
drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h
drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c
drivers/media/platform/exynos/mfc/s5p_mfc_irq.c
drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c

index ba4c8566ed99cf340f23868621cf9dcfda4cd731..b7aae8e2571c97c5bfefbafa7512b39fccff0bc7 100644 (file)
@@ -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);
index b1faf6930c7ab9f0e165dafcf004d87b0016f293..1d738dbbc4a5e8fa234aeac8127fcd9de97f7ed7 100644 (file)
@@ -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
 
index d4e394f06113aa09b215a5f7188c4f98ebeae15b..62ea0d64ab05e1a9d29d63684a2525164864c08c 100644 (file)
@@ -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);
index 61cd0bf355c54b0a46bcdebd1691c27c0f6b72d5..afd50772dc48df7bc36313c8f032db5b7ac9e7f5 100644 (file)
@@ -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)
index 894a3f7317d5e162208f99928ebe811a6cac915e..052fb4615317b4ab253f39b59709a862e09f57eb 100644 (file)
@@ -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