* [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC.
@ 2014-03-14 18:02 Chew Chiau Ee
2014-03-14 11:28 ` Andy Shevchenko
2014-03-26 6:23 ` Vinod Koul
0 siblings, 2 replies; 4+ messages in thread
From: Chew Chiau Ee @ 2014-03-14 18:02 UTC (permalink / raw)
To: Viresh Kumar, Andy Shevchenko
Cc: Vinod Koul, Dan Williams, dmaengine, linux-kernel, Chew Chiau Ee,
Lim Lee Booi
From: Chew, Chiau Ee <chiau.ee.chew@intel.com>
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>
---
v2 changelog:
* Change suspend_noirq and resume_noirq callback to suspend_late
and resume_early.
drivers/dma/dw/pci.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index 755cc6b..fec59f1 100644
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev)
dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret);
}
+#ifdef CONFIG_PM_SLEEP
+
+static int dw_pci_suspend_late(struct device *dev)
+{
+ struct pci_dev *pci = to_pci_dev(dev);
+ struct dw_dma_chip *chip = pci_get_drvdata(pci);
+
+ return dw_dma_suspend(chip);
+};
+
+static int dw_pci_resume_early(struct device *dev)
+{
+ struct pci_dev *pci = to_pci_dev(dev);
+ struct dw_dma_chip *chip = pci_get_drvdata(pci);
+
+ return dw_dma_resume(chip);
+};
+
+#else /* !CONFIG_PM_SLEEP */
+
+#define dw_pci_suspend_late NULL
+#define dw_pci_resume_early NULL
+
+#endif /* !CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops dw_pci_dev_pm_ops = {
+ .suspend_late = dw_pci_suspend_late,
+ .resume_early = dw_pci_resume_early,
+};
+
static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = {
/* Medfield */
{ PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata },
@@ -95,6 +125,9 @@ static struct pci_driver dw_pci_driver = {
.id_table = dw_pci_id_table,
.probe = dw_pci_probe,
.remove = dw_pci_remove,
+ .driver = {
+ .pm = &dw_pci_dev_pm_ops,
+ },
};
module_pci_driver(dw_pci_driver);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC.
2014-03-14 18:02 [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC Chew Chiau Ee
@ 2014-03-14 11:28 ` Andy Shevchenko
2014-03-14 17:21 ` Viresh Kumar
2014-03-26 6:23 ` Vinod Koul
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2014-03-14 11:28 UTC (permalink / raw)
To: Chew Chiau Ee
Cc: Viresh Kumar, Vinod Koul, Dan Williams, dmaengine, linux-kernel,
Lim Lee Booi
On Sat, 2014-03-15 at 02:02 +0800, Chew Chiau Ee wrote:
> From: Chew, Chiau Ee <chiau.ee.chew@intel.com>
>
> 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.
Thanks for an update!
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
P.S. It seems a material is for v3.16?
>
> Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
> ---
> v2 changelog:
> * Change suspend_noirq and resume_noirq callback to suspend_late
> and resume_early.
>
> drivers/dma/dw/pci.c | 33 +++++++++++++++++++++++++++++++++
> 1 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
> index 755cc6b..fec59f1 100644
> --- a/drivers/dma/dw/pci.c
> +++ b/drivers/dma/dw/pci.c
> @@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev)
> dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret);
> }
>
> +#ifdef CONFIG_PM_SLEEP
> +
> +static int dw_pci_suspend_late(struct device *dev)
> +{
> + struct pci_dev *pci = to_pci_dev(dev);
> + struct dw_dma_chip *chip = pci_get_drvdata(pci);
> +
> + return dw_dma_suspend(chip);
> +};
> +
> +static int dw_pci_resume_early(struct device *dev)
> +{
> + struct pci_dev *pci = to_pci_dev(dev);
> + struct dw_dma_chip *chip = pci_get_drvdata(pci);
> +
> + return dw_dma_resume(chip);
> +};
> +
> +#else /* !CONFIG_PM_SLEEP */
> +
> +#define dw_pci_suspend_late NULL
> +#define dw_pci_resume_early NULL
> +
> +#endif /* !CONFIG_PM_SLEEP */
> +
> +static const struct dev_pm_ops dw_pci_dev_pm_ops = {
> + .suspend_late = dw_pci_suspend_late,
> + .resume_early = dw_pci_resume_early,
> +};
> +
> static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = {
> /* Medfield */
> { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata },
> @@ -95,6 +125,9 @@ static struct pci_driver dw_pci_driver = {
> .id_table = dw_pci_id_table,
> .probe = dw_pci_probe,
> .remove = dw_pci_remove,
> + .driver = {
> + .pm = &dw_pci_dev_pm_ops,
> + },
> };
>
> module_pci_driver(dw_pci_driver);
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC.
2014-03-14 11:28 ` Andy Shevchenko
@ 2014-03-14 17:21 ` Viresh Kumar
0 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-03-14 17:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Chew Chiau Ee, Vinod Koul, Dan Williams, dmaengine,
linux-kernel@vger.kernel.org, Lim Lee Booi
On Fri, Mar 14, 2014 at 4:58 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Sat, 2014-03-15 at 02:02 +0800, Chew Chiau Ee wrote:
>> From: Chew, Chiau Ee <chiau.ee.chew@intel.com>
>>
>> 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.
>
> Thanks for an update!
>
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> P.S. It seems a material is for v3.16?
I think it can go in 3.15 as well.. we aren't that late yet.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC.
2014-03-14 18:02 [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC Chew Chiau Ee
2014-03-14 11:28 ` Andy Shevchenko
@ 2014-03-26 6:23 ` Vinod Koul
1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2014-03-26 6:23 UTC (permalink / raw)
To: Chew Chiau Ee
Cc: Viresh Kumar, Andy Shevchenko, Dan Williams, dmaengine,
linux-kernel, Lim Lee Booi
On Sat, Mar 15, 2014 at 02:02:39AM +0800, Chew Chiau Ee wrote:
> From: Chew, Chiau Ee <chiau.ee.chew@intel.com>
>
> 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>
Rather than bunch of ifdef, would make sense to provde a mcros in dmaengine core
to do so as we expect all dmaengine drivers to be late probe
Applied thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-26 6:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 18:02 [PATCH v2] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC Chew Chiau Ee
2014-03-14 11:28 ` Andy Shevchenko
2014-03-14 17:21 ` Viresh Kumar
2014-03-26 6:23 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox