All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-samsung-soc@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Vinod Koul <vinod.koul@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Inki Dae <inki.dae@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: [PATCH v2 3/4] dmaengine: pl330: Store pointer to slave device
Date: Mon, 09 Jan 2017 15:03:17 +0100	[thread overview]
Message-ID: <1483970598-6191-4-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1483970598-6191-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>
---
 drivers/dma/pl330.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 3c80e71271a2..9c72f535739c 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 {
@@ -2113,6 +2114,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

WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] dmaengine: pl330: Store pointer to slave device
Date: Mon, 09 Jan 2017 15:03:17 +0100	[thread overview]
Message-ID: <1483970598-6191-4-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1483970598-6191-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>
---
 drivers/dma/pl330.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 3c80e71271a2..9c72f535739c 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 {
@@ -2113,6 +2114,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-09 14:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170109140324eucas1p2c2b981ae2222c6a4e3dcb3e5ce3c607d@eucas1p2.samsung.com>
2017-01-09 14:03 ` [PATCH v2 0/4] DMA Engine: switch PL330 driver to non-irq-safe runtime PM Marek Szyprowski
2017-01-09 14:03   ` Marek Szyprowski
     [not found]   ` <CGME20170109140325eucas1p2674704b2505517ee532284c58c8a64d1@eucas1p2.samsung.com>
2017-01-09 14:03     ` [PATCH v2 1/4] dmaengine: pl330: remove pdata based initialization Marek Szyprowski
2017-01-09 14:03       ` Marek Szyprowski
2017-01-09 14:14       ` Arnd Bergmann
2017-01-09 14:14         ` Arnd Bergmann
2017-01-09 18:15       ` Krzysztof Kozlowski
2017-01-09 18:15         ` Krzysztof Kozlowski
2017-01-10  6:55         ` Marek Szyprowski
2017-01-10  6:55           ` Marek Szyprowski
     [not found]   ` <CGME20170109140326eucas1p25e098d4efdc5d29db08336d2177a2abe@eucas1p2.samsung.com>
2017-01-09 14:03     ` [PATCH v2 2/4] dmaengine: Forward slave device pointer to of_xlate callback Marek Szyprowski
2017-01-09 14:03       ` Marek Szyprowski
2017-01-09 15:11       ` kbuild test robot
2017-01-09 15:11         ` kbuild test robot
     [not found]   ` <CGME20170109140326eucas1p29d3e54da58845589e2adf70db854d996@eucas1p2.samsung.com>
2017-01-09 14:03     ` Marek Szyprowski [this message]
2017-01-09 14:03       ` [PATCH v2 3/4] dmaengine: pl330: Store pointer to slave device Marek Szyprowski
2017-01-09 18:08       ` Krzysztof Kozlowski
2017-01-09 18:08         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170109140327eucas1p20df21c98a5744003cd2687162f35ec10@eucas1p2.samsung.com>
2017-01-09 14:03     ` [PATCH v2 4/4] dmaengine: pl330: Don't require irq-safe runtime PM Marek Szyprowski
2017-01-09 14:03       ` Marek Szyprowski
2017-01-09 18:47       ` Krzysztof Kozlowski
2017-01-09 18:47         ` 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=1483970598-6191-4-git-send-email-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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 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.