コード例 #1
0
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;
}
コード例 #2
0
ファイル: mfc.c プロジェクト: ferow2k/NeatKernel_captivate
static int mfc_release(struct inode *inode, struct file *file)
{
	struct mfc_inst_ctx *mfc_ctx;
	int ret;

	mutex_lock(&mfc_mutex);

	mfc_ctx = (struct 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) {
		clk_enable(mfc_sclk);
		mfc_return_inst_no(mfc_ctx->InstNo, mfc_ctx->MfcCodecType);
		clk_disable(mfc_sclk);
	}

	kfree(mfc_ctx);

	ret = 0;

	if (!mfc_is_running()) {
#ifdef CONFIG_DVFS_LIMIT
		s5pv210_unlock_dvfs_high_level(DVFS_LOCK_TOKEN_1);
#endif
		/* Turn off mfc power domain regulator */
		ret = regulator_disable(mfc_pd_regulator);
		if (ret < 0) {
			mfc_err("MFC_RET_POWER_DISABLE_FAIL\n");
			goto out_release;
		}

		s5p_release_media_memory_bank(S5P_MDEV_MFC, 0);
		s5p_release_media_memory_bank(S5P_MDEV_MFC, 1);
	}

out_release:

	mutex_unlock(&mfc_mutex);
	return ret;
}
コード例 #3
0
static int mfc_release(struct inode *inode, struct file *file)
{
	struct mfc_inst_ctx *mfc_ctx;
	int ret;

	mutex_lock(&mfc_mutex);

	mfc_ctx = (struct 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) {
		clk_enable(mfc_sclk);
		mfc_return_inst_no(mfc_ctx->InstNo, mfc_ctx->MfcCodecType);
		clk_disable(mfc_sclk);
	}

	kfree(mfc_ctx);

	ret = 0;

	if (!mfc_is_running()) {
		/* Turn off mfc power domain regulator */
		ret = regulator_disable(mfc_pd_regulator);
		if (ret < 0) {
			mfc_err("MFC_RET_POWER_DISABLE_FAIL\n");
			goto out_release;
		}
	}

out_release:

	mutex_unlock(&mfc_mutex);
	return ret;
}
コード例 #4
0
ファイル: mfc.c プロジェクト: FrozenData/SGS2-Kernel-Update2
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;
}