Commit 4501fe61b286e35be5b372a4f1ffcf5881ceeaed
Committed by
Vinod Koul
1 parent
000871ce03
Exists in
master
and in
13 other branches
dma: dw: Add suspend and resume handling for PCI mode DW_DMAC.
This is to disable/enable DW_DMAC hw during late suspend/early resume. Since DMA is providing service to other clients (eg: SPI, HSUART), we need to ensure DMA suspends after the clients and resume before the clients are active. Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Showing 1 changed file with 33 additions and 0 deletions Side-by-side Diff
drivers/dma/dw/pci.c
... | ... | @@ -75,6 +75,36 @@ |
75 | 75 | dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret); |
76 | 76 | } |
77 | 77 | |
78 | +#ifdef CONFIG_PM_SLEEP | |
79 | + | |
80 | +static int dw_pci_suspend_late(struct device *dev) | |
81 | +{ | |
82 | + struct pci_dev *pci = to_pci_dev(dev); | |
83 | + struct dw_dma_chip *chip = pci_get_drvdata(pci); | |
84 | + | |
85 | + return dw_dma_suspend(chip); | |
86 | +}; | |
87 | + | |
88 | +static int dw_pci_resume_early(struct device *dev) | |
89 | +{ | |
90 | + struct pci_dev *pci = to_pci_dev(dev); | |
91 | + struct dw_dma_chip *chip = pci_get_drvdata(pci); | |
92 | + | |
93 | + return dw_dma_resume(chip); | |
94 | +}; | |
95 | + | |
96 | +#else /* !CONFIG_PM_SLEEP */ | |
97 | + | |
98 | +#define dw_pci_suspend_late NULL | |
99 | +#define dw_pci_resume_early NULL | |
100 | + | |
101 | +#endif /* !CONFIG_PM_SLEEP */ | |
102 | + | |
103 | +static const struct dev_pm_ops dw_pci_dev_pm_ops = { | |
104 | + .suspend_late = dw_pci_suspend_late, | |
105 | + .resume_early = dw_pci_resume_early, | |
106 | +}; | |
107 | + | |
78 | 108 | static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = { |
79 | 109 | /* Medfield */ |
80 | 110 | { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata }, |
... | ... | @@ -95,6 +125,9 @@ |
95 | 125 | .id_table = dw_pci_id_table, |
96 | 126 | .probe = dw_pci_probe, |
97 | 127 | .remove = dw_pci_remove, |
128 | + .driver = { | |
129 | + .pm = &dw_pci_dev_pm_ops, | |
130 | + }, | |
98 | 131 | }; |
99 | 132 | |
100 | 133 | module_pci_driver(dw_pci_driver); |
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a
-
mentioned in commit c31b6a