本文整理汇总了C++中pm_runtime_get函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_runtime_get函数的具体用法?C++ pm_runtime_get怎么用?C++ pm_runtime_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_runtime_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gma_power_begin
/**
* gma_power_begin - begin requiring power
* @dev: our DRM device
* @force_on: true to force power on
*
* Begin an action that requires the display power island is enabled.
* We refcount the islands.
*/
bool gma_power_begin(struct drm_device *dev, bool force_on)
{
struct drm_psb_private *dev_priv = dev->dev_private;
int ret;
unsigned long flags;
spin_lock_irqsave(&power_ctrl_lock, flags);
/* Power already on ? */
if (dev_priv->display_power) {
dev_priv->display_count++;
pm_runtime_get(&dev->pdev->dev);
spin_unlock_irqrestore(&power_ctrl_lock, flags);
return true;
}
if (force_on == false)
goto out_false;
/* Ok power up needed */
ret = gma_resume_pci(dev->pdev);
if (ret == 0) {
psb_irq_preinstall(dev);
psb_irq_postinstall(dev);
pm_runtime_get(&dev->pdev->dev);
dev_priv->display_count++;
spin_unlock_irqrestore(&power_ctrl_lock, flags);
return true;
}
out_false:
spin_unlock_irqrestore(&power_ctrl_lock, flags);
return false;
}
示例2: cyttsp4_mt_open
static int cyttsp4_mt_open(struct input_dev *input)
{
struct device *dev = input->dev.parent;
struct cyttsp4_device *ttsp =
container_of(dev, struct cyttsp4_device, dev);
dev_dbg(dev, "%s\n", __func__);
pm_runtime_get(dev);
dev_vdbg(dev, "%s: setup subscriptions\n", __func__);
/* set up touch call back */
cyttsp4_subscribe_attention(ttsp, CY_ATTEN_IRQ,
cyttsp4_mt_attention, CY_MODE_OPERATIONAL);
/* set up startup call back */
cyttsp4_subscribe_attention(ttsp, CY_ATTEN_STARTUP,
cyttsp4_startup_attention, 0);
/* set up wakeup call back */
cyttsp4_subscribe_attention(ttsp, CY_ATTEN_WAKE,
cyttsp4_mt_wake_attention, 0);
return 0;
}
示例3: vpif_probe
static int vpif_probe(struct platform_device *pdev)
{
int status = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENOENT;
res_len = resource_size(res);
res = request_mem_region(res->start, res_len, res->name);
if (!res)
return -EBUSY;
vpif_base = ioremap(res->start, res_len);
if (!vpif_base) {
status = -EBUSY;
goto fail;
}
pm_runtime_enable(&pdev->dev);
pm_runtime_get(&pdev->dev);
spin_lock_init(&vpif_lock);
dev_info(&pdev->dev, "vpif probe success\n");
return 0;
fail:
release_mem_region(res->start, res_len);
return status;
}
示例4: intel_mid_gps_hostwake_isr
static irqreturn_t intel_mid_gps_hostwake_isr(int irq, void *dev)
{
struct intel_mid_gps_platform_data *pdata = dev_get_drvdata(dev);
int hostwake;
hostwake = gpio_get_value(pdata->gpio_hostwake);
tty_dev = intel_mid_hsu_set_wake_peer(pdata->hsu_port, NULL);
if (!tty_dev) {
pr_err("%s: unable to get the HSU tty device \n", __func__);
}
irq_set_irq_type(irq, hostwake ? IRQF_TRIGGER_FALLING :
IRQF_TRIGGER_RISING);
if (hostwake) {
wake_lock(&hostwake_lock);
if (tty_dev)
pm_runtime_get(tty_dev);
}
else {
if (tty_dev)
pm_runtime_put(tty_dev);
wake_unlock(&hostwake_lock);
}
return IRQ_HANDLED;
}
示例5: byt_gpio_request
static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
{
struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *reg = byt_gpio_reg(chip, offset, BYT_CONF0_REG);
u32 value;
bool special;
/*
* In most cases, func pin mux 000 means GPIO function.
* But, some pins may have func pin mux 001 represents
* GPIO function. Only allow user to export pin with
* func pin mux preset as GPIO function by BIOS/FW.
*/
value = readl(reg) & BYT_PIN_MUX;
special = is_special_pin(vg, offset);
if ((special && value != 1) || (!special && value)) {
dev_err(&vg->pdev->dev,
"pin %u cannot be used as GPIO.\n", offset);
return -EINVAL;
}
pm_runtime_get(&vg->pdev->dev);
return 0;
}
示例6: res_trk_vidc_pwr_up
static u32 res_trk_vidc_pwr_up(void)
{
mutex_lock(&resource_context.lock);
if (pm_runtime_get(resource_context.device) < 0) {
VCDRES_MSG_ERROR("Error : pm_runtime_get failed\n");
goto bail_out;
}
if (!resource_context.footswitch)
resource_context.footswitch =
regulator_get(resource_context.device, "vdd");
if (IS_ERR(resource_context.footswitch)) {
VCDRES_MSG_ERROR("foot switch get failed\n");
resource_context.footswitch = NULL;
} else
regulator_enable(resource_context.footswitch);
if (!res_trk_get_clk())
goto rel_vidc_pm_runtime;
mutex_unlock(&resource_context.lock);
return true;
rel_vidc_pm_runtime:
if (pm_runtime_put(resource_context.device) < 0)
VCDRES_MSG_ERROR("Error : pm_runtime_put failed");
bail_out:
mutex_unlock(&resource_context.lock);
return false;
}
示例7: tdisc_interrupt
static irqreturn_t tdisc_interrupt(int irq, void *dev_id)
{
/*
* The touch disc intially generates an interrupt on any
* touch. The interrupt line is pulled low and remains low
* untill there are touch operations being performed. In case
* there are no further touch operations, the line goes high. The
* same process repeats again the next time,when the disc is touched.
*
* We do the following operations once we receive an interrupt.
* 1. Disable the IRQ for any further interrutps.
* 2. Schedule work every 25ms if the GPIO is still low.
* 3. In the work queue do a I2C read to get the touch data.
* 4. If the GPIO is pulled high, enable the IRQ and cancel the work.
*/
struct tdisc_data *dd = dev_id;
int rc;
rc = pm_runtime_get(&dd->clientp->dev);
if (rc < 0)
dev_dbg(&dd->clientp->dev, "%s: pm_runtime_get"
" failed\n", __func__);
pr_debug("%s: TDISC IRQ ! :-)\n", __func__);
/* Schedule the work immediately */
disable_irq_nosync(dd->clientp->irq);
schedule_delayed_work(&dd->tdisc_work, 0);
return IRQ_HANDLED;
}
示例8: request_autopm_lock
void request_autopm_lock(int status)
{
struct diag_bridge *dev = __dev;
if (!dev || !dev->udev)
return;
pr_info("%s: set runtime pm lock : %d\n", __func__, status);
if (status) {
if (!atomic_read(&dev->pmlock_cnt)) {
atomic_inc(&dev->pmlock_cnt);
pr_info("get lock\n");
pm_runtime_get(&dev->udev->dev);
pm_runtime_forbid(&dev->udev->dev);
} else
atomic_inc(&dev->pmlock_cnt);
} else {
if (!atomic_read(&dev->pmlock_cnt))
pr_info("unbalanced release\n");
else if (atomic_dec_and_test(&dev->pmlock_cnt)) {
pr_info("release lock\n");
pm_runtime_allow(&dev->udev->dev);
pm_runtime_put(&dev->udev->dev);
}
}
}
示例9: arizona_start_mic
static void arizona_start_mic(struct arizona_extcon_info *info)
{
struct arizona *arizona = info->arizona;
bool change;
int ret;
info->detecting = true;
info->mic = false;
info->jack_flips = 0;
/* Microphone detection can't use idle mode */
pm_runtime_get(info->dev);
ret = regulator_enable(info->micvdd);
if (ret != 0) {
dev_err(arizona->dev, "Failed to enable MICVDD: %d\n",
ret);
}
if (info->micd_reva) {
regmap_write(arizona->regmap, 0x80, 0x3);
regmap_write(arizona->regmap, 0x294, 0);
regmap_write(arizona->regmap, 0x80, 0x0);
}
regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_ENA, ARIZONA_MICD_ENA,
&change);
if (!change) {
regulator_disable(info->micvdd);
pm_runtime_put_autosuspend(info->dev);
}
}
示例10: debug_write_phy_data
static ssize_t debug_write_phy_data(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct msm_hcd *mhcd = file->private_data;
char kbuf[10];
u32 data = 0;
memset(kbuf, 0, 10);
if (copy_from_user(kbuf, buf, min_t(size_t, sizeof(kbuf) - 1, count)))
return -EFAULT;
if (sscanf(kbuf, "%x", &data) != 1)
return -EINVAL;
pm_runtime_get(mhcd->dev);
if (msm_ulpi_write(mhcd, data, addr) < 0) {
dev_err(mhcd->dev,
"%s(): ulpi write timeout\n", __func__);
return -ETIMEDOUT;
}
pm_runtime_put(mhcd->dev);
return count;
}
示例11: 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;
}
示例12: lnw_irq_type
static int lnw_irq_type(struct irq_data *d, unsigned type)
{
struct lnw_gpio *lnw = irq_data_get_irq_chip_data(d);
u32 gpio = irqd_to_hwirq(d);
unsigned long flags;
u32 value;
void __iomem *grer = gpio_reg(&lnw->chip, gpio, GRER);
void __iomem *gfer = gpio_reg(&lnw->chip, gpio, GFER);
if (gpio >= lnw->chip.ngpio)
return -EINVAL;
if (lnw->pdev)
pm_runtime_get(&lnw->pdev->dev);
spin_lock_irqsave(&lnw->lock, flags);
if (type & IRQ_TYPE_EDGE_RISING)
value = readl(grer) | BIT(gpio % 32);
else
value = readl(grer) & (~BIT(gpio % 32));
writel(value, grer);
if (type & IRQ_TYPE_EDGE_FALLING)
value = readl(gfer) | BIT(gpio % 32);
else
value = readl(gfer) & (~BIT(gpio % 32));
writel(value, gfer);
spin_unlock_irqrestore(&lnw->lock, flags);
if (lnw->pdev)
pm_runtime_put(&lnw->pdev->dev);
return 0;
}
示例13: debug_read_phy_data
static ssize_t debug_read_phy_data(struct file *file, char __user *ubuf,
size_t count, loff_t *ppos)
{
struct msm_hcd *mhcd = file->private_data;
char *kbuf;
size_t c = 0;
u32 data = 0;
int ret = 0;
kbuf = kzalloc(sizeof(char) * BUF_SIZE, GFP_KERNEL);
if (!kbuf)
return -ENOMEM;
pm_runtime_get(mhcd->dev);
data = msm_ulpi_read(mhcd, addr);
pm_runtime_put(mhcd->dev);
if (data < 0) {
dev_err(mhcd->dev,
"%s(): ulpi read timeout\n", __func__);
return -ETIMEDOUT;
}
c = scnprintf(kbuf, BUF_SIZE, "addr: 0x%x: data: 0x%x\n", addr, data);
ret = simple_read_from_buffer(ubuf, count, ppos, kbuf, c);
kfree(kbuf);
return ret;
}
示例14: msm_hsic_wakeup_irq
static irqreturn_t msm_hsic_wakeup_irq(int irq, void *data)
{
struct msm_hsic_hcd *mehci = data;
int ret;
mehci->wakeup_int_cnt++;
dbg_log_event(NULL, "Remote Wakeup IRQ", mehci->wakeup_int_cnt);
dev_dbg(mehci->dev, "%s: hsic remote wakeup interrupt cnt: %u\n",
__func__, mehci->wakeup_int_cnt);
wake_lock(&mehci->wlock);
if (mehci->wakeup_irq_enabled) {
mehci->wakeup_irq_enabled = 0;
disable_irq_wake(irq);
disable_irq_nosync(irq);
}
if (!atomic_read(&mehci->pm_usage_cnt)) {
ret = pm_runtime_get(mehci->dev);
/*
* HSIC runtime resume can race with us.
* if we are active (ret == 1) or resuming
* (ret == -EINPROGRESS), decrement the
* PM usage counter before returning.
*/
if ((ret == 1) || (ret == -EINPROGRESS))
pm_runtime_put_noidle(mehci->dev);
else
atomic_set(&mehci->pm_usage_cnt, 1);
}
return IRQ_HANDLED;
}
示例15: 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);
wake_lock(&mhcd->wlock);
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;
}