pci-mid.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Intel MID platform PM support
  3. *
  4. * Copyright (C) 2016, Intel Corporation
  5. *
  6. * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2, as published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/pci.h>
  14. #include <asm/cpu_device_id.h>
  15. #include <asm/intel-family.h>
  16. #include <asm/intel-mid.h>
  17. #include "pci.h"
  18. static bool mid_pci_power_manageable(struct pci_dev *dev)
  19. {
  20. return true;
  21. }
  22. static int mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
  23. {
  24. return intel_mid_pci_set_power_state(pdev, state);
  25. }
  26. static pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)
  27. {
  28. return intel_mid_pci_get_power_state(pdev);
  29. }
  30. static pci_power_t mid_pci_choose_state(struct pci_dev *pdev)
  31. {
  32. return PCI_D3hot;
  33. }
  34. static int mid_pci_sleep_wake(struct pci_dev *dev, bool enable)
  35. {
  36. return 0;
  37. }
  38. static int mid_pci_run_wake(struct pci_dev *dev, bool enable)
  39. {
  40. return 0;
  41. }
  42. static bool mid_pci_need_resume(struct pci_dev *dev)
  43. {
  44. return false;
  45. }
  46. static struct pci_platform_pm_ops mid_pci_platform_pm = {
  47. .is_manageable = mid_pci_power_manageable,
  48. .set_state = mid_pci_set_power_state,
  49. .get_state = mid_pci_get_power_state,
  50. .choose_state = mid_pci_choose_state,
  51. .sleep_wake = mid_pci_sleep_wake,
  52. .run_wake = mid_pci_run_wake,
  53. .need_resume = mid_pci_need_resume,
  54. };
  55. #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
  56. /*
  57. * This table should be in sync with the one in
  58. * arch/x86/platform/intel-mid/pwr.c.
  59. */
  60. static const struct x86_cpu_id lpss_cpu_ids[] = {
  61. ICPU(INTEL_FAM6_ATOM_PENWELL),
  62. ICPU(INTEL_FAM6_ATOM_MERRIFIELD),
  63. {}
  64. };
  65. static int __init mid_pci_init(void)
  66. {
  67. const struct x86_cpu_id *id;
  68. id = x86_match_cpu(lpss_cpu_ids);
  69. if (id)
  70. pci_set_platform_pm(&mid_pci_platform_pm);
  71. return 0;
  72. }
  73. arch_initcall(mid_pci_init);