pci-mid.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_choose_state(struct pci_dev *pdev)
  27. {
  28. return PCI_D3hot;
  29. }
  30. static int mid_pci_sleep_wake(struct pci_dev *dev, bool enable)
  31. {
  32. return 0;
  33. }
  34. static int mid_pci_run_wake(struct pci_dev *dev, bool enable)
  35. {
  36. return 0;
  37. }
  38. static bool mid_pci_need_resume(struct pci_dev *dev)
  39. {
  40. return false;
  41. }
  42. static struct pci_platform_pm_ops mid_pci_platform_pm = {
  43. .is_manageable = mid_pci_power_manageable,
  44. .set_state = mid_pci_set_power_state,
  45. .choose_state = mid_pci_choose_state,
  46. .sleep_wake = mid_pci_sleep_wake,
  47. .run_wake = mid_pci_run_wake,
  48. .need_resume = mid_pci_need_resume,
  49. };
  50. #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
  51. static const struct x86_cpu_id lpss_cpu_ids[] = {
  52. ICPU(INTEL_FAM6_ATOM_MERRIFIELD1),
  53. {}
  54. };
  55. static int __init mid_pci_init(void)
  56. {
  57. const struct x86_cpu_id *id;
  58. id = x86_match_cpu(lpss_cpu_ids);
  59. if (id)
  60. pci_set_platform_pm(&mid_pci_platform_pm);
  61. return 0;
  62. }
  63. arch_initcall(mid_pci_init);