*/
#include <linux/err.h>
+#ifdef CONFIG_EXYNOS_BTS
#include <soc/samsung/bts.h>
+#endif
#include "s5p_mfc_qos.h"
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",
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",
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);
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);
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);
}
}
+#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;
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);
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 },
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)
{
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)
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;
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);
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)
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) {
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) {
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;
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