本文整理汇总了C++中pci_restore_state函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_restore_state函数的具体用法?C++ pci_restore_state怎么用?C++ pci_restore_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pci_restore_state函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snd_als300_resume
static int snd_als300_resume(struct pci_dev *pci)
{
struct snd_card *card = pci_get_drvdata(pci);
struct snd_als300 *chip = card->private_data;
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "als300: pci_enable_device failed, "
"disabling device\n");
snd_card_disconnect(card);
return -EIO;
}
pci_set_master(pci);
snd_als300_init(chip);
snd_ac97_resume(chip->ac97);
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
开发者ID:nos1609,项目名称:Chrono_Kernel-1,代码行数:21,代码来源:als300.c
示例2: prism54_resume
int
prism54_resume(struct pci_dev *pdev)
{
struct net_device *ndev = pci_get_drvdata(pdev);
islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
BUG_ON(!priv);
pci_enable_device(pdev);
printk(KERN_NOTICE "%s: got resume request\n", ndev->name);
pci_restore_state(pdev);
/* alright let's go into the PREBOOT state */
islpci_reset(priv, 1);
netif_device_attach(ndev);
netif_start_queue(ndev);
return 0;
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:21,代码来源:islpci_hotplug.c
示例3: ahc_linux_pci_dev_resume
static int
ahc_linux_pci_dev_resume(struct pci_dev *pdev)
{
struct ahc_softc *ahc = pci_get_drvdata(pdev);
int rc;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
if ((rc = pci_enable_device(pdev))) {
dev_printk(KERN_ERR, &pdev->dev,
"failed to enable device after resume (%d)\n", rc);
return rc;
}
pci_set_master(pdev);
ahc_pci_resume(ahc);
return (ahc_resume(ahc));
}
开发者ID:BackupTheBerlios,项目名称:grasshopper-svn,代码行数:21,代码来源:aic7xxx_osm_pci.c
示例4: chd_dec_pci_resume
int chd_dec_pci_resume(struct pci_dev *pdev)
{
struct crystalhd_adp *adp;
struct device *dev = &pdev->dev;
BC_STATUS sts = BC_STS_SUCCESS;
int rc;
adp = (struct crystalhd_adp *)pci_get_drvdata(pdev);
if (!adp) {
dev_err(dev, "%s: could not get adp\n", __func__);
return -ENODEV;
}
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
/* device's irq possibly is changed, driver should take care */
if (pci_enable_device(pdev)) {
dev_err(dev, "Failed to enable PCI device\n");
return 1;
}
pci_set_master(pdev);
rc = chd_dec_enable_int(adp);
if (rc) {
dev_err(dev, "_enable_int err:%d\n", rc);
pci_disable_device(pdev);
return -ENODEV;
}
sts = crystalhd_resume(&adp->cmds);
if (sts != BC_STS_SUCCESS) {
dev_err(dev, "Crystal HD Resume %d\n", sts);
pci_disable_device(pdev);
return -ENODEV;
}
return 0;
}
开发者ID:Ardakilic,项目名称:crystalhd,代码行数:40,代码来源:crystalhd_lnx.c
示例5: genwqe_pci_fundamental_reset
/**
* genwqe_pci_fundamental_reset() - trigger a PCIe fundamental reset on the slot
*
* Note: pci_set_pcie_reset_state() is not implemented on all archs, so this
* reset method will not work in all cases.
*
* Return: 0 on success or error code from pci_set_pcie_reset_state()
*/
static int genwqe_pci_fundamental_reset(struct pci_dev *pci_dev)
{
int rc;
/*
* lock pci config space access from userspace,
* save state and issue PCIe fundamental reset
*/
pci_cfg_access_lock(pci_dev);
pci_save_state(pci_dev);
rc = pci_set_pcie_reset_state(pci_dev, pcie_warm_reset);
if (!rc) {
/* keep PCIe reset asserted for 250ms */
msleep(250);
pci_set_pcie_reset_state(pci_dev, pcie_deassert_reset);
/* Wait for 2s to reload flash and train the link */
msleep(2000);
}
pci_restore_state(pci_dev);
pci_cfg_access_unlock(pci_dev);
return rc;
}
开发者ID:AK101111,项目名称:linux,代码行数:30,代码来源:card_base.c
示例6: chd_dec_pci_resume
static int chd_dec_pci_resume(struct pci_dev *pdev)
{
struct crystalhd_adp *adp;
enum BC_STATUS sts = BC_STS_SUCCESS;
int rc;
adp = pci_get_drvdata(pdev);
if (!adp) {
BCMLOG_ERR("could not get adp\n");
return -ENODEV;
}
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
/* device's irq possibly is changed, driver should take care */
if (pci_enable_device(pdev)) {
BCMLOG_ERR("Failed to enable PCI device\n");
return 1;
}
pci_set_master(pdev);
rc = chd_dec_enable_int(adp);
if (rc) {
BCMLOG_ERR("_enable_int err:%d\n", rc);
pci_disable_device(pdev);
return -ENODEV;
}
sts = crystalhd_resume(&adp->cmds);
if (sts != BC_STS_SUCCESS) {
BCMLOG_ERR("BCM70012 Resume %d\n", sts);
pci_disable_device(pdev);
return -ENODEV;
}
return 0;
}
开发者ID:MaxChina,项目名称:linux,代码行数:39,代码来源:crystalhd_lnx.c
示例7: nm256_resume
static int nm256_resume(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct nm256 *chip = card->private_data;
int i;
/* Perform a full reset on the hardware */
chip->in_resume = 1;
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "nm256: pci_enable_device failed, "
"disabling device\n");
snd_card_disconnect(card);
return -EIO;
}
pci_set_master(pci);
snd_nm256_init_chip(chip);
/* restore ac97 */
snd_ac97_resume(chip->ac97);
for (i = 0; i < 2; i++) {
struct nm256_stream *s = &chip->streams[i];
if (s->substream && s->suspended) {
spin_lock_irq(&chip->reg_lock);
snd_nm256_set_format(chip, s, s->substream);
spin_unlock_irq(&chip->reg_lock);
}
}
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
chip->in_resume = 0;
return 0;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:38,代码来源:nm256.c
示例8: warp_fpga_reconfig
void warp_fpga_reconfig(void)
{
struct warp_fpga *chip = warp_fpga_getdevice();
disable_irq(chip->irq);
#ifndef WARP_V2
pci_save_state(chip->pdev);
pci_disable_device(chip->pdev);
#endif
fpga_write(chip->fpga, FPGA_CONFIG, fpga_read(chip->fpga, FPGA_CONFIG) | TRIGGER_RECONFIG_FLAG );
udelay(100);
fpga_write(chip->fpga, FPGA_CONFIG, fpga_read(chip->fpga, FPGA_CONFIG) & ~ TRIGGER_RECONFIG_FLAG );
ssleep(5);
#ifndef WARP_V2
pci_restore_state(chip->pdev);
pci_enable_device(chip->pdev);
#endif
enable_irq(chip->irq);
}
开发者ID:dvangilst,项目名称:dahdi-linux,代码行数:23,代码来源:warp-fpga.c
示例9: ahd_linux_pci_dev_resume
static int
ahd_linux_pci_dev_resume(struct pci_dev *pdev)
{
struct ahd_softc *ahd = pci_get_drvdata(pdev);
int rc;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
if ((rc = pci_enable_device(pdev))) {
// dev_printk(KERN_ERR, &pdev->dev,
;
return rc;
}
pci_set_master(pdev);
ahd_pci_resume(ahd);
ahd_resume(ahd);
return rc;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:23,代码来源:aic79xx_osm_pci.c
示例10: wl_resume
static int wl_resume(struct pci_dev *pdev)
{
struct wl_info *wl;
struct ieee80211_hw *hw;
int err = 0;
u32 val;
hw = pci_get_drvdata(pdev);
wl = HW_TO_WL(hw);
if (!wl) {
wiphy_err(wl->wiphy,
"wl: wl_resume: pci_get_drvdata failed\n");
return -ENODEV;
}
err = pci_set_power_state(pdev, PCI_D0);
if (err)
return err;
pci_restore_state(pdev);
err = pci_enable_device(pdev);
if (err)
return err;
pci_set_master(pdev);
pci_read_config_dword(pdev, 0x40, &val);
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
/*
* done. driver will be put in up state
* in wl_ops_add_interface() call.
*/
return err;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:37,代码来源:wl_mac80211.c
示例11: gma_resume_pci
/**
* gma_resume_pci - resume helper
* @dev: our PCI device
*
* Perform the resume processing on our PCI device state - rewrite
* register state and re-enable the PCI device
*/
static bool gma_resume_pci(struct pci_dev *pdev)
{
struct drm_device *dev = pci_get_drvdata(pdev);
struct drm_psb_private *dev_priv = dev->dev_private;
int ret;
if (!dev_priv->suspended)
return true;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
pci_write_config_dword(pdev, 0x5c, dev_priv->regs.saveBSM);
pci_write_config_dword(pdev, 0xFC, dev_priv->regs.saveVBT);
/* restoring MSI address and data in PCIx space */
pci_write_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, dev_priv->msi_addr);
pci_write_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, dev_priv->msi_data);
ret = pci_enable_device(pdev);
if (ret != 0)
dev_err(&pdev->dev, "pci_enable failed: %d\n", ret);
else
dev_priv->suspended = false;
return !dev_priv->suspended;
}
开发者ID:020gzh,项目名称:linux,代码行数:31,代码来源:power.c
示例12: __falcon_reset_hw
static int __falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
{
struct falcon_nic_data *nic_data = efx->nic_data;
efx_oword_t glb_ctl_reg_ker;
int rc;
netif_dbg(efx, hw, efx->net_dev, "performing %s hardware reset\n",
RESET_TYPE(method));
if (method == RESET_TYPE_WORLD) {
rc = pci_save_state(efx->pci_dev);
if (rc) {
netif_err(efx, drv, efx->net_dev,
"failed to backup PCI state of primary "
"function prior to hardware reset\n");
goto fail1;
}
if (efx_nic_is_dual_func(efx)) {
rc = pci_save_state(nic_data->pci_dev2);
if (rc) {
netif_err(efx, drv, efx->net_dev,
"failed to backup PCI state of "
"secondary function prior to "
"hardware reset\n");
goto fail2;
}
}
EFX_POPULATE_OWORD_2(glb_ctl_reg_ker,
FRF_AB_EXT_PHY_RST_DUR,
FFE_AB_EXT_PHY_RST_DUR_10240US,
FRF_AB_SWRST, 1);
} else {
EFX_POPULATE_OWORD_7(glb_ctl_reg_ker,
FRF_AB_EXT_PHY_RST_CTL,
method == RESET_TYPE_INVISIBLE,
FRF_AB_PCIE_CORE_RST_CTL, 1,
FRF_AB_PCIE_NSTKY_RST_CTL, 1,
FRF_AB_PCIE_SD_RST_CTL, 1,
FRF_AB_EE_RST_CTL, 1,
FRF_AB_EXT_PHY_RST_DUR,
FFE_AB_EXT_PHY_RST_DUR_10240US,
FRF_AB_SWRST, 1);
}
efx_writeo(efx, &glb_ctl_reg_ker, FR_AB_GLB_CTL);
netif_dbg(efx, hw, efx->net_dev, "waiting for hardware reset\n");
schedule_timeout_uninterruptible(HZ / 20);
if (method == RESET_TYPE_WORLD) {
if (efx_nic_is_dual_func(efx))
pci_restore_state(nic_data->pci_dev2);
pci_restore_state(efx->pci_dev);
netif_dbg(efx, drv, efx->net_dev,
"successfully restored PCI config\n");
}
efx_reado(efx, &glb_ctl_reg_ker, FR_AB_GLB_CTL);
if (EFX_OWORD_FIELD(glb_ctl_reg_ker, FRF_AB_SWRST) != 0) {
rc = -ETIMEDOUT;
netif_err(efx, hw, efx->net_dev,
"timed out waiting for hardware reset\n");
goto fail3;
}
netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n");
return 0;
fail2:
pci_restore_state(efx->pci_dev);
fail1:
fail3:
return rc;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:80,代码来源:falcon.c
示例13: ioat_reset_hw
static int
ioat_reset_hw(struct ioat_softc *ioat)
{
uint64_t status;
uint32_t chanerr;
unsigned timeout;
int error;
mtx_lock(IOAT_REFLK);
ioat->quiescing = TRUE;
ioat_drain_locked(ioat);
mtx_unlock(IOAT_REFLK);
status = ioat_get_chansts(ioat);
if (is_ioat_active(status) || is_ioat_idle(status))
ioat_suspend(ioat);
/* Wait at most 20 ms */
for (timeout = 0; (is_ioat_active(status) || is_ioat_idle(status)) &&
timeout < 20; timeout++) {
DELAY(1000);
status = ioat_get_chansts(ioat);
}
if (timeout == 20) {
error = ETIMEDOUT;
goto out;
}
KASSERT(ioat_get_active(ioat) == 0, ("active after quiesce"));
chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr);
/*
* IOAT v3 workaround - CHANERRMSK_INT with 3E07h to masks out errors
* that can cause stability issues for IOAT v3.
*/
pci_write_config(ioat->device, IOAT_CFG_CHANERRMASK_INT_OFFSET, 0x3e07,
4);
chanerr = pci_read_config(ioat->device, IOAT_CFG_CHANERR_INT_OFFSET, 4);
pci_write_config(ioat->device, IOAT_CFG_CHANERR_INT_OFFSET, chanerr, 4);
/*
* BDXDE and BWD models reset MSI-X registers on device reset.
* Save/restore their contents manually.
*/
if (ioat_model_resets_msix(ioat)) {
ioat_log_message(1, "device resets MSI-X registers; saving\n");
pci_save_state(ioat->device);
}
ioat_reset(ioat);
/* Wait at most 20 ms */
for (timeout = 0; ioat_reset_pending(ioat) && timeout < 20; timeout++)
DELAY(1000);
if (timeout == 20) {
error = ETIMEDOUT;
goto out;
}
if (ioat_model_resets_msix(ioat)) {
ioat_log_message(1, "device resets registers; restored\n");
pci_restore_state(ioat->device);
}
/* Reset attempts to return the hardware to "halted." */
status = ioat_get_chansts(ioat);
if (is_ioat_active(status) || is_ioat_idle(status)) {
/* So this really shouldn't happen... */
ioat_log_message(0, "Device is active after a reset?\n");
ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
error = 0;
goto out;
}
chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
if (chanerr != 0) {
mtx_lock(&ioat->cleanup_lock);
ioat_halted_debug(ioat, chanerr);
mtx_unlock(&ioat->cleanup_lock);
error = EIO;
goto out;
}
/*
* Bring device back online after reset. Writing CHAINADDR brings the
* device back to active.
*
* The internal ring counter resets to zero, so we have to start over
* at zero as well.
*/
ioat->tail = ioat->head = ioat->hw_head = 0;
ioat->last_seen = 0;
ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
ioat_write_chancmp(ioat, ioat->comp_update_bus_addr);
ioat_write_chainaddr(ioat, ioat->ring[0]->hw_desc_bus_addr);
error = 0;
//.........这里部分代码省略.........
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:101,代码来源:ioat.c
示例14: rtl8192E_resume
int rtl8192E_resume (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
#ifdef _RTL8192_EXT_PATCH_
struct net_device *meshdev = priv->rtllib->meshdev;
#endif
int err;
u32 val;
RT_TRACE(COMP_POWER, "================>r8192E resume call.");
printk("================>r8192E resume call.\n");
pci_set_power_state(pdev, PCI_D0);
err = pci_enable_device(pdev);
if(err) {
printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
dev->name);
return err;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
pci_restore_state(pdev,&(priv->pci_state));
#else
pci_restore_state(pdev);
#endif
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);
#ifdef ENABLE_GPIO_RADIO_CTL
if(priv->polling_timer_on == 0){
check_rfctrl_gpio_timer((unsigned long)dev);
}
#endif
#ifdef _RTL8192_EXT_PATCH_
if ((!netif_running(dev)) && (!netif_running(meshdev)))
#else
if(!netif_running(dev))
#endif
{
printk("RTL819XE:UI is open out of resume function\n");
goto out;
}
netif_device_attach(dev);
#ifdef HAVE_NET_DEVICE_OPS
if (priv->rtllib->wlan_up_before_suspend) {
if (dev->netdev_ops->ndo_open)
dev->netdev_ops->ndo_open(dev);
}
#ifdef _RTL8192_EXT_PATCH_
if (priv->rtllib->mesh_up_before_suspend) {
if (meshdev->netdev_ops->ndo_open)
meshdev->netdev_ops->ndo_open(meshdev);
netif_carrier_on(meshdev);
}
#endif
#else
if (priv->rtllib->wlan_up_before_suspend) {
dev->open(dev);
}
#ifdef _RTL8192_EXT_PATCH_
if (priv->rtllib->mesh_up_before_suspend) {
meshdev->open(meshdev);
netif_carrier_on(meshdev);
}
#endif
#endif
#if !(defined RTL8192SE || defined RTL8192CE)
if(!priv->rtllib->bSupportRemoteWakeUp) {
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT,true);
}
#endif
out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
return 0;
}
开发者ID:UNwS,项目名称:rtl8192su,代码行数:86,代码来源:rtl_pm.c
示例15: 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;
hcd = pci_get_drvdata(dev);
if (hcd->state != HC_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller,
"can't resume, not suspended!\n");
return 0;
}
/* NOTE: chip docs cover clean "real suspend" cases (what Linux
* calls "standby", "suspend to RAM", and so on). There are also
* dirty cases when swsusp fakes a suspend in "shutdown" mode.
*/
if (dev->current_state != PCI_D0) {
#ifdef DEBUG
int pci_pm;
u16 pmcr;
pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);
pmcr &= PCI_PM_CTRL_STATE_MASK;
if (pmcr) {
/* Clean case: power to USB and to HC registers was
* maintained; remote wakeup is easy.
*/
dev_dbg(hcd->self.controller, "resume from PCI D%d\n",
pmcr);
} else {
/* Clean: HC lost Vcc power, D0 uninitialized
* + Vaux may have preserved port and transceiver
* state ... for remote wakeup from D3cold
* + or not; HCD must reinit + re-enumerate
*
* Dirty: D0 semi-initialized cases with swsusp
* + after BIOS init
* + after Linux init (HCD statically linked)
*/
dev_dbg(hcd->self.controller,
"PCI D0, from previous PCI D%d\n",
dev->current_state);
}
#endif
pci_enable_wake (dev, dev->current_state, 0);
pci_enable_wake (dev, PCI_D3cold, 0);
} else {
/* Same basic cases: clean (powered/not), dirty */
dev_dbg(hcd->self.controller, "PCI legacy resume\n");
}
/* NOTE: the PCI API itself is asymmetric here. We don't need to
* pci_set_power_state(PCI_D0) since that's part of re-enabling;
* but that won't re-enable bus mastering. Yet pci_disable_device()
* explicitly disables bus mastering...
*/
retval = pci_enable_device (dev);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't re-enable after resume, %d!\n", retval);
return retval;
}
pci_set_master (dev);
pci_restore_state (dev);
dev->dev.power.power_state = PMSG_ON;
hcd->state = HC_STATE_RESUMING;
hcd->saw_irq = 0;
retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
hcd->irq_descr, hcd);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't restore IRQ after resume!\n");
usb_hc_died (hcd);
return retval;
}
retval = hcd->driver->resume (hcd);
if (!HC_IS_RUNNING (hcd->state)) {
dev_dbg (hcd->self.controller,
"resume fail, retval %d\n", retval);
usb_hc_died (hcd);
}
pci_enable_device(dev);
return retval;
}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:95,代码来源:hcd-pci.c
示例16: 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;
hcd = pci_get_drvdata(dev);
if (hcd->state != HC_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller,
"can't resume, not suspended!\n");
return 0;
}
#ifdef CONFIG_PPC_PMAC
/* Reenable ASIC clocks for USB */
if (machine_is(powermac)) {
struct device_node *of_node;
of_node = pci_device_to_OF_node (dev);
if (of_node)
pmac_call_feature (PMAC_FTR_USB_ENABLE,
of_node, 0, 1);
}
#endif
/* NOTE: chip docs cover clean "real suspend" cases (what Linux
* calls "standby", "suspend to RAM", and so on). There are also
* dirty cases when swsusp fakes a suspend in "shutdown" mode.
*/
if (dev->current_state != PCI_D0) {
#ifdef DEBUG
int pci_pm;
u16 pmcr;
pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);
pmcr &= PCI_PM_CTRL_STATE_MASK;
if (pmcr) {
/* Clean case: power to USB and to HC registers was
* maintained; remote wakeup is easy.
*/
dev_dbg(hcd->self.controller, "resume from PCI D%d\n",
pmcr);
} else {
/* Clean: HC lost Vcc power, D0 uninitialized
* + Vaux may have preserved port and transceiver
* state ... for remote wakeup from D3cold
* + or not; HCD must reinit + re-enumerate
*
* Dirty: D0 semi-initialized cases with swsusp
* + after BIOS init
* + after Linux init (HCD statically linked)
*/
dev_dbg(hcd->self.controller,
"PCI D0, from previous PCI D%d\n",
dev->current_state);
}
#endif
/* yes, ignore these results too... */
(void) pci_enable_wake (dev, dev->current_state, 0);
(void) pci_enable_wake (dev, PCI_D3cold, 0);
} else {
/* Same basic cases: clean (powered/not), dirty */
dev_dbg(hcd->self.controller, "PCI legacy resume\n");
}
/* NOTE: the PCI API itself is asymmetric here. We don't need to
* pci_set_power_state(PCI_D0) since that's part of re-enabling;
* but that won't re-enable bus mastering. Yet pci_disable_device()
* explicitly disables bus mastering...
*/
retval = pci_enable_device (dev);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't re-enable after resume, %d!\n", retval);
return retval;
}
pci_set_master (dev);
pci_restore_state (dev);
dev->dev.power.power_state = PMSG_ON;
clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
if (hcd->driver->resume) {
retval = hcd->driver->resume(hcd);
if (retval) {
dev_err (hcd->self.controller,
"PCI post-resume error %d!\n", retval);
usb_hc_died (hcd);
}
}
return retval;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:100,代码来源:hcd-pci.c
示例17: cnss_wlan_register_driver
int cnss_wlan_register_driver(struct cnss_wlan_driver *driver)
{
int ret = 0;
struct cnss_wlan_driver *wdrv;
struct cnss_wlan_vreg_info *vreg_info;
struct cnss_wlan_gpio_info *gpio_info;
struct pci_dev *pdev;
if (!penv)
return -ENODEV;
wdrv = penv->driver;
vreg_info = &penv->vreg_info;
gpio_info = &penv->gpio_info;
pdev = penv->pdev;
if (!wdrv) {
penv->driver = wdrv = driver;
} else {
pr_err("driver already registered\n");
return -EEXIST;
}
ret = cnss_wlan_vreg_set(vreg_info, VREG_ON);
if (ret) {
pr_err("wlan vreg ON failed\n");
goto err_wlan_vreg_on;
}
usleep(POWER_ON_DELAY);
cnss_wlan_gpio_set(gpio_info, WLAN_EN_HIGH);
usleep(WLAN_ENABLE_DELAY);
if (!pdev) {
pr_debug("%s: invalid pdev. register pci device\n", __func__);
ret = pci_register_driver(&cnss_wlan_pci_driver);
if (ret) {
pr_err("%s: pci registration failed\n", __func__);
goto err_pcie_link_up;
}
pdev = penv->pdev;
if (!pdev) {
pr_err("%s: pdev is still invalid\n", __func__);
goto err_pcie_link_up;
}
}
if (!penv->pcie_link_state) {
ret = msm_pcie_pm_control(MSM_PCIE_RESUME,
cnss_get_pci_dev_bus_number(pdev),
NULL, NULL, PM_OPTIONS);
if (ret) {
pr_err("PCIe link bring-up failed\n");
goto err_pcie_link_up;
}
penv->pcie_link_state = PCIE_LINK_UP;
}
if (wdrv->probe) {
if (penv->saved_state)
pci_load_and_free_saved_state(pdev, &penv->saved_state);
pci_restore_state(pdev);
ret = wdrv->probe(pdev, penv->id);
if (ret) {
pr_err("Failed to probe WLAN\n");
goto err_wlan_probe;
}
}
if (pdev && wdrv->modem_status)
wdrv->modem_status(pdev, penv->modem_current_status);
return ret;
err_wlan_probe:
pci_save_state(pdev);
penv->saved_state = pci_store_saved_state(pdev);
msm_pcie_pm_control(MSM_PCIE_SUSPEND,
cnss_get_pci_dev_bus_number(pdev),
NULL, NULL, PM_OPTIONS);
penv->pcie_link_state = PCIE_LINK_DOWN;
err_pcie_link_up:
cnss_wlan_gpio_set(gpio_info, WLAN_EN_LOW);
cnss_wlan_vreg_set(vreg_info, VREG_OFF);
if (pdev) {
pr_err("%d: Unregistering PCI device\n", __LINE__);
pci_unregister_driver(&cnss_wlan_pci_driver);
penv->pdev = NULL;
penv->pci_register_again = true;
}
err_wlan_vreg_on:
penv->driver = NULL;
//.........这里部分代码省略.........
开发者ID:rbheromax,项目名称:android_kernel_lge_dory,代码行数:101,代码来源:cnss.c
示例18: rt_pci_resume
static int rt_pci_resume(struct pci_dev *pci_dev)
{
struct net_device *net_dev = pci_get_drvdata(pci_dev);
VOID *pAd = NULL;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
INT32 retval;
/*
Set the power state of a PCI device
PCI has 4 power states, DO (normal) ~ D3(less power)
you can find that in include/linux/pci.h
#define PCI_D0 ((pci_power_t __force) 0)
#define PCI_D1 ((pci_power_t __force) 1)
#define PCI_D2 ((pci_power_t __force) 2)
#define PCI_D3hot ((pci_power_t __force) 3)
#define PCI_D3cold ((pci_power_t __force) 4)
#define PCI_UNKNOWN ((pci_power_t __force) 5)
#define PCI_POWER_ERROR ((pci_power_t __force) -1)
*/
retval = pci_set_power_state(pci_dev, PCI_D0);
/* restore the saved state of a PCI device */
pci_restore_state(pci_dev);
/* initialize device before it's used by a driver */
if (pci_enable_device(pci_dev))
{
printk("pci enable fail!\n");
return 0;
}
#endif
DBGPRINT(RT_DEBUG_TRACE, ("===>%s()\n", __FUNCTION__));
if (net_dev == NULL)
{
DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n"));
}
else
GET_PAD_FROM_NET_DEV(pAd, net_dev);
if (pAd != NULL)
{
ULONG IfNum;
/*
we can not use IFF_UP because ra0 down but ra1 up
and 1 suspend/resume function for 1 module, not for each interface
so Linux will call suspend/resume function once
*/
RTMP_DRIVER_VIRTUAL_INF_NUM_GET(pAd, &IfNum);
if (IfNum > 0)
/* if (VIRTUAL_IF_NUM(pAd) > 0) */
{
/* mark device as attached from system and restart if needed */
netif_device_attach(net_dev);
if (rt28xx_open((PNET_DEV)net_dev) != 0)
{
/* open fail */
DBGPRINT(RT_DEBUG_TRACE, ("<===%s()\n", __FUNCTION__));
return 0;
}
/* increase MODULE use count */
RT_MOD_INC_USE_COUNT();
/* RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); */
/* RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); */
RTMP_DRIVER_PCI_RESUME(pAd);
netif_start_queue(net_dev);
netif_carrier_on(net_dev);
netif_wake_queue(net_dev);
}
}
DBGPRINT(RT_DEBUG_TRACE, ("<=== %s()\n", __FUNCTION__));
return 0;
}
开发者ID:jing-git,项目名称:rt-n56u-1,代码行数:83,代码来源:pci_main_dev.c
示例19: snd_atiixp_pcm_open
//.........这里部分代码省略.........
#ifdef CONFIG_PM
/*
*/
static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
{
struct snd_card *card = pci_get_drvdata(pci);
struct atiixp_modem *chip = card->private_data;
int i;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
snd_pcm_suspend_all(chip->pcmdevs[i]);
for (i = 0; i < NUM_ATI_CODECS; i++)
snd_ac97_suspend(chip->ac97[i]);
snd_atiixp_aclink_down(chip);
snd_atiixp_chip_stop(chip);
pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
return 0;
}
static int snd_atiixp_resume(struct pci_dev *pci)
{
struct snd_card *card = pci_get_drvdata(pci);
struct atiixp_modem *chip = card->private_data;
int i;
pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "atiixp-modem: pci_enable_device failed, "
"disabling device\n");
snd_card_disconnect(card);
return -EIO;
}
pci_set_master(pci);
snd_atiixp_aclink_reset(chip);
snd_atiixp_chip_start(chip);
for (i = 0; i < NUM_ATI_CODECS; i++)
snd_ac97_resume(chip->ac97[i]);
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* */
#ifdef CONFIG_PROC_FS
/*
*/
static void snd_atiixp_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct atiixp_modem *chip = entry->private_data;
int i;
for (i = 0; i < 256; i += 4)
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:67,代码来源:atiixp_modem.c
示例20: dwc3_intel_resume
int dwc3_intel_resume(struct dwc_otg2 *otg)
{
struct pci_dev *pci_dev;
struct usb_hcd *hcd = NULL;
u32 data;
int ret;
if (!otg)
return 0;
hcd = container_of(otg->otg.host, struct usb_hcd, self);
/* After resume from D0i3cold. The UTMI PHY D+ drive issue
* reproduced due to all setting be reseted. So switch to OTG
* mode avoid D+ drive too early.
*/
if ((otg->state == DWC_STATE_B_IDLE ||
otg->state == DWC_STATE_CHARGING ||
otg->state == DWC_STATE_WAIT_VBUS_FALL ||
otg->state == DWC_STATE_WAIT_VBUS_RAISE) &&
is_utmi_phy(otg)) {
/* Reconnect DP/DM between Pmic and SOC for support host
* and device mode. */
ret = intel_scu_ipc_update_register(PMIC_USBPHYCTRL,
USBPHYRSTB, USBPHYRSTB);
if (ret)
otg_err(otg, "%s: ipc update failed\n", __func__);
otg_write(otg, OEVTEN, 0);
otg_write(otg, OCTL, 0);
dwc3_switch_mode(otg, GCTL_PRT_CAP_DIR_OTG);
}
/* This is one SCU WA. SCU should set GUSB2PHYCFG0
* bit 4 for ULPI setting. But SCU haven't do that.
* So do WA first until SCU fix.
*/
data = otg_read(otg, GUSB2PHYCFG0);
if (is_utmi_phy(otg))
data &= ~(1 << 4);
else
data |= (1 << 4);
otg_write(otg, GUSB2PHYCFG0, data);
pci_dev = to_pci_dev(otg->dev);
/* From synopsys spec 12.2.11.
* Software cannot access memory-mapped I/O space
* for 10ms. Delay 5 ms here should be enough. Too
* long a delay causes hibernation exit failure.
*/
mdelay(5);
pci_restore_state(pci_dev);
if (pci_enable_device(pci_dev) < 0) {
otg_err(otg, "pci_enable_device failed.\n");
return -EIO;
}
set_sus_phy(otg, 0);
/* Delay 1ms waiting PHY clock debounce.
* Without this debounce, will met fabric error randomly.
**/
mdelay(1);
if (otg->state == DWC_STATE_A_HOST &&
otg->resume_host)
otg->resume_host(hcd);
return 0;
}
开发者ID:wejgomi,项目名称:nexus-player,代码行数:72,代码来源:dwc3-intel-mrfl.c
注:本文中的pci_restore_state函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论