Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux-block.git] / drivers / pci / pci-mid.c
CommitLineData
8cfab3cf 1// SPDX-License-Identifier: GPL-2.0
5823d089
AS
2/*
3 * Intel MID platform PM support
4 *
5 * Copyright (C) 2016, Intel Corporation
6 *
7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5823d089
AS
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
d5b0d883
RW
19static bool pci_mid_pm_enabled __read_mostly;
20
21bool pci_use_mid_pm(void)
5823d089 22{
d5b0d883 23 return pci_mid_pm_enabled;
5823d089
AS
24}
25
d5b0d883 26int mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
5823d089
AS
27{
28 return intel_mid_pci_set_power_state(pdev, state);
29}
30
d5b0d883 31pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)
e8a6123e
LW
32{
33 return intel_mid_pci_get_power_state(pdev);
34}
35
8e522e1d
AS
36/*
37 * This table should be in sync with the one in
38 * arch/x86/platform/intel-mid/pwr.c.
39 */
5823d089 40static const struct x86_cpu_id lpss_cpu_ids[] = {
d5debddc
TL
41 X86_MATCH_VFM(INTEL_ATOM_SALTWELL_MID, NULL),
42 X86_MATCH_VFM(INTEL_ATOM_SILVERMONT_MID, NULL),
5823d089
AS
43 {}
44};
45
46static int __init mid_pci_init(void)
47{
48 const struct x86_cpu_id *id;
49
50 id = x86_match_cpu(lpss_cpu_ids);
51 if (id)
d5b0d883
RW
52 pci_mid_pm_enabled = true;
53
5823d089
AS
54 return 0;
55}
56arch_initcall(mid_pci_init);