hcd-pci.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright David Brownell 2000-2002
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/pci.h>
  8. #include <linux/usb.h>
  9. #include <linux/usb/hcd.h>
  10. #include <asm/io.h>
  11. #include <asm/irq.h>
  12. #ifdef CONFIG_PPC_PMAC
  13. #include <asm/machdep.h>
  14. #include <asm/pmac_feature.h>
  15. #endif
  16. #include "usb.h"
  17. /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
  18. /*
  19. * Coordinate handoffs between EHCI and companion controllers
  20. * during EHCI probing and system resume.
  21. */
  22. static DECLARE_RWSEM(companions_rwsem);
  23. #define CL_UHCI PCI_CLASS_SERIAL_USB_UHCI
  24. #define CL_OHCI PCI_CLASS_SERIAL_USB_OHCI
  25. #define CL_EHCI PCI_CLASS_SERIAL_USB_EHCI
  26. static inline int is_ohci_or_uhci(struct pci_dev *pdev)
  27. {
  28. return pdev->class == CL_OHCI || pdev->class == CL_UHCI;
  29. }
  30. typedef void (*companion_fn)(struct pci_dev *pdev, struct usb_hcd *hcd,
  31. struct pci_dev *companion, struct usb_hcd *companion_hcd);
  32. /* Iterate over PCI devices in the same slot as pdev and call fn for each */
  33. static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd,
  34. companion_fn fn)
  35. {
  36. struct pci_dev *companion;
  37. struct usb_hcd *companion_hcd;
  38. unsigned int slot = PCI_SLOT(pdev->devfn);
  39. /*
  40. * Iterate through other PCI functions in the same slot.
  41. * If the function's drvdata isn't set then it isn't bound to
  42. * a USB host controller driver, so skip it.
  43. */
  44. companion = NULL;
  45. for_each_pci_dev(companion) {
  46. if (companion->bus != pdev->bus ||
  47. PCI_SLOT(companion->devfn) != slot)
  48. continue;
  49. /*
  50. * Companion device should be either UHCI,OHCI or EHCI host
  51. * controller, otherwise skip.
  52. */
  53. if (companion->class != CL_UHCI && companion->class != CL_OHCI &&
  54. companion->class != CL_EHCI)
  55. continue;
  56. companion_hcd = pci_get_drvdata(companion);
  57. if (!companion_hcd || !companion_hcd->self.root_hub)
  58. continue;
  59. fn(pdev, hcd, companion, companion_hcd);
  60. }
  61. }
  62. /*
  63. * We're about to add an EHCI controller, which will unceremoniously grab
  64. * all the port connections away from its companions. To prevent annoying
  65. * error messages, lock the companion's root hub and gracefully unconfigure
  66. * it beforehand. Leave it locked until the EHCI controller is all set.
  67. */
  68. static void ehci_pre_add(struct pci_dev *pdev, struct usb_hcd *hcd,
  69. struct pci_dev *companion, struct usb_hcd *companion_hcd)
  70. {
  71. struct usb_device *udev;
  72. if (is_ohci_or_uhci(companion)) {
  73. udev = companion_hcd->self.root_hub;
  74. usb_lock_device(udev);
  75. usb_set_configuration(udev, 0);
  76. }
  77. }
  78. /*
  79. * Adding the EHCI controller has either succeeded or failed. Set the
  80. * companion pointer accordingly, and in either case, reconfigure and
  81. * unlock the root hub.
  82. */
  83. static void ehci_post_add(struct pci_dev *pdev, struct usb_hcd *hcd,
  84. struct pci_dev *companion, struct usb_hcd *companion_hcd)
  85. {
  86. struct usb_device *udev;
  87. if (is_ohci_or_uhci(companion)) {
  88. if (dev_get_drvdata(&pdev->dev)) { /* Succeeded */
  89. dev_dbg(&pdev->dev, "HS companion for %s\n",
  90. dev_name(&companion->dev));
  91. companion_hcd->self.hs_companion = &hcd->self;
  92. }
  93. udev = companion_hcd->self.root_hub;
  94. usb_set_configuration(udev, 1);
  95. usb_unlock_device(udev);
  96. }
  97. }
  98. /*
  99. * We just added a non-EHCI controller. Find the EHCI controller to
  100. * which it is a companion, and store a pointer to the bus structure.
  101. */
  102. static void non_ehci_add(struct pci_dev *pdev, struct usb_hcd *hcd,
  103. struct pci_dev *companion, struct usb_hcd *companion_hcd)
  104. {
  105. if (is_ohci_or_uhci(pdev) && companion->class == CL_EHCI) {
  106. dev_dbg(&pdev->dev, "FS/LS companion for %s\n",
  107. dev_name(&companion->dev));
  108. hcd->self.hs_companion = &companion_hcd->self;
  109. }
  110. }
  111. /* We are removing an EHCI controller. Clear the companions' pointers. */
  112. static void ehci_remove(struct pci_dev *pdev, struct usb_hcd *hcd,
  113. struct pci_dev *companion, struct usb_hcd *companion_hcd)
  114. {
  115. if (is_ohci_or_uhci(companion))
  116. companion_hcd->self.hs_companion = NULL;
  117. }
  118. #ifdef CONFIG_PM
  119. /* An EHCI controller must wait for its companions before resuming. */
  120. static void ehci_wait_for_companions(struct pci_dev *pdev, struct usb_hcd *hcd,
  121. struct pci_dev *companion, struct usb_hcd *companion_hcd)
  122. {
  123. if (is_ohci_or_uhci(companion))
  124. device_pm_wait_for_dev(&pdev->dev, &companion->dev);
  125. }
  126. #endif /* CONFIG_PM */
  127. /*-------------------------------------------------------------------------*/
  128. /* configure so an HC device and id are always provided */
  129. /* always called with process context; sleeping is OK */
  130. /**
  131. * usb_hcd_pci_probe - initialize PCI-based HCDs
  132. * @dev: USB Host Controller being probed
  133. * @driver: USB HC driver handle
  134. *
  135. * Context: task context, might sleep
  136. *
  137. * Allocates basic PCI resources for this USB host controller, and
  138. * then invokes the start() method for the HCD associated with it
  139. * through the hotplug entry's driver_data.
  140. *
  141. * Store this function in the HCD's struct pci_driver as probe().
  142. *
  143. * Return: 0 if successful.
  144. */
  145. int usb_hcd_pci_probe(struct pci_dev *dev, const struct hc_driver *driver)
  146. {
  147. struct usb_hcd *hcd;
  148. int retval;
  149. int hcd_irq = 0;
  150. if (usb_disabled())
  151. return -ENODEV;
  152. if (!driver)
  153. return -EINVAL;
  154. if (pci_enable_device(dev) < 0)
  155. return -ENODEV;
  156. /*
  157. * The xHCI driver has its own irq management
  158. * make sure irq setup is not touched for xhci in generic hcd code
  159. */
  160. if ((driver->flags & HCD_MASK) < HCD_USB3) {
  161. retval = pci_alloc_irq_vectors(dev, 1, 1,
  162. PCI_IRQ_INTX | PCI_IRQ_MSI);
  163. if (retval < 0) {
  164. dev_err(&dev->dev,
  165. "Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
  166. pci_name(dev));
  167. retval = -ENODEV;
  168. goto disable_pci;
  169. }
  170. hcd_irq = pci_irq_vector(dev, 0);
  171. }
  172. hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));
  173. if (!hcd) {
  174. retval = -ENOMEM;
  175. goto free_irq_vectors;
  176. }
  177. hcd->amd_resume_bug = usb_hcd_amd_resume_bug(dev, driver);
  178. if (driver->flags & HCD_MEMORY) {
  179. /* EHCI, OHCI */
  180. hcd->rsrc_start = pci_resource_start(dev, 0);
  181. hcd->rsrc_len = pci_resource_len(dev, 0);
  182. if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start,
  183. hcd->rsrc_len, driver->description)) {
  184. dev_dbg(&dev->dev, "controller already in use\n");
  185. retval = -EBUSY;
  186. goto put_hcd;
  187. }
  188. hcd->regs = devm_ioremap(&dev->dev, hcd->rsrc_start,
  189. hcd->rsrc_len);
  190. if (hcd->regs == NULL) {
  191. dev_dbg(&dev->dev, "error mapping memory\n");
  192. retval = -EFAULT;
  193. goto put_hcd;
  194. }
  195. } else {
  196. /* UHCI */
  197. int region;
  198. for (region = 0; region < PCI_STD_NUM_BARS; region++) {
  199. if (!(pci_resource_flags(dev, region) &
  200. IORESOURCE_IO))
  201. continue;
  202. hcd->rsrc_start = pci_resource_start(dev, region);
  203. hcd->rsrc_len = pci_resource_len(dev, region);
  204. if (devm_request_region(&dev->dev, hcd->rsrc_start,
  205. hcd->rsrc_len, driver->description))
  206. break;
  207. }
  208. if (region == PCI_STD_NUM_BARS) {
  209. dev_dbg(&dev->dev, "no i/o regions available\n");
  210. retval = -EBUSY;
  211. goto put_hcd;
  212. }
  213. }
  214. pci_set_master(dev);
  215. /* Note: dev_set_drvdata must be called while holding the rwsem */
  216. if (dev->class == CL_EHCI) {
  217. down_write(&companions_rwsem);
  218. dev_set_drvdata(&dev->dev, hcd);
  219. for_each_companion(dev, hcd, ehci_pre_add);
  220. retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED);
  221. if (retval != 0)
  222. dev_set_drvdata(&dev->dev, NULL);
  223. for_each_companion(dev, hcd, ehci_post_add);
  224. up_write(&companions_rwsem);
  225. } else {
  226. down_read(&companions_rwsem);
  227. dev_set_drvdata(&dev->dev, hcd);
  228. retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED);
  229. if (retval != 0)
  230. dev_set_drvdata(&dev->dev, NULL);
  231. else
  232. for_each_companion(dev, hcd, non_ehci_add);
  233. up_read(&companions_rwsem);
  234. }
  235. if (retval != 0)
  236. goto put_hcd;
  237. device_wakeup_enable(hcd->self.controller);
  238. if (pci_dev_run_wake(dev))
  239. pm_runtime_put_noidle(&dev->dev);
  240. return retval;
  241. put_hcd:
  242. usb_put_hcd(hcd);
  243. free_irq_vectors:
  244. if ((driver->flags & HCD_MASK) < HCD_USB3)
  245. pci_free_irq_vectors(dev);
  246. disable_pci:
  247. pci_disable_device(dev);
  248. dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
  249. return retval;
  250. }
  251. EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
  252. /* may be called without controller electrically present */
  253. /* may be called with controller, bus, and devices active */
  254. /**
  255. * usb_hcd_pci_remove - shutdown processing for PCI-based HCDs
  256. * @dev: USB Host Controller being removed
  257. *
  258. * Context: task context, might sleep
  259. *
  260. * Reverses the effect of usb_hcd_pci_probe(), first invoking
  261. * the HCD's stop() method. It is always called from a thread
  262. * context, normally "rmmod", "apmd", or something similar.
  263. *
  264. * Store this function in the HCD's struct pci_driver as remove().
  265. */
  266. void usb_hcd_pci_remove(struct pci_dev *dev)
  267. {
  268. struct usb_hcd *hcd;
  269. int hcd_driver_flags;
  270. hcd = pci_get_drvdata(dev);
  271. if (!hcd)
  272. return;
  273. hcd_driver_flags = hcd->driver->flags;
  274. if (pci_dev_run_wake(dev))
  275. pm_runtime_get_noresume(&dev->dev);
  276. /* Fake an interrupt request in order to give the driver a chance
  277. * to test whether the controller hardware has been removed (e.g.,
  278. * cardbus physical eject).
  279. */
  280. local_irq_disable();
  281. usb_hcd_irq(0, hcd);
  282. local_irq_enable();
  283. /* Note: dev_set_drvdata must be called while holding the rwsem */
  284. if (dev->class == CL_EHCI) {
  285. down_write(&companions_rwsem);
  286. for_each_companion(dev, hcd, ehci_remove);
  287. usb_remove_hcd(hcd);
  288. dev_set_drvdata(&dev->dev, NULL);
  289. up_write(&companions_rwsem);
  290. } else {
  291. /* Not EHCI; just clear the companion pointer */
  292. down_read(&companions_rwsem);
  293. hcd->self.hs_companion = NULL;
  294. usb_remove_hcd(hcd);
  295. dev_set_drvdata(&dev->dev, NULL);
  296. up_read(&companions_rwsem);
  297. }
  298. usb_put_hcd(hcd);
  299. if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
  300. pci_free_irq_vectors(dev);
  301. pci_disable_device(dev);
  302. }
  303. EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
  304. /**
  305. * usb_hcd_pci_shutdown - shutdown host controller
  306. * @dev: USB Host Controller being shutdown
  307. */
  308. void usb_hcd_pci_shutdown(struct pci_dev *dev)
  309. {
  310. struct usb_hcd *hcd;
  311. hcd = pci_get_drvdata(dev);
  312. if (!hcd)
  313. return;
  314. if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) &&
  315. hcd->driver->shutdown) {
  316. hcd->driver->shutdown(hcd);
  317. if (usb_hcd_is_primary_hcd(hcd) && hcd->irq > 0)
  318. free_irq(hcd->irq, hcd);
  319. pci_disable_device(dev);
  320. }
  321. }
  322. EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);
  323. #ifdef CONFIG_PM
  324. #ifdef CONFIG_PPC_PMAC
  325. static void powermac_set_asic(struct pci_dev *pci_dev, int enable)
  326. {
  327. /* Enanble or disable ASIC clocks for USB */
  328. if (machine_is(powermac)) {
  329. struct device_node *of_node;
  330. of_node = pci_device_to_OF_node(pci_dev);
  331. if (of_node)
  332. pmac_call_feature(PMAC_FTR_USB_ENABLE,
  333. of_node, 0, enable);
  334. }
  335. }
  336. #else
  337. static inline void powermac_set_asic(struct pci_dev *pci_dev, int enable)
  338. {}
  339. #endif /* CONFIG_PPC_PMAC */
  340. static int check_root_hub_suspended(struct device *dev)
  341. {
  342. struct usb_hcd *hcd = dev_get_drvdata(dev);
  343. if (HCD_RH_RUNNING(hcd)) {
  344. dev_warn(dev, "Root hub is not suspended\n");
  345. return -EBUSY;
  346. }
  347. if (hcd->shared_hcd) {
  348. hcd = hcd->shared_hcd;
  349. if (HCD_RH_RUNNING(hcd)) {
  350. dev_warn(dev, "Secondary root hub is not suspended\n");
  351. return -EBUSY;
  352. }
  353. }
  354. return 0;
  355. }
  356. static int suspend_common(struct device *dev, pm_message_t msg)
  357. {
  358. struct pci_dev *pci_dev = to_pci_dev(dev);
  359. struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
  360. bool do_wakeup;
  361. int retval;
  362. do_wakeup = PMSG_IS_AUTO(msg) ? true : device_may_wakeup(dev);
  363. /* Root hub suspend should have stopped all downstream traffic,
  364. * and all bus master traffic. And done so for both the interface
  365. * and the stub usb_device (which we check here). But maybe it
  366. * didn't; writing sysfs power/state files ignores such rules...
  367. */
  368. retval = check_root_hub_suspended(dev);
  369. if (retval)
  370. return retval;
  371. if (hcd->driver->pci_suspend && !HCD_DEAD(hcd)) {
  372. /* Optimization: Don't suspend if a root-hub wakeup is
  373. * pending and it would cause the HCD to wake up anyway.
  374. */
  375. if (do_wakeup && HCD_WAKEUP_PENDING(hcd))
  376. return -EBUSY;
  377. if (do_wakeup && hcd->shared_hcd &&
  378. HCD_WAKEUP_PENDING(hcd->shared_hcd))
  379. return -EBUSY;
  380. retval = hcd->driver->pci_suspend(hcd, do_wakeup);
  381. suspend_report_result(dev, hcd->driver->pci_suspend, retval);
  382. /* Check again in case wakeup raced with pci_suspend */
  383. if ((retval == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) ||
  384. (retval == 0 && do_wakeup && hcd->shared_hcd &&
  385. HCD_WAKEUP_PENDING(hcd->shared_hcd))) {
  386. if (hcd->driver->pci_resume)
  387. hcd->driver->pci_resume(hcd, msg);
  388. retval = -EBUSY;
  389. }
  390. if (retval)
  391. return retval;
  392. }
  393. /* If MSI-X is enabled, the driver will have synchronized all vectors
  394. * in pci_suspend(). If MSI or legacy PCI is enabled, that will be
  395. * synchronized here.
  396. */
  397. if (!hcd->msix_enabled)
  398. synchronize_irq(pci_irq_vector(pci_dev, 0));
  399. /* Downstream ports from this root hub should already be quiesced, so
  400. * there will be no DMA activity. Now we can shut down the upstream
  401. * link (except maybe for PME# resume signaling). We'll enter a
  402. * low power state during suspend_noirq, if the hardware allows.
  403. */
  404. pci_disable_device(pci_dev);
  405. return retval;
  406. }
  407. static int resume_common(struct device *dev, pm_message_t msg)
  408. {
  409. struct pci_dev *pci_dev = to_pci_dev(dev);
  410. struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
  411. int retval;
  412. if (HCD_RH_RUNNING(hcd) ||
  413. (hcd->shared_hcd &&
  414. HCD_RH_RUNNING(hcd->shared_hcd))) {
  415. dev_dbg(dev, "can't resume, not suspended!\n");
  416. return 0;
  417. }
  418. retval = pci_enable_device(pci_dev);
  419. if (retval < 0) {
  420. dev_err(dev, "can't re-enable after resume, %d!\n", retval);
  421. return retval;
  422. }
  423. pci_set_master(pci_dev);
  424. if (hcd->driver->pci_resume && !HCD_DEAD(hcd)) {
  425. /*
  426. * Only EHCI controllers have to wait for their companions.
  427. * No locking is needed because PCI controller drivers do not
  428. * get unbound during system resume.
  429. */
  430. if (pci_dev->class == CL_EHCI && msg.event != PM_EVENT_AUTO_RESUME)
  431. for_each_companion(pci_dev, hcd,
  432. ehci_wait_for_companions);
  433. retval = hcd->driver->pci_resume(hcd, msg);
  434. if (retval) {
  435. dev_err(dev, "PCI post-resume error %d!\n", retval);
  436. usb_hc_died(hcd);
  437. }
  438. }
  439. return retval;
  440. }
  441. #ifdef CONFIG_PM_SLEEP
  442. static int hcd_pci_suspend(struct device *dev)
  443. {
  444. return suspend_common(dev, PMSG_SUSPEND);
  445. }
  446. static int hcd_pci_suspend_noirq(struct device *dev)
  447. {
  448. struct pci_dev *pci_dev = to_pci_dev(dev);
  449. struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
  450. int retval;
  451. retval = check_root_hub_suspended(dev);
  452. if (retval)
  453. return retval;
  454. pci_save_state(pci_dev);
  455. /* If the root hub is dead rather than suspended, disallow remote
  456. * wakeup. usb_hc_died() should ensure that both hosts are marked as
  457. * dying, so we only need to check the primary roothub.
  458. */
  459. if (HCD_DEAD(hcd))
  460. device_set_wakeup_enable(dev, 0);
  461. dev_dbg(dev, "wakeup: %d\n", device_may_wakeup(dev));
  462. /* Possibly enable remote wakeup,
  463. * choose the appropriate low-power state, and go to that state.
  464. */
  465. retval = pci_prepare_to_sleep(pci_dev);
  466. if (retval == -EIO) { /* Low-power not supported */
  467. dev_dbg(dev, "--> PCI D0 legacy\n");
  468. retval = 0;
  469. } else if (retval == 0) {
  470. dev_dbg(dev, "--> PCI %s\n",
  471. pci_power_name(pci_dev->current_state));
  472. } else {
  473. suspend_report_result(dev, pci_prepare_to_sleep, retval);
  474. return retval;
  475. }
  476. powermac_set_asic(pci_dev, 0);
  477. return retval;
  478. }
  479. static int hcd_pci_poweroff_late(struct device *dev)
  480. {
  481. struct pci_dev *pci_dev = to_pci_dev(dev);
  482. struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
  483. if (hcd->driver->pci_poweroff_late && !HCD_DEAD(hcd))
  484. return hcd->driver->pci_poweroff_late(hcd, device_may_wakeup(dev));
  485. return 0;
  486. }
  487. static int hcd_pci_resume_noirq(struct device *dev)
  488. {
  489. powermac_set_asic(to_pci_dev(dev), 1);
  490. return 0;
  491. }
  492. static int hcd_pci_resume(struct device *dev)
  493. {
  494. return resume_common(dev, PMSG_RESUME);
  495. }
  496. static int hcd_pci_restore(struct device *dev)
  497. {
  498. return resume_common(dev, PMSG_RESTORE);
  499. }
  500. #else
  501. #define hcd_pci_suspend NULL
  502. #define hcd_pci_suspend_noirq NULL
  503. #define hcd_pci_poweroff_late NULL
  504. #define hcd_pci_resume_noirq NULL
  505. #define hcd_pci_resume NULL
  506. #define hcd_pci_restore NULL
  507. #endif /* CONFIG_PM_SLEEP */
  508. static int hcd_pci_runtime_suspend(struct device *dev)
  509. {
  510. int retval;
  511. retval = suspend_common(dev, PMSG_AUTO_SUSPEND);
  512. if (retval == 0)
  513. powermac_set_asic(to_pci_dev(dev), 0);
  514. dev_dbg(dev, "hcd_pci_runtime_suspend: %d\n", retval);
  515. return retval;
  516. }
  517. static int hcd_pci_runtime_resume(struct device *dev)
  518. {
  519. int retval;
  520. powermac_set_asic(to_pci_dev(dev), 1);
  521. retval = resume_common(dev, PMSG_AUTO_RESUME);
  522. dev_dbg(dev, "hcd_pci_runtime_resume: %d\n", retval);
  523. return retval;
  524. }
  525. const struct dev_pm_ops usb_hcd_pci_pm_ops = {
  526. .suspend = hcd_pci_suspend,
  527. .suspend_noirq = hcd_pci_suspend_noirq,
  528. .resume_noirq = hcd_pci_resume_noirq,
  529. .resume = hcd_pci_resume,
  530. .freeze = hcd_pci_suspend,
  531. .freeze_noirq = check_root_hub_suspended,
  532. .thaw_noirq = NULL,
  533. .thaw = hcd_pci_resume,
  534. .poweroff = hcd_pci_suspend,
  535. .poweroff_late = hcd_pci_poweroff_late,
  536. .poweroff_noirq = hcd_pci_suspend_noirq,
  537. .restore_noirq = hcd_pci_resume_noirq,
  538. .restore = hcd_pci_restore,
  539. .runtime_suspend = hcd_pci_runtime_suspend,
  540. .runtime_resume = hcd_pci_runtime_resume,
  541. };
  542. EXPORT_SYMBOL_GPL(usb_hcd_pci_pm_ops);
  543. #endif /* CONFIG_PM */