aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/samsung')
-rw-r--r--drivers/media/video/samsung/mfc5x/SsbSipMfcApi.h4
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_buf.h5
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_cmd.c2
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_dec.c129
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_dev.c79
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_dev.h4
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_enc.c32
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_inst.c59
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_inst.h4
-rw-r--r--drivers/media/video/samsung/mfc5x/mfc_mem.c56
10 files changed, 227 insertions, 147 deletions
diff --git a/drivers/media/video/samsung/mfc5x/SsbSipMfcApi.h b/drivers/media/video/samsung/mfc5x/SsbSipMfcApi.h
index cbf6cab..c68980d 100644
--- a/drivers/media/video/samsung/mfc5x/SsbSipMfcApi.h
+++ b/drivers/media/video/samsung/mfc5x/SsbSipMfcApi.h
@@ -41,7 +41,7 @@
#define SAMSUNG_MFC_DEV_NAME "/dev/s3c-mfc"
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
-#define SUPPORT_SLICE_ENCODING 0 // originaly 1, but we're missing matching userspace
+#define SUPPORT_SLICE_ENCODING 0 // originally 1, but we're missing matching userspace
#else
#define SUPPORT_SLICE_ENCODING 0
#endif
@@ -136,7 +136,7 @@ typedef enum {
/* C210 specific feature */
MFC_ENC_SETCONF_VUI_INFO,
MFC_ENC_SETCONF_I_PERIOD,
- MFC_ENC_SETCONF_SPS_PPS_GEN,
+ MFC_ENC_SETCONF_SPS_PPS_GEN,
MFC_ENC_SETCONF_HIER_P,
MFC_ENC_SETCONF_SEI_GEN,
diff --git a/drivers/media/video/samsung/mfc5x/mfc_buf.h b/drivers/media/video/samsung/mfc5x/mfc_buf.h
index 28ef0d6..f93ed26 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_buf.h
+++ b/drivers/media/video/samsung/mfc5x/mfc_buf.h
@@ -34,8 +34,13 @@
#define ALIGN_H_L_L 16 /* Linear, Vertical, Luma */
#define ALIGN_H_L_C 8 /* Linear, Vertical, Chroma */
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_GC1)
+/* System */ /* Size, Port, Align */
+#define MFC_FW_SYSTEM_SIZE (0x100000) /* 1MB, A, N(4KB for VMEM) */
+#else
/* System */ /* Size, Port, Align */
#define MFC_FW_SYSTEM_SIZE (0x80000) /* 512KB, A, N(4KB for VMEM) */
+#endif
/* Instance */
#define MFC_CTX_SIZE_L (0x96000) /* 600KB, N, 2KB, H.264 Decoding only */
diff --git a/drivers/media/video/samsung/mfc5x/mfc_cmd.c b/drivers/media/video/samsung/mfc5x/mfc_cmd.c
index 38b4757..ba4faf9 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_cmd.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_cmd.c
@@ -310,7 +310,7 @@ int mfc_cmd_inst_open(struct mfc_inst_ctx *ctx)
}
memset(&h2r_args, 0, sizeof(struct mfc_cmd_args));
- h2r_args.arg[0] = ctx->codecid;
+ h2r_args.arg[0] = (1 << 29) | ctx->codecid;
h2r_args.arg[1] = crc << 31 | pixelcache;
h2r_args.arg[2] = ctx->ctxbufofs;
h2r_args.arg[3] = ctx->ctxbufsize;
diff --git a/drivers/media/video/samsung/mfc5x/mfc_dec.c b/drivers/media/video/samsung/mfc5x/mfc_dec.c
index d3d336a..f0a7c4d 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_dec.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_dec.c
@@ -155,10 +155,6 @@ static void dump_stream(unsigned long address, unsigned int size)
ctx->ctxbufofs = mfc_mem_base_ofs(alloc->real) >> 11;
ctx->ctxbufsize = alloc->size;
- memset((void *)alloc->addr, 0, alloc->size);
-
- mfc_mem_cache_clean((void *)alloc->addr, alloc->size);
-
return 0;
}
@@ -176,10 +172,6 @@ static int h264_alloc_ctx_buf(struct mfc_inst_ctx *ctx)
ctx->ctxbufofs = mfc_mem_base_ofs(alloc->real) >> 11;
ctx->ctxbufsize = alloc->size;
- memset((void *)alloc->addr, 0, alloc->size);
-
- mfc_mem_cache_clean((void *)alloc->addr, alloc->size);
-
return 0;
}
@@ -1591,56 +1583,6 @@ static int CheckMPEG4StartCode(unsigned char *src_mem, unsigned int remainSize)
return -1;
}
-static int CheckDecStartCode(unsigned char *src_mem,
- unsigned int nstreamSize,
- SSBSIP_MFC_CODEC_TYPE nCodecType)
-{
- unsigned int index = 0;
- /* Check Start Code within "isearchSize" bytes */
- unsigned int isearchSize = 20;
- unsigned int nShift = 0;
- unsigned char nFlag = 0xFF;
-
- if (nCodecType == H263_DEC) {
- nFlag = 0x08;
- nShift = 4;
- } else if (nCodecType == MPEG4_DEC) {
- nFlag = 0x01;
- nShift = 0;
- } else if (nCodecType == H264_DEC) {
- nFlag = 0x01;
- nShift = 0;
- } else
- nFlag = 0xFF;
-
- /* Last frame detection from user */
- if (nstreamSize == 0)
- nFlag = 0xFF;
-
- if (nFlag == 0xFF)
- return 0;
-
- if (nstreamSize > 3) {
- if (nstreamSize > isearchSize) {
- for (index = 0; index < isearchSize-3; index++) {
- if ((src_mem[index] == 0x00) &&
- (src_mem[index+1] == 0x00) &&
- ((src_mem[index+2] >> nShift) == nFlag))
- return index;
- }
- } else {
- for (index = 0; index < nstreamSize - 3; index++) {
- if ((src_mem[index] == 0x00) &&
- (src_mem[index+1] == 0x00) &&
- ((src_mem[index+2] >> nShift) == nFlag))
- return index;
- }
- }
- }
-
- return -1;
-}
-
void mfc_init_decoders(void)
{
list_add_tail(&unknown_dec.list, &mfc_decoders);
@@ -1904,6 +1846,20 @@ int mfc_init_decoding(struct mfc_inst_ctx *ctx, union mfc_args *args)
}
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ if ((ctx->width >= 1280 && ctx->height >= 720)
+ || (ctx->width >= 720 && ctx->height >= 1280)) {
+ if (atomic_read(&ctx->dev->cpufreq_lock_cnt) == 0) {
+ if (0 == ctx->dev->cpufreq_level) /* 800MHz */
+ exynos_cpufreq_get_level(800000, &ctx->dev->cpufreq_level);
+ exynos_cpufreq_lock(DVFS_LOCK_ID_MFC, ctx->dev->cpufreq_level);
+ mfc_dbg("[%s] CPU Freq Locked 800MHz!\n", __func__);
+ }
+ atomic_inc(&ctx->dev->cpufreq_lock_cnt);
+ ctx->cpufreq_flag = true;
+ }
+#endif
+
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
if ((ctx->width >= 1280 && ctx->height >= 720)
|| (ctx->width >= 720 && ctx->height >= 1280)) {
@@ -1919,27 +1875,27 @@ int mfc_init_decoding(struct mfc_inst_ctx *ctx, union mfc_args *args)
#endif
#ifdef CONFIG_BUSFREQ_OPP
- if (HD_MOVIE_SIZE_MULTIPLY_WIDTH_HEIGHT > (ctx->width * ctx->height)) {
- if (atomic_read(&ctx->dev->dmcthreshold_lock_cnt) == 0) {
- mfc_info("Implement set dmc_max_threshold\n");
- if (soc_is_exynos4212()) {
+if (HD_MOVIE_SIZE_MULTIPLY_WIDTH_HEIGHT > (ctx->width * ctx->height)) {
+ if (atomic_read(&ctx->dev->dmcthreshold_lock_cnt) == 0) {
+ mfc_info("Implement set dmc_max_threshold\n");
+ if (soc_is_exynos4212()) {
+ dmc_max_threshold =
+ EXYNOS4212_DMC_MAX_THRESHOLD + DECODING_LOAD;
+ } else if (soc_is_exynos4412()) {
+ if (samsung_rev() >= EXYNOS4412_REV_2_0)
dmc_max_threshold =
- EXYNOS4212_DMC_MAX_THRESHOLD + 5;
- } else if (soc_is_exynos4412()) {
- if (samsung_rev() >= EXYNOS4412_REV_2_0)
- dmc_max_threshold =
- PRIME_DMC_MAX_THRESHOLD + 5;
- else
- dmc_max_threshold =
- EXYNOS4412_DMC_MAX_THRESHOLD + 5;
- } else {
- pr_err("Unsupported model.\n");
- return -EINVAL;
- }
+ PRIME_DMC_MAX_THRESHOLD + DECODING_LOAD;
+ else
+ dmc_max_threshold =
+ EXYNOS4412_DMC_MAX_THRESHOLD + DECODING_LOAD;
+ } else {
+ pr_err("Unsupported model.\n");
+ return -EINVAL;
}
- atomic_inc(&ctx->dev->dmcthreshold_lock_cnt);
- ctx->dmcthreshold_flag = true;
}
+ atomic_inc(&ctx->dev->dmcthreshold_lock_cnt);
+ ctx->dmcthreshold_flag = true;
+}
#endif
/*
* allocate & set codec buffers
@@ -2146,7 +2102,6 @@ static int mfc_decoding_frame(struct mfc_inst_ctx *ctx, struct mfc_dec_exe_arg *
int display_chroma_addr;
int display_frame_type;
int display_frame_tag;
- unsigned char *stream_vir;
int ret;
struct mfc_dec_ctx *dec_ctx = (struct mfc_dec_ctx *)ctx->c_priv;
long mem_ofs;
@@ -2154,22 +2109,6 @@ static int mfc_decoding_frame(struct mfc_inst_ctx *ctx, struct mfc_dec_exe_arg *
void *ump_handle;
#endif
-#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
- if (!ctx->drm_flag) {
-#endif
- /* Check Frame Start code */
- stream_vir = phys_to_virt(exe_arg->in_strm_buf + start_ofs);
- ret = CheckDecStartCode(stream_vir, exe_arg->in_strm_size,
- exe_arg->in_codec_type);
- if (ret < 0) {
- mfc_err("Frame Check start Code Failed\n");
- /* FIXME: Need to define proper error */
- return MFC_FRM_BUF_SIZE_FAIL;
- }
-#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
- }
-#endif
-
/* Set Frame Tag */
write_shm(ctx, dec_ctx->frametag, SET_FRAME_TAG);
@@ -2405,7 +2344,9 @@ int mfc_exec_decoding(struct mfc_inst_ctx *ctx, union mfc_args *args)
if (ctx->resolution_status == RES_SET_CHANGE) {
ret = mfc_decoding_frame(ctx, exe_arg, &consumed);
#ifndef CONFIG_SLP
- } else if ((ctx->resolution_status == RES_WAIT_FRAME_DONE) &&
+ }
+
+ if ((ctx->resolution_status == RES_WAIT_FRAME_DONE) &&
(exe_arg->out_display_status == DISP_S_FINISH)) {
exe_arg->out_display_status = DISP_S_RES_CHANGE;
ret = mfc_change_resolution(ctx, exe_arg);
diff --git a/drivers/media/video/samsung/mfc5x/mfc_dev.c b/drivers/media/video/samsung/mfc5x/mfc_dev.c
index 23bc10d..43ea79d 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_dev.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_dev.c
@@ -213,7 +213,7 @@ static int mfc_open(struct inode *inode, struct file *file)
mutex_lock(&mfcdev->lock);
-#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_M0)
+#ifdef CONFIG_USE_MFC_CMA
if (atomic_read(&mfcdev->inst_cnt) == 0) {
size_t size = 0x02800000;
mfcdev->cma_vaddr = dma_alloc_coherent(mfcdev->device, size,
@@ -368,8 +368,6 @@ static int mfc_open(struct inode *inode, struct file *file)
mfc_ctx->ctxbufofs = mfc_mem_base_ofs(alloc->real) >> 11;
mfc_ctx->ctxbufsize = alloc->size;
- memset((void *)alloc->addr, 0, alloc->size);
- mfc_mem_cache_clean((void *)alloc->addr, alloc->size);
}
#endif
@@ -392,7 +390,7 @@ static int mfc_open(struct inode *inode, struct file *file)
ret = mfc_queue_alloc(mfc_ctx);
if (ret < 0) {
mfc_err("mfc_queue_alloc failed\n");
- goto err_inst_ctx;
+ goto err_queue_alloc;
}
#endif
@@ -403,9 +401,17 @@ static int mfc_open(struct inode *inode, struct file *file)
return 0;
+#ifdef CONFIG_SLP_DMABUF
+err_queue_alloc:
+#endif
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
err_drm_ctx:
#endif
+ mfcdev->inst_ctx[inst_id] = NULL;
+ atomic_dec(&mfcdev->inst_cnt);
+
+ mfc_destroy_inst(mfc_ctx);
+
err_inst_ctx:
err_inst_id:
err_inst_cnt:
@@ -423,7 +429,16 @@ err_pwr_enable:
#endif
err_fw_state:
-#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
+#ifdef CONFIG_USE_MFC_CMA
+ if (atomic_read(&mfcdev->inst_cnt) == 0) {
+ size_t size = 0x02800000;
+ dma_free_coherent(mfcdev->device, size, mfcdev->cma_vaddr,
+ mfcdev->cma_dma_addr);
+ printk(KERN_INFO "%s[%d] size 0x%x, vaddr 0x%x, base 0x0%x\n",
+ __func__, __LINE__, (int)size,
+ (int) mfcdev->cma_vaddr,
+ (int)mfcdev->cma_dma_addr);
+ }
#endif
mutex_unlock(&mfcdev->lock);
@@ -476,6 +491,19 @@ static int mfc_release(struct inode *inode, struct file *file)
}
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ /* Release MFC & CPU Frequency lock for High resolution */
+ if (mfc_ctx->cpufreq_flag == true) {
+ atomic_dec(&dev->cpufreq_lock_cnt);
+ mfc_ctx->cpufreq_flag = false;
+ if (atomic_read(&dev->cpufreq_lock_cnt) == 0) {
+ /* release Freq lock back to normal */
+ exynos_cpufreq_lock_free(DVFS_LOCK_ID_MFC);
+ mfc_dbg("[%s] CPU Freq lock Released Normal!\n", __func__);
+ }
+ }
+#endif
+
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
/* Release MFC & CPU Frequency lock for High resolution */
if (mfc_ctx->cpufreq_flag == true) {
@@ -565,7 +593,7 @@ static int mfc_release(struct inode *inode, struct file *file)
err_pwr_disable:
-#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_M0)
+#ifdef CONFIG_USE_MFC_CMA
if (atomic_read(&mfcdev->inst_cnt) == 0) {
size_t size = 0x02800000;
dma_free_coherent(mfcdev->device, size, mfcdev->cma_vaddr,
@@ -977,6 +1005,16 @@ static long mfc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* RMVME: need locking ? */
mutex_lock(&dev->lock);
+ if (mfc_ctx->state < INST_STATE_SETUP) {
+ mfc_err("IOCTL_MFC_GET_CONFIG invalid state: 0x%08x\n",
+ mfc_ctx->state);
+ in_param.ret_code = MFC_STATE_INVALID;
+ ret = -EINVAL;
+
+ mutex_unlock(&dev->lock);
+ break;
+ }
+
cfg_arg = (struct mfc_config_arg *)&in_param.args;
in_param.ret_code = mfc_get_inst_cfg(mfc_ctx, cfg_arg->type,
@@ -1083,9 +1121,13 @@ static int mfc_mmap(struct file *file, struct vm_area_struct *vma)
unsigned long start, size;
#endif
#endif
+ mfc_info("%s line : %d IN\n", __func__, __LINE__);
mfc_ctx = (struct mfc_inst_ctx *)file->private_data;
- if (!mfc_ctx)
+ if (!mfc_ctx) {
+ mfc_err("%s line : %d mfc_ctx is NULL\n",
+ __func__, __LINE__);
return -EINVAL;
+ }
#if !(defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(CONFIG_S5P_VMEM))
dev = mfc_ctx->dev;
@@ -1325,9 +1367,30 @@ static int mfc_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}
+#ifdef CONFIG_USE_MFC_CMA
+/* FIXME: workaround for CMA migration fail due to page lock */
+static int mfc_open_with_retry(struct inode *inode, struct file *file)
+{
+ int ret;
+ int i = 0;
+
+ ret = mfc_open(inode, file);
+
+ while (ret == -ENOMEM && i++ < 10) {
+ msleep(1000);
+ ret = mfc_open(inode, file);
+ }
+
+ return ret;
+}
+#define MFC_OPEN mfc_open_with_retry
+#else
+#define MFC_OPEN mfc_open
+#endif
+
static const struct file_operations mfc_fops = {
.owner = THIS_MODULE,
- .open = mfc_open,
+ .open = MFC_OPEN,
.release = mfc_release,
.unlocked_ioctl = mfc_ioctl,
.mmap = mfc_mmap,
diff --git a/drivers/media/video/samsung/mfc5x/mfc_dev.h b/drivers/media/video/samsung/mfc5x/mfc_dev.h
index bb2095c..16bd027 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_dev.h
+++ b/drivers/media/video/samsung/mfc5x/mfc_dev.h
@@ -114,6 +114,10 @@ struct mfc_dev {
#if defined(CONFIG_BUSFREQ)
atomic_t busfreq_lock_cnt; /* Bus frequency Lock count */
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ atomic_t cpufreq_lock_cnt; /* CPU frequency Lock count */
+ int cpufreq_level; /* CPU frequency leve */
+#endif
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
atomic_t cpufreq_lock_cnt; /* CPU frequency Lock count */
int cpufreq_level; /* CPU frequency leve */
diff --git a/drivers/media/video/samsung/mfc5x/mfc_enc.c b/drivers/media/video/samsung/mfc5x/mfc_enc.c
index 65d7b6b..f2dc039 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_enc.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_enc.c
@@ -55,10 +55,6 @@ static LIST_HEAD(mfc_encoders);
ctx->ctxbufofs = mfc_mem_base_ofs(alloc->real) >> 11;
ctx->ctxbufsize = alloc->size;
- memset((void *)alloc->addr, 0, alloc->size);
-
- mfc_mem_cache_clean((void *)alloc->addr, alloc->size);
-
return 0;
}
@@ -101,7 +97,7 @@ int get_init_arg(struct mfc_inst_ctx *ctx, void *arg)
write_reg((1 << 1) | 0x1, MFC_ENC_MSLICE_CTRL);
if (init_arg->cmn.in_ms_arg < 1900)
init_arg->cmn.in_ms_arg = 1900;
- write_reg(init_arg->cmn.in_ms_arg, MFC_ENC_MSLICE_BIT);
+ write_reg(init_arg->cmn.in_ms_arg * 8, MFC_ENC_MSLICE_BIT);
} else {
write_reg(0, MFC_ENC_MSLICE_CTRL);
write_reg(0, MFC_ENC_MSLICE_MB);
@@ -586,8 +582,7 @@ static int h264_pre_seq_start(struct mfc_inst_ctx *ctx)
if (h264->sps_pps_gen == 1) {
write_shm(ctx,
- ((h264->sps_pps_gen << 8) |
- read_shm(ctx, EXT_ENC_CONTROL)),
+ ((h264->sps_pps_gen << 8) | read_shm(ctx, EXT_ENC_CONTROL)),
EXT_ENC_CONTROL);
}
@@ -1066,10 +1061,8 @@ static int h264_set_codec_cfg(struct mfc_inst_ctx *ctx, int type, void *arg)
case MFC_ENC_SETCONF_SPS_PPS_GEN:
mfc_dbg("MFC_ENC_SETCONF_SPS_PPS_GEN : %d\n", ctx->state);
- if ((ctx->state < INST_STATE_CREATE) ||
- (ctx->state > INST_STATE_EXE)) {
- mfc_err("MFC_ENC_SETCONF_SPS_PPS_GEN : "
- " state is invalid\n");
+ if ((ctx->state < INST_STATE_CREATE) || (ctx->state > INST_STATE_EXE)) {
+ mfc_err("MFC_ENC_SETCONF_SPS_PPS_GEN : state is invalid\n");
return MFC_STATE_INVALID;
}
@@ -1079,6 +1072,7 @@ static int h264_set_codec_cfg(struct mfc_inst_ctx *ctx, int type, void *arg)
h264->sps_pps_gen = 0;
break;
+
default:
mfc_dbg("invalid set cfg type: 0x%08x\n", type);
ret = -2;
@@ -1548,6 +1542,22 @@ int mfc_init_encoding(struct mfc_inst_ctx *ctx, union mfc_args *args)
}
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ if ((ctx->width >= 1280 && ctx->height >= 720)
+ || (ctx->width >= 720 && ctx->height >= 1280)) {
+ if (atomic_read(&ctx->dev->cpufreq_lock_cnt) == 0) {
+ if (0 == ctx->dev->cpufreq_level) /* 800MHz */
+ exynos_cpufreq_get_level(800000,
+ &ctx->dev->cpufreq_level);
+ exynos_cpufreq_lock(DVFS_LOCK_ID_MFC,
+ ctx->dev->cpufreq_level);
+ mfc_dbg("[%s] CPU Freq Locked 800MHz!\n", __func__);
+ }
+ atomic_inc(&ctx->dev->cpufreq_lock_cnt);
+ ctx->cpufreq_flag = true;
+ }
+#endif
+
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
if ((ctx->width >= 320 && ctx->height >= 240)
|| (ctx->width >= 240 && ctx->height >= 320)) {
diff --git a/drivers/media/video/samsung/mfc5x/mfc_inst.c b/drivers/media/video/samsung/mfc5x/mfc_inst.c
index ef0d0e0..33736c9 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_inst.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_inst.c
@@ -55,6 +55,9 @@ struct mfc_inst_ctx *mfc_create_inst(void)
#ifdef CONFIG_BUSFREQ
ctx->busfreq_flag = false;
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ ctx->cpufreq_flag = false;
+#endif
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
ctx->cpufreq_flag = false;
#endif
@@ -193,34 +196,34 @@ int mfc_set_inst_cfg(struct mfc_inst_ctx *ctx, int type, void *arg)
}
switch (type) {
- case MFC_DEC_SETCONF_POST_ENABLE:
- case MFC_DEC_SETCONF_EXTRA_BUFFER_NUM:
- case MFC_DEC_SETCONF_DISPLAY_DELAY:
- case MFC_DEC_SETCONF_IS_LAST_FRAME:
- case MFC_DEC_SETCONF_SLICE_ENABLE:
- case MFC_DEC_SETCONF_CRC_ENABLE:
- case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT:
- case MFC_DEC_SETCONF_FRAME_TAG:
- case MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY:
- case MFC_DEC_SETCONF_DPB_FLUSH:
- case MFC_DEC_SETCONF_SEI_PARSE:
- case MFC_DEC_SETCONF_PIXEL_CACHE:
- case MFC_ENC_SETCONF_FRAME_TYPE:
- case MFC_ENC_SETCONF_CHANGE_FRAME_RATE:
- case MFC_ENC_SETCONF_CHANGE_BIT_RATE:
- case MFC_ENC_SETCONF_FRAME_TAG:
- case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
- case MFC_ENC_SETCONF_VUI_INFO:
- case MFC_ENC_SETCONF_I_PERIOD:
- case MFC_ENC_SETCONF_HIER_P:
- case MFC_ENC_SETCONF_SEI_GEN:
- case MFC_ENC_SETCONF_FRAME_PACKING:
- case MFC_ENC_SETCONF_SPS_PPS_GEN:
- if (ctx->c_ops->set_codec_cfg) {
- if ((ctx->c_ops->set_codec_cfg(ctx, type, arg)) < 0)
- return MFC_SET_CONF_FAIL;
- }
- break;
+ case MFC_DEC_SETCONF_POST_ENABLE:
+ case MFC_DEC_SETCONF_EXTRA_BUFFER_NUM:
+ case MFC_DEC_SETCONF_DISPLAY_DELAY:
+ case MFC_DEC_SETCONF_IS_LAST_FRAME:
+ case MFC_DEC_SETCONF_SLICE_ENABLE:
+ case MFC_DEC_SETCONF_CRC_ENABLE:
+ case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT:
+ case MFC_DEC_SETCONF_FRAME_TAG:
+ case MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY:
+ case MFC_DEC_SETCONF_DPB_FLUSH:
+ case MFC_DEC_SETCONF_SEI_PARSE:
+ case MFC_DEC_SETCONF_PIXEL_CACHE:
+ case MFC_ENC_SETCONF_FRAME_TYPE:
+ case MFC_ENC_SETCONF_CHANGE_FRAME_RATE:
+ case MFC_ENC_SETCONF_CHANGE_BIT_RATE:
+ case MFC_ENC_SETCONF_FRAME_TAG:
+ case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
+ case MFC_ENC_SETCONF_VUI_INFO:
+ case MFC_ENC_SETCONF_I_PERIOD:
+ case MFC_ENC_SETCONF_HIER_P:
+ case MFC_ENC_SETCONF_SEI_GEN:
+ case MFC_ENC_SETCONF_FRAME_PACKING:
+ case MFC_ENC_SETCONF_SPS_PPS_GEN:
+ if (ctx->c_ops->set_codec_cfg) {
+ if ((ctx->c_ops->set_codec_cfg(ctx, type, arg)) < 0)
+ return MFC_SET_CONF_FAIL;
+ }
+ break;
default:
mfc_err("invalid set config type: 0x%08x\n", type);
diff --git a/drivers/media/video/samsung/mfc5x/mfc_inst.h b/drivers/media/video/samsung/mfc5x/mfc_inst.h
index b78dd91..eedd6f1 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_inst.h
+++ b/drivers/media/video/samsung/mfc5x/mfc_inst.h
@@ -158,6 +158,10 @@ struct mfc_inst_ctx {
int busfreq_flag; /* context bus frequency flag */
#endif
+#if defined(CONFIG_MACH_GC1) && defined(CONFIG_EXYNOS4_CPUFREQ)
+ int cpufreq_flag; /* context CPU frequency flag*/
+#endif
+
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
int cpufreq_flag; /* context CPU frequency flag*/
#endif
diff --git a/drivers/media/video/samsung/mfc5x/mfc_mem.c b/drivers/media/video/samsung/mfc5x/mfc_mem.c
index 051e4c0..a4f5345 100644
--- a/drivers/media/video/samsung/mfc5x/mfc_mem.c
+++ b/drivers/media/video/samsung/mfc5x/mfc_mem.c
@@ -551,12 +551,26 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
/* early allocator */
#if defined(CONFIG_S5P_MEM_CMA)
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
-#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_M0)
+#ifdef CONFIG_USE_MFC_CMA
+#if defined(CONFIG_MACH_M0)
cma_infos[0].lower_bound = 0x5C100000;
cma_infos[0].upper_bound = 0x5F200000;
cma_infos[0].total_size = 0x03100000;
cma_infos[0].free_size = 0x03100000;
cma_infos[0].count = 1;
+#elif defined(CONFIG_MACH_GC1) || defined(CONFIG_MACH_GC2PD)
+ cma_infos[0].lower_bound = 0x50200000;
+ cma_infos[0].upper_bound = 0x53300000;
+ cma_infos[0].total_size = 0x03100000;
+ cma_infos[0].free_size = 0x03100000;
+ cma_infos[0].count = 1;
+#elif defined(CONFIG_MACH_TAB3) || defined(CONFIG_MACH_ZEST)
+ cma_infos[0].lower_bound = 0x58100000;
+ cma_infos[0].upper_bound = 0x5B200000;
+ cma_infos[0].total_size = 0x03100000;
+ cma_infos[0].free_size = 0x03100000;
+ cma_infos[0].count = 1;
+#endif
#else
if (cma_info(&cma_infos[0], dev->device, "A")) {
mfc_info("failed to get CMA info of 'mfc-secure'\n");
@@ -611,8 +625,14 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
return -ENOMEM;
}
-#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_M0)
+#ifdef CONFIG_USE_MFC_CMA
+#if defined(CONFIG_MACH_GC1) || defined(CONFIG_MACH_GC2PD)
+ base[0] = 0x50200000;
+#elif defined(CONFIG_MACH_TAB3) || defined(CONFIG_MACH_ZEST)
+ base[0] = 0x58100000;
+#else
base[0] = 0x5c100000;
+#endif
dev->mem_infos[0].base = base[0];
dev->mem_infos[0].size = size;
dev->mem_infos[0].addr = phys_to_virt(base[0]);
@@ -707,6 +727,20 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
dev->mem_infos[0].size = size;
dev->mem_infos[0].addr = cma_get_virt(base[0], size, 0);
} else if (dev->mem_ports == 2) {
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_Q1_BD)
+ /* for MFC0:A */
+ cma_infos[0].lower_bound = 0x67200000;
+ cma_infos[0].upper_bound = 0x68400000;
+ cma_infos[0].total_size = 0x01200000;
+ cma_infos[0].free_size = 0x01200000;
+ cma_infos[0].count = 1;
+ /* for MFC1:B */
+ cma_infos[1].lower_bound = 0x68400000;
+ cma_infos[1].upper_bound = 0x6A000000;
+ cma_infos[1].total_size = 0x01C00000;
+ cma_infos[1].free_size = 0x01C00000;
+ cma_infos[1].count = 1;
+#else
if (cma_info(&cma_infos[0], dev->device, "A")) {
mfc_info("failed to get CMA info of 'mfc0'\n");
return -ENOMEM;
@@ -716,7 +750,7 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
mfc_info("failed to get CMA info of 'mfc1'\n");
return -ENOMEM;
}
-
+#endif
if (cma_infos[0].lower_bound > cma_infos[1].lower_bound)
cma_index = 1;
@@ -733,8 +767,12 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
base[0] = cma_alloc(dev->device, cma_index ? "B" : "A",
MFC_FW_SYSTEM_SIZE, ALIGN_128KB);
#else
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_Q1_BD)
+ base[0] = cma_index ? 0x68400000 : 0x67200000;
+#else
base[0] = cma_alloc(dev->device, cma_index ? "B" : "A", size, ALIGN_128KB);
#endif
+#endif
if (IS_ERR_VALUE(base[0])) {
mfc_err("failed to get rsv. memory from CMA on port #0");
return -ENOMEM;
@@ -742,7 +780,11 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
dev->mem_infos[0].base = base[0];
dev->mem_infos[0].size = size;
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_Q1_BD)
+ dev->mem_infos[0].addr = phys_to_virt(base[0]);
+#else
dev->mem_infos[0].addr = cma_get_virt(base[0], size, 0);
+#endif
/* swap CMA index */
cma_index = !cma_index;
@@ -760,8 +802,12 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
base[1] = cma_index ? cma_infos[1].lower_bound :
cma_infos[0].lower_bound;
#else
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_Q1_BD)
+ base[1] = cma_index ? 0x68400000 : 0x67200000;
+#else
base[1] = cma_alloc(dev->device, cma_index ? "B" : "A", size, ALIGN_128KB);
#endif
+#endif
if (IS_ERR_VALUE(base[1])) {
mfc_err("failed to get rsv. memory from CMA on port #1");
cma_free(base[0]);
@@ -770,7 +816,11 @@ int mfc_init_mem_mgr(struct mfc_dev *dev)
dev->mem_infos[1].base = base[1];
dev->mem_infos[1].size = size;
+#if defined(CONFIG_USE_MFC_CMA) && defined(CONFIG_MACH_Q1_BD)
+ dev->mem_infos[1].addr = phys_to_virt(base[1]);
+#else
dev->mem_infos[1].addr = cma_get_virt(base[1], size, 0);
+#endif
} else {
mfc_err("failed to get reserved memory from CMA");
return -EPERM;