pci-mid.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Intel MID platform PM support
  4. *
  5. * Copyright (C) 2016, Intel Corporation
  6. *
  7. * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  8. */
  9. #include <linux/init.h>
  10. #include <linux/pci.h>
  11. #include <asm/cpu_device_id.h>
  12. #include <asm/intel-family.h>
  13. #include <asm/intel-mid.h>
  14. #include "pci.h"
  15. static bool mid_pci_power_manageable(struct pci_dev *dev)
  16. {
  17. return true;
  18. }
  19. static int mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
  20. {
  21. return intel_mid_pci_set_power_state(pdev, state);
  22. }
  23. static pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)
  24. {
  25. return intel_mid_pci_get_power_state(pdev);
  26. }
  27. static pci_power_t mid_pci_choose_state(struct pci_dev *pdev)
  28. {
  29. return PCI_D3hot;
  30. }
  31. static int mid_pci_wakeup(struct pci_dev *dev, bool enable)
  32. {
  33. return 0;
  34. }
  35. static bool mid_pci_need_resume(struct pci_dev *dev)
  36. {
  37. return false;
  38. }
  39. static const struct pci_platform_pm_ops mid_pci_platform_pm = {
  40. .is_manageable = mid_pci_power_manageable,
  41. .set_state = mid_pci_set_power_state,
  42. .get_state = mid_pci_get_power_state,
  43. .choose_state = mid_pci_choose_state,
  44. .set_wakeup = mid_pci_wakeup,
  45. .need_resume = mid_pci_need_resume,
  46. };
  47. #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
  48. /*
  49. * This table should be in sync with the one in
  50. * arch/x86/platform/intel-mid/pwr.c.
  51. */
  52. static const struct x86_cpu_id lpss_cpu_ids[] = {
  53. ICPU(INTEL_FAM6_ATOM_SALTWELL_MID),
  54. ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID),
  55. {}
  56. };
  57. static int __init mid_pci_init(void)
  58. {
  59. const struct x86_cpu_id *id;
  60. id = x86_match_cpu(lpss_cpu_ids);
  61. if (id)
  62. pci_set_platform_pm(&mid_pci_platform_pm);
  63. return 0;
  64. }
  65. arch_initcall(mid_pci_init);