All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	neumann-SRDuVqtxQLSzQB+pC5nmwQ@public.gmane.org,
	bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v3 5/5] dma: cppi41: add support for suspend and resume
Date: Mon, 23 Sep 2013 09:39:47 +0530	[thread overview]
Message-ID: <20130923040947.GV17188@intel.com> (raw)
In-Reply-To: <1379861404-8250-6-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Sun, Sep 22, 2013 at 04:50:04PM +0200, Daniel Mack wrote:
> This patch adds support for suspend/resume functionality to the cppi41
> DMA driver. The steps necessary to make the system resume properly were
> figured out by 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/dma/cppi41.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
> index 3347321..89decc9 100644
> --- a/drivers/dma/cppi41.c
> +++ b/drivers/dma/cppi41.c
> @@ -1040,12 +1040,41 @@ static int cppi41_dma_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
ahhhh

> +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;
> +}
> +#endif
> +
> +static SIMPLE_DEV_PM_OPS(cppi41_pm_ops, cppi41_suspend, cppi41_resume);
Here is the macro in pm.h

#ifdef CONFIG_PM_SLEEP
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
        .suspend = suspend_fn, \
        .resume = resume_fn, \
        .freeze = suspend_fn, \
        .thaw = resume_fn, \
        .poweroff = suspend_fn, \
        .restore = resume_fn,
#else
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#endif

/*
 * Use this if you want to use the same suspend and resume callbacks for suspend
 * to RAM and hibernation.
 */
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
const struct dev_pm_ops name = { \
        SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \

Now since you are using the macro there should be no need to wrap ifdef around
your code, the macro will take care of it. 

~Vinod

> +
>  static struct platform_driver cpp41_dma_driver = {
>  	.probe  = cppi41_dma_probe,
>  	.remove = cppi41_dma_remove,
>  	.driver = {
>  		.name = "cppi41-dma-engine",
>  		.owner = THIS_MODULE,
> +		.pm = &cppi41_pm_ops,
>  		.of_match_table = of_match_ptr(cppi41_dma_ids),
>  	},
>  };
> -- 
> 1.8.3.1
> 

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

  parent reply	other threads:[~2013-09-23  4:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22 14:49 [PATCH v3 0/5] dma: cppi41: some trivial fixes and support for suspend/resume Daniel Mack
     [not found] ` <1379861404-8250-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-22 14:50   ` [PATCH v3 1/5] dma: cppi41: pass around device instead of platform_device Daniel Mack
2013-09-23  4:16     ` Vinod Koul
2013-09-22 14:50 ` [PATCH v3 2/5] dma: cppi41: s/deinit_cpii41/deinit_cppi41/ Daniel Mack
2013-09-23  4:16   ` Vinod Koul
2013-09-22 14:50 ` [PATCH v3 3/5] dma: cppi41: add shortcut to &pdev->dev in cppi41_dma_probe() Daniel Mack
     [not found]   ` <1379861404-8250-4-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-23  4:17     ` Vinod Koul
2013-09-22 14:50 ` [PATCH v3 4/5] dma: cppi41: only allocate descriptor memory once Daniel Mack
2013-09-23  4:17   ` Vinod Koul
     [not found]     ` <20130923041754.GZ17188-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-23 14:51       ` Sebastian Andrzej Siewior
2013-09-23 14:36         ` Vinod Koul
     [not found]   ` <1379861404-8250-5-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-26  8:26     ` Sebastian Andrzej Siewior
2013-10-01 13:09       ` Daniel Mack
     [not found]         ` <524AC987.5000301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-01 16:22           ` Sebastian Andrzej Siewior
2013-10-01 16:57             ` Daniel Mack
2013-10-02  7:13               ` Sebastian Andrzej Siewior
2013-09-22 14:50 ` [PATCH v3 5/5] dma: cppi41: add support for suspend and resume Daniel Mack
     [not found]   ` <1379861404-8250-6-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-23  4:09     ` Vinod Koul [this message]
2013-09-23  5:53       ` Daniel Mack
2013-09-23 10:00         ` Vinod Koul
2013-09-23 10:01   ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130923040947.GV17188@intel.com \
    --to=vinod.koul-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=neumann-SRDuVqtxQLSzQB+pC5nmwQ@public.gmane.org \
    --cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
    --cc=zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.