From c1daddbcd47564927cdd0b3bb2395c9f14b0bbfa Mon Sep 17 00:00:00 2001 From: Jeonghee Kim Date: Fri, 19 Jan 2018 11:02:27 +0900 Subject: [PATCH] media: mfc: add ifdef for BTS interface. Change-Id: I9e62082d35476446d4ff7722be220cb3c485085e Signed-off-by: Jeonghee Kim --- .../platform/exynos/mfc/s5p_mfc_data_struct.h | 4 +- .../media/platform/exynos/mfc/s5p_mfc_qos.c | 48 +++++++++++++++++-- 2 files changed, 47 insertions(+), 5 deletions(-) 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 e9c6399aa9a8..cf7c2c1b80a1 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -19,6 +19,8 @@ #ifdef CONFIG_MFC_USE_BUS_DEVFREQ #include +#endif +#ifdef CONFIG_EXYNOS_BTS #include #endif #include @@ -728,7 +730,7 @@ struct s5p_mfc_dev { struct s5p_mfc_special_buf dbg_info_buf; -#ifdef CONFIG_MFC_USE_BUS_DEVFREQ +#ifdef CONFIG_EXYNOS_BTS struct bts_bw mfc_bw; #endif diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c index c92fe7b28ddc..6a41dd1f2a2a 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c @@ -11,7 +11,9 @@ */ #include +#ifdef CONFIG_EXYNOS_BTS #include +#endif #include "s5p_mfc_qos.h" @@ -50,9 +52,11 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) qos_table[idx].freq_kfc); #endif +#ifdef CONFIG_EXYNOS_BTS bts_update_scen(BS_MFC_UHD_ENC60, qos_table[idx].mo_uhd_enc60_value); bts_update_scen(BS_MFC_UHD_10BIT, qos_table[idx].mo_10bit_value); bts_update_scen(BS_MFC_UHD, qos_table[idx].mo_value); +#endif atomic_set(&dev->qos_req_cur, idx + 1); MFC_TRACE_CTX("-- QOS add[%d] (int:%d, mif:%d, mo:%d, mo_10bit:%d, mo_uhd_enc:%d)\n", @@ -80,9 +84,11 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) qos_table[idx].freq_kfc); #endif +#ifdef CONFIG_EXYNOS_BTS bts_update_scen(BS_MFC_UHD_ENC60, qos_table[idx].mo_uhd_enc60_value); bts_update_scen(BS_MFC_UHD_10BIT, qos_table[idx].mo_10bit_value); bts_update_scen(BS_MFC_UHD, qos_table[idx].mo_value); +#endif atomic_set(&dev->qos_req_cur, idx + 1); MFC_TRACE_CTX("-- QOS update[%d] (int:%d, mif:%d, mo:%d, mo_10bit:%d, mo_uhd_enc:%d)\n", @@ -105,6 +111,7 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) pm_qos_remove_request(&dev->qos_req_cluster0); #endif +#ifdef CONFIG_EXYNOS_BTS bts_update_scen(BS_MFC_UHD_ENC60, 0); bts_update_scen(BS_MFC_UHD_10BIT, 0); bts_update_scen(BS_MFC_UHD, 0); @@ -113,12 +120,14 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) dev->mfc_bw.read = 0; dev->mfc_bw.write = 0; bts_update_bw(BTS_BW_MFC, dev->mfc_bw); +#endif atomic_set(&dev->qos_req_cur, 0); MFC_TRACE_CTX("-- QOS remove\n"); mfc_debug(2, "QoS remove\n"); break; case MFC_QOS_BW: +#ifdef CONFIG_EXYNOS_BTS MFC_TRACE_CTX("++ QOS BW (peak: %d, read: %d, write: %d)\n", dev->mfc_bw.peak, dev->mfc_bw.read, dev->mfc_bw.write); @@ -128,6 +137,7 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) dev->mfc_bw.peak, dev->mfc_bw.read, dev->mfc_bw.write); mfc_debug(2, "QoS BW, (peak: %d, read: %d, write: %d)\n", dev->mfc_bw.peak, dev->mfc_bw.read, dev->mfc_bw.write); +#endif break; default: mfc_err_ctx("Unknown request for opr [%d]\n", opr_type); @@ -135,7 +145,12 @@ static void mfc_qos_operate(struct s5p_mfc_ctx *ctx, int opr_type, int idx) } } +#ifdef CONFIG_EXYNOS_BTS static void mfc_qos_set(struct s5p_mfc_ctx *ctx, struct bts_bw *mfc_bw, int i) +#else +static void mfc_qos_set(struct s5p_mfc_ctx *ctx, int i) +#endif + { struct s5p_mfc_dev *dev = ctx->dev; struct s5p_mfc_platdata *pdata = dev->pdata; @@ -147,12 +162,14 @@ static void mfc_qos_set(struct s5p_mfc_ctx *ctx, struct bts_bw *mfc_bw, int i) pdata->max_mb : qos_table[i + 1].threshold_mb, qos_table[i].freq_int, qos_table[i].freq_mif); +#ifdef CONFIG_EXYNOS_BTS if (mfc_bw->peak != dev->mfc_bw.peak) { dev->mfc_bw.peak = mfc_bw->peak; dev->mfc_bw.read = mfc_bw->read; dev->mfc_bw.write = mfc_bw->write; mfc_qos_operate(ctx, MFC_QOS_BW, i); } +#endif if (atomic_read(&dev->qos_req_cur) == 0) mfc_qos_operate(ctx, MFC_QOS_ADD, i); @@ -261,6 +278,7 @@ static inline unsigned long mfc_qos_get_mb_per_second(struct s5p_mfc_ctx *ctx) return mfc_qos_get_weighted_mb(ctx, mb); } +#ifdef CONFIG_EXYNOS_BTS static struct s5p_mfc_qos_bw mfc_bw_info = { /* peak read write (KB/UHD frame) */ .h264_dec_uhd_bw = { 38131, 40206, 24870 }, @@ -376,6 +394,7 @@ static void mfc_qos_get_bw_per_second(struct s5p_mfc_ctx *ctx, struct bts_bw *mf mfc_bw->read = (unsigned int)read_bw_per_sec; mfc_bw->write = (unsigned int)write_bw_per_sec; } +#endif void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) { @@ -383,11 +402,13 @@ void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) struct s5p_mfc_platdata *pdata = dev->pdata; struct s5p_mfc_qos *qos_table = pdata->qos_table; struct s5p_mfc_ctx *qos_ctx; - struct bts_bw mfc_bw, mfc_bw_ctx; unsigned long hw_mb = 0, total_mb = 0; unsigned int fw_time, sw_time, total_fps = 0; int i, found = 0, enc_found = 0; int start_qos_step; +#ifdef CONFIG_EXYNOS_BTS + struct bts_bw mfc_bw, mfc_bw_ctx; +#endif list_for_each_entry(qos_ctx, &dev->qos_queue, qos_list) if (qos_ctx == ctx) @@ -396,19 +417,23 @@ void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) if (!found) list_add_tail(&ctx->qos_list, &dev->qos_queue); +#ifdef CONFIG_EXYNOS_BTS mfc_bw.peak = 0; mfc_bw.read = 0; mfc_bw.write = 0; +#endif /* get the hw macroblock */ list_for_each_entry(qos_ctx, &dev->qos_queue, qos_list) { if (OVER_UHD_ENC60(qos_ctx)) enc_found = 1; hw_mb += mfc_qos_get_mb_per_second(qos_ctx); + total_fps += (qos_ctx->framerate / 1000); +#ifdef CONFIG_EXYNOS_BTS mfc_qos_get_bw_per_second(qos_ctx, &mfc_bw_ctx); mfc_bw.peak += mfc_bw_ctx.peak; mfc_bw.read += mfc_bw_ctx.read; mfc_bw.write += mfc_bw_ctx.write; - total_fps += (qos_ctx->framerate / 1000); +#endif } start_qos_step = pdata->num_qos_steps; @@ -421,6 +446,7 @@ void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) sw_time = (MFC_DRV_TIME + fw_time); total_mb = ((1000000 * hw_mb) / (1000000 - (total_fps * sw_time))); + mfc_debug(4, "QoS table[%d] fw_time: %dus, hw_mb: %ld, " "sw_time: %d, total_fps: %d, total_mb: %ld\n", i, fw_time, hw_mb, sw_time, total_fps, total_mb); @@ -432,7 +458,11 @@ void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) if (total_mb > pdata->max_mb) mfc_debug(4, "QoS overspec mb %ld > %d\n", total_mb, pdata->max_mb); +#ifdef CONFIG_EXYNOS_BTS mfc_qos_set(ctx, &mfc_bw, i); +#else + mfc_qos_set(ctx, i); +#endif } void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) @@ -441,11 +471,13 @@ void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) struct s5p_mfc_platdata *pdata = dev->pdata; struct s5p_mfc_qos *qos_table = pdata->qos_table; struct s5p_mfc_ctx *qos_ctx; - struct bts_bw mfc_bw, mfc_bw_ctx; unsigned long hw_mb = 0, total_mb = 0; unsigned int fw_time, sw_time, total_fps = 0; int i, found = 0, enc_found = 0; int start_qos_step; +#ifdef CONFIG_EXYNOS_BTS + struct bts_bw mfc_bw, mfc_bw_ctx; +#endif if (list_empty(&dev->qos_queue)) { if (atomic_read(&dev->qos_req_cur) != 0) { @@ -455,9 +487,11 @@ void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) return; } +#ifdef CONFIG_EXYNOS_BTS mfc_bw.peak = 0; mfc_bw.read = 0; mfc_bw.write = 0; +#endif /* get the hw macroblock */ list_for_each_entry(qos_ctx, &dev->qos_queue, qos_list) { if (qos_ctx == ctx) { @@ -468,11 +502,13 @@ void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) if (OVER_UHD_ENC60(qos_ctx)) enc_found = 1; hw_mb += mfc_qos_get_mb_per_second(qos_ctx); + total_fps += (qos_ctx->framerate / 1000); +#ifdef CONFIG_EXYNOS_BTS mfc_qos_get_bw_per_second(qos_ctx, &mfc_bw_ctx); mfc_bw.peak += mfc_bw_ctx.peak; mfc_bw.read += mfc_bw_ctx.read; mfc_bw.write += mfc_bw_ctx.write; - total_fps += (qos_ctx->framerate / 1000); +#endif } start_qos_step = pdata->num_qos_steps; @@ -502,7 +538,11 @@ void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) if (list_empty(&dev->qos_queue) || total_mb == 0) mfc_qos_operate(ctx, MFC_QOS_REMOVE, 0); else +#ifdef CONFIG_EXYNOS_BTS mfc_qos_set(ctx, &mfc_bw, i); +#else + mfc_qos_set(ctx, i); +#endif } #endif -- 2.20.1