blob: 30fbe2ea6eab48bad6a974b423a4fe1aefe79224 [file] [log] [blame]
Bjorn Helgaas8cfab3c2018-01-26 12:50:27 -06001// SPDX-License-Identifier: GPL-2.0
Andy Shevchenko5823d0892016-06-14 21:29:45 +03002/*
3 * Intel MID platform PM support
4 *
5 * Copyright (C) 2016, Intel Corporation
6 *
7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko5823d0892016-06-14 21:29:45 +03008 */
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
19static bool mid_pci_power_manageable(struct pci_dev *dev)
20{
21 return true;
22}
23
24static 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 Wunnere8a6123e2016-10-23 13:55:34 +020029static 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 Shevchenko5823d0892016-06-14 21:29:45 +030034static pci_power_t mid_pci_choose_state(struct pci_dev *pdev)
35{
36 return PCI_D3hot;
37}
38
Rafael J. Wysocki08476842017-06-24 01:57:35 +020039static int mid_pci_wakeup(struct pci_dev *dev, bool enable)
Andy Shevchenko5823d0892016-06-14 21:29:45 +030040{
41 return 0;
42}
43
44static bool mid_pci_need_resume(struct pci_dev *dev)
45{
46 return false;
47}
48
Lukas Wunnerc9312252016-12-12 09:45:47 -060049static const struct pci_platform_pm_ops mid_pci_platform_pm = {
Andy Shevchenko5823d0892016-06-14 21:29:45 +030050 .is_manageable = mid_pci_power_manageable,
51 .set_state = mid_pci_set_power_state,
Lukas Wunnere8a6123e2016-10-23 13:55:34 +020052 .get_state = mid_pci_get_power_state,
Andy Shevchenko5823d0892016-06-14 21:29:45 +030053 .choose_state = mid_pci_choose_state,
Rafael J. Wysocki08476842017-06-24 01:57:35 +020054 .set_wakeup = mid_pci_wakeup,
Andy Shevchenko5823d0892016-06-14 21:29:45 +030055 .need_resume = mid_pci_need_resume,
56};
57
58#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
59
Andy Shevchenko8e522e12016-09-08 13:32:31 +030060/*
61 * This table should be in sync with the one in
62 * arch/x86/platform/intel-mid/pwr.c.
63 */
Andy Shevchenko5823d0892016-06-14 21:29:45 +030064static const struct x86_cpu_id lpss_cpu_ids[] = {
Peter Zijlstraf2c4db12018-08-07 10:17:27 -070065 ICPU(INTEL_FAM6_ATOM_SALTWELL_MID),
66 ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID),
Andy Shevchenko5823d0892016-06-14 21:29:45 +030067 {}
68};
69
70static int __init mid_pci_init(void)
71{
72 const struct x86_cpu_id *id;
73
74 id = x86_match_cpu(lpss_cpu_ids);
75 if (id)
76 pci_set_platform_pm(&mid_pci_platform_pm);
77 return 0;
78}
79arch_initcall(mid_pci_init);