本文整理汇总了C++中pci_set_power_state函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_set_power_state函数的具体用法?C++ pci_set_power_state怎么用?C++ pci_set_power_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pci_set_power_state函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtsx_resume
static int rtsx_resume(struct pci_dev *pci)
{
struct rtsx_dev *dev = (struct rtsx_dev *)pci_get_drvdata(pci);
struct rtsx_chip *chip;
printk(KERN_INFO "Ready to resume\n");
if (!dev) {
printk(KERN_ERR "Invalid memory\n");
return 0;
}
chip = dev->chip;
/* lock the device pointers */
mutex_lock(&(dev->dev_mutex));
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "%s: pci_enable_device failed, "
"disabling device\n", CR_DRIVER_NAME);
/* unlock the device pointers */
mutex_unlock(&dev->dev_mutex);
return -EIO;
}
pci_set_master(pci);
if (chip->msi_en) {
if (pci_enable_msi(pci) < 0)
chip->msi_en = 0;
}
if (rtsx_acquire_irq(dev) < 0) {
/* unlock the device pointers */
mutex_unlock(&dev->dev_mutex);
return -EIO;
}
rtsx_write_register(chip, HOST_SLEEP_STATE, 0x03, 0x00);
rtsx_init_chip(chip);
/* unlock the device pointers */
mutex_unlock(&dev->dev_mutex);
return 0;
}
示例2: snd_cs5535audio_resume
int snd_cs5535audio_resume(struct pci_dev *pci)
{
struct snd_card *card = pci_get_drvdata(pci);
struct cs5535audio *cs5535au = card->private_data;
u32 tmp;
int timeout;
int i;
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
"disabling device\n");
snd_card_disconnect(card);
return -EIO;
}
pci_set_master(pci);
/* set LNK_WRM_RST to reset AC link */
cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_WRM_RST);
timeout = 50;
do {
tmp = cs_readl(cs5535au, ACC_CODEC_STATUS);
if (tmp & PRM_RDY_STS)
break;
udelay(1);
} while (--timeout);
if (!timeout)
snd_printk(KERN_ERR "Failure getting AC Link ready\n");
/* set up rate regs, dma. actual initiation is done in trig */
for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) {
struct cs5535audio_dma *dma = &cs5535au->dmas[i];
if (dma && dma->substream) {
dma->substream->ops->prepare(dma->substream);
dma->ops->setup_prd(cs5535au, dma->saved_prd);
}
}
/* we depend on ac97 to perform the codec power up */
snd_ac97_resume(cs5535au->ac97);
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
示例3: rtl8192E_suspend
int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
u32 ulRegRead;
netdev_info(dev, "============> r8192E suspend call.\n");
del_timer_sync(&priv->gpio_polling_timer);
cancel_delayed_work(&priv->gpio_change_rf_wq);
priv->polling_timer_on = 0;
if (!netif_running(dev)) {
netdev_info(dev,
"RTL819XE:UI is open out of suspend function\n");
goto out_pci_suspend;
}
if (dev->netdev_ops->ndo_stop)
dev->netdev_ops->ndo_stop(dev);
netif_device_detach(dev);
if (!priv->rtllib->bSupportRemoteWakeUp) {
MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT, true);
ulRegRead = read_nic_dword(dev, CPU_GEN);
ulRegRead |= CPU_GEN_SYSTEM_RESET;
write_nic_dword(dev, CPU_GEN, ulRegRead);
} else {
write_nic_dword(dev, WFCRC0, 0xffffffff);
write_nic_dword(dev, WFCRC1, 0xffffffff);
write_nic_dword(dev, WFCRC2, 0xffffffff);
write_nic_byte(dev, PMR, 0x5);
write_nic_byte(dev, MacBlkCtrl, 0xa);
}
out_pci_suspend:
netdev_info(dev, "WOL is %s\n", priv->rtllib->bSupportRemoteWakeUp ?
"Supported" : "Not supported");
pci_save_state(pdev);
pci_disable_device(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev, state),
priv->rtllib->bSupportRemoteWakeUp ? 1 : 0);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
mdelay(20);
return 0;
}
示例4: snd_vx222_resume
static int snd_vx222_resume(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_vx222 *vx = card->private_data;
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "vx222: pci_enable_device failed, "
"disabling device\n");
snd_card_disconnect(card);
return -EIO;
}
pci_set_master(pci);
return snd_vx_resume(&vx->core);
}
示例5: bbswitch_on
static void bbswitch_on(void) {
if (!is_card_disabled())
return;
printk(KERN_INFO "bbswitch: enabling discrete graphics\n");
if (bbswitch_acpi_on())
printk(KERN_WARNING "bbswitch: The discrete card could not be enabled"
" by a _DSM call\n");
pci_set_power_state(dis_dev, PCI_D0);
pci_restore_state(dis_dev);
if (pci_enable_device(dis_dev))
printk(KERN_WARNING "bbswitch: failed to enable %s\n",
dev_name(&dis_dev->dev));
pci_set_master(dis_dev);
}
示例6: pch_phub_suspend
static int pch_phub_suspend(struct pci_dev *pdev, pm_message_t state)
{
int ret;
pch_phub_save_reg_conf(pdev);
ret = pci_save_state(pdev);
if (ret) {
dev_err(&pdev->dev,
" %s -pci_save_state returns %d\n", __func__, ret);
return ret;
}
pci_enable_wake(pdev, PCI_D3hot, 0);
pci_disable_device(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
示例7: ahc_linux_pci_dev_suspend
static int
ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
{
struct ahc_softc *ahc = pci_get_drvdata(pdev);
int rc;
if ((rc = ahc_suspend(ahc)))
return rc;
pci_save_state(pdev);
pci_disable_device(pdev);
if (mesg.event == PM_EVENT_SUSPEND)
pci_set_power_state(pdev, PCI_D3hot);
return rc;
}
示例8: mhi_turn_on_pcie_link
MHI_STATUS mhi_turn_on_pcie_link(mhi_device_ctxt *mhi_dev_ctxt)
{
int r = 0;
struct pci_dev *pcie_dev;
MHI_STATUS ret_val = MHI_STATUS_SUCCESS;
pcie_dev = mhi_dev_ctxt->dev_info->pcie_device;
mutex_lock(&mhi_dev_ctxt->mhi_link_state);
mhi_log(MHI_MSG_INFO, "Entered...\n");
if (mhi_dev_ctxt->flags.link_up)
goto exit;
r = exynos_pcie_pm_resume(0);
if (r) {
mhi_log(MHI_MSG_CRITICAL | MHI_DBG_POWER,
"Failed to resume PCIe RC driver ret %d\n", r);
ret_val = MHI_STATUS_ERROR;
goto exit;
}
atomic_dec(&mhi_dev_ctxt->flags.mhi_link_off);
r = pci_set_power_state(mhi_dev_ctxt->dev_info->pcie_device,
PCI_D0);
if (r) {
mhi_log(MHI_MSG_CRITICAL | MHI_DBG_POWER,
"Failed to load stored state ret %d\n", r);
ret_val = MHI_STATUS_ERROR;
goto exit;
}
/* Restore pcie config space */
r = exynos_pcie_restore_config(mhi_dev_ctxt->dev_info->pcie_device);
if (r) {
mhi_log(MHI_MSG_CRITICAL | MHI_DBG_POWER,
"Failed to save pcie config space: %x\n", r);
ret_val = MHI_STATUS_ERROR;
goto exit;
}
mhi_dev_ctxt->flags.link_up = 1;
exit:
mutex_unlock(&mhi_dev_ctxt->mhi_link_state);
mhi_log(MHI_MSG_INFO, "Exited...\n");
return ret_val;
}
示例9: usb_hcd_pci_resume
/**
* usb_hcd_pci_resume - power management resume of a PCI-based HCD
* @dev: USB Host Controller being resumed
*
* Store this function in the HCD's struct pci_driver as resume().
*/
int usb_hcd_pci_resume (struct pci_dev *dev)
{
struct usb_hcd *hcd;
int retval;
int has_pci_pm;
hcd = pci_get_drvdata(dev);
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (has_pci_pm)
dev_dbg(hcd->self.controller, "resume from state D%d\n",
dev->current_state);
if (hcd->state != HCD_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller,
"can't resume, not suspended!\n");
return -EL3HLT;
}
hcd->state = USB_STATE_RESUMING;
if (has_pci_pm)
pci_set_power_state (dev, 0);
dev->dev.power.power_state = 0;
retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
hcd->description, hcd);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't restore IRQ after resume!\n");
return retval;
}
pci_set_master (dev);
pci_restore_state (dev, hcd->pci_state);
#ifdef CONFIG_USB_SUSPEND
pci_enable_wake (dev, dev->current_state, 0);
pci_enable_wake (dev, 4, 0);
#endif
retval = hcd->driver->resume (hcd);
if (!HCD_IS_RUNNING (hcd->state)) {
dev_dbg (hcd->self.controller,
"resume fail, retval %d\n", retval);
usb_hc_died (hcd);
}
return retval;
}
示例10: pch_phub_resume
static int pch_phub_resume(struct pci_dev *pdev)
{
int ret;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
ret = pci_enable_device(pdev);
if (ret) {
dev_err(&pdev->dev,
"%s-pci_enable_device failed(ret=%d) ", __func__, ret);
return ret;
}
pci_enable_wake(pdev, PCI_D3hot, 0);
pch_phub_restore_reg_conf(pdev);
return 0;
}
示例11: snd_atiixp_suspend
/*
* power management
*/
static int snd_atiixp_suspend(snd_card_t *card, unsigned int state)
{
atiixp_t *chip = card->pm_private_data;
int i;
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
if (chip->pcmdevs[i])
snd_pcm_suspend_all(chip->pcmdevs[i]);
for (i = 0; i < NUM_ATI_CODECS; i++)
if (chip->ac97[i])
snd_ac97_suspend(chip->ac97[i]);
snd_atiixp_aclink_down(chip);
snd_atiixp_chip_stop(chip);
pci_set_power_state(chip->pci, 3);
pci_disable_device(chip->pci);
return 0;
}
示例12: snd_atiixp_resume
static int snd_atiixp_resume(snd_card_t *card, unsigned int state)
{
atiixp_t *chip = card->pm_private_data;
int i;
pci_enable_device(chip->pci);
pci_set_power_state(chip->pci, 0);
pci_set_master(chip->pci);
snd_atiixp_aclink_reset(chip);
snd_atiixp_chip_start(chip);
for (i = 0; i < NUM_ATI_CODECS; i++)
if (chip->ac97[i])
snd_ac97_resume(chip->ac97[i]);
return 0;
}
示例13: rtl8180_suspend
int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
// struct r8180_priv *priv = ieee80211_priv(dev);
if (!netif_running(dev))
goto out_pci_suspend;
dev->stop(dev);
netif_device_detach(dev);
out_pci_suspend:
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev,pci_choose_state(pdev,state));
return 0;
}
示例14: tw68_suspend
static int tw68_suspend(struct pci_dev *pci_dev , pm_message_t state)
{
struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
struct tw68_dev *dev = container_of(v4l2_dev,
struct tw68_dev, v4l2_dev);
tw_clearl(TW68_DMAC, TW68_DMAP_EN | TW68_FIFO_EN);
dev->pci_irqmask &= ~TW68_VID_INTS;
tw_writel(TW68_INTMASK, 0);
synchronize_irq(pci_dev->irq);
pci_save_state(pci_dev);
pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
vb2_discard_done(&dev->vidq);
return 0;
}
示例15: rtl8192E_resume
int rtl8192E_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
int err;
u32 val;
netdev_info(dev, "================>r8192E resume call.\n");
pci_set_power_state(pdev, PCI_D0);
err = pci_enable_device(pdev);
if (err) {
netdev_err(dev, "pci_enable_device failed on resume\n");
return err;
}
pci_restore_state(pdev);
pci_read_config_dword(pdev, 0x40, &val);
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
pci_enable_wake(pdev, PCI_D0, 0);
if (priv->polling_timer_on == 0)
check_rfctrl_gpio_timer((unsigned long)dev);
if (!netif_running(dev)) {
netdev_info(dev,
"RTL819XE:UI is open out of resume function\n");
goto out;
}
netif_device_attach(dev);
if (dev->netdev_ops->ndo_open)
dev->netdev_ops->ndo_open(dev);
if (!priv->rtllib->bSupportRemoteWakeUp)
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT, true);
out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
return 0;
}