diff options
Diffstat (limited to 'drivers/pwm/pwm-lpss-pci.c')
-rw-r--r-- | drivers/pwm/pwm-lpss-pci.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-lpss-pci.c b/drivers/pwm/pwm-lpss-pci.c index c15bc6d00f1a..7160e8ab38a4 100644 --- a/drivers/pwm/pwm-lpss-pci.c +++ b/drivers/pwm/pwm-lpss-pci.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/pm_runtime.h> | ||
16 | 17 | ||
17 | #include "pwm-lpss.h" | 18 | #include "pwm-lpss.h" |
18 | 19 | ||
@@ -33,6 +34,10 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev, | |||
33 | return PTR_ERR(lpwm); | 34 | return PTR_ERR(lpwm); |
34 | 35 | ||
35 | pci_set_drvdata(pdev, lpwm); | 36 | pci_set_drvdata(pdev, lpwm); |
37 | |||
38 | pm_runtime_put(&pdev->dev); | ||
39 | pm_runtime_allow(&pdev->dev); | ||
40 | |||
36 | return 0; | 41 | return 0; |
37 | } | 42 | } |
38 | 43 | ||
@@ -40,9 +45,33 @@ static void pwm_lpss_remove_pci(struct pci_dev *pdev) | |||
40 | { | 45 | { |
41 | struct pwm_lpss_chip *lpwm = pci_get_drvdata(pdev); | 46 | struct pwm_lpss_chip *lpwm = pci_get_drvdata(pdev); |
42 | 47 | ||
48 | pm_runtime_forbid(&pdev->dev); | ||
49 | pm_runtime_get_sync(&pdev->dev); | ||
50 | |||
43 | pwm_lpss_remove(lpwm); | 51 | pwm_lpss_remove(lpwm); |
44 | } | 52 | } |
45 | 53 | ||
54 | #ifdef CONFIG_PM | ||
55 | static int pwm_lpss_runtime_suspend_pci(struct device *dev) | ||
56 | { | ||
57 | /* | ||
58 | * The PCI core will handle transition to D3 automatically. We only | ||
59 | * need to provide runtime PM hooks for that to happen. | ||
60 | */ | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int pwm_lpss_runtime_resume_pci(struct device *dev) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | static const struct dev_pm_ops pwm_lpss_pci_pm = { | ||
71 | SET_RUNTIME_PM_OPS(pwm_lpss_runtime_suspend_pci, | ||
72 | pwm_lpss_runtime_resume_pci, NULL) | ||
73 | }; | ||
74 | |||
46 | static const struct pci_device_id pwm_lpss_pci_ids[] = { | 75 | static const struct pci_device_id pwm_lpss_pci_ids[] = { |
47 | { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info}, | 76 | { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info}, |
48 | { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info}, | 77 | { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info}, |
@@ -60,6 +89,9 @@ static struct pci_driver pwm_lpss_driver_pci = { | |||
60 | .id_table = pwm_lpss_pci_ids, | 89 | .id_table = pwm_lpss_pci_ids, |
61 | .probe = pwm_lpss_probe_pci, | 90 | .probe = pwm_lpss_probe_pci, |
62 | .remove = pwm_lpss_remove_pci, | 91 | .remove = pwm_lpss_remove_pci, |
92 | .driver = { | ||
93 | .pm = &pwm_lpss_pci_pm, | ||
94 | }, | ||
63 | }; | 95 | }; |
64 | module_pci_driver(pwm_lpss_driver_pci); | 96 | module_pci_driver(pwm_lpss_driver_pci); |
65 | 97 | ||