static int fimc_is_runtime_resume(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 resume\n"); if (is_dev->pdata->clk_cfg) { is_dev->pdata->clk_cfg(pdev); } else { printk(KERN_ERR "#### failed to Clock CONFIG ####\n"); return -EINVAL; } if (is_dev->pdata->clk_on) { is_dev->pdata->clk_on(pdev); } else { printk(KERN_ERR "#### failed to Clock On ####\n"); return -EINVAL; } is_dev->frame_count = 0; #if defined(CONFIG_VIDEOBUF2_ION) if (is_dev->alloc_ctx) fimc_is_mem_resume(is_dev->alloc_ctx); #endif mutex_lock(&is_dev->lock); clear_bit(IS_PWR_ST_POWEROFF, &is_dev->power); clear_bit(IS_PWR_SUB_IP_POWER_OFF, &is_dev->power); set_bit(IS_PWR_ST_POWERON, &is_dev->power); mutex_unlock(&is_dev->lock); //printk(KERN_INFO "FIMC-IS runtime resume end\n"); return 0; }
static int fimc_is_remove(struct platform_device *pdev) { struct v4l2_subdev *sd = platform_get_drvdata(pdev); struct fimc_is_dev *dev = to_fimc_is_dev(sd); if (dev->pdata->clk_put) dev->pdata->clk_put(pdev); else err("#### failed to Put Clock####\n"); #ifdef CONFIG_REGULATOR if (dev->r_vdd18_cam) regulator_put(dev->r_vdd18_cam); if (dev->r_vddio18_cam) regulator_put(dev->r_vddio18_cam); if (dev->r_vdd28_af_cam) regulator_put(dev->r_vdd28_af_cam); if (dev->r_vadd28_cam) regulator_put(dev->r_vadd28_cam); #endif #if defined(CONFIG_VIDEOBUF2_ION) fimc_is_mem_init_mem_cleanup(dev->alloc_ctx); #endif kfree(dev); 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 */ 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_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); int ret = 0; //printk(KERN_INFO "FIMC-IS suspend\n"); if (!test_bit(IS_ST_INIT_DONE, &is_dev->state)) { //printk(KERN_INFO "FIMC-IS suspend end\n"); return 0; } /* If stream was not stopped, stop streaming */ if (!test_bit(IS_ST_STREAM_OFF, &is_dev->state)) { err("Not stream off state\n"); clear_bit(IS_ST_STREAM_OFF, &is_dev->state); fimc_is_hw_set_stream(is_dev, false); ret = wait_event_timeout(is_dev->irq_queue1, test_bit(IS_ST_STREAM_OFF, &is_dev->state), (HZ)); if (!ret) { err("wait timeout : Stream off\n"); fimc_is_hw_set_low_poweroff(is_dev, true); } } /* If the power is not off state, turn off the power */ if (!test_bit(IS_PWR_ST_POWEROFF, &is_dev->power)) { err("Not power off state\n"); if (!test_bit(IS_PWR_SUB_IP_POWER_OFF, &is_dev->power)) { fimc_is_hw_subip_poweroff(is_dev); ret = wait_event_timeout(is_dev->irq_queue1, test_bit(IS_PWR_SUB_IP_POWER_OFF, &is_dev->power), FIMC_IS_SHUTDOWN_TIMEOUT); if (!ret) { err("wait timeout : %s\n", __func__); fimc_is_hw_set_low_poweroff(is_dev, true); } } fimc_is_hw_a5_power(is_dev, 0); pm_runtime_put_sync(dev); is_dev->sensor.id = 0; is_dev->p_region_index1 = 0; is_dev->p_region_index2 = 0; atomic_set(&is_dev->p_region_num, 0); is_dev->state = 0; set_bit(IS_ST_IDLE, &is_dev->state); is_dev->power = 0; is_dev->af.af_state = FIMC_IS_AF_IDLE; set_bit(IS_PWR_ST_POWEROFF, &is_dev->power); } //printk(KERN_INFO "FIMC-IS suspend end\n"); return 0; }
static int fimc_is_resume(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 resume\n"); mutex_lock(&is_dev->lock); mutex_unlock(&is_dev->lock); //printk(KERN_INFO "FIMC-IS resume end\n"); return 0; }
static int fimc_is_runtime_resume(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 resume\n"); #ifdef CONFIG_REGULATOR regulator_enable(is_dev->r_vdd18_cam); regulator_enable(is_dev->r_vddio18_cam); regulator_enable(is_dev->r_vdd28_af_cam); regulator_enable(is_dev->r_vadd28_cam); #endif if (is_dev->pdata->clk_cfg) { is_dev->pdata->clk_cfg(pdev); } else { printk(KERN_ERR "#### failed to Clock CONFIG ####\n"); return -EINVAL; } if (is_dev->pdata->clk_on) { is_dev->pdata->clk_on(pdev); } else { printk(KERN_ERR "#### failed to Clock On ####\n"); return -EINVAL; } is_dev->frame_count = 0; #if defined(CONFIG_VIDEOBUF2_ION) if (is_dev->alloc_ctx) fimc_is_mem_resume(is_dev->alloc_ctx); #endif #if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER) /* lock bus frequency */ dev_lock(is_dev->bus_dev, dev, BUS_LOCK_FREQ_L0); pm_qos_add_request(&bus_qos_pm_qos_req, PM_QOS_BUS_QOS, 1); #endif #ifdef CONFIG_EXYNOS4_CPUFREQ if (exynos_cpufreq_lock(DVFS_LOCK_ID_CAM, L8)) { printk(KERN_ERR "ISP: failed to cpufreq lock for L0"); } #endif mutex_lock(&is_dev->lock); clear_bit(IS_PWR_ST_POWEROFF, &is_dev->power); clear_bit(IS_PWR_SUB_IP_POWER_OFF, &is_dev->power); set_bit(IS_PWR_ST_POWERON, &is_dev->power); mutex_unlock(&is_dev->lock); printk(KERN_INFO "FIMC-IS runtime resume end\n"); return 0; }
static void fimc_is_af_interrupt(struct work_struct *work) { struct fimc_is_dev *dev = to_fimc_is_dev(fimc_is_sd); int ret = 0; int count = 0; if(dev->af.mode == IS_FOCUS_MODE_TOUCH){ dev->af.af_lost_count++; if(dev->af.af_lost_count == 2){ dev->af.mode = IS_FOCUS_MODE_CONTINUOUS; ret = fimc_is_v4l2_af_mode(dev,FOCUS_MODE_CONTINOUS); dev->af.af_lost_count = 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; }