public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [RFC PATCH] dma: pl330: add Power Management support
Date: Mon, 08 Sep 2014 14:39:30 +0200	[thread overview]
Message-ID: <1410179970.4300.16.camel@AMDC1943> (raw)
In-Reply-To: <1410163907.4300.5.camel@AMDC1943>

On pon, 2014-09-08 at 10:11 +0200, Krzysztof Kozlowski wrote:
> On pią, 2014-09-05 at 17:23 +0200, Lars-Peter Clausen wrote:
> > On 09/05/2014 05:06 PM, Krzysztof Kozlowski wrote:
> > [...]
> > > @@ -2168,11 +2199,23 @@ static void pl330_issue_pending(struct dma_chan *chan)
> > >   {
> > >   	struct dma_pl330_chan *pch = to_pchan(chan);
> > >   	unsigned long flags;
> > > +	bool power_up;
> > >
> > >   	spin_lock_irqsave(&pch->lock, flags);
> > > +	power_up = list_empty(&pch->work_list);
> > >   	list_splice_tail_init(&pch->submitted_list, &pch->work_list);
> > >   	spin_unlock_irqrestore(&pch->lock, flags);
> > >
> > > +	if (power_up) {
> > > +		/*
> > > +		 * Warn on nothing pending. This may break our pm_runtime
> > > +		 * usage counter as it is updated on work_list emptiness
> > > +		 * status.
> > > +		 */
> > > +		WARN_ON(list_empty(&pch->work_list));
> > > +		pm_runtime_get_sync(pch->dmac->ddma.dev);
> > 
> > Unfortunately this does not work. pm_runtime_get_sync() may sleep, where as 
> > the issue_pending callback needs to be able to run from contexts in which 
> > sleeping is not possible.
> 
> Thank you for pointing this out. It seems I'll have to find another
> solution because I really need to runtime suspend this driver...

I found that idea was wrong in few more places. The most important is
that the pl330 is an AMBA device. This means that runtime suspend/resume
callbacks are already implemented (drivers/amba/bus.c) and they are
called instead of my callbacks.

That would be fine... except that these callbacks in amba/bus.c call
clk_preare()/clk_unprepare() which is not safe for atomic context. This
prohibits me from using pm_runtime_irq_safe() which could solve problem
pointed by you. 

Best regards,
Krzysztof


> 
> Best regards,
> Krzysztof
> 
> > 
> > > +	}
> > > +
> > >   	pl330_tasklet((unsigned long)pch);
> > >   }
> > >
> > [...]


  reply	other threads:[~2014-09-08 12:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 15:06 [RFC PATCH] dma: pl330: add Power Management support Krzysztof Kozlowski
2014-09-05 15:23 ` Lars-Peter Clausen
2014-09-08  8:11   ` Krzysztof Kozlowski
2014-09-08 12:39     ` Krzysztof Kozlowski [this message]
2014-09-08  8:06 ` Michal Simek
2014-09-08  8:15   ` Krzysztof Kozlowski

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=1410179970.4300.16.camel@AMDC1943 \
    --to=k.kozlowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=michal.simek@xilinx.com \
    --cc=vinod.koul@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox