Bjorn Helgaas | 8cfab3c | 2018-01-26 12:50:27 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Intel MID platform PM support |
| 4 | * |
| 5 | * Copyright (C) 2016, Intel Corporation |
| 6 | * |
| 7 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <linux/init.h> |
| 11 | #include <linux/pci.h> |
| 12 | |
| 13 | #include <asm/cpu_device_id.h> |
| 14 | #include <asm/intel-family.h> |
| 15 | #include <asm/intel-mid.h> |
| 16 | |
| 17 | #include "pci.h" |
| 18 | |
| 19 | static bool mid_pci_power_manageable(struct pci_dev *dev) |
| 20 | { |
| 21 | return true; |
| 22 | } |
| 23 | |
| 24 | static int mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state) |
| 25 | { |
| 26 | return intel_mid_pci_set_power_state(pdev, state); |
| 27 | } |
| 28 | |
Lukas Wunner | e8a6123e | 2016-10-23 13:55:34 +0200 | [diff] [blame] | 29 | static pci_power_t mid_pci_get_power_state(struct pci_dev *pdev) |
| 30 | { |
| 31 | return intel_mid_pci_get_power_state(pdev); |
| 32 | } |
| 33 | |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 34 | static pci_power_t mid_pci_choose_state(struct pci_dev *pdev) |
| 35 | { |
| 36 | return PCI_D3hot; |
| 37 | } |
| 38 | |
Rafael J. Wysocki | 0847684 | 2017-06-24 01:57:35 +0200 | [diff] [blame] | 39 | static int mid_pci_wakeup(struct pci_dev *dev, bool enable) |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 40 | { |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | static bool mid_pci_need_resume(struct pci_dev *dev) |
| 45 | { |
| 46 | return false; |
| 47 | } |
| 48 | |
Lukas Wunner | c931225 | 2016-12-12 09:45:47 -0600 | [diff] [blame] | 49 | static const struct pci_platform_pm_ops mid_pci_platform_pm = { |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 50 | .is_manageable = mid_pci_power_manageable, |
| 51 | .set_state = mid_pci_set_power_state, |
Lukas Wunner | e8a6123e | 2016-10-23 13:55:34 +0200 | [diff] [blame] | 52 | .get_state = mid_pci_get_power_state, |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 53 | .choose_state = mid_pci_choose_state, |
Rafael J. Wysocki | 0847684 | 2017-06-24 01:57:35 +0200 | [diff] [blame] | 54 | .set_wakeup = mid_pci_wakeup, |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 55 | .need_resume = mid_pci_need_resume, |
| 56 | }; |
| 57 | |
Andy Shevchenko | 8e522e1 | 2016-09-08 13:32:31 +0300 | [diff] [blame] | 58 | /* |
| 59 | * This table should be in sync with the one in |
| 60 | * arch/x86/platform/intel-mid/pwr.c. |
| 61 | */ |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 62 | static const struct x86_cpu_id lpss_cpu_ids[] = { |
Thomas Gleixner | 91e503e | 2020-03-20 14:14:02 +0100 | [diff] [blame] | 63 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_MID, NULL), |
| 64 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, NULL), |
Andy Shevchenko | 5823d089 | 2016-06-14 21:29:45 +0300 | [diff] [blame] | 65 | {} |
| 66 | }; |
| 67 | |
| 68 | static int __init mid_pci_init(void) |
| 69 | { |
| 70 | const struct x86_cpu_id *id; |
| 71 | |
| 72 | id = x86_match_cpu(lpss_cpu_ids); |
| 73 | if (id) |
| 74 | pci_set_platform_pm(&mid_pci_platform_pm); |
| 75 | return 0; |
| 76 | } |
| 77 | arch_initcall(mid_pci_init); |