本文整理汇总了C++中pm_relax函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_relax函数的具体用法?C++ pm_relax怎么用?C++ pm_relax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_relax函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
/* */
int ret = 0;
/* */
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
//
atomic_sub_return(1, &pvdev->opened);
if (atomic_read(&pvdev->opened) == 0) {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
/* */
ret = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if(ret < 0){
pr_err("%s:%d camera_v4l2_close_1 failed\n", __func__, __LINE__);
}
/* */
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
pm_relax(&pvdev->vdev->dev);
atomic_set(&pvdev->stream_cnt, 0);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
/* */
ret = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if(ret < 0){
pr_err("%s:%d camera_v4l2_close_2 failed\n", __func__, __LINE__);
}
/* */
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
示例2: bcmsdh_dev_relax
void bcmsdh_dev_relax(bcmsdh_info_t *bcmsdh)
{
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
pm_relax(bcmsdh_osinfo->dev);
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
}
示例3: ssusb_set_mailbox
/*
* switch to host: -> MTU3_VBUS_OFF --> MTU3_ID_GROUND
* switch to device: -> MTU3_ID_FLOAT --> MTU3_VBUS_VALID
*/
static void ssusb_set_mailbox(struct otg_switch_mtk *otg_sx,
enum mtu3_vbus_id_state status)
{
struct ssusb_mtk *ssusb =
container_of(otg_sx, struct ssusb_mtk, otg_switch);
struct mtu3 *mtu = ssusb->u3d;
dev_dbg(ssusb->dev, "mailbox state(%d)\n", status);
switch (status) {
case MTU3_ID_GROUND:
switch_port_to_host(ssusb);
ssusb_set_vbus(otg_sx, 1);
ssusb->is_host = true;
break;
case MTU3_ID_FLOAT:
ssusb->is_host = false;
ssusb_set_vbus(otg_sx, 0);
switch_port_to_device(ssusb);
break;
case MTU3_VBUS_OFF:
mtu3_stop(mtu);
pm_relax(ssusb->dev);
break;
case MTU3_VBUS_VALID:
/* avoid suspend when works as device */
pm_stay_awake(ssusb->dev);
mtu3_start(mtu);
break;
default:
dev_err(ssusb->dev, "invalid state\n");
}
}
示例4: wcd9xxx_spmi_unlock_sleep
void wcd9xxx_spmi_unlock_sleep()
{
mutex_lock(&map.pm_lock);
if (--map.wlock_holders == 0) {
pr_debug("%s: releasing wake lock pm_state %d -> %d\n",
__func__, map.pm_state, WCD9XXX_PM_SLEEPABLE);
/*
* if wcd9xxx_spmi_lock_sleep failed, pm_state would be still
* WCD9XXX_PM_ASLEEP, don't overwrite
*/
if (likely(map.pm_state == WCD9XXX_PM_AWAKE))
map.pm_state = WCD9XXX_PM_SLEEPABLE;
pm_qos_update_request(&map.pm_qos_req,
PM_QOS_DEFAULT_VALUE);
#ifdef VENDOR_EDIT
//[email protected], 2015/03/19, Add for Qcom patch,
//Headset sometime not detected when phone is sleep
pm_relax(&map.spmi[0]->dev);
#endif /* VENDOR_EDIT */
}
mutex_unlock(&map.pm_lock);
pr_debug("%s: wake lock counter %d\n", __func__,
map.wlock_holders);
pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
wake_up_all(&map.pm_wq);
}
示例5: titsc_irq
static irqreturn_t titsc_irq(int irq, void *dev)
{
struct titsc *ts_dev = dev;
struct input_dev *input_dev = ts_dev->input;
unsigned int fsm, status, irqclr = 0;
unsigned int x = 0, y = 0;
unsigned int z1, z2, z;
status = titsc_readl(ts_dev, REG_RAWIRQSTATUS);
if (status & IRQENB_HW_PEN) {
ts_dev->pen_down = true;
irqclr |= IRQENB_HW_PEN;
pm_stay_awake(ts_dev->mfd_tscadc->dev);
}
if (status & IRQENB_PENUP) {
fsm = titsc_readl(ts_dev, REG_ADCFSM);
if (fsm == ADCFSM_STEPID) {
ts_dev->pen_down = false;
input_report_key(input_dev, BTN_TOUCH, 0);
input_report_abs(input_dev, ABS_PRESSURE, 0);
input_sync(input_dev);
pm_relax(ts_dev->mfd_tscadc->dev);
} else {
ts_dev->pen_down = true;
}
irqclr |= IRQENB_PENUP;
}
if (status & IRQENB_EOS)
irqclr |= IRQENB_EOS;
/*
* ADC and touchscreen share the IRQ line.
* FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
*/
if (status & IRQENB_FIFO0THRES) {
titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2);
if (ts_dev->pen_down && z1 != 0 && z2 != 0) {
/*
* Calculate pressure using formula
* Resistance(touch) = x plate resistance *
* x postion/4096 * ((z2 / z1) - 1)
*/
z = z1 - z2;
z *= x;
z *= ts_dev->x_plate_resistance;
z /= z2;
z = (z + 2047) >> 12;
if (z <= MAX_12BIT) {
input_report_abs(input_dev, ABS_X, x);
input_report_abs(input_dev, ABS_Y, y);
input_report_abs(input_dev, ABS_PRESSURE, z);
input_report_key(input_dev, BTN_TOUCH, 1);
input_sync(input_dev);
}
}
示例6: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
BUG_ON(!pvdev);
atomic_sub_return(1, &pvdev->opened);
if (atomic_read(&pvdev->opened) == 0) {
if(1 == cam_wakelock_init && !wake_lock_active(&cam_wakelock))
{
hw_camera_log_info("%s: start camera wake_lock_timeout!\n",__func__);
//wake lock 500ms for camera exit
wake_lock_timeout(&cam_wakelock, HZ/2);
}
else
{
hw_camera_log_info("%s: do not need wake_lock now, cam_wakelock_init = %d\n",
__func__, cam_wakelock_init);
}
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
pm_relax(&pvdev->vdev->dev);
atomic_set(&pvdev->stream_cnt, 0);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
示例7: gpio_keys_gpio_work_func
static void gpio_keys_gpio_work_func(struct work_struct *work)
{
struct gpio_button_data *bdata =
container_of(work, struct gpio_button_data, work.work);
gpio_keys_gpio_report_event(bdata);
if (bdata->button->wakeup)
pm_relax(bdata->input->dev.parent);
}
示例8: mv_otg_disable
static void mv_otg_disable(struct mv_otg *mvotg)
{
if (mvotg->clock_gating)
mv_otg_disable_internal(mvotg);
pm_qos_update_request(&mvotg->qos_idle,
PM_QOS_CPUIDLE_BLOCK_DEFAULT_VALUE);
pm_relax(&mvotg->pdev->dev);
}
示例9: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
unsigned int opn_idx, mask;
BUG_ON(!pvdev);
opn_idx = atomic_read(&pvdev->opened);
pr_debug("%s: close stream_id=%d\n", __func__, sp->stream_id);
mask = (1 << sp->stream_id);
opn_idx &= ~mask;
atomic_set(&pvdev->opened, opn_idx);
if (atomic_read(&pvdev->opened) == 0) {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
/* Enable power collapse latency */
msm_pm_qos_update_request(CAMERA_ENABLE_PC_LATENCY);
pm_relax(&pvdev->vdev->dev);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
示例10: qpnp_iadc_vadc_sync_read
int32_t qpnp_iadc_vadc_sync_read(
enum qpnp_iadc_channels i_channel, struct qpnp_iadc_result *i_result,
enum qpnp_vadc_channels v_channel, struct qpnp_vadc_result *v_result)
{
struct qpnp_iadc_drv *iadc = qpnp_iadc;
int rc = 0;
if (!iadc || !iadc->iadc_initialized)
return -EPROBE_DEFER;
mutex_lock(&iadc->iadc_vadc_lock);
if (iadc->iadc_poll_eoc) {
pr_debug("acquiring iadc eoc wakelock\n");
pm_stay_awake(iadc->dev);
}
rc = qpnp_check_pmic_temp();
if (rc) {
pr_err("PMIC die temp check failed\n");
goto fail;
}
iadc->iadc_mode_sel = true;
rc = qpnp_vadc_iadc_sync_request(v_channel);
if (rc) {
pr_err("Configuring VADC failed\n");
goto fail;
}
rc = qpnp_iadc_read(i_channel, i_result);
if (rc)
pr_err("Configuring IADC failed\n");
/* Intentional fall through to release VADC */
rc = qpnp_vadc_iadc_sync_complete_request(v_channel,
v_result);
if (rc)
pr_err("Releasing VADC failed\n");
fail:
iadc->iadc_mode_sel = false;
if (iadc->iadc_poll_eoc) {
pr_debug("releasing iadc eoc wakelock\n");
pm_relax(iadc->dev);
}
mutex_unlock(&iadc->iadc_vadc_lock);
return rc;
}
示例11: smb349_pm_relax
static void smb349_pm_relax(struct smb349_dual_charger *chip, int reason)
{
int reasons;
mutex_lock(&chip->pm_lock);
reasons = chip->wake_reasons & (~reason);
if (reasons == 0 && chip->wake_reasons != 0) {
dev_dbg(chip->dev, "relaxing: 0x%02x (bit %d)\n",
reasons, reason);
pm_relax(chip->dev);
}
chip->wake_reasons = reasons;
mutex_unlock(&chip->pm_lock);
}
示例12: wake_timer_irq
static irqreturn_t wake_timer_irq(int irq, void *dev_id)
{
struct wake_timer *tm = dev_id;
int stat = 0;
if(irq == tm->irq[0]) {
/*clear interrupt*/
readl(tm->mmio + EOI);
pm_wakeup_event(&tm->pdev->dev, 0);
pm_relax(&tm->pdev->dev);
#ifdef CONFIG_PM_WAKEUP_DEVICE_AUTO_TEST_SUSPEND
input_report_key(tm->input_dev, KEY_POWER, 1);
input_sync(tm->input_dev);
input_report_key(tm->input_dev, KEY_POWER, 0);
input_sync(tm->input_dev);
#endif
#ifdef MANU_UNLOCK
wake_lock(&tm->wake_lock);
#else
wake_lock_timeout(&tm->wake_lock, tm->wake_ms/1000*HZ);
#endif
} else if(irq == tm->irq[1]) {
/*clear interrupt*/
readl(tm->mmio + EOI + OFFSET);
if(tm->stat == STAT_ON) {
stat = pm_runtime_put(&tm->pdev->dev);
} else {
stat = pm_runtime_get(&tm->pdev->dev);
}
if(stat)
dev_err(&tm->pdev->dev, "pm runtime ret %d", stat);
#ifdef MANU_UNLOCK
wake_unlock(&tm->wake_lock);
#endif
}
/*dev_info(&tm->pdev->dev, "irq %d", irq);*/
return IRQ_HANDLED;
}
示例13: wcd9xxx_spmi_unlock_sleep
void wcd9xxx_spmi_unlock_sleep()
{
mutex_lock(&map.pm_lock);
if (--map.wlock_holders == 0) {
pr_debug("%s: releasing wake lock pm_state %d -> %d\n",
__func__, map.pm_state, WCD9XXX_PM_SLEEPABLE);
/*
* if wcd9xxx_spmi_lock_sleep failed, pm_state would be still
* WCD9XXX_PM_ASLEEP, don't overwrite
*/
if (likely(map.pm_state == WCD9XXX_PM_AWAKE))
map.pm_state = WCD9XXX_PM_SLEEPABLE;
pm_qos_update_request(&map.pm_qos_req,
PM_QOS_DEFAULT_VALUE);
pm_relax(&map.spmi[0]->dev);
}
mutex_unlock(&map.pm_lock);
pr_debug("%s: wake lock counter %d\n", __func__,
map.wlock_holders);
pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
wake_up_all(&map.pm_wq);
}
示例14: imx_imx_snvs_check_for_events
static void imx_imx_snvs_check_for_events(struct timer_list *t)
{
struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
struct input_dev *input = pdata->input;
u32 state;
regmap_read(pdata->snvs, SNVS_HPSR_REG, &state);
state = state & SNVS_HPSR_BTN ? 1 : 0;
/* only report new event if status changed */
if (state ^ pdata->keystate) {
pdata->keystate = state;
input_event(input, EV_KEY, pdata->keycode, state);
input_sync(input);
pm_relax(pdata->input->dev.parent);
}
/* repeat check if pressed long */
if (state) {
mod_timer(&pdata->check_timer,
jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
}
}
示例15: bu21150_ioctl_set_scan_mode
static long bu21150_ioctl_set_scan_mode(unsigned long arg)
{
struct bu21150_data *ts = spi_get_drvdata(g_client_bu21150);
void __user *argp = (void __user *)arg;
if (copy_from_user(&ts->scan_mode, argp,
sizeof(u16))) {
pr_err("%s: Failed to copy_from_user().\n", __func__);
return -EFAULT;
}
mutex_lock(&ts->mutex_wake);
if (ts->stay_awake && ts->wake_up &&
ts->scan_mode != AFE_SCAN_GESTURE_SELF_CAP) {
pm_relax(&ts->client->dev);
ts->stay_awake = false;
}
mutex_unlock(&ts->mutex_wake);
return 0;
}