本文整理汇总了C++中pm_stay_awake函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_stay_awake函数的具体用法?C++ pm_stay_awake怎么用?C++ pm_stay_awake使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_stay_awake函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtc_set_time
int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
{
int err;
err = rtc_valid_tm(tm);
if (err != 0)
return err;
err = rtc_valid_range(rtc, tm);
if (err)
return err;
rtc_subtract_offset(rtc, tm);
err = mutex_lock_interruptible(&rtc->ops_lock);
if (err)
return err;
if (!rtc->ops)
err = -ENODEV;
else if (rtc->ops->set_time)
err = rtc->ops->set_time(rtc->dev.parent, tm);
else
err = -EINVAL;
pm_stay_awake(rtc->dev.parent);
mutex_unlock(&rtc->ops_lock);
/* A timer might have just expired */
schedule_work(&rtc->irqwork);
trace_rtc_set_time(rtc_tm_to_time64(tm), err);
return err;
}
示例2: msm_ehci_host_wakeup_irq
static irqreturn_t msm_ehci_host_wakeup_irq(int irq, void *data)
{
struct msm_hcd *mhcd = data;
mhcd->pmic_gpio_int_cnt++;
dev_dbg(mhcd->dev, "%s: hsusb host remote wakeup interrupt cnt: %u\n",
__func__, mhcd->pmic_gpio_int_cnt);
pm_stay_awake(mhcd->dev);
if (mhcd->pmic_gpio_dp_irq_enabled) {
mhcd->pmic_gpio_dp_irq_enabled = 0;
disable_irq_wake(irq);
disable_irq_nosync(irq);
}
if (!atomic_read(&mhcd->pm_usage_cnt)) {
atomic_set(&mhcd->pm_usage_cnt, 1);
pm_runtime_get(mhcd->dev);
}
return IRQ_HANDLED;
}
示例3: gpio_keys_gpio_isr
static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
{
struct gpio_button_data *bdata = dev_id;
#ifdef CONFIG_SEC_DEBUG
int state = (gpio_get_value(bdata->button->gpio) ? 1 : 0) ^ bdata->button->active_low;
sec_debug_check_crash_key(bdata->button->code, state);
#endif
BUG_ON(irq != bdata->irq);
if (suspend_state) {
irq_in_suspend = true;
wakeup_reason = bdata->button->code;
pr_info("%s before resume by %d\n", __func__, wakeup_reason);
}
if (bdata->button->wakeup)
pm_stay_awake(bdata->input->dev.parent);
if (bdata->timer_debounce)
mod_timer(&bdata->timer,
jiffies + msecs_to_jiffies(bdata->timer_debounce));
else
schedule_work(&bdata->work);
return IRQ_HANDLED;
}
示例4: gpio_keys_gpio_isr
static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
{
struct gpio_button_data *bdata = dev_id;
BUG_ON(irq != bdata->irq);
if (bdata->button->wakeup) {
const struct gpio_keys_button *button = bdata->button;
pm_stay_awake(bdata->input->dev.parent);
if (bdata->suspended &&
(button->type == 0 || button->type == EV_KEY)) {
/*
* Simulate wakeup key press in case the key has
* already released by the time we got interrupt
* handler to run.
*/
input_report_key(bdata->input, button->code, 1);
}
}
mod_delayed_work(system_wq,
&bdata->work,
msecs_to_jiffies(bdata->software_debounce));
return IRQ_HANDLED;
}
示例5: rtc_timer_remove
/**
* rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
* @rtc rtc device
* @timer timer being removed.
*
* Removes a timer onto the rtc devices timerqueue and sets
* the next alarm event appropriately.
*
* Clears the enabled bit on the removed timer.
*
* Must hold ops_lock for proper serialization of timerqueue
*/
static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
{
struct timerqueue_node *next = timerqueue_getnext(&rtc->timerqueue);
timerqueue_del(&rtc->timerqueue, &timer->node);
trace_rtc_timer_dequeue(timer);
timer->enabled = 0;
if (next == &timer->node) {
struct rtc_wkalrm alarm;
int err;
next = timerqueue_getnext(&rtc->timerqueue);
if (!next) {
rtc_alarm_disable(rtc);
return;
}
alarm.time = rtc_ktime_to_tm(next->expires);
alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm);
if (err == -ETIME) {
pm_stay_awake(rtc->dev.parent);
schedule_work(&rtc->irqwork);
}
}
}
示例6: rtc_set_time
int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
{
int err;
err = rtc_valid_tm(tm);
if (err != 0)
return err;
err = mutex_lock_interruptible(&rtc->ops_lock);
if (err)
return err;
if (!rtc->ops)
err = -ENODEV;
else if (rtc->ops->set_time)
err = rtc->ops->set_time(rtc->dev.parent, tm);
else if (rtc->ops->set_mmss64) {
time64_t secs64 = rtc_tm_to_time64(tm);
err = rtc->ops->set_mmss64(rtc->dev.parent, secs64);
} else if (rtc->ops->set_mmss) {
time64_t secs64 = rtc_tm_to_time64(tm);
err = rtc->ops->set_mmss(rtc->dev.parent, secs64);
} else
err = -EINVAL;
pm_stay_awake(rtc->dev.parent);
mutex_unlock(&rtc->ops_lock);
/* A timer might have just expired */
schedule_work(&rtc->irqwork);
return err;
}
示例7: imx_keypad_irq_handler
static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id)
{
struct imx_keypad *keypad = dev_id;
unsigned short reg_val;
reg_val = readw(keypad->mmio_base + KPSR);
/* Disable both interrupt types */
reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
/* Clear interrupts status bits */
reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
writew(reg_val, keypad->mmio_base + KPSR);
if (keypad->enabled) {
pm_stay_awake(keypad->input_dev->dev.parent);
/* The matrix is supposed to be changed */
keypad->stable_count = 0;
/* Schedule the scanning procedure near in the future */
mod_timer(&keypad->check_matrix_timer,
jiffies + msecs_to_jiffies(2));
}
return IRQ_HANDLED;
}
示例8: bu21150_irq_thread
static irqreturn_t bu21150_irq_thread(int irq, void *dev_id)
{
struct bu21150_data *ts = dev_id;
u8 *psbuf = (u8 *)ts->frame_work;
mutex_lock(&ts->mutex_wake);
if (!ts->stay_awake && ts->wake_up &&
ts->scan_mode == AFE_SCAN_GESTURE_SELF_CAP) {
pm_stay_awake(&ts->client->dev);
ts->stay_awake = true;
}
mutex_unlock(&ts->mutex_wake);
/* get frame */
ts->frame_work_get = ts->req_get;
bu21150_read_register(REG_READ_DATA, ts->frame_work_get.size, psbuf);
if (ts->reset_flag == 0) {
#ifdef CHECK_SAME_FRAME
check_same_frame(ts);
#endif
copy_frame(ts);
wake_up_frame_waitq(ts);
} else {
ts->reset_flag = 0;
}
return IRQ_HANDLED;
}
示例9: 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");
}
}
示例10: bcmsdh_dev_pm_stay_awake
void bcmsdh_dev_pm_stay_awake(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_stay_awake(bcmsdh_osinfo->dev);
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
}
示例11: 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);
}
}
示例12: msm_async_irq
static irqreturn_t msm_async_irq(int irq, void *data)
{
struct msm_hcd *mhcd = data;
int ret;
mhcd->async_int_cnt++;
dev_dbg(mhcd->dev, "%s: hsusb host remote wakeup interrupt cnt: %u\n",
__func__, mhcd->async_int_cnt);
pm_stay_awake(mhcd->dev);
spin_lock(&mhcd->wakeup_lock);
if (mhcd->async_irq_enabled) {
mhcd->async_irq_enabled = 0;
disable_irq_wake(irq);
disable_irq_nosync(irq);
}
spin_unlock(&mhcd->wakeup_lock);
if (!atomic_read(&mhcd->pm_usage_cnt)) {
ret = pm_runtime_get(mhcd->dev);
if ((ret == 1) || (ret == -EINPROGRESS))
pm_runtime_put_noidle(mhcd->dev);
else
atomic_set(&mhcd->pm_usage_cnt, 1);
}
return IRQ_HANDLED;
}
示例13: mxhci_hsic_resume
static int mxhci_hsic_resume(struct mxhci_hsic_hcd *mxhci)
{
struct usb_hcd *hcd = hsic_to_hcd(mxhci);
int ret;
unsigned long flags;
if (!mxhci->in_lpm) {
dev_dbg(mxhci->dev, "%s called in !in_lpm\n", __func__);
return 0;
}
pm_stay_awake(mxhci->dev);
/* enable force-on mode for periph_on */
clk_set_flags(mxhci->system_clk, CLKFLAG_RETAIN_PERIPH);
if (mxhci->bus_perf_client) {
mxhci->bus_vote = true;
queue_work(mxhci->wq, &mxhci->bus_vote_w);
}
spin_lock_irqsave(&mxhci->wakeup_lock, flags);
if (mxhci->wakeup_irq_enabled) {
disable_irq_wake(mxhci->wakeup_irq);
disable_irq_nosync(mxhci->wakeup_irq);
mxhci->wakeup_irq_enabled = 0;
}
if (mxhci->pm_usage_cnt) {
mxhci->pm_usage_cnt = 0;
pm_runtime_put_noidle(mxhci->dev);
}
spin_unlock_irqrestore(&mxhci->wakeup_lock, flags);
ret = regulator_set_voltage(mxhci->hsic_vddcx, mxhci->vdd_low_vol_level,
mxhci->vdd_high_vol_level);
if (ret < 0)
dev_err(mxhci->dev,
"unable to set nominal vddcx voltage (no VDD MIN)\n");
clk_prepare_enable(mxhci->system_clk);
clk_prepare_enable(mxhci->cal_clk);
clk_prepare_enable(mxhci->hsic_clk);
clk_prepare_enable(mxhci->utmi_clk);
clk_prepare_enable(mxhci->core_clk);
if (mxhci->wakeup_irq)
usb_hcd_resume_root_hub(hcd);
mxhci->in_lpm = 0;
dev_dbg(mxhci->dev, "HSIC-USB exited from low power mode\n");
xhci_dbg_log_event(&dbg_hsic, NULL, "Controller resumed", 0);
return 0;
}
示例14: rtc_update_irq
/**
* rtc_update_irq - Triggered when a RTC interrupt occurs.
* @rtc: the rtc device
* @num: how many irqs are being reported (usually one)
* @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF
* Context: any
*/
void rtc_update_irq(struct rtc_device *rtc,
unsigned long num, unsigned long events)
{
if (IS_ERR_OR_NULL(rtc))
return;
pm_stay_awake(rtc->dev.parent);
schedule_work(&rtc->irqwork);
}
示例15: link_pm_runtime_get_active
static int link_pm_runtime_get_active(struct link_pm_data *pm_data)
{
int ret;
struct usb_link_device *usb_ld = pm_data->usb_ld;
struct device *dev = &usb_ld->usbdev->dev;
if (!usb_ld->if_usb_connected || usb_ld->ld.com_state == COM_NONE)
return -ENODEV;
if (pm_data->dpm_suspending) {
mif_err("Kernel in suspending try get_active later\n");
/* during dpm_suspending..
* if AP get tx data, wake up. */
#ifdef CONFIG_HAS_WAKELOCK
wake_lock(&pm_data->l2_wake);
#else
pm_stay_awake(pm_data->miscdev.this_device);
#endif
return -EAGAIN;
}
if (dev->power.runtime_status == RPM_ACTIVE) {
pm_data->resume_retry_cnt = 0;
return 0;
}
if (!pm_data->resume_requested) {
mif_debug("QW PM\n");
queue_delayed_work(pm_data->wq, &pm_data->link_pm_work, 0);
}
mif_debug("Wait pm\n");
INIT_COMPLETION(pm_data->active_done);
ret = wait_for_completion_timeout(&pm_data->active_done,
msecs_to_jiffies(500));
/* If usb link was disconnected while waiting ACTIVE State, usb device
* was removed, usb_ld->usbdev->dev is invalid and below
* dev->power.runtime_status is also invalid address.
* It will be occured LPA L3 -> AP iniated L0 -> disconnect -> link
* timeout
*/
if (!usb_ld->if_usb_connected || usb_ld->ld.com_state == COM_NONE) {
mif_info("link disconnected after timed-out\n");
return -ENODEV;
}
if (dev->power.runtime_status != RPM_ACTIVE) {
mif_info("link_active (%d) retry\n",
dev->power.runtime_status);
return -EAGAIN;
}
mif_debug("link_active success(%d)\n", ret);
return 0;
}