From patchwork Wed Jan 25 10:28:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9536703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7D65604A0 for ; Wed, 25 Jan 2017 10:29:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B64E327DF9 for ; Wed, 25 Jan 2017 10:29:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB18D27EE9; Wed, 25 Jan 2017 10:29:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1590127E5A for ; Wed, 25 Jan 2017 10:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908AbdAYK2e (ORCPT ); Wed, 25 Jan 2017 05:28:34 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:52899 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbdAYK23 (ORCPT ); Wed, 25 Jan 2017 05:28:29 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKB00GG2ZREUU90@mailout2.w1.samsung.com>; Wed, 25 Jan 2017 10:28:26 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170125102825eucas1p18f545645eb4ed04622efb581b3f8e15a~c-PTV9YuV2537425374eucas1p1j; Wed, 25 Jan 2017 10:28:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 7A.0A.17477.9CD78885; Wed, 25 Jan 2017 10:28:25 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd~c-PShfG5n0770107701eucas1p2U; Wed, 25 Jan 2017 10:28:24 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-aa-58887dc9eaf6 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 43.83.06687.70E78885; Wed, 25 Jan 2017 10:29:27 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OKB00K87ZR4QX40@eusync4.samsung.com>; Wed, 25 Jan 2017 10:28:24 +0000 (GMT) From: Marek Szyprowski 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 , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Vinod Koul , Ulf Hansson , "Rafael J. Wysocki" , Kuninori Morimoto , Mark Brown , Inki Dae Subject: [PATCH v7 3/4] dmaengine: pl330: Store pointer to slave device Date: Wed, 25 Jan 2017 11:28:07 +0100 Message-id: <1485340088-25481-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1485340088-25481-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSXUhTY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9/AbvHq8C5Gi02Pr7FaXN41h83ic+8RRosZ5/cxWaw9cpfd 4szpS6wWx9eGW7zs28/iwO+x4XMTm8fiPS+ZPDat6mTzuHNtD5vH5iX1Ht/OTGTx2HK1ncWj b8sqRo/Pm+QCOKPcbDJSE1NSixRS85LzUzLz0m2VQkPcdC2UFPISc1NtlSJ0fUOClBTKEnNK gTwjAzTg4BzgHqykb5fgljH/BEfBfO6KuT2dzA2Mqzm7GDk5JARMJGYfnMoGYYtJXLi3Hsjm 4hASWMIoMWnXSWaQhJBAE5PEtKelIDabgKFE19susCIRgf2MEh9uXQfrZhZoYpZY9xTMFhZw l9i1/xEriM0ioCrxb+sxFhCbV8BD4tSTp1Db5CROHpsMVsMp4Ckx4+8R9i5GDqBlHhIbt1tP YORdwMiwilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzB6th37uXkH46WNwYcYBTgYlXh4JyS1 RwixJpYVV+YeYpTgYFYS4XWr6YgQ4k1JrKxKLcqPLyrNSS0+xGgKdNNEZinR5HxgZOeVxBua GJpbGhoZW1iYGxkpifOWfLgSLiSQnliSmp2aWpBaBNPHxMEp1cAoZqGx98btzcd7g3dYrt+z 5Um6Q9yGE9utxLJsdjJGVv3PaapnvvDKT+6O1OTH7+6/4Hr1nivX2LDvlvnr5868m75n1bsJ rVeefO6Xnb+dVXvks3XbL9kmbpth9rivap7E8p9PFoX8DUrYqHi5lO2uT6Lf7mtJUW2JkyKW rxD6feO69zeFrx9fK7EUZyQaajEXFScCADh+ks20AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd X-RootMTR: 20170125102824eucas1p25744330b6608c8d6e1a994b4894827bd References: <1485340088-25481-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Krzysztof Kozlowski Reviewed-by: Ulf Hansson Acked-by: Arnd Bergmann --- 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); }