static int mfc_release(struct inode *inode, struct file *file) { mfc_inst_ctx *mfc_ctx; int ret; #if ENABLE_MONITORING_MFC_DD mfc_info("MFC Release..\n"); #endif mutex_lock(&mfc_mutex); #if Frame_Base_Power_CTR_ON clk_enable(mfc_clk); #endif mfc_ctx = (mfc_inst_ctx *)file->private_data; if (mfc_ctx == NULL) { mfc_err("MFCINST_ERR_INVALID_PARAM\n"); ret = -EIO; goto out_release; } mfc_release_all_buffer(mfc_ctx->mem_inst_no); mfc_merge_fragment(mfc_ctx->mem_inst_no); mfc_return_mem_inst_no(mfc_ctx->mem_inst_no); /* In case of no instance, we should not release codec instance */ if (mfc_ctx->InstNo >= 0) mfc_return_inst_no(mfc_ctx->InstNo, mfc_ctx->MfcCodecType); kfree(mfc_ctx); ret = 0; out_release: if (!mfc_is_running()) { #ifdef CONFIG_CPU_FREQ s5pc110_unlock_dvfs_high_level(DVFS_LOCK_TOKEN_1); #endif #ifdef CONFIG_PM_PWR_GATING s5pc110_unlock_power_domain(MFC_DOMAIN_LOCK_TOKEN); #endif #ifdef CONFIG_S5PC11X_LPAUDIO s5pc110_set_lpaudio_lock(0); #endif /* CONFIG_S5PC11X_LPAUDIO */ } clk_disable(mfc_clk); mutex_unlock(&mfc_mutex); return ret; }
static int mfc_release(struct inode *inode, struct file *file) { mfc_inst_ctx *mfc_ctx; int ret; #if ENABLE_MONITORING_MFC_DD mfc_info("MFC Release..\n"); #endif mutex_lock(&mfc_mutex); #if Frame_Base_Power_CTR_ON /*if (s5pv210_pd_enable("mfc_pd") < 0) { printk(KERN_ERR "[Error]The power is not on for mfc\n"); return -1; }*/ clk_enable(mfc_clk); #endif mfc_ctx = (mfc_inst_ctx *)file->private_data; if (mfc_ctx == NULL) { mfc_err("MFCINST_ERR_INVALID_PARAM\n"); ret = -EIO; goto out_release; } mfc_release_all_buffer(mfc_ctx->mem_inst_no); mfc_merge_fragment(mfc_ctx->mem_inst_no); mfc_return_mem_inst_no(mfc_ctx->mem_inst_no); /* In case of no instance, we should not release codec instance */ if (mfc_ctx->InstNo >= 0) mfc_return_inst_no(mfc_ctx->InstNo, mfc_ctx->MfcCodecType); kfree(mfc_ctx); ret = 0; out_release: if (!mfc_is_running()) { #ifdef CONFIG_CPU_FREQ_S5PV210 s5pv210_set_cpufreq_level(NORMAL_TABLE); #endif /* CONFIG_CPU_FREQ_S5PV210 */ #ifdef CONFIG_PM_PWR_GATING s5pc110_unlock_power_domain(MFC_DOMAIN_LOCK_TOKEN); #endif #ifdef CONFIG_S5P_LPAUDIO s5p_set_lpaudio_lock(0); #endif /* CONFIG_S5P_LPAUDIO */ } clk_disable(mfc_clk); if (s5pv210_pd_disable("mfc_pd") < 0) { printk(KERN_ERR "[Error]The power is not off for mfc\n"); return -1; } mutex_unlock(&mfc_mutex); return ret; }