pci-mid.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /*
  48. * This table should be in sync with the one in
  49. * arch/x86/platform/intel-mid/pwr.c.
  50. */
  51. static const struct x86_cpu_id lpss_cpu_ids[] = {
  52. X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_MID, NULL),
  53. X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, NULL),
  54. {}
  55. };
  56. static int __init mid_pci_init(void)
  57. {
  58. const struct x86_cpu_id *id;
  59. id = x86_match_cpu(lpss_cpu_ids);
  60. if (id)
  61. pci_set_platform_pm(&mid_pci_platform_pm);
  62. return 0;
  63. }
  64. arch_initcall(mid_pci_init);