linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-samsung-soc@vger.kernel.org, dmaengine@vger.kernel.org,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>, Inki Dae <inki.dae@samsung.com>
Subject: [PATCH v7 3/4] dmaengine: pl330: Store pointer to slave device
Date: Wed, 25 Jan 2017 11:28:07 +0100	[thread overview]
Message-ID: <1485340088-25481-4-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1485340088-25481-1-git-send-email-m.szyprowski@samsung.com>

Store the pointer to slave device, which requested our channel. It will be
later used to implement runtime PM of PL330 DMA controller. Although
DMA channels might be requested many times, each DMA peripheral channel is
physically dedicated only for specific hardware, so there should be only
one slave device for each channel.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/pl330.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index b6b2cc912380..c77a3494659c 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -450,6 +450,7 @@ struct dma_pl330_chan {
 
 	/* for runtime pm tracking */
 	bool active;
+	struct device *slave;
 };
 
 struct pl330_dmac {
@@ -2093,6 +2094,14 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
 	if (chan_id >= pl330->num_peripherals)
 		return NULL;
 
+	if (!pl330->peripherals[chan_id].slave) {
+		pl330->peripherals[chan_id].slave = slave;
+	} else if (pl330->peripherals[chan_id].slave != slave) {
+		dev_err(pl330->ddma.dev,
+			"Can't use same channel with multiple slave devices!\n");
+		return NULL;
+	}
+
 	return dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
 }
 
-- 
1.9.1

  parent reply	other threads:[~2017-01-25 10:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170125102822eucas1p29f2605060eb8255a6cf06638c1148ec4@eucas1p2.samsung.com>
2017-01-25 10:28 ` [PATCH v7 0/4] DMA Engine: switch PL330 driver to non-irq-safe runtime PM Marek Szyprowski
     [not found]   ` <CGME20170125102823eucas1p2a21db04249e4c844ac21d612f76b1e12@eucas1p2.samsung.com>
2017-01-25 10:28     ` [PATCH v7 1/4] dmaengine: pl330: remove pdata based initialization Marek Szyprowski
     [not found]   ` <CGME20170125102824eucas1p1cf027184286131ff628eb7113c3f9e60@eucas1p1.samsung.com>
2017-01-25 10:28     ` [PATCH v7 2/4] dmaengine: Forward slave device pointer to of_xlate callback Marek Szyprowski
2017-01-25 13:12       ` Lars-Peter Clausen
2017-01-26 14:43         ` Marek Szyprowski
2017-02-03 13:01           ` Marek Szyprowski
2017-02-05 12:04             ` Vinod Koul
2017-02-09  4:11           ` Vinod Koul
2017-02-09  9:22             ` Marek Szyprowski
2017-02-09  9:55               ` Ulf Hansson
2017-02-09 13:30                 ` Marek Szyprowski
2017-02-09 16:28               ` Vinod Koul
     [not found]   ` <CGME20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd@eucas1p2.samsung.com>
2017-01-25 10:28     ` Marek Szyprowski [this message]
     [not found]   ` <CGME20170125102825eucas1p22f4f6dbe744d778f0e1b53b6b26da5de@eucas1p2.samsung.com>
2017-01-25 10:28     ` [PATCH v7 4/4] dmaengine: pl330: Don't require irq-safe runtime PM Marek Szyprowski

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=1485340088-25481-4-git-send-email-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=broonie@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).