static void drm_mixer_qos_ctrl(struct device *dev) { struct drm_hdmi_context *ctx = to_context(dev); int win, val, count = 0; DRM_DEBUG_KMS("%s\n", __func__); for (win = 0; win < MIXER_WIN_NR; win++) if (ctx->enabled[win]) count++; switch (count) { case 1: val = 160160; break; case 2 ... MIXER_WIN_NR: val = 267160; break; default: val = 0; break; } DRM_DEBUG_KMS("%s:count[%d]val[%d]\n", __func__, count, val); #if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER) if (val == 0) dev_unlock(ctx->bus_dev, dev); else dev_lock(ctx->bus_dev, dev, val); #endif }
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; }
/*:::::*/ int fb_SerialClose( FB_FILE *handle, void *pvHandle ) { int SerialFD; struct termios oserp; #ifdef HAS_LOCKDEV pid_t plckid; #endif LINUX_SERIAL_INFO *pInfo = (LINUX_SERIAL_INFO *) pvHandle; SerialFD = pInfo->sfd; oserp = pInfo->oldtty; #ifdef HAS_LOCKDEV plckid = pInfo->pplckid; #endif #ifdef HAS_LOCKDEV dev_unlock(DeviceName, plckid); #endif /* Restore old parameter of serial line */ tcsetattr( SerialFD, TCSAFLUSH, &oserp); close(SerialFD); free(pInfo); return fb_ErrorSetNum( FB_RTERROR_OK ); }
int s3cfb_disable_window(struct s3cfb_global *fbdev, int id) { struct s3cfb_window *win = fbdev->fb[id]->par; if (win->enabled) atomic_dec(&fbdev->enabled_win); if (s3cfb_window_off(fbdev, id)) { win->enabled = 1; return -EFAULT; } else { win->enabled = 0; #ifdef CONFIG_BUSFREQ_OPP if (soc_is_exynos4212() || soc_is_exynos4412()) { int win_status = 0, i; for (i = 0; i < 5; i++) { /* exynos4x12 has 5 windows */ win = fbdev->fb[i]->par; if (win->enabled) win_status |= (1 << i); } win_status &= ~(1 << CONFIG_FB_S5P_DEFAULT_WINDOW); if (0 == win_status) //check if all window be turned off except default dev_unlock(fbdev->bus_dev, fbdev->dev); } #endif return 0; } }
static int gp_port_serial_unlock (GPPort *dev, const char *path) { #if defined(HAVE_TTYLOCK) if (ttyunlock ((char*) path)) { if (dev) gp_port_set_error (dev, _("Device '%s' could not be " "unlocked."), path); return (GP_ERROR_IO_LOCK); } #elif defined(HAVE_LOCKDEV) int pid; pid = dev_unlock (path, 0); if (pid) { if (dev) { if (pid > 0) gp_port_set_error (dev, _("Device '%s' could " "not be unlocked as it is locked by " "pid %d."), path, pid); else gp_port_set_error (dev, _("Device '%s' could " "not be unlocked (dev_unlock " "returned %d)"), path, pid); } return (GP_ERROR_IO_LOCK); } #endif /* !HAVE_LOCKDEV */ return (GP_OK); }
static int jpeg_m2m_release(struct file *file) { struct jpeg_ctx *ctx = file->private_data; unsigned long flags; spin_lock_irqsave(&ctx->slock, flags); if (test_bit(0, &ctx->dev->hw_run) == 0) del_timer_sync(&ctx->dev->watchdog_timer); v4l2_m2m_ctx_release(ctx->m2m_ctx); spin_unlock_irqrestore(&ctx->slock, flags); #ifdef CONFIG_PM_RUNTIME #if defined (CONFIG_CPU_EXYNOS5250) ctx->dev->vb2->suspend(ctx->dev->alloc_ctx); #ifdef CONFIG_BUSFREQ_OPP /* Unlock bus frequency */ dev_unlock(ctx->dev->bus_dev, &ctx->dev->plat_dev->dev); #endif #else pm_runtime_put_sync(&ctx->dev->plat_dev->dev); #endif #endif clk_disable(ctx->dev->clk); kfree(ctx); return 0; }
static void ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev) { if (*dev != NULL) return; if (strcmp(name, "tty")) return; sx_sunlock(&clone_drain_lock); sx_slock(&proctree_lock); sx_slock(&clone_drain_lock); dev_lock(); if (!(curthread->td_proc->p_flag & P_CONTROLT)) *dev = ctty; else if (curthread->td_proc->p_session->s_ttyvp == NULL) *dev = ctty; else if (curthread->td_proc->p_session->s_ttyvp->v_type == VBAD || curthread->td_proc->p_session->s_ttyvp->v_rdev == NULL) { /* e.g. s_ttyvp was revoked */ *dev = ctty; } else *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; dev_refl(*dev); dev_unlock(); sx_sunlock(&proctree_lock); }
static int jpeg_hx_remove(struct platform_device *pdev) { struct jpeg_dev *dev = platform_get_drvdata(pdev); del_timer_sync(&dev->watchdog_timer); flush_workqueue(dev->watchdog_workqueue); destroy_workqueue(dev->watchdog_workqueue); v4l2_m2m_release(dev->m2m_dev_enc); video_unregister_device(dev->vfd_enc); v4l2_m2m_release(dev->m2m_dev_dec); video_unregister_device(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); dev->vb2->cleanup(dev->alloc_ctx); free_irq(dev->irq_no, pdev); mutex_destroy(&dev->lock); iounmap(dev->reg_base); clk_put(dev->clk); clk_put(dev->sclk_clk); #ifdef CONFIG_BUSFREQ_OPP /* lock bus frequency */ dev_unlock(dev->bus_dev, &pdev->dev); #endif kfree(dev); return 0; }
static int exynos_frequency_unlock(struct device *dev) { int ret = 0; struct device *busdev = dev_get("exynos-busfreq"); if (atomic_read(&umts_link_pm_data.freqlock) == 1) { /* cpu frequency unlock */ exynos_cpufreq_lock_free(DVFS_LOCK_ID_USB_IF); /* bus frequency unlock */ ret = dev_unlock(busdev, dev); if (ret < 0) { mif_err("ERR: dev_unlock error: %d\n", ret); goto exit; } /* unlock minimum number of cpu cores */ cpufreq_pegasusq_min_cpu_unlock(); atomic_set(&umts_link_pm_data.freqlock, 0); mif_debug("success\n"); } exit: return ret; }
int s3cfb_disable_window(struct s3cfb_global *fbdev, int id) { struct s3cfb_window *win = fbdev->fb[id]->par; #ifdef FEATURE_BUSFREQ_LOCK int enabled_win = 0; #endif #if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412) #ifdef CONFIG_BUSFREQ_OPP int win_status; #endif #endif if (win->enabled) atomic_dec(&fbdev->enabled_win); if (fbdev->regs != 0 && s3cfb_window_off(fbdev, id)) { win->enabled = 1; return -EFAULT; } else { #ifdef FEATURE_BUSFREQ_LOCK enabled_win = atomic_read(&fbdev->enabled_win); if (enabled_win < 2) s3cfb_busfreq_lock(fbdev, 0); #endif win->enabled = 0; #if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412) #ifdef CONFIG_BUSFREQ_OPP win_status = window_on_off_status(fbdev); if ((win_status & ~(1 << CONFIG_FB_S5P_DEFAULT_WINDOW)) == 0) dev_unlock(fbdev->bus_dev, fbdev->dev); #endif #endif return 0; } }
/** * exynos_tc_volt - locks or frees vdd_arm, vdd_mif/int and vdd_g3d for * temperature compensation. * * This function limits or free voltage of cpufreq, busfreq, and mali driver * according to 2nd arguments. */ static int exynos_tc_volt(struct s5p_tmu_info *info, int enable) { struct s5p_platform_tmu *data; static int usage; int ret = 0; if (!info || !(info->dev)) return -EPERM; data = info->dev->platform_data; if (enable == usage) { pr_debug("TMU: already is %s.\n", enable ? "locked" : "unlocked"); return 0; } if (enable) { ret = exynos_cpufreq_lock(DVFS_LOCK_ID_TMU, info->cpulevel_tc); if (ret) goto err_lock; #ifdef CONFIG_BUSFREQ_OPP ret = dev_lock(info->bus_dev, info->dev, info->busfreq_tc); if (ret) goto err_lock; #endif #if defined(CONFIG_VIDEO_MALI400MP) ret = mali_voltage_lock_push(data->temp_compensate.g3d_volt); if (ret < 0) { pr_err("TMU: g3d_push error: %u uV\n", data->temp_compensate.g3d_volt); goto err_lock; } #endif } else { exynos_cpufreq_lock_free(DVFS_LOCK_ID_TMU); #ifdef CONFIG_BUSFREQ_OPP ret = dev_unlock(info->bus_dev, info->dev); if (ret) goto err_unlock; #endif #if defined(CONFIG_VIDEO_MALI400MP) ret = mali_voltage_lock_pop(); if (ret < 0) { pr_err("TMU: g3d_pop error\n"); goto err_unlock; } #endif } usage = enable; pr_info("TMU: %s is ok!\n", enable ? "lock" : "unlock"); return ret; err_lock: err_unlock: pr_err("TMU: %s is fail.\n", enable ? "lock" : "unlock"); return ret; }
static void busfreq_early_suspend(struct early_suspend *h) { unsigned long freq; struct busfreq_data *data = container_of(h, struct busfreq_data, busfreq_early_suspend_handler); freq = data->min_freq[PPMU_MIF] + data->min_freq[PPMU_INT] / 1000; //dev_lock(data->dev[PPMU_MIF], data->dev[PPMU_MIF], freq); dev_unlock(data->dev[PPMU_MIF], data->dev[PPMU_MIF]); }
void dev_relthread(struct cdev *dev) { mtx_assert(&devmtx, MA_NOTOWNED); dev_lock(); KASSERT(dev->si_threadcount > 0, ("%s threadcount is wrong", dev->si_name)); dev->si_threadcount--; dev_unlock(); }
struct cdevsw * devvn_refthread(struct vnode *vp, struct cdev **devp, int *ref) { struct cdevsw *csw; struct cdev_priv *cdp; struct cdev *dev; mtx_assert(&devmtx, MA_NOTOWNED); if ((vp->v_vflag & VV_ETERNALDEV) != 0) { dev = vp->v_rdev; if (dev == NULL) return (NULL); KASSERT((dev->si_flags & SI_ETERNAL) != 0, ("Not eternal cdev")); *ref = 0; csw = dev->si_devsw; KASSERT(csw != NULL, ("Eternal cdev is destroyed")); *devp = dev; return (csw); } csw = NULL; dev_lock(); dev = vp->v_rdev; if (dev == NULL) { dev_unlock(); return (NULL); } cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { csw = dev->si_devsw; if (csw != NULL) dev->si_threadcount++; } dev_unlock(); if (csw != NULL) { *devp = dev; *ref = 1; } return (csw); }
void Modem::unlockDevice() { #ifdef HAVE_LOCKDEV dev_unlock( (*prefs).serialDevice().local8Bit(), getpid() ); #else if ( is_locked ) { QStringList pathList = QStringList::split( "/", (*prefs).serialDevice() ); QFile::remove( (*prefs).lockDirectory() + "/LCK.." + pathList.last() ); is_locked = false; } #endif }
static int jpeg_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct jpeg_dev *jpeg_drv = platform_get_drvdata(pdev); #ifdef CONFIG_BUSFREQ_OPP /* lock bus frequency */ dev_unlock(jpeg_drv->bus_dev, dev); #endif jpeg_drv->vb2->suspend(jpeg_drv->alloc_ctx); /* clock disable */ clk_disable(jpeg_drv->clk); return 0; }
void free_dvfs_lock(struct work_struct *work) { struct wacom_i2c *wac_i2c = container_of(work, struct wacom_i2c, dvfs_work.work); if (wac_i2c->dvfs_lock_status) dev_lock(wac_i2c->bus_dev, wac_i2c->dev, SEC_BUS_LOCK_FREQ); else { dev_unlock(wac_i2c->bus_dev, wac_i2c->dev); exynos_cpufreq_lock_free(DVFS_LOCK_ID_PEN); } }
int s3cfb_extdsp_disable_window(struct s3cfb_extdsp_global *fbdev, int id) { struct s3cfb_extdsp_window *win = fbdev->fb[id]->par; if (win->enabled) atomic_dec(&fbdev->enabled_win); #ifdef CONFIG_BUSFREQ_OPP dev_unlock(fbdev->bus_dev, fbdev->dev); #endif win->enabled = 0; return 0; }
void free_dvfs_lock(struct work_struct *work) { struct wacom_i2c *wac_i2c = container_of(work, struct wacom_i2c, dvfs_work.work); #ifdef SEC_BUS_LOCK #if defined(CONFIG_MACH_P4NOTE) dev_unlock(wac_i2c->bus_dev, wac_i2c->dev); #else exynos4_busfreq_lock_free(DVFS_LOCK_ID_PEN); #endif #endif /* SEC_BUS_LOCK */ exynos_cpufreq_lock_free(DVFS_LOCK_ID_PEN); wac_i2c->dvfs_lock_status = false; }
static int jpeg_hx_suspend(struct platform_device *pdev, pm_message_t state) { struct jpeg_dev *dev = platform_get_drvdata(pdev); if (dev->ctx) { dev->vb2->suspend(dev->alloc_ctx); clk_disable(dev->clk); clk_disable(dev->sclk_clk); } #ifdef CONFIG_BUSFREQ_OPP /* lock bus frequency */ dev_unlock(dev->bus_dev, &pdev->dev); #endif return 0; }
static int jpeg_hx_m2m_release(struct file *file) { struct jpeg_ctx *ctx = file->private_data; v4l2_m2m_ctx_release(ctx->m2m_ctx); #ifdef CONFIG_BUSFREQ_OPP /* Unlock bus frequency */ dev_unlock(ctx->dev->bus_dev, &ctx->dev->plat_dev->dev); #endif ctx->dev->vb2->suspend(ctx->dev->alloc_ctx); clk_disable(ctx->dev->clk); clk_disable(ctx->dev->sclk_clk); kfree(ctx); return 0; }
static int jpeg_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct jpeg_dev *jpeg_drv = platform_get_drvdata(pdev); #if defined(CONFIG_MACH_P11) || defined(CONFIG_MACH_P10) return 0; #endif #ifdef CONFIG_BUSFREQ_OPP /* lock bus frequency */ dev_unlock(jpeg_drv->bus_dev, dev); #endif jpeg_drv->vb2->suspend(jpeg_drv->alloc_ctx); return 0; }
static void set_dvfs_off(struct work_struct *work) { int ret; if (dvfs_lock_status && !press_status) { ret = dev_unlock(bus_dev, sec_touchscreen); if (ret < 0) { pr_err("%s: bus unlock failed(%d)\n", __func__, __LINE__); return; } exynos_cpufreq_lock_free(DVFS_LOCK_ID_TSP); dvfs_lock_status = false; #if DEBUG_PRINT pr_info("[TSP] TSP DVFS mode exit "); #endif } }
bool KMobileDevice::unlockDevice(const QString &device) { #ifdef HAVE_BAUDBOY_H return ttyunlock(device.local8bit()) == EXIT_SUCCESS; #else # ifdef HAVE_LOCKDEV_H return 0 <= dev_unlock(device.local8bit(), getpid()); # else QStringList all = QStringList::split('/', device); if (!all.count()) return false; QString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1]; QFile file(lockName); if (!file.exists()) return true; return file.remove(); # endif #endif }
static void mxr_graph_stream_set(struct mxr_layer *layer, int en) { struct mxr_device *mdev = layer->mdev; exynos_cpufreq_lock_freq(en, MAX_CPU_FREQ); #ifdef CONFIG_BUSFREQ_OPP if (en) dev_lock(mdev->bus_dev, mdev->dev, BUSFREQ_400MHZ); else dev_unlock(mdev->bus_dev, mdev->dev); #endif #ifdef CONFIG_ARM_EXYNOS4_BUS_DEVFREQ exynos4_busfreq_lock(!en); #endif mxr_reg_graph_layer_stream(layer->mdev, layer->idx, en); }
struct cdevsw * dev_refthread(struct cdev *dev) { struct cdevsw *csw; struct cdev_priv *cdp; mtx_assert(&devmtx, MA_NOTOWNED); dev_lock(); csw = dev->si_devsw; if (csw != NULL) { cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) dev->si_threadcount++; else csw = NULL; } dev_unlock(); return (csw); }
/** * exynos_tc_volt - locks or frees vdd_arm, vdd_mif/int and vdd_g3d for * temperature compensation. * * This function limits or free voltage of cpufreq, busfreq, and mali driver * according to 2nd arguments. */ static int exynos_tc_volt(struct s5p_tmu_info *info, int enable) { struct s5p_platform_tmu *data; static int usage; int ret = 0; if (!info || !(info->dev)) return -EPERM; data = info->dev->platform_data; if (enable == usage) { pr_debug("TMU: already is %s.\n", enable ? "locked" : "unlocked"); return 0; } if (enable) { ret = exynos_cpufreq_lock(DVFS_LOCK_ID_TMU, info->cpulevel_tc); if (ret) goto err_lock; #ifdef CONFIG_BUSFREQ_OPP ret = dev_lock(info->bus_dev, info->dev, info->busfreq_tc); if (ret) goto err_lock; #endif } else { exynos_cpufreq_lock_free(DVFS_LOCK_ID_TMU); #ifdef CONFIG_BUSFREQ_OPP ret = dev_unlock(info->bus_dev, info->dev); if (ret) goto err_unlock; #endif } usage = enable; pr_info("TMU: %s is ok!\n", enable ? "lock" : "unlock"); return ret; err_lock: err_unlock: pr_err("TMU: %s is fail.\n", enable ? "lock" : "unlock"); return ret; }
static int jpeg_suspend(struct platform_device *pdev, pm_message_t state) { #ifdef CONFIG_PM_RUNTIME #if defined (CONFIG_CPU_EXYNOS5250) struct jpeg_dev *dev = platform_get_drvdata(pdev); if (dev->ctx) { dev->vb2->suspend(dev->alloc_ctx); clk_disable(dev->clk); } #ifdef CONFIG_BUSFREQ_OPP /* lock bus frequency */ dev_unlock(dev->bus_dev, &pdev->dev); #endif #else pm_runtime_put_sync(&pdev->dev); #endif #endif return 0; }
struct cdevsw * devvn_refthread(struct vnode *vp, struct cdev **devp) { struct cdevsw *csw; struct cdev_priv *cdp; mtx_assert(&devmtx, MA_NOTOWNED); csw = NULL; dev_lock(); *devp = vp->v_rdev; if (*devp != NULL) { cdp = cdev2priv(*devp); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { csw = (*devp)->si_devsw; if (csw != NULL) (*devp)->si_threadcount++; } } dev_unlock(); return (csw); }
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; }