Esempio n. 1
0
static int fimc_is_runtime_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct v4l2_subdev *sd = platform_get_drvdata(pdev);
	struct fimc_is_dev *is_dev = to_fimc_is_dev(sd);

	//printk(KERN_INFO "FIMC-IS runtime suspend\n");
	if (is_dev->pdata->clk_off) {
		is_dev->pdata->clk_off(pdev);
	} else {
		printk(KERN_ERR "#### failed to Clock OFF ####\n");
		return -EINVAL;
	}
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
	/* Unlock bus frequency */
	dev_unlock(is_dev->bus_dev, dev);
#endif
#if defined(CONFIG_VIDEOBUF2_ION)
	if (is_dev->alloc_ctx)
		fimc_is_mem_suspend(is_dev->alloc_ctx);
#endif
	mutex_lock(&is_dev->lock);
	clear_bit(IS_PWR_ST_POWERON, &is_dev->power);
	set_bit(IS_PWR_ST_POWEROFF, &is_dev->power);
	mutex_unlock(&is_dev->lock);
	//printk(KERN_INFO "FIMC-IS runtime suspend end\n");
	return 0;
}
static int fimc_is_runtime_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct v4l2_subdev *sd = platform_get_drvdata(pdev);
	struct fimc_is_dev *is_dev = to_fimc_is_dev(sd);

	printk(KERN_INFO "FIMC-IS runtime suspend\n");
	if (is_dev->pdata->clk_off) {
		is_dev->pdata->clk_off(pdev);
	} else {
		printk(KERN_ERR "#### failed to Clock OFF ####\n");
		return -EINVAL;
	}
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
	/* Unlock bus frequency */
	pm_qos_remove_request(&bus_qos_pm_qos_req);
	dev_unlock(is_dev->bus_dev, dev);
#endif
#ifdef CONFIG_EXYNOS4_CPUFREQ
	exynos_cpufreq_lock_free(DVFS_LOCK_ID_CAM);
#endif

#if defined(CONFIG_VIDEOBUF2_ION)
	if (is_dev->alloc_ctx)
		fimc_is_mem_suspend(is_dev->alloc_ctx);
#endif
	mutex_lock(&is_dev->lock);
	clear_bit(IS_PWR_ST_POWERON, &is_dev->power);
	set_bit(IS_PWR_ST_POWEROFF, &is_dev->power);
	mutex_unlock(&is_dev->lock);
#ifdef CONFIG_REGULATOR	
	regulator_disable(is_dev->r_vdd18_cam);
	regulator_disable(is_dev->r_vddio18_cam);
	regulator_disable(is_dev->r_vdd28_af_cam);
	regulator_disable(is_dev->r_vadd28_cam);
#endif

	printk(KERN_INFO "FIMC-IS runtime suspend end\n");
	return 0;
}