Ejemplo n.º 1
0
static int ssb_pcihost_suspend(struct device *d)
{
	struct pci_dev *dev = to_pci_dev(d);
	struct ssb_bus *ssb = pci_get_drvdata(dev);
	int err;
#if 1 /* in RHEL */
	int i, wakeup_path = 0;
#endif

	err = ssb_bus_suspend(ssb);
	if (err)
		return err;
	pci_save_state(dev);
	pci_disable_device(dev);

	/* if there is a wakeup enabled child device on ssb bus,
	   enable pci wakeup posibility. */
#if 0 /* Not in RHEL */
	device_set_wakeup_enable(d, d->power.wakeup_path);
#else
	for (i = 0; i < ssb->nr_devices; i++) {
		struct ssb_device *sdev = &ssb->devices[i];
		if (sdev && sdev->dev && sdev->dev->power.should_wakeup) {
			wakeup_path = 1;
			break;
		}
	}
	device_set_wakeup_enable(d, wakeup_path);
#endif

	pci_prepare_to_sleep(dev);
	return 0;
}
Ejemplo n.º 2
0
static int hcd_pci_suspend_noirq(struct device *dev)
{
	struct pci_dev		*pci_dev = to_pci_dev(dev);
	struct usb_hcd		*hcd = pci_get_drvdata(pci_dev);
	int			retval;

	retval = check_root_hub_suspended(dev);
	if (retval)
		return retval;

	pci_save_state(pci_dev);

	/* If the root hub is HALTed rather than SUSPENDed,
	 * disallow remote wakeup.
	 */
	if (hcd->state == HC_STATE_HALT)
		device_set_wakeup_enable(dev, 0);
	dev_dbg(dev, "wakeup: %d\n", device_may_wakeup(dev));

	/* Possibly enable remote wakeup,
	 * choose the appropriate low-power state, and go to that state.
	 */
	retval = pci_prepare_to_sleep(pci_dev);
	if (retval == -EIO) {		/* Low-power not supported */
		dev_dbg(dev, "--> PCI D0 legacy\n");
		retval = 0;
	} else if (retval == 0) {
		dev_dbg(dev, "--> PCI %s\n",
				pci_power_name(pci_dev->current_state));
	} else {
		suspend_report_result(pci_prepare_to_sleep, retval);
		return retval;
	}

#ifdef CONFIG_PPC_PMAC
	/* Disable ASIC clocks for USB */
	if (machine_is(powermac)) {
		struct device_node	*of_node;

		of_node = pci_device_to_OF_node(pci_dev);
		if (of_node)
			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
	}
#endif
	return retval;
}
Ejemplo n.º 3
0
Archivo: pcie.c Proyecto: andyqee/linux
static int brcmf_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
{
	struct brcmf_pciedev_info *devinfo;
	struct brcmf_bus *bus;
	int err;

	brcmf_dbg(PCIE, "Enter, state=%d, pdev=%p\n", state.event, pdev);

	bus = dev_get_drvdata(&pdev->dev);
	devinfo = bus->bus_priv.pcie->devinfo;

	brcmf_bus_change_state(bus, BRCMF_BUS_DOWN);

	devinfo->mbdata_completed = false;
	brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);

	wait_event_timeout(devinfo->mbdata_resp_wait,
			   devinfo->mbdata_completed,
			   msecs_to_jiffies(BRCMF_PCIE_MBDATA_TIMEOUT));
	if (!devinfo->mbdata_completed) {
		brcmf_err("Timeout on response for entering D3 substate\n");
		return -EIO;
	}
	brcmf_pcie_release_irq(devinfo);

	err = pci_save_state(pdev);
	if (err) {
		brcmf_err("pci_save_state failed, err=%d\n", err);
		return err;
	}

	brcmf_chip_detach(devinfo->ci);
	devinfo->ci = NULL;

	brcmf_pcie_remove(pdev);

	return pci_prepare_to_sleep(pdev);
}