PCI: Detach driver before procfs & sysfs teardown on device remove
[linux/fpc-iii.git] / drivers / pci / pci-mid.c
blobc7f3408e31487ef2db339233c61a4e66d15bb07d
1 /*
2 * Intel MID platform PM support
4 * Copyright (C) 2016, Intel Corporation
6 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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.
13 #include <linux/init.h>
14 #include <linux/pci.h>
16 #include <asm/cpu_device_id.h>
17 #include <asm/intel-family.h>
18 #include <asm/intel-mid.h>
20 #include "pci.h"
22 static bool mid_pci_power_manageable(struct pci_dev *dev)
24 return true;
27 static int mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
29 return intel_mid_pci_set_power_state(pdev, state);
32 static pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)
34 return intel_mid_pci_get_power_state(pdev);
37 static pci_power_t mid_pci_choose_state(struct pci_dev *pdev)
39 return PCI_D3hot;
42 static int mid_pci_sleep_wake(struct pci_dev *dev, bool enable)
44 return 0;
47 static int mid_pci_run_wake(struct pci_dev *dev, bool enable)
49 return 0;
52 static bool mid_pci_need_resume(struct pci_dev *dev)
54 return false;
57 static struct pci_platform_pm_ops mid_pci_platform_pm = {
58 .is_manageable = mid_pci_power_manageable,
59 .set_state = mid_pci_set_power_state,
60 .get_state = mid_pci_get_power_state,
61 .choose_state = mid_pci_choose_state,
62 .sleep_wake = mid_pci_sleep_wake,
63 .run_wake = mid_pci_run_wake,
64 .need_resume = mid_pci_need_resume,
67 #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
70 * This table should be in sync with the one in
71 * arch/x86/platform/intel-mid/pwr.c.
73 static const struct x86_cpu_id lpss_cpu_ids[] = {
74 ICPU(INTEL_FAM6_ATOM_PENWELL),
75 ICPU(INTEL_FAM6_ATOM_MERRIFIELD),
79 static int __init mid_pci_init(void)
81 const struct x86_cpu_id *id;
83 id = x86_match_cpu(lpss_cpu_ids);
84 if (id)
85 pci_set_platform_pm(&mid_pci_platform_pm);
86 return 0;
88 arch_initcall(mid_pci_init);