diff mbox

[v2,5/5] dma: cppi41: add support for suspend and resume

Message ID 1379851068-18675-6-git-send-email-zonque@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Mack Sept. 22, 2013, 11:57 a.m. UTC
This patch adds support for suspend/resume functionality to the cppi41
DMA driver. The steps neccessary to make the system resume properly were
figured out by hefty trial-and-error. The code as it stands now is the
minimum that has to be done to put the musb host system on an AM33xx
system into an operable state after resume.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 drivers/dma/cppi41.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Sergei Shtylyov Sept. 22, 2013, 2:25 p.m. UTC | #1
Hello.

On 22-09-2013 15:57, Daniel Mack wrote:

> This patch adds support for suspend/resume functionality to the cppi41
> DMA driver. The steps neccessary to make the system resume properly were

    Necessary.

> figured out by hefty trial-and-error. The code as it stands now is the
> minimum that has to be done to put the musb host system on an AM33xx
> system into an operable state after resume.

> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
>   drivers/dma/cppi41.c | 33 +++++++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)

> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
> index 3347321..59dfa8e 100644
> --- a/drivers/dma/cppi41.c
> +++ b/drivers/dma/cppi41.c
> @@ -1040,12 +1040,45 @@ static int cppi41_dma_remove(struct platform_device *pdev)
>   	return 0;
>   }
>
> +#ifdef CONFIG_PM_SLEEP
[...]
> +static SIMPLE_DEV_PM_OPS(cppi41_pm_ops, cppi41_suspend, cppi41_resume);
> +
> +#define DEV_PM_OPS (&cppi41_pm_ops)
> +#else
> +#define DEV_PM_OPS NULL
> +#endif

    You don't need that with SIMPLE_DEV_PM_OPS(), just get it out of #ifdef.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Mack Sept. 22, 2013, 2:39 p.m. UTC | #2
On 22.09.2013 16:25, Sergei Shtylyov wrote:
> On 22-09-2013 15:57, Daniel Mack wrote:
>> +#ifdef CONFIG_PM_SLEEP
> [...]
>> +static SIMPLE_DEV_PM_OPS(cppi41_pm_ops, cppi41_suspend, cppi41_resume);
>> +
>> +#define DEV_PM_OPS (&cppi41_pm_ops)
>> +#else
>> +#define DEV_PM_OPS NULL
>> +#endif
> 
>     You don't need that with SIMPLE_DEV_PM_OPS(), just get it out of #ifdef.

Ah, now I see it. Thanks for the heads-up!


Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 3347321..59dfa8e 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -1040,12 +1040,45 @@  static int cppi41_dma_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int cppi41_suspend(struct device *dev)
+{
+	struct cppi41_dd *cdd = dev_get_drvdata(dev);
+
+	cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR);
+	disable_sched(cdd);
+
+	return 0;
+}
+
+static int cppi41_resume(struct device *dev)
+{
+	struct cppi41_dd *cdd = dev_get_drvdata(dev);
+	int i;
+
+	for (i = 0; i < DESCS_AREAS; i++)
+		cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i));
+
+	init_sched(cdd);
+	cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(cppi41_pm_ops, cppi41_suspend, cppi41_resume);
+
+#define DEV_PM_OPS (&cppi41_pm_ops)
+#else
+#define DEV_PM_OPS NULL
+#endif
+
 static struct platform_driver cpp41_dma_driver = {
 	.probe  = cppi41_dma_probe,
 	.remove = cppi41_dma_remove,
 	.driver = {
 		.name = "cppi41-dma-engine",
 		.owner = THIS_MODULE,
+		.pm = DEV_PM_OPS,
 		.of_match_table = of_match_ptr(cppi41_dma_ids),
 	},
 };