From patchwork Thu Feb 7 17:00:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A41C13BF for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ADDB2E4C5 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9672E4C7; Thu, 7 Feb 2019 18:56:22 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31A672E4CD for ; Thu, 7 Feb 2019 18:56:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 92A8D2679CA; Thu, 7 Feb 2019 18:00:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5C6202679D8; Thu, 7 Feb 2019 18:00:55 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 1947C2679CA for ; Thu, 7 Feb 2019 18:00:52 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170049epoutp041ea4ce93b98be29dc12f6cec12cb3579~BI5BH5q5j0210902109epoutp04U; Thu, 7 Feb 2019 17:00:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170049epoutp041ea4ce93b98be29dc12f6cec12cb3579~BI5BH5q5j0210902109epoutp04U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558849; bh=gGqXDjg8EoDzsbQ/KrZNphjC4zmgqj6Okx70I+0Rr0c=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=rav/VNHjpDjiy3ksAE90bHp/5c1Bn/uExlIh9tKI312TijqTKMq7IqIQhWruiXvBr EfZ2SAqllfNeVZXnViUfeo5i5nj6oskyBM5bYIuLFlnXz8J8R04IJfzQr4h8LOb46Z g0jnO1pAugHFZ2x9DlN35GtJanjeY1TCbJLR7Vis= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170049epcas1p1a6d596368a87d7c0da822ebeedf56f67~BI5A42McB1636416364epcas1p1K; Thu, 7 Feb 2019 17:00:49 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 83.C9.04173.0446C5C5; Fri, 8 Feb 2019 02:00:49 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170047epcas1p42d7ec4acfd976871c676efa5aecb33bc~BI4-y1_GT1456614566epcas1p4K; Thu, 7 Feb 2019 17:00:47 +0000 (GMT) X-AuditID: b6c32a36-5c1ff7000000104d-f2-5c5c6440d8d9 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id C7.C8.04015.F346C5C5; Fri, 8 Feb 2019 02:00:47 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:00:47 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:09 +0100 Message-id: <20190207170028.720-2-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmrq5jSkyMwbYmJosrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfG9mO3WAp2clTs2KLTwNjD3sXIySEh YCKx9chcxi5GLg4hgR2MEpMe34VyvjNKXHr/ghGm6u6dPUwQid2MEgeubWCHcH4xSmxvX8cC UsUmYCjRe7QPrENEQEzi9pxOZpAiZoEWJok5c5cygySEBRIluj7dAytiEVCV2HUW4hBeAUuJ d4ueQR0lL3G+dx2YzSlgJXFr/w4WiBpBiR+T74HZzEA1B688ZwFZICGwg01i8aWbULe6SLx8 cwHI5gCypSUuHbWFCFdL7NrezQxR38Eo0XJhOzNEwlri8PGLrBBD+STefe1hhejllehoE4Io 8ZBYse4TC8THvYwSO9ZNYZ3AKDULyU2zkNy0gJFpFaNYakFxbnpqsWGBkV5xYm5xaV66XnJ+ 7iZGcJRrme1gXHTO5xCjAAejEg+vhl5MjBBrYllxZe4hRgkOZiURXtkEoBBvSmJlVWpRfnxR aU5q8SFGaQ4WJXHe9Q7OMUIC6YklqdmpqQWpRTBZJg5OqQZGvWfrPuZJfZ5j/+PI+gdtM4yT tQ6eDbK58NGD0SroUtDyiZ69dQnKR28JccVZM5SqGike3/citjb7ZOPmrqmPRRTeLVdx2Hsz MPZYpLzAb/8t+X3qP4+Xqzg8yz+k1sm1wvXxPwfVgvfvFk2fOevaStZdz6Uq7+0+8I3rm+H2 dU9uaq3vz45hUmIpzkg01GIuKk4EAGMePsnuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAV37lJgYgx2f9SyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZ24/dYinYyVGxY4tOA2MPexcjJ4eE gInE3Tt7mLoYuTiEBHYySqx4dZUNwvnFKDH1/1awKjYBQ4neo32MILaIgJjE7TmdzCBFzAJN TBK7bl8EKxIWSJTo+nQPrIhFQFVi11mIFbwClhLvFj2DWicvcb53HZjNKWAlcWv/DhYQWwio 5sOEJlaIekGJH5PvgcWZgeoPXnnOMoGRbxaS1CwkqQWMTKsYJVMLinPTc4uNCgzzUsv1ihNz i0vz0vWS83M3MQKDeNthrb4djPeXxB9iFOBgVOLhvaAdEyPEmlhWXJl7iFGCg1lJhFc2ASjE m5JYWZValB9fVJqTWnyIUZqDRUmc93besUghgfTEktTs1NSC1CKYLBMHp1QDo9CEBc2H7qWJ rbVbtvKD7aEIY4tnOawz59gldniEhz98K9D09tgJ/3uCtqWzt+7glZOyt1+1LpvZXzSacc+2 +3UPA9zONdfOYji29n9dQ2PHhx3b/iedsXp4OrXksfsEl+QzOutWTAlyDWUO02T47XeG+ZT9 12NNzi/Dar+/Pr1k8opKhV1TipVYijMSDbWYi4oTAacxVpxeAgAA X-CMS-MailID: 20190207170047epcas1p42d7ec4acfd976871c676efa5aecb33bc CMS-TYPE: 101P X-CMS-RootMailID: 20190207170047epcas1p42d7ec4acfd976871c676efa5aecb33bc References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 01/22] ASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently when of_node of the "PCM" device is null dmaengine_pcm_request_chan_of() function will bail out, including cases when custom DMA device is intended to be used. To have the channels properly requested when custom DMA device is provided extend the of_node test to also consider dma_dev->of_node. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/soc-generic-dmaengine-pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 30e791a53352..6d7638c1233d 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -415,7 +415,8 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) || - !dev->of_node) + (!dev->of_node && !(config && config->dma_dev && + config->dma_dev->of_node))) return 0; if (config && config->dma_dev) { From patchwork Thu Feb 7 17:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FF3113BF for ; Thu, 7 Feb 2019 18:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FA282E4C7 for ; Thu, 7 Feb 2019 18:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31D152E4CC; Thu, 7 Feb 2019 18:56:25 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CCE22E4C5 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E8BCE267A07; Thu, 7 Feb 2019 18:01:00 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6D22E2679F2; Thu, 7 Feb 2019 18:00:56 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id 8A77526747F for ; Thu, 7 Feb 2019 18:00:53 +0100 (CET) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170051epoutp03385fbb804a1734a55f99278db627a3f6~BI5DjIR9F2895028950epoutp03p; Thu, 7 Feb 2019 17:00:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170051epoutp03385fbb804a1734a55f99278db627a3f6~BI5DjIR9F2895028950epoutp03p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558852; bh=Z3qp8NJqkxPTiayffdnOCrSlYTCyQwDLBEB9V7x+dYQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=WASyGRPVmOkbW7KACRzrVFc/4hNBEij2sjUWMX4QTpNCX9VaoNOwz8rDGh+B8dtcc pp9vGNvKG0JijJfxbq5q44WvWyZQWuZLGFtK2mf+creJMsSohNww4mhOJ6EOoQjd6I CeM8iuQPBtROZe2vv8odb0u8WiZdyw1EE6EbWSCE= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170051epcas1p274507f06eabb8d4923bdb80a862458bc~BI5DUp2Xi1282112821epcas1p2B; Thu, 7 Feb 2019 17:00:51 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 8E.A3.04074.3446C5C5; Fri, 8 Feb 2019 02:00:51 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190207170051epcas1p37a1acaef52cffb01af00c8d34dd9b1dd~BI5C-PBW80868808688epcas1p3d; Thu, 7 Feb 2019 17:00:51 +0000 (GMT) X-AuditID: b6c32a35-27fff70000000fea-38-5c5c64438eda Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 98.C8.04015.3446C5C5; Fri, 8 Feb 2019 02:00:51 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:00:51 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:10 +0100 Message-id: <20190207170028.720-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmga5zSkyMwfWrqhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MiT++Mhes4q14utymgXEmdxcjJ4eE gInEhffnWbsYuTiEBHYwSny8c4wZwvnOKPFv3zJWmKov53dAVe1mlNi24x0bhPOLUWLfncks IFVsAoYSvUf7GEFsEQExidtzOsFGMQu0MEnMmbuUGSQhLJAgsWnpVbAiFgFViVUtvUwgNq+A pcTh5ZPZINbJS5zvXccOYnMKWEnc2r+DBaJGUOLH5HtgNjNQzcErz1lAFkgIHGCTOP19DdSt LhJtbxqBmjmAbGmJS0dtIcLVEru2dzND1HcwSrRc2M4MkbCWOHz8IivEUD6Jd197WCF6eSU6 2oQgSjwknu7aCA2XXkaJ3iM/2ScwSs1CctMsJDctYGRaxSiWWlCcm55abFhgqFecmFtcmpeu l5yfu4kRHOVapjsYp5zzOcQowMGoxMOroRcTI8SaWFZcmXuIUYKDWUmEVzYBKMSbklhZlVqU H19UmpNafIhRmoNFSZx3vYNzjJBAemJJanZqakFqEUyWiYNTqoGxIOef0PuGNZt/lyh4fl3e PPfUadX7Wy4luATxb/reVeJ/vu9j/r1s1UmCHGcFPokZiM4z7qh0jew9wDbzzxNLxqeyUyde ezX37SZG5seVfQccnC9kKea9lg1h/7fMaEqs3YWTSuUmXHPvyh2M/1UntPn+f5VVebtT1aWe 5s3Vfvp5k/+K3aa3lViKMxINtZiLihMB057y7e4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAV3nlJgYg4blwhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MiT++Mhes4q14utymgXEmdxcjJ4eE gInEl/M7WLsYuTiEBHYySpz8OxPK+cUo8fbsSWaQKjYBQ4neo32MILaIgJjE7TmdzCBFzAJN TBK7bl9kB0kICyRIbFp6FayIRUBVYlVLLxOIzStgKXF4+WQ2iHXyEud714HVcwpYSdzav4MF xBYCqvkwoYkVol5Q4sfke2BxZqD6g1ees0xg5JuFJDULSWoBI9MqRsnUguLc9NxiowLDvNRy veLE3OLSvHS95PzcTYzAIN52WKtvB+P9JfGHGAU4GJV4eC9ox8QIsSaWFVfmHmKU4GBWEuGV TQAK8aYkVlalFuXHF5XmpBYfYpTmYFES572ddyxSSCA9sSQ1OzW1ILUIJsvEwSnVwJgsv9SP 5ebCF05H2Kcx892Uc0uO7Oz3ap+RUnd8ypNlVz49tinknMOjPH2Cur/3pjNMy956OrOd/yRo Pt/36bfPeZff/97jH9KtIxBf+NTz0axePfOcfTaa+t8NFD7WPmc9KewxXXvppYU3X56cnFwq NqngYbdnw/XHvSKaZQoxQVdPfJKyWqvEUpyRaKjFXFScCABmTR3CXgIAAA== X-CMS-MailID: 20190207170051epcas1p37a1acaef52cffb01af00c8d34dd9b1dd CMS-TYPE: 101P X-CMS-RootMailID: 20190207170051epcas1p37a1acaef52cffb01af00c8d34dd9b1dd References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 02/22] ASoC: dmaengine: Extend use of chan_names provided in custom DMA config X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP There are currently two ways to specify custom DMA channel names: - through the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag and snd_dmaengine_dai_dma_data data structure, - through chan_names field of struct snd_dmaengine_pcm_config. In order to replace the DAI DMA data method with the custom DMA config one on non-DT platforms the dmaengine_pcm_new() function is extended to also consider channel names specified in the custom DMA config. If both config->chan_names and dma_data->chan_name are provided the former will be used. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/soc-generic-dmaengine-pcm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 6d7638c1233d..1b44e363c50c 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -288,9 +288,16 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); if (!pcm->chan[i] && - (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) + ((pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME) || + (config && config->chan_names[i]))) { + const char *chan_name = dma_data->chan_name; + + if (config && config->chan_names[i]) + chan_name = config->chan_names[i]; + pcm->chan[i] = dma_request_slave_channel(dev, - dma_data->chan_name); + chan_name); + } if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, From patchwork Thu Feb 7 17:00:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3B391390 for ; Thu, 7 Feb 2019 18:56:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2C3A2E4C5 for ; Thu, 7 Feb 2019 18:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C48002E4D0; Thu, 7 Feb 2019 18:56:21 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00A932E4C5 for ; Thu, 7 Feb 2019 18:56:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D0D0267A0F; Thu, 7 Feb 2019 18:01:04 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2CCB0267A18; Thu, 7 Feb 2019 18:01:01 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id B53DF267A0F for ; Thu, 7 Feb 2019 18:00:58 +0100 (CET) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170056epoutp03732bd1d199ed64a5ec7bbad0e56df276~BI5Hg-8Y02488224882epoutp03b; Thu, 7 Feb 2019 17:00:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170056epoutp03732bd1d199ed64a5ec7bbad0e56df276~BI5Hg-8Y02488224882epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558856; bh=yeG7cOJqA6pJEeXmtWt2pGkVdYpGnpKyrGXLzbCrFHo=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=h3vduXgAlt6FRv9F9bm1QIZf5QAGyoXXV5YLci+WzCX4DOjSe3xD9xnoVddAxD2IP 8SC3Hvp6qXFQovXg9lYIcDVa2Mdstv4aSJv/sVTFpxqj5Un51IDzDwqCi8dYpBHx11 ko9Sm9DyvernAuVnjnu0qnddnxuiRfggyyveZQ04= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170055epcas1p249079fa391524301607d84460c0b775e~BI5GsfDvT2711827118epcas1p2A; Thu, 7 Feb 2019 17:00:55 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id E1.AE.04206.7446C5C5; Fri, 8 Feb 2019 02:00:55 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170054epcas1p1e61320d308bc5be30187919f3360f501~BI5GVzO9y2372323723epcas1p1H; Thu, 7 Feb 2019 17:00:54 +0000 (GMT) X-AuditID: b6c32a39-d65ff7000000106e-41-5c5c6447c294 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 49.C8.04015.6446C5C5; Fri, 8 Feb 2019 02:00:54 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:00:54 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:11 +0100 Message-id: <20190207170028.720-4-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7bCmrq57SkyMQf9vfosrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfGvauvmQtOq1bsaZnJ1MD4Qq6LkZND QsBEYueERvYuRi4OIYEdjBK7d85kg3C+M0o8mH+DDabq4bsLTBCJ3YwSy5/fY4FwfjFK/Prx mh2kik3AUKL3aB8jiC0iICZxe04nM0gRs0ALk8ScuUuZQRLCAqES6z9/ZwGxWQRUJT6+6AaL 8wpYSiw9tBpqnbzE+d51YEM5Bawkbu3fwQJRIyjxY/I9MJsZqObglecsEPUH2CS+nMmCsF0k 5vxfDNTLAWRLS1w6agsRrpbYtb0b7B4JgQ5GiZYL25khEtYSh49fZIWYySfx7msPK0Qvr0RH mxCE6SFx6qkIxL+9jBLvzh1jm8AoNQvJRbOQXLSAkWkVo1hqQXFuemqxYYGpXnFibnFpXrpe cn7uJkZwjGtZ7mA8ds7nEKMAB6MSD+8F7ZgYIdbEsuLK3EOMEhzMSiK8sglAId6UxMqq1KL8 +KLSnNTiQ4zSHCxK4rzrHZxjhATSE0tSs1NTC1KLYLJMHJxSDYzFgvuWsi8XeLh1y1nrsjtl PNHr7urH/53DVSH6evoF2dkztzgKT+Nd6bsjQD3+4IfMG2k/E93WPBHdX1C9wKyCtZmdSWup mMS23y0Gs9hrUv9uDA1KkylcdKX5W4SNkca1+pQVX+ddKW/hOpg2ef7vQ5J3Z2yUtZnBNl8+ LsRdYu3n3Qv75FSUWIozEg21mIuKEwEWkB0D7QIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAV23lJgYg8sHTC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZ966+Zi44rVqxp2UmUwPjC7kuRk4O CQETiYfvLjB1MXJxCAnsZJRo7djNDOH8YpTY+v8VG0gVm4ChRO/RPkYQW0RATOL2nE6wImaB JiaJXbcvsoMkhAVCJdZ//s4CYrMIqEp8fNHNDGLzClhKLD20mg1inbzE+d51YPWcAlYSt/bv AKsXAqr5MKGJFaJeUOLH5HtgcWag+oNXnrNMYOSbhSQ1C0lqASPTKkbJ1ILi3PTcYqMCw7zU cr3ixNzi0rx0veT83E2MwDDedlirbwfj/SXxhxgFOBiVeHgvaMfECLEmlhVX5h5ilOBgVhLh lU0ACvGmJFZWpRblxxeV5qQWH2KU5mBREue9nXcsUkggPbEkNTs1tSC1CCbLxMEp1cDoNlex 9/p5JoWkUJHNXFunJ+2IyXasXeVyW+ldYW01T+6/Y053k14q/X8hbOp30Y7NaiHL2UXLFn9f YtcfwM+6V0zRZy13XVH++5/TXtpO5P9lHrinteKQQa9gxuSMJdO6Fno1x7TnWvYnF+js1r2u rrtI6cTPLQ4h369PP3n0tOq+q2rFyx4rsRRnJBpqMRcVJwIA0kVbU18CAAA= X-CMS-MailID: 20190207170054epcas1p1e61320d308bc5be30187919f3360f501 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170054epcas1p1e61320d308bc5be30187919f3360f501 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 03/22] ASoC: samsung: dmaengine: Allow to specify custom DMA device X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The additional function argument will allow to select proper DMA device for requesting DMA channel for the secondary CPU DAI. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/dma.h | 3 ++- sound/soc/samsung/dmaengine.c | 4 +++- sound/soc/samsung/i2s.c | 4 ++-- sound/soc/samsung/pcm.c | 2 +- sound/soc/samsung/s3c2412-i2s.c | 2 +- sound/soc/samsung/s3c24xx-i2s.c | 2 +- sound/soc/samsung/spdif.c | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h index 7ae580d677c8..0ae15d01a3f6 100644 --- a/sound/soc/samsung/dma.h +++ b/sound/soc/samsung/dma.h @@ -17,5 +17,6 @@ * otherwise actual DMA channel names must be passed to this function. */ int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, - const char *tx, const char *rx); + const char *tx, const char *rx, + struct device *dma_dev); #endif /* _SAMSUNG_DMA_H */ diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c index 9104c98deeb7..84601fa9aa46 100644 --- a/sound/soc/samsung/dmaengine.c +++ b/sound/soc/samsung/dmaengine.c @@ -25,7 +25,8 @@ #include "dma.h" int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, - const char *tx, const char *rx) + const char *tx, const char *rx, + struct device *dma_dev) { unsigned int flags = SND_DMAENGINE_PCM_FLAG_COMPAT; struct snd_dmaengine_pcm_config *pcm_conf; @@ -36,6 +37,7 @@ int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; pcm_conf->compat_filter_fn = filter; + pcm_conf->dma_dev = dma_dev; if (dev->of_node) { pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index ce00fe2f6aae..9d3dcb2204fe 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1345,7 +1345,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->i2s_dai_drv.playback.channels_max = 6; ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter, - NULL, NULL); + NULL, NULL, NULL); if (ret < 0) goto err_disable_clk; @@ -1382,7 +1382,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->sec_dai = sec_dai; ret = samsung_asoc_dma_platform_register(&pdev->dev, - sec_dai->filter, "tx-sec", NULL); + sec_dai->filter, "tx-sec", NULL, NULL); if (ret < 0) goto err_disable_clk; diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 37f95eee1558..3c7baa561084 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -553,7 +553,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, - NULL, NULL); + NULL, NULL, NULL); if (ret) { dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); goto err_dis_pclk; diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index cc0840fff5aa..67dfa27ae321 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -177,7 +177,7 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ret = samsung_asoc_dma_platform_register(&pdev->dev, pdata->dma_filter, - NULL, NULL); + NULL, NULL, NULL); if (ret) { pr_err("failed to register the DMA: %d\n", ret); return ret; diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index 8d58d02183bf..ba0f2b94f8d4 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -446,7 +446,7 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO; ret = samsung_asoc_dma_platform_register(&pdev->dev, NULL, - NULL, NULL); + NULL, NULL, NULL); if (ret) { dev_err(&pdev->dev, "Failed to register the DMA: %d\n", ret); return ret; diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index cb59911e65c0..5e4afb330416 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c @@ -430,7 +430,7 @@ static int spdif_probe(struct platform_device *pdev) spdif->dma_playback = &spdif_stereo_out; ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, - NULL, NULL); + NULL, NULL, NULL); if (ret) { dev_err(&pdev->dev, "failed to register DMA: %d\n", ret); goto err4; From patchwork Thu Feb 7 17:00:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6E531390 for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6F752A42B for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBB8B2E4D1; Thu, 7 Feb 2019 18:56:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A6CB2E4D2 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BF6B5267A30; Thu, 7 Feb 2019 18:01:07 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E1158267A30; Thu, 7 Feb 2019 18:01:05 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id 1212C2679E2 for ; Thu, 7 Feb 2019 18:01:01 +0100 (CET) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170059epoutp0324555212c5b5a8791511f30bbb26779c~BI5K7Hotd2488224882epoutp03d; Thu, 7 Feb 2019 17:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170059epoutp0324555212c5b5a8791511f30bbb26779c~BI5K7Hotd2488224882epoutp03d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558859; bh=z+2XzIlWDYBCqalO/VoQ/cstpDjX/5UQBwVI2/feHn4=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ZMy46AnvkxqEsjzsh2EXA9cnxnmKkhSU7gTKXl4lUNHO/eNNLV6tbo3hPkgpqBdtW 18d1NKX9G+oRQyLuh75ZlpwH8xXKHP+IEt1fYCLK3waSQD4xR6V7hDG2wVRJKzU5Qs hC+XPLU0c3OwO8zvazNjdiSmjSNOjVgjIM8AoDBE= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170059epcas1p1ebfe29d0f3a0aa360595f54dcf68a488~BI5KsTfb71074510745epcas1p1M; Thu, 7 Feb 2019 17:00:59 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id D2.AE.04206.B446C5C5; Fri, 8 Feb 2019 02:00:59 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170058epcas1p4e2fadf4aae2ece3c47c0750a094a4fbb~BI5JmBIF12153821538epcas1p4f; Thu, 7 Feb 2019 17:00:58 +0000 (GMT) X-AuditID: b6c32a39-d7dff7000000106e-48-5c5c644b7751 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F9.C8.04015.A446C5C5; Fri, 8 Feb 2019 02:00:58 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:00:58 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:12 +0100 Message-id: <20190207170028.720-5-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmrq53SkyMQd89NYsrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAldGy8F5jAUb+SoOX+xjbmB8wN3FyMkh IWAi0XCji7GLkYtDSGAHo8TZH2dYIZzvjBLf715mham6uXcDO0RiN6PE4fkPWSCcX4wSk1p3 sIFUsQkYSvQe7WMEsUUExCRuz+lkBiliFmhhkpgzdymQw8EhLBAh8eiTDUgNi4CqxIc/fewg Nq+ApUTroQmMENvkJc73rgOLcwpYSdzav4MFokZQ4sfke2A2M1DNwSvPwY6QEDjAJnHzynwW iGYXidUv97KB7JIQkJa4dNQWIlwtsWt7NzNEfQejRMuF7cwQCWuJw8cvskIM5ZN497WHFaKX V6KjTQiixENiaetaaLD0MkqsPTqTbQKj1CwkN81CctMCRqZVjGKpBcW56anFhgWmesWJucWl eel6yfm5mxjBUa5luYPx2DmfQ4wCHIxKPLwXtGNihFgTy4orcw8xSnAwK4nwyiYAhXhTEiur Uovy44tKc1KLDzFKc7AoifOud3COERJITyxJzU5NLUgtgskycXBKNTAu9DTvVv8irGt49BfP TDeBH9uy7n9yW1TZarGmyGYRY45LyKNIpZwVaydrRM2Mqlvgtecc/8lPd+6+eC0duUyd55cO 78L9tzZ86JQPNLh7MLVALHFFiYnbo0iP37fP79wXsfUV11n++bL/QxzEyoq949vfb7qZ0J+9 ZPYP0ydxP5cet700LWWXEktxRqKhFnNRcSIAj/2dte4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAV2vlJgYg5n/JS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZLQfnMRZs5Ks4fLGPuYHxAXcXIyeH hICJxM29G9i7GLk4hAR2MkrsejqHEcL5xShxvXMVG0gVm4ChRO/RPkYQW0RATOL2nE5mkCJm gSYmiV23LwK1c3AIC0RIPPpkA1LDIqAq8eFPHzuIzStgKdF6aAIjxDZ5ifO968DinAJWErf2 72ABsYWAaj5MaGKFqBeU+DH5HlicGaj+4JXnLBMY+WYhSc1CklrAyLSKUTK1oDg3PbfYqMAw L7Vcrzgxt7g0L10vOT93EyMwiLcd1urbwXh/SfwhRgEORiUe3gvaMTFCrIllxZW5hxglOJiV RHhlE4BCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeW/nHYsUEkhPLEnNTk0tSC2CyTJxcEo1MGau fO+vbS37ge3A3MeqGrd4vW8uCHG9LbsoJsVtFdeuogbuCZfbDmdoXlNN/rg15XlLGrfkvoTl c5y0M39r9N4V/l8Q9/y6W5Th5a2V+gbr98/7rG345ds+ORkOEyXhun1ZGRqf/x842f1p6kGz U09Xsd2s892eojSl5bO67twW1xQ+c4NAByWW4oxEQy3mouJEALqrpDJeAgAA X-CMS-MailID: 20190207170058epcas1p4e2fadf4aae2ece3c47c0750a094a4fbb CMS-TYPE: 101P X-CMS-RootMailID: 20190207170058epcas1p4e2fadf4aae2ece3c47c0750a094a4fbb References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 04/22] ASoC: samsung: i2s: Fix prescaler setting for the secondary DAI X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure i2s->rclk_srcrate is properly initialized also during playback through the secondary DAI. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 9d3dcb2204fe..d5ddad23d5e5 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct i2s_dai *i2s = to_info(dai); + struct i2s_dai *other = get_other_dai(i2s); int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; u32 mod, tmp = 0; unsigned long flags; @@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any * clock configuration assigned in DT is not overwritten. */ - if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) + if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL && + other->clk_data.clks == NULL) i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 0, SND_SOC_CLOCK_IN); break; @@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); + struct i2s_dai *other = get_other_dai(i2s); u32 mod, mask = 0, val = 0; struct clk *rclksrc; unsigned long flags; @@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, i2s->frmclk = params_rate(params); rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; + if (!rclksrc || IS_ERR(rclksrc)) + rclksrc = other->clk_table[CLK_I2S_RCLK_SRC]; + if (rclksrc && !IS_ERR(rclksrc)) i2s->rclk_srcrate = clk_get_rate(rclksrc); From patchwork Thu Feb 7 17:00:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98762186D for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 877B52E4D0 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 790122A42B; Thu, 7 Feb 2019 18:56:22 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9EC52A42B for ; Thu, 7 Feb 2019 18:56:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D763267A44; Thu, 7 Feb 2019 18:01:11 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 65444267A08; Thu, 7 Feb 2019 18:01:09 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 38E6B267A1E for ; Thu, 7 Feb 2019 18:01:04 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170102epoutp04dc5ee21ded3c40792725ab5a0ceb766a~BI5NeNO_Z2868228682epoutp04O; Thu, 7 Feb 2019 17:01:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170102epoutp04dc5ee21ded3c40792725ab5a0ceb766a~BI5NeNO_Z2868228682epoutp04O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558862; bh=qVz4QuhurXb56dPzooLLoVuLMR5l8arJ+uVcU3lmGlU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=uFN+Gtr3925ZyYXPDtIM0VLhFfJO8WYMU7V+I4V6YDR380zUH6pulbes+NeOa/eTg GXiEGWXMJlz+S2FPeyJJvIi8QNHhGvsEWPEu0Ls/Z2ZNE/Ly9fdODuGlL56ZPcgJrm MKlvR2OlzqYsBpMJ176FzYkqPr8m+p/Qk+HI4aYQ= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170102epcas1p14210d05d81bf4614ed62779d6c7819fb~BI5NPmZl11636416364epcas1p1o; Thu, 7 Feb 2019 17:01:02 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 66.C9.04173.E446C5C5; Fri, 8 Feb 2019 02:01:02 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170102epcas1p445f2a5d8e70bc3a6e42424034c2eb34a~BI5NC_7C31053310533epcas1p47; Thu, 7 Feb 2019 17:01:02 +0000 (GMT) X-AuditID: b6c32a36-5d9ff7000000104d-0b-5c5c644ea85e Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BA.C8.04015.D446C5C5; Fri, 8 Feb 2019 02:01:02 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:01 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:13 +0100 Message-id: <20190207170028.720-6-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7bCmrq5fSkyMQXuzqMWVi4eYLDbOWM9q MfXhEzaL8+c3sFt8u9LBZHF51xw2ixnn9zFZrD1yl93i8Jt2VouLK74wOXB5bPjcxOaxc9Zd do9NqzrZPPq2rGL0+LxJLoA1issmJTUnsyy1SN8ugStjwvUp7AX/4yr2L9nM3sC4x6+LkZND QsBEYsH/0yxdjFwcQgI7GCVWbDnHBJIQEvjOKNG5yQimaN2MOUwQRbsZJVZvncsM4fxilLi6 ppkFpIpNwFCi92gfI4gtIiAmcXtOJ1gRs0ALk8ScuUuBHA4OYYFoiQnN+SA1LAKqEpsnfmAD sXkFLCUef5rDCLFNXuJ87zp2EJtTwEri1v4dLBA1ghI/Jt8Ds5mBag5eeQ52toTAETaJHUt/ MEM0u0gsOniZDWSXhIC0xKWjthDhaold27uZIeo7GCVaLmyHqreWOHz8IivEUD6Jd197WCF6 eSU62oQgSjwknl1fzgjxcC+jxNcNrewTGKVmIblpFpKbFjAyrWIUSy0ozk1PLTYsMNIrTswt Ls1L10vOz93ECI5xLbMdjIvO+RxiFOBgVOLh1dCLiRFiTSwrrsw9xCjBwawkwiubABTiTUms rEotyo8vKs1JLT7EKM3BoiTOu97BOUZIID2xJDU7NbUgtQgmy8TBKdXAyMj4u/2V4fbFP+OU hVZMk4rZafCN89ede7OcBN6GJ3Veuirdp/2+u6T13d9JvHURM6dUM8gv1/kZOFP8io9+UGra s4evVD2cWN5f07J38rB9mPu4QsFQZOYHlfM/6yedOTbVs+vqG4me71t+Na1Y/U/O6Nvk3ys+ cFSW6hXUaFwKl9g+8b3YGSWW4oxEQy3mouJEAAeHLX7tAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAV2/lJgYg7ZDbBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MCdensBf8j6vYv2QzewPjHr8uRk4O CQETiXUz5jB1MXJxCAnsZJS4d+c1K4Tzi1Hi/pZP7CBVbAKGEr1H+xhBbBEBMYnbczqZQYqY BZqYJHbdvghUxMEhLBAtMaE5H6SGRUBVYvPED2wgNq+ApcTjT3MYIbbJS5zvXQc2k1PASuLW /h0sILYQUM2HCU2sEPWCEj8m3wOLMwPVH7zynGUCI98sJKlZSFILGJlWMUqmFhTnpucWGxUY 5qWW6xUn5haX5qXrJefnbmIEBvG2w1p9OxjvL4k/xCjAwajEw3tBOyZGiDWxrLgy9xCjBAez kgivbAJQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/tvGORQgLpiSWp2ampBalFMFkmDk6pBsaQ n9v9BasKNnmd4Mwz8VURy/jyLbfo3MxqdY33wden3Mz2D+u86JB/eVH3rx/qIdozNq0XC1/j stGLyS1sbtvP5ZtStO0eC8dc/7HkMPv/8imTbBTeXjJVTD/SH/RGZ9GTYPVqgYaunxfK7vCU qvy7+sjhy4slO5vPMk7W229vebGxyvaWubsSS3FGoqEWc1FxIgASE9yuXgIAAA== X-CMS-MailID: 20190207170102epcas1p445f2a5d8e70bc3a6e42424034c2eb34a CMS-TYPE: 101P X-CMS-RootMailID: 20190207170102epcas1p445f2a5d8e70bc3a6e42424034c2eb34a References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 05/22] ASoC: samsung: i2s: Convert to single component with multiple DAIs X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch includes minimal changes as a prerequisite for adding support for the Exynos secondary I2S interface as second DAI of the I2S component. Doing it that way allows to avoid problems as indicated in commmit 6b01e0365b1689 ("ASoC: samsung: i2s: disable secondary DAI until it gets fixed") The samsung_i2s_get_pri_dai() helper added in this patch is temporary and will be removed in one of subsequent patches. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 192 ++++++++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 77 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index d5ddad23d5e5..4bc3b181f1c2 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -34,6 +34,9 @@ #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) +#define SAMSUNG_I2S_ID_PRIMARY 1 +#define SAMSUNG_I2S_ID_SECONDARY 2 + struct samsung_i2s_variant_regs { unsigned int bfs_off; unsigned int rfs_off; @@ -79,8 +82,10 @@ struct i2s_dai { #define DAI_OPENED (1 << 0) /* Dai is opened */ #define DAI_MANAGER (1 << 1) /* Dai is the manager */ unsigned mode; + /* Driver for this DAI */ - struct snd_soc_dai_driver i2s_dai_drv; + struct snd_soc_dai_driver *drv; + /* DMA parameters */ struct snd_dmaengine_dai_dma_data dma_playback; struct snd_dmaengine_dai_dma_data dma_capture; @@ -92,8 +97,6 @@ struct i2s_dai { u32 suspend_i2spsr; const struct samsung_i2s_variant_regs *variant_regs; - /* Spinlock protecting access to the device's registers */ - spinlock_t spinlock; spinlock_t *lock; /* Below fields are only valid if this is the primary FIFO */ @@ -104,10 +107,29 @@ struct i2s_dai { /* Lock for cross i/f checks */ static DEFINE_SPINLOCK(lock); -/* If this is the 'overlay' stereo DAI */ +struct samsung_i2s_priv { + struct platform_device *pdev; + + /* Spinlock protecting access to the device's registers */ + spinlock_t spinlock; + + /* CPU DAIs and their corresponding drivers */ + struct i2s_dai *dai; + struct snd_soc_dai_driver *dai_drv; + int num_dais; +}; + +struct i2s_dai *samsung_i2s_get_pri_dai(struct device *dev) +{ + struct samsung_i2s_priv *priv = dev_get_drvdata(dev); + + return &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1]; +} + +/* Returns true if this is the 'overlay' stereo DAI */ static inline bool is_secondary(struct i2s_dai *i2s) { - return i2s->pri_dai ? true : false; + return i2s->drv->id == SAMSUNG_I2S_ID_SECONDARY; } /* If operating in SoC-Slave mode */ @@ -202,7 +224,9 @@ static inline bool any_active(struct i2s_dai *i2s) static inline struct i2s_dai *to_info(struct snd_soc_dai *dai) { - return snd_soc_dai_get_drvdata(dai); + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); + + return &priv->dai[dai->id - 1]; } static inline bool is_opened(struct i2s_dai *i2s) @@ -1065,7 +1089,7 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { - struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); + struct i2s_dai *i2s = to_info(dai); unsigned long flags; pm_runtime_get_sync(dai->dev); @@ -1102,47 +1126,63 @@ static const struct snd_soc_component_driver samsung_i2s_component = { SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, - const struct samsung_i2s_dai_data *i2s_dai_data, - bool sec) +static int i2s_alloc_dais(struct samsung_i2s_priv *priv, + const struct samsung_i2s_dai_data *i2s_dai_data, + int num_dais) { - struct i2s_dai *i2s; - - i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); - if (i2s == NULL) - return NULL; - - i2s->pdev = pdev; - i2s->pri_dai = NULL; - i2s->sec_dai = NULL; - i2s->i2s_dai_drv.id = 1; - i2s->i2s_dai_drv.symmetric_rates = 1; - i2s->i2s_dai_drv.probe = samsung_i2s_dai_probe; - i2s->i2s_dai_drv.remove = samsung_i2s_dai_remove; - i2s->i2s_dai_drv.ops = &samsung_i2s_dai_ops; - i2s->i2s_dai_drv.suspend = i2s_suspend; - i2s->i2s_dai_drv.resume = i2s_resume; - i2s->i2s_dai_drv.playback.channels_min = 1; - i2s->i2s_dai_drv.playback.channels_max = 2; - i2s->i2s_dai_drv.playback.rates = i2s_dai_data->pcm_rates; - i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; - - if (!sec) { - i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI; - i2s->i2s_dai_drv.capture.channels_min = 1; - i2s->i2s_dai_drv.capture.channels_max = 2; - i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates; - i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; - } else { - i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI_SEC; + static const char *dai_names[] = { "samsung-i2s", "samsung-i2s-sec" }; + struct snd_soc_dai_driver *dai_drv; + struct i2s_dai *dai; + int i; + + priv->dai = devm_kcalloc(&priv->pdev->dev, num_dais, + sizeof(*dai), GFP_KERNEL); + if (!priv->dai) + return -ENOMEM; + + priv->dai_drv = devm_kcalloc(&priv->pdev->dev, num_dais, + sizeof(*dai_drv), GFP_KERNEL); + if (!priv->dai_drv) + return -ENOMEM; + + for (i = 0; i < num_dais; i++) { + dai_drv = &priv->dai_drv[i]; + + dai_drv->probe = samsung_i2s_dai_probe; + dai_drv->remove = samsung_i2s_dai_remove; + dai_drv->suspend = i2s_suspend; + dai_drv->resume = i2s_resume; + + dai_drv->symmetric_rates = 1; + dai_drv->ops = &samsung_i2s_dai_ops; + + dai_drv->playback.channels_min = 1; + dai_drv->playback.channels_max = 2; + dai_drv->playback.rates = i2s_dai_data->pcm_rates; + dai_drv->playback.formats = SAMSUNG_I2S_FMTS; + + dai_drv->id = i + 1; + dai_drv->name = dai_names[i]; + + priv->dai[i].drv = &priv->dai_drv[i]; + priv->dai[i].pdev = priv->pdev; } - return i2s; + + /* Initialize capture only for the primary DAI */ + dai_drv = &priv->dai_drv[SAMSUNG_I2S_ID_PRIMARY - 1]; + + dai_drv->capture.channels_min = 1; + dai_drv->capture.channels_max = 2; + dai_drv->capture.rates = i2s_dai_data->pcm_rates; + dai_drv->capture.formats = SAMSUNG_I2S_FMTS; + + return 0; } #ifdef CONFIG_PM static int i2s_runtime_suspend(struct device *dev) { - struct i2s_dai *i2s = dev_get_drvdata(dev); + struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); i2s->suspend_i2scon = readl(i2s->addr + I2SCON); @@ -1157,7 +1197,7 @@ static int i2s_runtime_suspend(struct device *dev) static int i2s_runtime_resume(struct device *dev) { - struct i2s_dai *i2s = dev_get_drvdata(dev); + struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); int ret; ret = clk_prepare_enable(i2s->clk); @@ -1192,7 +1232,7 @@ static void i2s_unregister_clocks(struct i2s_dai *i2s) static void i2s_unregister_clock_provider(struct platform_device *pdev) { - struct i2s_dai *i2s = dev_get_drvdata(&pdev->dev); + struct i2s_dai *i2s = samsung_i2s_get_pri_dai(&pdev->dev); of_clk_del_provider(pdev->dev.of_node); i2s_unregister_clocks(i2s); @@ -1200,11 +1240,12 @@ static void i2s_unregister_clock_provider(struct platform_device *pdev) static int i2s_register_clock_provider(struct platform_device *pdev) { + const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" }; const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" }; const char *p_names[2] = { NULL }; struct device *dev = &pdev->dev; - struct i2s_dai *i2s = dev_get_drvdata(dev); + struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs; const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)]; struct clk *rclksrc; @@ -1279,7 +1320,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev->dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; - int ret; + int num_dais, ret; + struct samsung_i2s_priv *priv; if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) i2s_dai_data = of_device_get_match_data(&pdev->dev); @@ -1287,14 +1329,24 @@ static int samsung_i2s_probe(struct platform_device *pdev) i2s_dai_data = (struct samsung_i2s_dai_data *) platform_get_device_id(pdev)->driver_data; - pri_dai = i2s_alloc_dai(pdev, i2s_dai_data, false); - if (!pri_dai) { - dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) return -ENOMEM; - } - spin_lock_init(&pri_dai->spinlock); - pri_dai->lock = &pri_dai->spinlock; + quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks; + quirks &= ~(QUIRK_SEC_DAI | QUIRK_SUPPORTS_IDMA); + + num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1; + priv->pdev = pdev; + + ret = i2s_alloc_dais(priv, i2s_dai_data, num_dais); + if (ret < 0) + return ret; + + pri_dai = &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1]; + + spin_lock_init(&priv->spinlock); + pri_dai->lock = &priv->spinlock; if (!np) { if (i2s_pdata == NULL) { @@ -1306,10 +1358,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->dma_capture.filter_data = i2s_pdata->dma_capture; pri_dai->filter = i2s_pdata->dma_filter; - quirks = i2s_pdata->type.quirks; idma_addr = i2s_pdata->type.idma_addr; } else { - quirks = i2s_dai_data->quirks; if (of_property_read_u32(np, "samsung,idma-addr", &idma_addr)) { if (quirks & QUIRK_SUPPORTS_IDMA) { @@ -1318,7 +1368,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) } } } - quirks &= ~(QUIRK_SEC_DAI | QUIRK_SUPPORTS_IDMA); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pri_dai->addr = devm_ioremap_resource(&pdev->dev, res); @@ -1348,28 +1397,17 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->variant_regs = i2s_dai_data->i2s_variant_regs; if (quirks & QUIRK_PRI_6CHAN) - pri_dai->i2s_dai_drv.playback.channels_max = 6; + pri_dai->drv->playback.channels_max = 6; ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter, NULL, NULL, NULL); if (ret < 0) goto err_disable_clk; - ret = devm_snd_soc_register_component(&pdev->dev, - &samsung_i2s_component, - &pri_dai->i2s_dai_drv, 1); - if (ret < 0) - goto err_disable_clk; - if (quirks & QUIRK_SEC_DAI) { - sec_dai = i2s_alloc_dai(pdev, i2s_dai_data, true); - if (!sec_dai) { - dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); - ret = -ENOMEM; - goto err_disable_clk; - } + sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1]; - sec_dai->lock = &pri_dai->spinlock; + sec_dai->lock = &priv->spinlock; sec_dai->variant_regs = pri_dai->variant_regs; sec_dai->dma_playback.addr = regs_base + I2STXDS; sec_dai->dma_playback.chan_name = "tx-sec"; @@ -1392,11 +1430,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (ret < 0) goto err_disable_clk; - ret = devm_snd_soc_register_component(&pdev->dev, - &samsung_i2s_component, - &sec_dai->i2s_dai_drv, 1); - if (ret < 0) - goto err_disable_clk; } if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { @@ -1405,7 +1438,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) goto err_disable_clk; } - dev_set_drvdata(&pdev->dev, pri_dai); + dev_set_drvdata(&pdev->dev, priv); + + ret = devm_snd_soc_register_component(&pdev->dev, + &samsung_i2s_component, + priv->dai_drv, num_dais); + if (ret < 0) + goto err_disable_clk; pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -1427,9 +1466,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) static int samsung_i2s_remove(struct platform_device *pdev) { - struct i2s_dai *pri_dai; - - pri_dai = dev_get_drvdata(&pdev->dev); + struct samsung_i2s_priv *priv = dev_get_drvdata(&pdev->dev); + struct i2s_dai *pri_dai = samsung_i2s_get_pri_dai(&pdev->dev); pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); From patchwork Thu Feb 7 17:00:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05948186D for ; Thu, 7 Feb 2019 18:56:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E94D12E4CD for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1A142E4D2; Thu, 7 Feb 2019 18:56:23 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RDNS_NONE autolearn=no version=3.3.1 Received: from alsa0.perex.cz (unknown [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70FAF2E4CD for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EF633267A37; Thu, 7 Feb 2019 18:01:21 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 580D0267A37; Thu, 7 Feb 2019 18:01:20 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 1FD54267A42 for ; Thu, 7 Feb 2019 18:01:09 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190207170107epoutp021c9e3af31c8d7c6a8df41154925058e9~BI5RsihWr0530705307epoutp02E; Thu, 7 Feb 2019 17:01:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190207170107epoutp021c9e3af31c8d7c6a8df41154925058e9~BI5RsihWr0530705307epoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558867; bh=dxEYTg5/K1AIH5X9l7D1G8z1EL6NomawTiUu7irpU2s=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=CZTtDFonMxLzhzXLAHxadr7GHAJL+QW0l9vjoif7xer/sNmaX2pK3vRUZLMXiEEv+ G8Ve20iXIxWPja5tkTYIFOmNPZ5+CJ7mxYVa+vj9zLlz/VdXResVbAH/mRBUinS4Zv u9qE3iSQYMixzHlSjWpN/sWXKL0iJoA2J7lEIH7I= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170106epcas1p1e5677be9a5c65b3a72ab3c040f4e567f~BI5Q6IboC2372323723epcas1p1m; Thu, 7 Feb 2019 17:01:06 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B7.C9.04173.2546C5C5; Fri, 8 Feb 2019 02:01:06 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190207170105epcas1p3d4a1da9ae268f8e95b32fb499e5a1dad~BI5QNv2ih0868808688epcas1p3D; Thu, 7 Feb 2019 17:01:05 +0000 (GMT) X-AuditID: b6c32a36-5c1ff7000000104d-14-5c5c64526a93 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id FB.C8.04015.1546C5C5; Fri, 8 Feb 2019 02:01:05 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:05 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:14 +0100 Message-id: <20190207170028.720-7-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7bCmrm5QSkyMwafFfBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MAytesRRcl6s4df4JYwPjRMkuRk4O CQETiTOnHzB1MXJxCAnsYJR4fWMnC4TznVHi7M5ZzDBVe5/vgUrsZpS43HSFESQhJPCLUeJp oz2IzSZgKNF7tA8sLiIgJnF7TiczSAOzQAuTxJy5S4EcDg5hgSCJN6cdQWpYBFQlln9bBFbP K2ApseF0KxvEMnmJ873r2EFsTgEriVv7d7BA1AhK/Jh8D8xmBqo5eOU52EESAgfYJKY+nsMI 0ewi8ejAGSaQXRIC0hKXjtpChKsldm3vZoao72CUaLmwHeoza4nDxy+yQgzlk3j3tYcVopdX oqNNCKLEQ2L9zHmMEM/3MkpMOLuRcQKj1CwkN81CctMCRqZVjGKpBcW56anFhgVGesWJucWl eel6yfm5mxjBMa5ltoNx0TmfQ4wCHIxKPLwaejExQqyJZcWVuYcYJTiYlUR4ZROAQrwpiZVV qUX58UWlOanFhxilOViUxHnXOzjHCAmkJ5akZqemFqQWwWSZODilGhgXWK9cUbaq4V2GtFvE JsdPjRfP1X3J1ZiY9EiX9ZquZ+D12ncPbiR0yjMtnMxXlhyx8NOOt6/ndn0P/bXhAPeiy+n+ 3EomPk7WE48+P8CS9ndyrkmu1pLy5q9ZfAt0Lt19fSWtTn5d/ARtm93F/8oPRWS6MJRPbX3o GqCVxZs0VfxVlsiVmUVKLMUZiYZazEXFiQC8n8p57QIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd3AlJgYg4k/FC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZB1a8Yim4Lldx6vwTxgbGiZJdjJwc EgImEnuf72HpYuTiEBLYySix4N1UZgjnF6PEyztvGEGq2AQMJXqP9oHZIgJiErfndIIVMQs0 MUnsun2RHSQhLBAg0bX3MBuIzSKgKrH82yKwBl4BS4kNp1vZINbJS5zvXQdWzylgJXFr/w4W EFsIqObDhCZWiHpBiR+T74HFmYHqD155zjKBkW8WktQsJKkFjEyrGCVTC4pz03OLjQoM81LL 9YoTc4tL89L1kvNzNzECw3jbYa2+HYz3l8QfYhTgYFTi4b2gHRMjxJpYVlyZe4hRgoNZSYRX NgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPd23rFIIYH0xJLU7NTUgtQimCwTB6dUA+O82ews 05J/SgmI7tn/67M0x+PFvjYOHF7TG++VCd9tni83m3vZrZiF3/wXLAuUlsrfUdB3d97sXx+W bA3bW7DS8+2OKyULRF7Zmun1X+B2z5jj9G1p/7LAs492NMq9OfhCg/tC05UPc1Rqhbm5LI+8 Wxcd/rzfgu3Pwg7xHwmhyZbacuICjveVWIozEg21mIuKEwEKVPxAXwIAAA== X-CMS-MailID: 20190207170105epcas1p3d4a1da9ae268f8e95b32fb499e5a1dad CMS-TYPE: 101P X-CMS-RootMailID: 20190207170105epcas1p3d4a1da9ae268f8e95b32fb499e5a1dad References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 06/22] ASoC: samsung: i2s: Restore support for the secondary PCM X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces again registration of additional platform device as we still need it for registering the secondary dmaengine PCM component. This patch in most part is a revert of changes done in commit be2c92eb64023e ("ASoC: samsung: i2s: Remove virtual device for secondary DAI") Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 52 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 4bc3b181f1c2..994dcd4b01fb 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -109,6 +109,7 @@ static DEFINE_SPINLOCK(lock); struct samsung_i2s_priv { struct platform_device *pdev; + struct platform_device *pdev_sec; /* Spinlock protecting access to the device's registers */ spinlock_t spinlock; @@ -1312,6 +1313,34 @@ static int i2s_register_clock_provider(struct platform_device *pdev) return ret; } +/* Create platform device for the secondary PCM */ +static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) +{ + struct platform_device *pdev; + int ret; + + pdev = platform_device_register_simple("samsung-i2s-sec", -1, NULL, 0); + if (!pdev) + return -ENOMEM; + + ret = device_attach(&pdev->dev); + if (ret < 0) { + dev_info(&pdev->dev, "device_attach() failed\n"); + return ret; + } + + priv->pdev_sec = pdev; + + return 0; +} + +static void i2s_delete_secondary_device(struct samsung_i2s_priv *priv) +{ + if (priv->pdev_sec) { + platform_device_del(priv->pdev_sec); + priv->pdev_sec = NULL; + } +} static int samsung_i2s_probe(struct platform_device *pdev) { struct i2s_dai *pri_dai, *sec_dai = NULL; @@ -1329,13 +1358,15 @@ static int samsung_i2s_probe(struct platform_device *pdev) i2s_dai_data = (struct samsung_i2s_dai_data *) platform_get_device_id(pdev)->driver_data; + /* Nothing to do if it is the secondary device probing */ + if (!i2s_dai_data) + return 0; + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks; - quirks &= ~(QUIRK_SEC_DAI | QUIRK_SUPPORTS_IDMA); - num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1; priv->pdev = pdev; @@ -1425,8 +1456,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->pri_dai = pri_dai; pri_dai->sec_dai = sec_dai; - ret = samsung_asoc_dma_platform_register(&pdev->dev, - sec_dai->filter, "tx-sec", NULL, NULL); + ret = i2s_create_secondary_device(priv); + if (ret < 0) + goto err_disable_clk; + + ret = samsung_asoc_dma_platform_register(&priv->pdev_sec->dev, + sec_dai->filter, "tx-sec", NULL, + &pdev->dev); if (ret < 0) goto err_disable_clk; @@ -1461,6 +1497,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); err_disable_clk: clk_disable_unprepare(pri_dai->clk); + i2s_delete_secondary_device(priv); return ret; } @@ -1469,12 +1506,16 @@ static int samsung_i2s_remove(struct platform_device *pdev) struct samsung_i2s_priv *priv = dev_get_drvdata(&pdev->dev); struct i2s_dai *pri_dai = samsung_i2s_get_pri_dai(&pdev->dev); + if (!priv) + return 0; + pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); i2s_unregister_clock_provider(pdev); clk_disable_unprepare(pri_dai->clk); pm_runtime_put_noidle(&pdev->dev); + i2s_delete_secondary_device(priv); return 0; } @@ -1573,6 +1614,9 @@ static const struct platform_device_id samsung_i2s_driver_ids[] = { .name = "samsung-i2s", .driver_data = (kernel_ulong_t)&i2sv3_dai_type, }, + { + .name = "samsung-i2s-sec", + }, {}, }; MODULE_DEVICE_TABLE(platform, samsung_i2s_driver_ids); From patchwork Thu Feb 7 17:00:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03E3817FB for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E90CE2E4C5 for ; Thu, 7 Feb 2019 18:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDC5C2E4D2; Thu, 7 Feb 2019 18:56:21 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04E862E4C7 for ; Thu, 7 Feb 2019 18:56:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 67E5E267A08; Thu, 7 Feb 2019 18:01:26 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 997AD2679E2; Thu, 7 Feb 2019 18:01:23 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 1E60E267A05 for ; Thu, 7 Feb 2019 18:01:13 +0100 (CET) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170111epoutp04d2c13f58a6d73843d2d18fa041cb9579~BI5VsVctu2868228682epoutp04P; Thu, 7 Feb 2019 17:01:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170111epoutp04d2c13f58a6d73843d2d18fa041cb9579~BI5VsVctu2868228682epoutp04P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558871; bh=9ExnuY/43UnV5ruD8Yez08W/97/GVzIM7ZfIACRWbgk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=X/bhTgEth2BE3oIjRwZymwOl+jO5KaF/aKw6jPNQbiBA+bFgYCRwvlg16uDaSkzdC DOiLkgv5mnKfsw1vkGgx7xi0BexrcypNP7u6IyWNRzJsfLOZLGPx8CVLmhGhKAiugh LEEtwUQxAoL+3aDBAiyTPVm2NPwvDyOSEgZLnlbA= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170110epcas1p432ce516636791f0bfde1defa42400099~BI5Uc-JZO1053310533epcas1p4N; Thu, 7 Feb 2019 17:01:10 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 43.B3.04074.6546C5C5; Fri, 8 Feb 2019 02:01:10 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170109epcas1p20929934c01ae67a05cd6a56f13ed8486~BI5TjEGWE3249332493epcas1p28; Thu, 7 Feb 2019 17:01:09 +0000 (GMT) X-AuditID: b6c32a35-27fff70000000fea-5a-5c5c6456e799 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.C8.04015.4546C5C5; Fri, 8 Feb 2019 02:01:09 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:08 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:15 +0100 Message-id: <20190207170028.720-8-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmrm5YSkyMwZ82dosrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfGk0tzWAtOWlW8vbqdsYHxjEEXIweH hICJxLLnbl2MXBxCAjsYJXrWrmGGcL4zSpyb183YxcgJVnRy0weoxG5GiV3vr7BBOL8YJdZ0 72IHqWITMJToPdoH1iEiICZxe04nWAezQAuTxJy5S5lBEsICyRIz58wFa2ARUJW4c/sxmM0r YClx78d6doh18hLne9eB2ZwCVhK39u9ggagRlPgx+R6YzQxUc/DKcxaQBRICe9gkllzcDNXs IjHl3BNGiOekJS4dtYUIV0vs2t7NDFHfwSjRcmE7M0TCWuLw8YusEEP5JN597WGF6OWV6GgT gijxkOhZ/YAd4uNeRomV59exTWCUmoXkpllIblrAyLSKUSy1oDg3PbXYsMBQrzgxt7g0L10v OT93EyM4yrVMdzBOOedziFGAg1GJh1dDLyZGiDWxrLgy9xCjBAezkgivbAJQiDclsbIqtSg/ vqg0J7X4EKM0B4uSOO96B+cYIYH0xJLU7NTUgtQimCwTB6dUA6P1ZpHlpW/uOrM8zHizjbHB tshaLce8Wihn0e+ml0lTmXcJeTTdeid4fE/I8oPfio+//OOfx2vwqG/XvEfTHV6dYDyhuNT8 bdXrAztP3HOqkjmr4H9R/e9Jp+2HGvlue8fcleWZ+7Jnt+789d8Wzus9uzdjW+BtX8Pp0+yW zjz3jvFYnwJTT8EJJZbijERDLeai4kQAtxGKI+4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd3QlJgYg4sT2C2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZTy7NYS04aVXx9up2xgbGMwZdjJwc EgImEic3fWDuYuTiEBLYySixdXkDO4Tzi1Hi1ZwrTCBVbAKGEr1H+xhBbBEBMYnbczrBOpgF mpgkdt2+yA6SEBZIlpg5Zy6YzSKgKnHn9mMwm1fAUuLej/XsEOvkJc73rgOzOQWsJG7t38EC YgsB1XyY0MQKUS8o8WPyPbA4M1D9wSvPWSYw8s1CkpqFJLWAkWkVo2RqQXFuem6xUYFhXmq5 XnFibnFpXrpecn7uJkZgGG87rNW3g/H+kvhDjAIcjEo8vBe0Y2KEWBPLiitzDzFKcDArifDK JgCFeFMSK6tSi/Lji0pzUosPMUpzsCiJ897OOxYpJJCeWJKanZpakFoEk2Xi4JRqYORZx+7R ONe9+7zagSNGPDW5K83uzPndbmnNnhRmeqwu3Punp2vE82v1/6bXh8Xfa589S8Mi4BUXT+C2 sKk3Y1pDp8hM/uv+q+6p9Zb9+z3r1ult8+zZ8vxx6VRhHoPrS56Zt+2a3Gy+cEmJTwjjfc8H Dkz77p/2v3kycquv9fqYtFTt9apqy5RYijMSDbWYi4oTAcoGgh9fAgAA X-CMS-MailID: 20190207170109epcas1p20929934c01ae67a05cd6a56f13ed8486 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170109epcas1p20929934c01ae67a05cd6a56f13ed8486 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 07/22] ASoC: samsung: i2s: Move clk supplier data to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Having the clocks provider data in struct samsung_i2s_priv, i.e. per the I2S controller instance, rather than per CPU DAI better models the hardware and simplifies the code a little. The clock provider is common for both DAIs. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 68 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 994dcd4b01fb..978614673ffb 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -99,9 +99,7 @@ struct i2s_dai { spinlock_t *lock; - /* Below fields are only valid if this is the primary FIFO */ - struct clk *clk_table[3]; - struct clk_onecell_data clk_data; + struct samsung_i2s_priv *priv; }; /* Lock for cross i/f checks */ @@ -118,6 +116,10 @@ struct samsung_i2s_priv { struct i2s_dai *dai; struct snd_soc_dai_driver *dai_drv; int num_dais; + + /* The clock provider's data */ + struct clk *clk_table[3]; + struct clk_onecell_data clk_data; }; struct i2s_dai *samsung_i2s_get_pri_dai(struct device *dev) @@ -625,11 +627,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, return ret; } -static int i2s_set_fmt(struct snd_soc_dai *dai, - unsigned int fmt) +static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = get_other_dai(i2s); int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; u32 mod, tmp = 0; unsigned long flags; @@ -687,8 +688,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any * clock configuration assigned in DT is not overwritten. */ - if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL && - other->clk_data.clks == NULL) + if (i2s->rclk_srcrate == 0 && priv->clk_data.clks == NULL) i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 0, SND_SOC_CLOCK_IN); break; @@ -725,8 +725,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, static int i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = get_other_dai(i2s); u32 mod, mask = 0, val = 0; struct clk *rclksrc; unsigned long flags; @@ -811,10 +811,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, i2s->frmclk = params_rate(params); - rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; - if (!rclksrc || IS_ERR(rclksrc)) - rclksrc = other->clk_table[CLK_I2S_RCLK_SRC]; - + rclksrc = priv->clk_table[CLK_I2S_RCLK_SRC]; if (rclksrc && !IS_ERR(rclksrc)) i2s->rclk_srcrate = clk_get_rate(rclksrc); @@ -1221,31 +1218,30 @@ static int i2s_runtime_resume(struct device *dev) } #endif /* CONFIG_PM */ -static void i2s_unregister_clocks(struct i2s_dai *i2s) +static void i2s_unregister_clocks(struct samsung_i2s_priv *priv) { int i; - for (i = 0; i < i2s->clk_data.clk_num; i++) { - if (!IS_ERR(i2s->clk_table[i])) - clk_unregister(i2s->clk_table[i]); + for (i = 0; i < priv->clk_data.clk_num; i++) { + if (!IS_ERR(priv->clk_table[i])) + clk_unregister(priv->clk_table[i]); } } -static void i2s_unregister_clock_provider(struct platform_device *pdev) +static void i2s_unregister_clock_provider(struct samsung_i2s_priv *priv) { - struct i2s_dai *i2s = samsung_i2s_get_pri_dai(&pdev->dev); - - of_clk_del_provider(pdev->dev.of_node); - i2s_unregister_clocks(i2s); + of_clk_del_provider(priv->pdev->dev.of_node); + i2s_unregister_clocks(priv); } -static int i2s_register_clock_provider(struct platform_device *pdev) + +static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) { const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" }; const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" }; const char *p_names[2] = { NULL }; - struct device *dev = &pdev->dev; + struct device *dev = &priv->pdev->dev; struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs; const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)]; @@ -1277,37 +1273,37 @@ static int i2s_register_clock_provider(struct platform_device *pdev) u32 val = readl(i2s->addr + I2SPSR); writel(val | PSR_PSREN, i2s->addr + I2SPSR); - i2s->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev, + priv->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev, i2s_clk_name[CLK_I2S_RCLK_SRC], p_names, ARRAY_SIZE(p_names), CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, i2s->addr + I2SMOD, reg_info->rclksrc_off, 1, 0, i2s->lock); - i2s->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev, + priv->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev, i2s_clk_name[CLK_I2S_RCLK_PSR], i2s_clk_name[CLK_I2S_RCLK_SRC], CLK_SET_RATE_PARENT, i2s->addr + I2SPSR, 8, 6, 0, i2s->lock); p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR]; - i2s->clk_data.clk_num = 2; + priv->clk_data.clk_num = 2; } - i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, + priv->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, i2s_clk_name[CLK_I2S_CDCLK], p_names[0], CLK_SET_RATE_PARENT, i2s->addr + I2SMOD, reg_info->cdclkcon_off, CLK_GATE_SET_TO_DISABLE, i2s->lock); - i2s->clk_data.clk_num += 1; - i2s->clk_data.clks = i2s->clk_table; + priv->clk_data.clk_num += 1; + priv->clk_data.clks = priv->clk_table; ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, - &i2s->clk_data); + &priv->clk_data); if (ret < 0) { dev_err(dev, "failed to add clock provider: %d\n", ret); - i2s_unregister_clocks(i2s); + i2s_unregister_clocks(priv); } return ret; @@ -1426,6 +1422,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->dma_capture.addr_width = 4; pri_dai->quirks = quirks; pri_dai->variant_regs = i2s_dai_data->i2s_variant_regs; + pri_dai->priv = priv; if (quirks & QUIRK_PRI_6CHAN) pri_dai->drv->playback.channels_max = 6; @@ -1454,6 +1451,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->quirks = quirks; sec_dai->idma_playback.addr = idma_addr; sec_dai->pri_dai = pri_dai; + sec_dai->priv = priv; pri_dai->sec_dai = sec_dai; ret = i2s_create_secondary_device(priv); @@ -1485,11 +1483,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - ret = i2s_register_clock_provider(pdev); + ret = i2s_register_clock_provider(priv); if (ret < 0) goto err_disable_pm; - pri_dai->op_clk = clk_get_parent(pri_dai->clk_table[CLK_I2S_RCLK_SRC]); + pri_dai->op_clk = clk_get_parent(priv->clk_table[CLK_I2S_RCLK_SRC]); return 0; @@ -1512,7 +1510,7 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - i2s_unregister_clock_provider(pdev); + i2s_unregister_clock_provider(priv); clk_disable_unprepare(pri_dai->clk); pm_runtime_put_noidle(&pdev->dev); i2s_delete_secondary_device(priv); From patchwork Thu Feb 7 17:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 443EB13BF for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31F242A42B for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 269F72E4D0; Thu, 7 Feb 2019 18:56:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39CAE2E4D1 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DDCFF2679EA; Thu, 7 Feb 2019 18:01:30 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7A4B6267A08; Thu, 7 Feb 2019 18:01:25 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 47D27267A1F for ; Thu, 7 Feb 2019 18:01:15 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190207170113epoutp024aa7d8f3476b5065c869616cca012776~BI5XpzCzc0530705307epoutp02F; Thu, 7 Feb 2019 17:01:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190207170113epoutp024aa7d8f3476b5065c869616cca012776~BI5XpzCzc0530705307epoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558873; bh=tr3teq5FXrCMqB9mlSIoDLcOpZJLhsPkbwRQRaxD5pU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=rT6Tq613RTrenaAOKyAyAwZNpmlzwLktIoz0HRt1G4/dwAF60lBiNG05vf7PfsWIF 2IuLssLsU3oAKZjSaVaLS7s6d2JVmtPxFxVVBVUzqEa7sQ12I3tAdppoSqb1DulQbk MXT9qtiX/KQROFBJhRRa2z5Zm4P/p7TmuUyat1lY= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170113epcas1p2778a199eedab4669278b4aea7d717043~BI5XSF0U11808618086epcas1p2W; Thu, 7 Feb 2019 17:01:13 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 55.AE.04206.9546C5C5; Fri, 8 Feb 2019 02:01:13 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190207170112epcas1p31ed740ef43d8a3eb71ca7245fba1bc3d~BI5W66pmw2640626406epcas1p3a; Thu, 7 Feb 2019 17:01:12 +0000 (GMT) X-AuditID: b6c32a39-d7dff7000000106e-5e-5c5c6459dbe3 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id FD.C8.04015.8546C5C5; Fri, 8 Feb 2019 02:01:12 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:12 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:16 +0100 Message-id: <20190207170028.720-9-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7bCmvm5kSkyMwZm9bBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MD83N7AUfBCt+dcxjbmD8yNfFyMkh IWAi8XtGI2MXIxeHkMAORok5J9eyQTjfGSXOXfrAAlO18dJKJojEbkaJS43vWCCcX4wSV6cu ZwapYhMwlOg92scIYosIiEncntPJDFLELNDCJDFn7lKwImGBEImuyUfBxrIIqEpMfLyCFcTm FbCUuHawlw1inbzE+d517CA2p4CVxK39O1ggagQlfky+B2YzA9UcvPIc7AoJgQNsEo2v9zJB NLtIPP3yEKiZA8iWlrh01BYiXC2xa3s3M0R9B6NEy4XtzBAJa4nDxy+yQgzlk3j3tYcVopdX oqNNCKLEA+jmFnaIj3sZJSY97mKcwCg1C8lNs5DctICRaRWjWGpBcW56arFhgalecWJucWle ul5yfu4mRnCca1nuYDx2zucQowAHoxIP7wXtmBgh1sSy4srcQ4wSHMxKIryyCUAh3pTEyqrU ovz4otKc1OJDjNIcLErivOsdnGOEBNITS1KzU1MLUotgskwcnFINjGGu0qtfzCsvMbZo3Wz3 7QLvLK1LMz4VCKgHaTXn61Uu+Wj1JUHg1bmY119zI9ROu9o9d6qTENjacu2Un/GOkPmFc6on Bt5S13y30aLL7fIeY9ZLLbY++y8sYVSxzDrPPK3p6RvRHA3NN4wTX+2o+Xa1skkvcdWnXYdy td6ztWhXaTx/aJDlqsRSnJFoqMVcVJwIADETvU3vAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd2IlJgYg52XNCyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZH5qb2Qs+CFb86pjH3MD4ka+LkZND QsBEYuOllUxdjFwcQgI7GSUWXX7IBpIQEvjFKDF3vh2IzSZgKNF7tI8RxBYREJO4PaeTGaSB WaCJSWLX7YvsIAlhgRCJrslHWUBsFgFViYmPV7CC2LwClhLXDvayQWyTlzjfuw6snlPASuLW /h0sEMssJT5MaIKqF5T4MfkeWJwZqP7glecsExj5ZiFJzUKSWsDItIpRMrWgODc9t9iowDAv tVyvODG3uDQvXS85P3cTIzCItx3W6tvBeH9J/CFGAQ5GJR7eC9oxMUKsiWXFlbmHGCU4mJVE eGUTgEK8KYmVValF+fFFpTmpxYcYpTlYlMR5b+cdixQSSE8sSc1OTS1ILYLJMnFwSjUwSkp0 5Qsuv527OuZrqXXK1FdPe18f3zt3D8/5NW7LcjY/tdGw8PiTf15iv9SqmOQirisJ+k/Wvdu1 b9pCPY+jeor756+8LNAjnz/nXY/TqoXJWXELdqYkLmq4tKSkYdmsNUdSo7ZtcLGqXet3TvoJ g9PiR+yRTZynDYtEMmy2/usKWCnZuuftDiWW4oxEQy3mouJEAE/8LoteAgAA X-CMS-MailID: 20190207170112epcas1p31ed740ef43d8a3eb71ca7245fba1bc3d CMS-TYPE: 101P X-CMS-RootMailID: 20190207170112epcas1p31ed740ef43d8a3eb71ca7245fba1bc3d References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 08/22] ASoC: samsung: i2s: Add widgets and routes for DPCM support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds DAPM widgets required to model the internal mixer of the I2S controller merging audio streams from the primary and from the secondary PCM interface. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 978614673ffb..b435e6226ec2 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1116,8 +1116,31 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = { .delay = i2s_delay, }; +static const struct snd_soc_dapm_widget samsung_i2s_widgets[] = { + /* Backend DAI */ + SND_SOC_DAPM_AIF_OUT("Mixer DAI TX", NULL, 0, SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("Mixer DAI RX", NULL, 0, SND_SOC_NOPM, 0, 0), + + /* Playback Mixer */ + SND_SOC_DAPM_MIXER("Playback Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), +}; + +static const struct snd_soc_dapm_route samsung_i2s_dapm_routes[] = { + { "Playback Mixer", NULL, "Primary" }, + { "Playback Mixer", NULL, "Secondary" }, + + { "Mixer DAI TX", NULL, "Playback Mixer" }, + { "Playback Mixer", NULL, "Mixer DAI RX" }, +}; + static const struct snd_soc_component_driver samsung_i2s_component = { - .name = "samsung-i2s", + .name = "samsung-i2s", + + .dapm_widgets = samsung_i2s_widgets, + .num_dapm_widgets = ARRAY_SIZE(samsung_i2s_widgets), + + .dapm_routes = samsung_i2s_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(samsung_i2s_dapm_routes), }; #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \ @@ -1129,6 +1152,7 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, int num_dais) { static const char *dai_names[] = { "samsung-i2s", "samsung-i2s-sec" }; + static const char *stream_names[] = { "Primary", "Secondary" }; struct snd_soc_dai_driver *dai_drv; struct i2s_dai *dai; int i; @@ -1158,6 +1182,7 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, dai_drv->playback.channels_max = 2; dai_drv->playback.rates = i2s_dai_data->pcm_rates; dai_drv->playback.formats = SAMSUNG_I2S_FMTS; + dai_drv->playback.stream_name = stream_names[i]; dai_drv->id = i + 1; dai_drv->name = dai_names[i]; From patchwork Thu Feb 7 17:00:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 224AA6C2 for ; Thu, 7 Feb 2019 18:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 141842E4CD for ; Thu, 7 Feb 2019 18:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08A7A2E4CE; Thu, 7 Feb 2019 18:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8DD72E4CB for ; Thu, 7 Feb 2019 18:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5F195267A31; Thu, 7 Feb 2019 18:01:32 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E9A78267A49; Thu, 7 Feb 2019 18:01:28 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id C80FA267A2E for ; Thu, 7 Feb 2019 18:01:20 +0100 (CET) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190207170118epoutp01ddb8aefc4505fe3b64f4314dab67c8ea~BI5cKy-0n1148911489epoutp01R; Thu, 7 Feb 2019 17:01:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190207170118epoutp01ddb8aefc4505fe3b64f4314dab67c8ea~BI5cKy-0n1148911489epoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558878; bh=GEtG85kEEkBYvjn7ahbjfWXUuidG8thlI4Py+FY2OCQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=bO7Il1f8bPzYxtx8dA3PbzVbwqZ8dsvar5iSg9Gr/qRvHMYW/0hcrAbEko3e3b0rj j6esi29V0zfwDpzXy8oUHqJi2HScw+tNMAGDX3D+o/7NbY/hAJR9/vc77Gf8ISRjSZ M7VU8tMcJakWagn4tanpaIICVgCIYDGjCnO+0y7E= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170117epcas2p3e9cef5ff7e4da52b136aa0213865e224~BI5bTkTfx2769327693epcas2p3N; Thu, 7 Feb 2019 17:01:17 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 29.B6.04093.D546C5C5; Fri, 8 Feb 2019 02:01:17 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190207170116epcas2p1e0768a74062c8af83842ddb59309850f~BI5aMGJ8t2100621006epcas2p1D; Thu, 7 Feb 2019 17:01:16 +0000 (GMT) X-AuditID: b6c32a48-173ff70000000ffd-23-5c5c645ddc56 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.B8.03689.C546C5C5; Fri, 8 Feb 2019 02:01:16 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:16 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:17 +0100 Message-id: <20190207170028.720-10-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmqW5sSkyMwZod0hZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6Mlh1bmQvWyVUc3X6SvYHxv0QXIyeH hICJxKSte9i6GLk4hAR2MEqsm76UBcL5zijxfNJuJpiq7zPWsUIkdjNKHJ+xDcr5xSixefF7 dpAqNgFDid6jfYwgtoiAmMTtOZ3MIEXMAi1MEnPmLmUGSQgLxEnMOjcHqJuDg0VAVeJpRypI mFfASuLv/KdsENvkJc73rgObyQkUv7V/BwtEjaDEj8n3wGxmoJqDV56zQNQfYZNY3SEOYbtI XN37BOpqaYlnqzYyQtjVEru2d4PdIyHQwSjRcmE7M0TCWuLw8YusEEP5JDoO/2UHuU1CgFei o00IosRD4vmfBcwQD/cCPfz/IMsERqlZSG6aheSmBYxMqxjFUguKc9NTi40KTPSKE3OLS/PS 9ZLzczcxgqNcy2MH44FzPocYBTgYlXh4L2jHxAixJpYVV+YeYpTgYFYS4ZVNAArxpiRWVqUW 5ccXleakFh9ilOZgURLnfSg9N1pIID2xJDU7NbUgtQgmy8TBKdXAWMZwgGmLYqOLmmnAV9n7 BrOvzuRnv8zmqvxa6IuW6vH+SX9sNT7IbV56MKfyzaMd7uK7w9eHvpjA43rmFM/rPJMgMWHh M8qmtu5CDHanNd67fik+NaXVZpXWsqOR7p6Pd05Z9d6pYcXMteVcbm/inP9fWHjpQ7P5ddNo fovVtQ4aP18tVtjIp8RSnJFoqMVcVJwIANcPbbbuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd2YlJgYg/1PeS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZLTu2Mhesk6s4uv0kewPjf4kuRk4O CQETie8z1rF2MXJxCAnsZJQ4cfgkO4Tzi1Fi+Yp9LCBVbAKGEr1H+xhBbBEBMYnbczqZQYqY BZqYJHbdvsgOkhAWiJP4/3oTUIKDg0VAVeJpRypImFfASuLv/KdsENvkJc73rgMr5wSK39q/ A2y+kIClxIcJTawQ9YISPybfA4szA9UfvPKcZQIj3ywkqVlIUgsYmVYxSqYWFOem5xYbFRjl pZbrFSfmFpfmpesl5+duYgQG8bbDWv07GB8viT/EKMDBqMTDe0E7JkaINbGsuDL3EKMEB7OS CK9sAlCINyWxsiq1KD++qDQntfgQozQHi5I4L3/+sUghgfTEktTs1NSC1CKYLBMHp1QDI9cy t9OHhfbUas2LWpRT3i2SNWe74a1zlvNnP3zSkRT98pb9zXiWB1GHWIJkTndvVjt4YdnKklP8 OX++uugdvr7m4ZcGy508ubZL7F0Sb735U2hTtmKFuhmD2c9SV6VW8U0xk9P9zyf8e/bk4K4/ 01ts1Z8mHUgv1fu1+9bWqD2/Lrmx1q0yFVRiKc5INNRiLipOBAB4plovXgIAAA== X-CMS-MailID: 20190207170116epcas2p1e0768a74062c8af83842ddb59309850f CMS-TYPE: 102P X-CMS-RootMailID: 20190207170116epcas2p1e0768a74062c8af83842ddb59309850f References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 09/22] ASoC: samsung: i2s: Move core clk to the driver common data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The core clock is also common for both CPU DAIs so move it to the driver's private data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index b435e6226ec2..c2c3a3286c63 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -71,8 +71,6 @@ struct i2s_dai { * 0 indicates CPU driver is free to choose any value. */ unsigned rfs, bfs; - /* I2S Controller's core clock */ - struct clk *clk; /* Clock for generating I2S signals */ struct clk *op_clk; /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */ @@ -117,6 +115,9 @@ struct samsung_i2s_priv { struct snd_soc_dai_driver *dai_drv; int num_dais; + /* The I2S controller's core clock */ + struct clk *clk; + /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; @@ -1205,6 +1206,7 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, #ifdef CONFIG_PM static int i2s_runtime_suspend(struct device *dev) { + struct samsung_i2s_priv *priv = dev_get_drvdata(dev); struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); @@ -1213,24 +1215,25 @@ static int i2s_runtime_suspend(struct device *dev) if (i2s->op_clk) clk_disable_unprepare(i2s->op_clk); - clk_disable_unprepare(i2s->clk); + clk_disable_unprepare(priv->clk); return 0; } static int i2s_runtime_resume(struct device *dev) { + struct samsung_i2s_priv *priv = dev_get_drvdata(dev); struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); int ret; - ret = clk_prepare_enable(i2s->clk); + ret = clk_prepare_enable(priv->clk); if (ret) return ret; if (i2s->op_clk) { ret = clk_prepare_enable(i2s->op_clk); if (ret) { - clk_disable_unprepare(i2s->clk); + clk_disable_unprepare(priv->clk); return ret; } } @@ -1428,13 +1431,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) regs_base = res->start; - pri_dai->clk = devm_clk_get(&pdev->dev, "iis"); - if (IS_ERR(pri_dai->clk)) { + priv->clk = devm_clk_get(&pdev->dev, "iis"); + if (IS_ERR(priv->clk)) { dev_err(&pdev->dev, "Failed to get iis clock\n"); - return PTR_ERR(pri_dai->clk); + return PTR_ERR(priv->clk); } - ret = clk_prepare_enable(pri_dai->clk); + ret = clk_prepare_enable(priv->clk); if (ret != 0) { dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); return ret; @@ -1472,7 +1475,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->dma_playback.addr_width = 4; sec_dai->addr = pri_dai->addr; - sec_dai->clk = pri_dai->clk; sec_dai->quirks = quirks; sec_dai->idma_playback.addr = idma_addr; sec_dai->pri_dai = pri_dai; @@ -1519,7 +1521,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) err_disable_pm: pm_runtime_disable(&pdev->dev); err_disable_clk: - clk_disable_unprepare(pri_dai->clk); + clk_disable_unprepare(priv->clk); i2s_delete_secondary_device(priv); return ret; } @@ -1527,7 +1529,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) static int samsung_i2s_remove(struct platform_device *pdev) { struct samsung_i2s_priv *priv = dev_get_drvdata(&pdev->dev); - struct i2s_dai *pri_dai = samsung_i2s_get_pri_dai(&pdev->dev); if (!priv) return 0; @@ -1536,7 +1537,7 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); i2s_unregister_clock_provider(priv); - clk_disable_unprepare(pri_dai->clk); + clk_disable_unprepare(priv->clk); pm_runtime_put_noidle(&pdev->dev); i2s_delete_secondary_device(priv); From patchwork Thu Feb 7 17:00:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D03717FB for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2472A42B for ; Thu, 7 Feb 2019 18:56:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 413122E4D4; Thu, 7 Feb 2019 18:56:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3955C2E4CC for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D6992267A45; Thu, 7 Feb 2019 18:01:33 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DC378267A4A; Thu, 7 Feb 2019 18:01:29 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id B2AB52679E2 for ; Thu, 7 Feb 2019 18:01:23 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170122epoutp032a275b698f5659fd34cfd70816516f68~BI5fjFAy32488224882epoutp03i; Thu, 7 Feb 2019 17:01:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170122epoutp032a275b698f5659fd34cfd70816516f68~BI5fjFAy32488224882epoutp03i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558882; bh=KLf79dZGUrO4MgsvODSE+uPK6XDnEMuXGHQ2YhzjbMw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=rggbw4qQK5u9Qw+hzcifsulfot0ArWzezx78pSZnXJxOxV8rRnfu383hloIc/bT26 pfi8yK7j574LUHkkj7Wc3La1zOsdik7LG1FweSKP5LnJRK8ltKFfKT7J36Ou1KWomh 465U6mNrlU3Atc5BF7vDDpF5EHTuU/wa5w1eFb/c= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170120epcas1p2831e8888b5c6fcc3f7a110f8b330cb2e~BI5ebKfRm3249332493epcas1p2G; Thu, 7 Feb 2019 17:01:20 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 6E.D7.04069.0646C5C5; Fri, 8 Feb 2019 02:01:20 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170120epcas1p211e1582a6124d6b7d0e33db6c0017480~BI5d5-49B1779017790epcas1p2i; Thu, 7 Feb 2019 17:01:20 +0000 (GMT) X-AuditID: b6c32a37-971ff70000000fe5-40-5c5c6460a331 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CE.C8.04015.0646C5C5; Fri, 8 Feb 2019 02:01:20 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:20 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:18 +0100 Message-id: <20190207170028.720-11-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7bCmrm5CSkyMwa77+hZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MnR++sRe8MK54cPM6cwPjLY0uRk4O CQETidsPpzF1MXJxCAnsYJS4vGkGO4TznVFiyfd37DBV2zdegkrsZpRo+bOYBcL5xShx99Iq NpAqNgFDid6jfYwgtoiAmMTtOZ3MIEXMAi1MEnPmLmUGSQgLxEjMW36DCcRmEVCVaL+wmxXE 5hWwkjiwcBUTxDp5ifO968BWcwLFb+3fwQJRIyjxY/I9MJsZqObgledgV0gIHGCT+ND1hxGi 2UXi45bXQMs4gGxpiUtHbSHC1RK7tnczQ9R3AL1wYTszRMJa4vDxi6wQQ/kk3n3tYYXo5ZXo aBOCKPGQmHq2HerjXkaJTV8+skxglJqF5KZZSG5awMi0ilEstaA4Nz212LDAWK84Mbe4NC9d Lzk/dxMjOM61zHcwbjjnc4hRgINRiYdXQy8mRog1say4MvcQowQHs5IIr2wCUIg3JbGyKrUo P76oNCe1+BCjNAeLkjjvegfnGCGB9MSS1OzU1ILUIpgsEwenVANjZvuKvv91PsXO3tserVFQ 4Zmt7Dn/J59q5O/+rh0fTOIfShq+nxgT2p/ttd92SvPVW0/W5hz1sGe77xTP6S+ZJ7/L/q+r fVNi0bO6C2fjV7dN9dbgndQ7/+6lOwdvvlDz2f3H+YfStZUHGZ+zyU2WUgwuzpwt8TXcb9G+ kAlevPxZ11KWrk1QYinOSDTUYi4qTgQA0EclnO8CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd2ElJgYgz23+C2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZOz98Yy94YVzx4OZ15gbGWxpdjJwc EgImEts3XmLvYuTiEBLYySgx8+V/RpCEkMAvRomj2+pBbDYBQ4neo31gcREBMYnbczqZQRqY BZqYJHbdvsgOkhAWiJGYt/wGE4jNIqAq0X5hNyuIzStgJXFg4SomiG3yEud714HVcwLFb+3f wQKxzFLiw4QmqHpBiR+T74HFmYHqD155zjKBkW8WktQsJKkFjEyrGCVTC4pz03OLjQoM81LL 9YoTc4tL89L1kvNzNzECg3jbYa2+HYz3l8QfYhTgYFTi4b2gHRMjxJpYVlyZe4hRgoNZSYRX NgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPd23rFIIYH0xJLU7NTUgtQimCwTB6dUA+NGs7vb dp5Uiz8mLnJASbeX01+f3edmd/czLeU1F5sKHB4duryw6/1ML7c4TeX+HfrTFq/tUE7zmn/7 dXvr3YkhSYbss7Xf3TX6G/rkyMniK0GTpjO9ct4Xv1l3/qrQ/Za6M/rfvumTDY92jOpM2OVu 6cB6bp5Lza7ilQ763DemHS18/Ljtt4YSS3FGoqEWc1FxIgAli4MWXgIAAA== X-CMS-MailID: 20190207170120epcas1p211e1582a6124d6b7d0e33db6c0017480 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170120epcas1p211e1582a6124d6b7d0e33db6c0017480 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 10/22] ASoC: samsung: i2s: Move opclk data to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The clock for generating I2S signals is also common for both CPU DAIs so move it to the driver's common data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 70 +++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index c2c3a3286c63..b7b28813645a 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -62,8 +62,6 @@ struct i2s_dai { struct platform_device *pdev; /* Memory mapped SFR region */ void __iomem *addr; - /* Rate of RCLK source clock */ - unsigned long rclk_srcrate; /* Frame Clock */ unsigned frmclk; /* @@ -71,8 +69,6 @@ struct i2s_dai { * 0 indicates CPU driver is free to choose any value. */ unsigned rfs, bfs; - /* Clock for generating I2S signals */ - struct clk *op_clk; /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */ struct i2s_dai *pri_dai; /* Pointer to the Secondary_Fifo if it has one, NULL otherwise */ @@ -118,6 +114,12 @@ struct samsung_i2s_priv { /* The I2S controller's core clock */ struct clk *clk; + /* Clock for generating I2S signals */ + struct clk *op_clk; + + /* Rate of RCLK source clock */ + unsigned long rclk_srcrate; + /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; @@ -496,9 +498,10 @@ static inline void i2s_fifo(struct i2s_dai *i2s, u32 flush) writel(readl(fic) & ~flush, fic); } -static int i2s_set_sysclk(struct snd_soc_dai *dai, - int clk_id, unsigned int rfs, int dir) +static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, + int dir) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs; @@ -554,44 +557,39 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, clk_id = 1; if (!any_active(i2s)) { - if (i2s->op_clk && !IS_ERR(i2s->op_clk)) { + if (priv->op_clk && !IS_ERR(priv->op_clk)) { if ((clk_id && !(mod & rsrc_mask)) || (!clk_id && (mod & rsrc_mask))) { - clk_disable_unprepare(i2s->op_clk); - clk_put(i2s->op_clk); + clk_disable_unprepare(priv->op_clk); + clk_put(priv->op_clk); } else { - i2s->rclk_srcrate = - clk_get_rate(i2s->op_clk); + priv->rclk_srcrate = + clk_get_rate(priv->op_clk); goto done; } } if (clk_id) - i2s->op_clk = clk_get(&i2s->pdev->dev, + priv->op_clk = clk_get(&i2s->pdev->dev, "i2s_opclk1"); else - i2s->op_clk = clk_get(&i2s->pdev->dev, + priv->op_clk = clk_get(&i2s->pdev->dev, "i2s_opclk0"); - if (WARN_ON(IS_ERR(i2s->op_clk))) { - ret = PTR_ERR(i2s->op_clk); - i2s->op_clk = NULL; + if (WARN_ON(IS_ERR(priv->op_clk))) { + ret = PTR_ERR(priv->op_clk); + priv->op_clk = NULL; goto err; } - ret = clk_prepare_enable(i2s->op_clk); + ret = clk_prepare_enable(priv->op_clk); if (ret) { - clk_put(i2s->op_clk); - i2s->op_clk = NULL; + clk_put(priv->op_clk); + priv->op_clk = NULL; goto err; } - i2s->rclk_srcrate = clk_get_rate(i2s->op_clk); + priv->rclk_srcrate = clk_get_rate(priv->op_clk); - /* Over-ride the other's */ - if (other) { - other->op_clk = i2s->op_clk; - other->rclk_srcrate = i2s->rclk_srcrate; - } } else if ((!clk_id && (mod & rsrc_mask)) || (clk_id && !(mod & rsrc_mask))) { dev_err(&i2s->pdev->dev, @@ -600,8 +598,6 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, goto err; } else { /* Call can't be on the active DAI */ - i2s->op_clk = other->op_clk; - i2s->rclk_srcrate = other->rclk_srcrate; goto done; } @@ -689,7 +685,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any * clock configuration assigned in DT is not overwritten. */ - if (i2s->rclk_srcrate == 0 && priv->clk_data.clks == NULL) + if (priv->rclk_srcrate == 0 && priv->clk_data.clks == NULL) i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 0, SND_SOC_CLOCK_IN); break; @@ -814,7 +810,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, rclksrc = priv->clk_table[CLK_I2S_RCLK_SRC]; if (rclksrc && !IS_ERR(rclksrc)) - i2s->rclk_srcrate = clk_get_rate(rclksrc); + priv->rclk_srcrate = clk_get_rate(rclksrc); return 0; } @@ -872,6 +868,7 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, static int config_setup(struct i2s_dai *i2s) { + struct samsung_i2s_priv *priv = i2s->priv; struct i2s_dai *other = get_other_dai(i2s); unsigned rfs, bfs, blc; u32 psr; @@ -920,11 +917,11 @@ static int config_setup(struct i2s_dai *i2s) return 0; if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { - psr = i2s->rclk_srcrate / i2s->frmclk / rfs; + psr = priv->rclk_srcrate / i2s->frmclk / rfs; writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR); dev_dbg(&i2s->pdev->dev, "RCLK_SRC=%luHz PSR=%u, RCLK=%dfs, BCLK=%dfs\n", - i2s->rclk_srcrate, psr, rfs, bfs); + priv->rclk_srcrate, psr, rfs, bfs); } return 0; @@ -1067,7 +1064,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) /* Reset any constraint on RFS and BFS */ i2s->rfs = 0; i2s->bfs = 0; - i2s->rclk_srcrate = 0; spin_lock_irqsave(i2s->lock, flags); i2s_txctrl(i2s, 0); @@ -1213,8 +1209,8 @@ static int i2s_runtime_suspend(struct device *dev) i2s->suspend_i2scon = readl(i2s->addr + I2SCON); i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR); - if (i2s->op_clk) - clk_disable_unprepare(i2s->op_clk); + if (priv->op_clk) + clk_disable_unprepare(priv->op_clk); clk_disable_unprepare(priv->clk); return 0; @@ -1230,8 +1226,8 @@ static int i2s_runtime_resume(struct device *dev) if (ret) return ret; - if (i2s->op_clk) { - ret = clk_prepare_enable(i2s->op_clk); + if (priv->op_clk) { + ret = clk_prepare_enable(priv->op_clk); if (ret) { clk_disable_unprepare(priv->clk); return ret; @@ -1514,7 +1510,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (ret < 0) goto err_disable_pm; - pri_dai->op_clk = clk_get_parent(priv->clk_table[CLK_I2S_RCLK_SRC]); + priv->op_clk = clk_get_parent(priv->clk_table[CLK_I2S_RCLK_SRC]); return 0; From patchwork Thu Feb 7 17:00:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5336E17FB for ; Thu, 7 Feb 2019 18:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F9432E4C5 for ; Thu, 7 Feb 2019 18:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 333642A42B; Thu, 7 Feb 2019 18:56:25 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39BC82E4CF for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D4C83267A66; Thu, 7 Feb 2019 18:01:37 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F108A267A50; Thu, 7 Feb 2019 18:01:32 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id C87A7267A29 for ; Thu, 7 Feb 2019 18:01:26 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190207170125epoutp022c46b5860264d792d358be09dfcd0277~BI5ikhsU10594605946epoutp02D; Thu, 7 Feb 2019 17:01:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190207170125epoutp022c46b5860264d792d358be09dfcd0277~BI5ikhsU10594605946epoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558885; bh=fCsdwjdNwG9u/naWrmAr0rLFX67hfSlTmvz4bZJA2H0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=OXGanKvtEcKYtM1vetFWB8Lcz4Z4Ao8zZOhZCND1gQN19kOY/SdVoDpDp3WmfdOl1 pj/dggusxQJ/7hGYN+Up2OliZll86TBbtdV5Nkq7Ey3vrX8Wo15ZLBnEUcpjS/aDac LsNeueKa2A0aXmZtjKzqin69SAfCarcX2wNT0CnA= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170124epcas1p2c6d3458a4383f543aa3bedde9c51f3f9~BI5ht8YOd3249332493epcas1p2I; Thu, 7 Feb 2019 17:01:24 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 74.B3.04074.4646C5C5; Fri, 8 Feb 2019 02:01:24 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170123epcas1p2fae464ba7f102d841548c5a523cc6660~BI5hQr89z1282112821epcas1p2_; Thu, 7 Feb 2019 17:01:23 +0000 (GMT) X-AuditID: b6c32a35-27fff70000000fea-6c-5c5c6464881e Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7F.C8.04015.3646C5C5; Fri, 8 Feb 2019 02:01:23 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:23 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:19 +0100 Message-id: <20190207170028.720-12-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmvm5KSkyMQd9ZQYsrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfG+3c3WAquCFacPdnE3MB4g6+LkYND QsBEYuL+3C5GLg4hgR2MEr/vvWSHcL4zSkxY/IS5i5ETrOjFhFY2iMRuRomHja1MEM4vRonJ dx8ygVSxCRhK9B7tYwSxRQTEJG7P6WQGKWIWaGGSmDN3KdgoYYFEieNX14HZLAKqEluXHGEH sXkFrCSuXNjKBLFOXuJ87zqwOCdQ/Nb+HSwQNYISPybfA7OZgWoOXnnOArJAQuAAm8SGMx2M EM0uEns3n2CGeE5a4tJRW4hwtcSu7d3MEPUdjBItF7ZD/WYtcfj4RVaIoXwS7772sEL08kp0 tAlBlHhILL/znBXi415Gib8PutknMErNQnLTLCQ3LWBkWsUollpQnJueWmxYYKhXnJhbXJqX rpecn7uJERzlWqY7GKec8znEKMDBqMTDq6EXEyPEmlhWXJl7iFGCg1lJhFc2ASjEm5JYWZVa lB9fVJqTWnyIUZqDRUmcd72Dc4yQQHpiSWp2ampBahFMlomDU6qB0WoBX+jTw5d/nd6kZMya 5Gwky3Jr2RO5lGerp9xZeOdMgnl3+Cm3PXeNHjv1rAm4P/s+T3/k1ftfZx1vqdqnl+x7Z++L tKITK5YZ7ZxTL9GtnV/j+C/yYiKjx8WKsvkTHTrWvdqudTj3EfdH/dzjbJ/3fG5P1bGfOUPv v4K6xFb3AunuQ13ndyqxFGckGmoxFxUnAgD/xWyf7gIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd3klJgYg1uzDC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZ79/dYCm4Ilhx9mQTcwPjDb4uRk4O CQETiRcTWtm6GLk4hAR2MkqcXr4IyvnFKLHu4lkWkCo2AUOJ3qN9jCC2iICYxO05ncwgRcwC TUwSu25fZAdJCAskShy/uo4ZxGYRUJXYuuQIWJxXwEriyoWtTBDr5CXO964Di3MCxW/t3wG2 QEjAUuLDhCZWiHpBiR+T74HFmYHqD155zjKBkW8WktQsJKkFjEyrGCVTC4pz03OLjQoM81LL 9YoTc4tL89L1kvNzNzECw3jbYa2+HYz3l8QfYhTgYFTi4b2gHRMjxJpYVlyZe4hRgoNZSYRX NgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPd23rFIIYH0xJLU7NTUgtQimCwTB6dUA2P1Va/Z Ci+8JQ7JXWnN+Pnyn9ElQTPrdxs3Gyy9fXZ+wfvHpiUtfFzdD6UjmE8t/23eb3Rl1vS58Vf2 +RueeS4ozPnobvOhn+cq15l7a2olKd3UUHrlLcUfXKw9q/lU1Y6W9U8a+v+znekJq7HUn3hn stnxn80TRFz9uQ8J7Sw7nThby9eBoUiJpTgj0VCLuag4EQA/uj/yXwIAAA== X-CMS-MailID: 20190207170123epcas1p2fae464ba7f102d841548c5a523cc6660 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170123epcas1p2fae464ba7f102d841548c5a523cc6660 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 11/22] ASoC: samsung: i2s: Move registers cache to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need to keep the PM suspend/resume register cache separate for each DAI as those registers are common, move related i2s_dai data structure to the driver's common data structure. This will allow us to simplify the code a little eventually and to make it easier to follow. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index b7b28813645a..b0913cc488ab 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -86,9 +86,6 @@ struct i2s_dai { struct snd_dmaengine_dai_dma_data idma_playback; dma_filter_fn filter; u32 quirks; - u32 suspend_i2smod; - u32 suspend_i2scon; - u32 suspend_i2spsr; const struct samsung_i2s_variant_regs *variant_regs; spinlock_t *lock; @@ -120,6 +117,11 @@ struct samsung_i2s_priv { /* Rate of RCLK source clock */ unsigned long rclk_srcrate; + /* Cache of selected I2S registers for system suspend */ + u32 suspend_i2smod; + u32 suspend_i2scon; + u32 suspend_i2spsr; + /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; @@ -1205,9 +1207,9 @@ static int i2s_runtime_suspend(struct device *dev) struct samsung_i2s_priv *priv = dev_get_drvdata(dev); struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); - i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); - i2s->suspend_i2scon = readl(i2s->addr + I2SCON); - i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR); + priv->suspend_i2smod = readl(i2s->addr + I2SMOD); + priv->suspend_i2scon = readl(i2s->addr + I2SCON); + priv->suspend_i2spsr = readl(i2s->addr + I2SPSR); if (priv->op_clk) clk_disable_unprepare(priv->op_clk); @@ -1234,9 +1236,9 @@ static int i2s_runtime_resume(struct device *dev) } } - writel(i2s->suspend_i2scon, i2s->addr + I2SCON); - writel(i2s->suspend_i2smod, i2s->addr + I2SMOD); - writel(i2s->suspend_i2spsr, i2s->addr + I2SPSR); + writel(priv->suspend_i2scon, i2s->addr + I2SCON); + writel(priv->suspend_i2smod, i2s->addr + I2SMOD); + writel(priv->suspend_i2spsr, i2s->addr + I2SPSR); return 0; } From patchwork Thu Feb 7 17:00:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5410517FB for ; Thu, 7 Feb 2019 18:56:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 436572A42B for ; Thu, 7 Feb 2019 18:56:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37A3E2E4CD; Thu, 7 Feb 2019 18:56:24 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67CD92E4C7 for ; Thu, 7 Feb 2019 18:56:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A9AC4267A2F; Thu, 7 Feb 2019 18:01:41 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 31715267A6F; Thu, 7 Feb 2019 18:01:39 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id 9797C267A4C for ; Thu, 7 Feb 2019 18:01:30 +0100 (CET) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190207170128epoutp017c6c713e8bbccb55ffc493cb864dfa0e~BI5lqhl9K1148911489epoutp01T; Thu, 7 Feb 2019 17:01:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190207170128epoutp017c6c713e8bbccb55ffc493cb864dfa0e~BI5lqhl9K1148911489epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558888; bh=2PEDIGTabNdAGYOHgvcaBkJXFdPOPcw4GeyaZDuLGDM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=uVBNbXaCJ4bgN4njJiv4iaOVEKXAyUtFm8j0iGpRVX1KhZECzUP0JEYN+KVH3NMUh VVnh19W4esTlDQFFURNSWXrqVM5zUhYJsbGoJ3KErafpLl7ir/aihpO7Oda4gLM4If vukxCxHRKhA9JjLjFZEO/5mEsXkPvKxqq+D7Agws= Received: from epsmges2p2.samsung.com (unknown [182.195.42.70]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190207170128epcas2p474596f73003ff60ecb09561ca122a94a~BI5lJrpWi2370123701epcas2p48; Thu, 7 Feb 2019 17:01:28 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 08.9B.04136.7646C5C5; Fri, 8 Feb 2019 02:01:28 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170127epcas2p31da340c3f63e75e7bcb5c9c864a42173~BI5knwNBu2769227692epcas2p3b; Thu, 7 Feb 2019 17:01:27 +0000 (GMT) X-AuditID: b6c32a46-2a7ff70000001028-88-5c5c6467ac44 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4F.B8.03689.7646C5C5; Fri, 8 Feb 2019 02:01:27 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:27 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:20 +0100 Message-id: <20190207170028.720-13-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7bCmhW5GSkyMwfb3jBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MvT1vmArep1X0d3xibmC8HdzFyMkh IWAicWbjG/YuRi4OIYEdjBLbFs1hhXC+M0p0frvNClO15tF5qMRuRokN37dDtfxilJjw/isb SBWbgKFE79E+RhBbREBM4vacTmaQImaBFiaJOXOXMoMkhAViJa5tnQA2lkVAVWLKqpdgzbwC VhI7nhxmg1gnL3G+dx07iM0JFL+1fwcLRI2gxI/J98BsZqCag1ees4AskBDYwyax/OIuoAUc QI6LxJWXnhBzpCWerdrICGFXS+za3s0MUd/BKNFyYTszRMJa4vDxi6wQQ/kkOg7/ZYeYwyvR 0SYEUeIhsab3GiPEx72MEif372ScwCg1C8lNs5DctICRaRWjWGpBcW56arFRgZFecWJucWle ul5yfu4mRnCca7ntYFxyzucQowAHoxIP7wXtmBgh1sSy4srcQ4wSHMxKIryyCUAh3pTEyqrU ovz4otKc1OJDjNIcLErivA+l50YLCaQnlqRmp6YWpBbBZJk4OKUaGIVSM9P23p/p891SWy+n b9JJ3cKzE1hVgsxyTpe0ZTi3JbwtnVXhdOwQF6/H1B1rWUzmeC3S1p5+6HWzc8zjWzcK1IOZ YmepL7u5mW9tCMOjzJszszfKpXoXZ664Ojnjg9e8TPXVRwIzX1/TLE8M7Yjgnr99onnvYZZP gXOVu8Su/p4y6YH+RCWW4oxEQy3mouJEALf/sBzvAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd30lJgYg2PnxS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZe3veMBW8T6vo7/jE3MB4O7iLkZND QsBEYs2j86wgtpDATkaJthNRXYxcQPYvRomn9ycxgSTYBAwleo/2MYLYIgJiErfndDKDFDEL NDFJ7Lp9kR0kISwQK3Ft6wSwSSwCqhJTVr1kA7F5Bawkdjw5zAaxTV7ifO86sHpOoPit/TtY IDZbSnyY0MQKUS8o8WPyPbA4M1D9wSvPWSYw8s1CkpqFJLWAkWkVo2RqQXFuem6xUYFRXmq5 XnFibnFpXrpecn7uJkZgEG87rNW/g/HxkvhDjAIcjEo8vBe0Y2KEWBPLiitzDzFKcDArifDK JgCFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8/LnH4sUEkhPLEnNTk0tSC2CyTJxcEo1MJY+kt/M vaXx9uVV0yc+fvntG7N8UEP9ucPWngkJdvwRoS8/+bGsrNRjTrl8pe3chC3TPs/StWHK5133 KbNgmirb/eld3b0uBg3y+3RO7zIUMZmtc9bZ4UunXoqnwWS57jfmdkt+FgrFR1z9NPcec5JR BI8Lq148S3ORd/M7+UtMk64GXgnwU2Ipzkg01GIuKk4EAAgM3FleAgAA X-CMS-MailID: 20190207170127epcas2p31da340c3f63e75e7bcb5c9c864a42173 CMS-TYPE: 102P X-CMS-RootMailID: 20190207170127epcas2p31da340c3f63e75e7bcb5c9c864a42173 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 12/22] ASoC: samsung: i2s: Move SFR pointer to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The SFR region is common for both DAIs so move related data structure field from struct i2s_dai to the common driver data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 105 ++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index b0913cc488ab..9fae732bb620 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -60,8 +60,7 @@ struct samsung_i2s_dai_data { struct i2s_dai { /* Platform device for this DAI */ struct platform_device *pdev; - /* Memory mapped SFR region */ - void __iomem *addr; + /* Frame Clock */ unsigned frmclk; /* @@ -100,6 +99,9 @@ struct samsung_i2s_priv { struct platform_device *pdev; struct platform_device *pdev_sec; + /* Memory mapped SFR region */ + void __iomem *addr; + /* Spinlock protecting access to the device's registers */ spinlock_t spinlock; @@ -143,7 +145,9 @@ static inline bool is_secondary(struct i2s_dai *i2s) /* If operating in SoC-Slave mode */ static inline bool is_slave(struct i2s_dai *i2s) { - u32 mod = readl(i2s->addr + I2SMOD); + struct samsung_i2s_priv *priv = i2s->priv; + + u32 mod = readl(priv->addr + I2SMOD); return (mod & (1 << i2s->variant_regs->mss_off)) ? true : false; } @@ -155,7 +159,7 @@ static inline bool tx_active(struct i2s_dai *i2s) if (!i2s) return false; - active = readl(i2s->addr + I2SCON); + active = readl(i2s->priv->addr + I2SCON); if (is_secondary(i2s)) active &= CON_TXSDMA_ACTIVE; @@ -193,7 +197,7 @@ static inline bool rx_active(struct i2s_dai *i2s) if (!i2s) return false; - active = readl(i2s->addr + I2SCON) & CON_RXDMA_ACTIVE; + active = readl(i2s->priv->addr + I2SCON) & CON_RXDMA_ACTIVE; return active ? true : false; } @@ -256,8 +260,10 @@ static inline bool is_manager(struct i2s_dai *i2s) /* Read RCLK of I2S (in multiples of LRCLK) */ static inline unsigned get_rfs(struct i2s_dai *i2s) { + struct samsung_i2s_priv *priv = i2s->priv; u32 rfs; - rfs = readl(i2s->addr + I2SMOD) >> i2s->variant_regs->rfs_off; + + rfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->rfs_off; rfs &= i2s->variant_regs->rfs_mask; switch (rfs) { @@ -275,7 +281,8 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) /* Write RCLK of I2S (in multiples of LRCLK) */ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { - u32 mod = readl(i2s->addr + I2SMOD); + struct samsung_i2s_priv *priv = i2s->priv; + u32 mod = readl(priv->addr + I2SMOD); int rfs_shift = i2s->variant_regs->rfs_off; mod &= ~(i2s->variant_regs->rfs_mask << rfs_shift); @@ -307,14 +314,16 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) break; } - writel(mod, i2s->addr + I2SMOD); + writel(mod, priv->addr + I2SMOD); } /* Read Bit-Clock of I2S (in multiples of LRCLK) */ static inline unsigned get_bfs(struct i2s_dai *i2s) { + struct samsung_i2s_priv *priv = i2s->priv; u32 bfs; - bfs = readl(i2s->addr + I2SMOD) >> i2s->variant_regs->bfs_off; + + bfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->bfs_off; bfs &= i2s->variant_regs->bfs_mask; switch (bfs) { @@ -333,7 +342,8 @@ static inline unsigned get_bfs(struct i2s_dai *i2s) /* Write Bit-Clock of I2S (in multiples of LRCLK) */ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) { - u32 mod = readl(i2s->addr + I2SMOD); + struct samsung_i2s_priv *priv = i2s->priv; + u32 mod = readl(priv->addr + I2SMOD); int tdm = i2s->quirks & QUIRK_SUPPORTS_TDM; int bfs_shift = i2s->variant_regs->bfs_off; @@ -378,13 +388,13 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) return; } - writel(mod, i2s->addr + I2SMOD); + writel(mod, priv->addr + I2SMOD); } /* Sample-Size */ static inline int get_blc(struct i2s_dai *i2s) { - int blc = readl(i2s->addr + I2SMOD); + int blc = readl(i2s->priv->addr + I2SMOD); blc = (blc >> 13) & 0x3; @@ -398,7 +408,8 @@ static inline int get_blc(struct i2s_dai *i2s) /* TX Channel Control */ static void i2s_txctrl(struct i2s_dai *i2s, int on) { - void __iomem *addr = i2s->addr; + struct samsung_i2s_priv *priv = i2s->priv; + void __iomem *addr = priv->addr; int txr_off = i2s->variant_regs->txr_off; u32 con = readl(addr + I2SCON); u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off); @@ -448,7 +459,8 @@ static void i2s_txctrl(struct i2s_dai *i2s, int on) /* RX Channel Control */ static void i2s_rxctrl(struct i2s_dai *i2s, int on) { - void __iomem *addr = i2s->addr; + struct samsung_i2s_priv *priv = i2s->priv; + void __iomem *addr = priv->addr; int txr_off = i2s->variant_regs->txr_off; u32 con = readl(addr + I2SCON); u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off); @@ -485,9 +497,9 @@ static inline void i2s_fifo(struct i2s_dai *i2s, u32 flush) return; if (is_secondary(i2s)) - fic = i2s->addr + I2SFICS; + fic = i2s->priv->addr + I2SFICS; else - fic = i2s->addr + I2SFIC; + fic = i2s->priv->addr + I2SFIC; /* Flush the FIFO */ writel(readl(fic) | flush, fic); @@ -516,7 +528,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, pm_runtime_get_sync(dai->dev); spin_lock_irqsave(i2s->lock, flags); - mod = readl(i2s->addr + I2SMOD); + mod = readl(priv->addr + I2SMOD); spin_unlock_irqrestore(i2s->lock, flags); switch (clk_id) { @@ -613,9 +625,9 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, } spin_lock_irqsave(i2s->lock, flags); - mod = readl(i2s->addr + I2SMOD); + mod = readl(priv->addr + I2SMOD); mod = (mod & ~mask) | val; - writel(mod, i2s->addr + I2SMOD); + writel(mod, priv->addr + I2SMOD); spin_unlock_irqrestore(i2s->lock, flags); done: pm_runtime_put(dai->dev); @@ -698,7 +710,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) pm_runtime_get_sync(dai->dev); spin_lock_irqsave(i2s->lock, flags); - mod = readl(i2s->addr + I2SMOD); + mod = readl(priv->addr + I2SMOD); /* * Don't change the I2S mode if any controller is active on this * channel. @@ -714,7 +726,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) mod &= ~(sdf_mask | lrp_rlow | mod_slave); mod |= tmp; - writel(mod, i2s->addr + I2SMOD); + writel(mod, priv->addr + I2SMOD); spin_unlock_irqrestore(i2s->lock, flags); pm_runtime_put(dai->dev); @@ -801,9 +813,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, } spin_lock_irqsave(i2s->lock, flags); - mod = readl(i2s->addr + I2SMOD); + mod = readl(priv->addr + I2SMOD); mod = (mod & ~mask) | val; - writel(mod, i2s->addr + I2SMOD); + writel(mod, priv->addr + I2SMOD); spin_unlock_irqrestore(i2s->lock, flags); snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); @@ -837,7 +849,7 @@ static int i2s_startup(struct snd_pcm_substream *substream, i2s->mode |= DAI_MANAGER; if (!any_active(i2s) && (i2s->quirks & QUIRK_NEED_RSTCLR)) - writel(CON_RSTCLR, i2s->addr + I2SCON); + writel(CON_RSTCLR, i2s->priv->addr + I2SCON); spin_unlock_irqrestore(&lock, flags); @@ -920,7 +932,7 @@ static int config_setup(struct i2s_dai *i2s) if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { psr = priv->rclk_srcrate / i2s->frmclk / rfs; - writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR); + writel(((psr - 1) << 8) | PSR_PSREN, priv->addr + I2SPSR); dev_dbg(&i2s->pdev->dev, "RCLK_SRC=%luHz PSR=%u, RCLK=%dfs, BCLK=%dfs\n", priv->rclk_srcrate, psr, rfs, bfs); @@ -1008,8 +1020,9 @@ static int i2s_set_clkdiv(struct snd_soc_dai *dai, static snd_pcm_sframes_t i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); - u32 reg = readl(i2s->addr + I2SFIC); + u32 reg = readl(priv->addr + I2SFIC); snd_pcm_sframes_t delay; const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs; @@ -1018,7 +1031,7 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) delay = FIC_RXCOUNT(reg); else if (is_secondary(i2s)) - delay = FICS_TXCOUNT(readl(i2s->addr + I2SFICS)); + delay = FICS_TXCOUNT(readl(priv->addr + I2SFICS)); else delay = (reg >> i2s_regs->ftx0cnt_off) & 0x7f; @@ -1042,6 +1055,7 @@ static int i2s_resume(struct snd_soc_dai *dai) static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; @@ -1056,10 +1070,10 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) &i2s->dma_capture); if (i2s->quirks & QUIRK_NEED_RSTCLR) - writel(CON_RSTCLR, i2s->addr + I2SCON); + writel(CON_RSTCLR, priv->addr + I2SCON); if (i2s->quirks & QUIRK_SUPPORTS_IDMA) - idma_reg_addr_init(i2s->addr, + idma_reg_addr_init(priv->addr, i2s->sec_dai->idma_playback.addr); } @@ -1094,7 +1108,7 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) if (!is_secondary(i2s)) { if (i2s->quirks & QUIRK_NEED_RSTCLR) { spin_lock_irqsave(i2s->lock, flags); - writel(0, i2s->addr + I2SCON); + writel(0, i2s->priv->addr + I2SCON); spin_unlock_irqrestore(i2s->lock, flags); } } @@ -1205,11 +1219,10 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, static int i2s_runtime_suspend(struct device *dev) { struct samsung_i2s_priv *priv = dev_get_drvdata(dev); - struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); - priv->suspend_i2smod = readl(i2s->addr + I2SMOD); - priv->suspend_i2scon = readl(i2s->addr + I2SCON); - priv->suspend_i2spsr = readl(i2s->addr + I2SPSR); + priv->suspend_i2smod = readl(priv->addr + I2SMOD); + priv->suspend_i2scon = readl(priv->addr + I2SCON); + priv->suspend_i2spsr = readl(priv->addr + I2SPSR); if (priv->op_clk) clk_disable_unprepare(priv->op_clk); @@ -1221,7 +1234,6 @@ static int i2s_runtime_suspend(struct device *dev) static int i2s_runtime_resume(struct device *dev) { struct samsung_i2s_priv *priv = dev_get_drvdata(dev); - struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); int ret; ret = clk_prepare_enable(priv->clk); @@ -1236,9 +1248,9 @@ static int i2s_runtime_resume(struct device *dev) } } - writel(priv->suspend_i2scon, i2s->addr + I2SCON); - writel(priv->suspend_i2smod, i2s->addr + I2SMOD); - writel(priv->suspend_i2spsr, i2s->addr + I2SPSR); + writel(priv->suspend_i2scon, priv->addr + I2SCON); + writel(priv->suspend_i2smod, priv->addr + I2SMOD); + writel(priv->suspend_i2spsr, priv->addr + I2SPSR); return 0; } @@ -1296,21 +1308,21 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { /* Activate the prescaler */ - u32 val = readl(i2s->addr + I2SPSR); - writel(val | PSR_PSREN, i2s->addr + I2SPSR); + u32 val = readl(priv->addr + I2SPSR); + writel(val | PSR_PSREN, priv->addr + I2SPSR); priv->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev, i2s_clk_name[CLK_I2S_RCLK_SRC], p_names, ARRAY_SIZE(p_names), CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, - i2s->addr + I2SMOD, reg_info->rclksrc_off, + priv->addr + I2SMOD, reg_info->rclksrc_off, 1, 0, i2s->lock); priv->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev, i2s_clk_name[CLK_I2S_RCLK_PSR], i2s_clk_name[CLK_I2S_RCLK_SRC], CLK_SET_RATE_PARENT, - i2s->addr + I2SPSR, 8, 6, 0, i2s->lock); + priv->addr + I2SPSR, 8, 6, 0, i2s->lock); p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR]; priv->clk_data.clk_num = 2; @@ -1319,7 +1331,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) priv->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, i2s_clk_name[CLK_I2S_CDCLK], p_names[0], CLK_SET_RATE_PARENT, - i2s->addr + I2SMOD, reg_info->cdclkcon_off, + priv->addr + I2SMOD, reg_info->cdclkcon_off, CLK_GATE_SET_TO_DISABLE, i2s->lock); priv->clk_data.clk_num += 1; @@ -1423,9 +1435,9 @@ static int samsung_i2s_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - pri_dai->addr = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pri_dai->addr)) - return PTR_ERR(pri_dai->addr); + priv->addr = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(priv->addr)) + return PTR_ERR(priv->addr); regs_base = res->start; @@ -1472,7 +1484,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) } sec_dai->dma_playback.addr_width = 4; - sec_dai->addr = pri_dai->addr; sec_dai->quirks = quirks; sec_dai->idma_playback.addr = idma_addr; sec_dai->pri_dai = pri_dai; From patchwork Thu Feb 7 17:00:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C817D17FB for ; Thu, 7 Feb 2019 18:51:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7F842E0B0 for ; Thu, 7 Feb 2019 18:51:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC8742E0FA; Thu, 7 Feb 2019 18:51:22 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 467DF2E0EE for ; Thu, 7 Feb 2019 18:51:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1F2EE267A58; Thu, 7 Feb 2019 18:01:45 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7DF04267A65; Thu, 7 Feb 2019 18:01:42 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id E2637267A56 for ; Thu, 7 Feb 2019 18:01:34 +0100 (CET) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170133epoutp033a1aa7659459037ce77c337d107f35d9~BI5qM9f6Q2895028950epoutp031; Thu, 7 Feb 2019 17:01:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170133epoutp033a1aa7659459037ce77c337d107f35d9~BI5qM9f6Q2895028950epoutp031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558893; bh=sFgTV7wJVrbLv5ZBZQ7fcAraaJGip7s62VnsufDgPeA=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=AIQ0MiYXBNqPy5hDD8sJm7pEmdJhCvU/armXMJ8IgQ17a1tq/ka0ELLjb/sPzIS0p 1I/cWO34ZOHwh6eZokehlBNr6BNjvNdIB3UtYBuTGUP1+hOL1UZFwnmOPV9R5uvxn7 IaN1/fTMsb0D20yYgL/nr4ieHzvpG27NYoB7Z7po= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170132epcas1p2ba4912a3f694bcb1b82efd69a7de9c5c~BI5pBfH641833218332epcas1p2h; Thu, 7 Feb 2019 17:01:32 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 25.B3.04074.C646C5C5; Fri, 8 Feb 2019 02:01:32 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170130epcas1p4809b7a8dc797ced2982dc3b305a0991b~BI5n38KGO1456614566epcas1p4L; Thu, 7 Feb 2019 17:01:30 +0000 (GMT) X-AuditID: b6c32a35-297ff70000000fea-75-5c5c646cd5d9 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 20.D8.04015.A646C5C5; Fri, 8 Feb 2019 02:01:30 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:30 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:21 +0100 Message-id: <20190207170028.720-14-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7bCmgW5OSkyMwZcd7BZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6M6fcOMRZ0W1XM7OpgbGD8od/FyMkh IWAisePANtYuRi4OIYEdjBKPut6xQzjfGSV2TnvLBlf1pJUZIrGbUWLVj0dQzi9GiQUfnjCC VLEJGEr0Hu0Ds0UExCRuz+kEK2IWaGGSmDN3KTNIQlggTuJqTxcLiM0ioCpxY/ZtsBW8AlYS j88cg1onL3G+dx07iM0JFL+1fwcLRI2gxI/J98BsZqCag1ees4AskBDYwybx4tJ3VohmF4mz 16YAJTiAbGmJS0dtIcLVEru2dzND1HcwSrRc2M4MkbCWOHz8IivEUD6Jd197WCF6eSU62oQg SjwkttwAuRPk415GiY579xknMErNQnLTLCQ3LWBkWsUollpQnJueWmxYYKhXnJhbXJqXrpec n7uJERznWqY7GKec8znEKMDBqMTDq6EXEyPEmlhWXJl7iFGCg1lJhFc2ASjEm5JYWZValB9f VJqTWnyIUZqDRUmcd72Dc4yQQHpiSWp2ampBahFMlomDU6qBMVH07ZTCRSz+1ycduLi2YNOL EK15Cv8Oxr+ovuQxeQqzVtLlGTYXdgW1rdJcccla7quc9ImDOq+PXgnIeFNTK3jnm/Nsv0Lv HjMnbUbu6r1JX2f/teyrW3jj7Zr3KzjLeL/efv3kgOI97nPXshU5N2gK9bPM1Oc8J/aOb1bv 38jjV12D+VZJNiuxFGckGmoxFxUnAgBzIfCH7wIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd2slJgYgyc7rCyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZ0+8dYizotqqY2dXB2MD4Q7+LkZND QsBEYseTVuYuRi4OIYGdjBITd/xjh3B+MUo8f/CTEaSKTcBQovdoH5gtIiAmcXtOJ1gHs0AT k8Su2xfZQRLCAnESV5ffArNZBFQlbsy+zQZi8wpYSTw+c4wNYp28xPnedWA1nEDxW/t3sIDY QgKWEh8mNLFC1AtK/Jh8DyzODFR/8MpzlgmMfLOQpGYhSS1gZFrFKJlaUJybnltsVGCYl1qu V5yYW1yal66XnJ+7iREYxtsOa/XtYLy/JP4QowAHoxIP7wXtmBgh1sSy4srcQ4wSHMxKIryy CUAh3pTEyqrUovz4otKc1OJDjNIcLErivLfzjkUKCaQnlqRmp6YWpBbBZJk4OKUaGKN/Lt99 20wkSjeA8WxE9wHZ+quN1h4ftho/LUiKN9hTp9r9+NksCSmlU7O0lhv7qsi6T0n87sN2PeXX /mNsV6ZvtDiwdNrN7tCn/QtfJ23rOf7dzrVW9/zDn0Ehovkyt1jit923D3YpK1P0y7ietdy0 u/LYHFv3vN99M9xDz81nPSX3JT7BRYmlOCPRUIu5qDgRAOFUnuJfAgAA X-CMS-MailID: 20190207170130epcas1p4809b7a8dc797ced2982dc3b305a0991b CMS-TYPE: 101P X-CMS-RootMailID: 20190207170130epcas1p4809b7a8dc797ced2982dc3b305a0991b References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 13/22] ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP As we now have the 'priv' pointer in most of the places we can use priv->lock directly, dropping extra indirection in the SFR region spinlock access. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 51 +++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 9fae732bb620..c7499e25ce2b 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -87,8 +87,6 @@ struct i2s_dai { u32 quirks; const struct samsung_i2s_variant_regs *variant_regs; - spinlock_t *lock; - struct samsung_i2s_priv *priv; }; @@ -103,7 +101,7 @@ struct samsung_i2s_priv { void __iomem *addr; /* Spinlock protecting access to the device's registers */ - spinlock_t spinlock; + spinlock_t lock; /* CPU DAIs and their corresponding drivers */ struct i2s_dai *dai; @@ -527,9 +525,9 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, pm_runtime_get_sync(dai->dev); - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); mod = readl(priv->addr + I2SMOD); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); switch (clk_id) { case SAMSUNG_I2S_OPCLK: @@ -624,11 +622,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, goto err; } - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); mod = readl(priv->addr + I2SMOD); mod = (mod & ~mask) | val; writel(mod, priv->addr + I2SMOD); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); done: pm_runtime_put(dai->dev); @@ -709,7 +707,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) } pm_runtime_get_sync(dai->dev); - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); mod = readl(priv->addr + I2SMOD); /* * Don't change the I2S mode if any controller is active on this @@ -717,7 +715,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) */ if (any_active(i2s) && ((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp)) { - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); pm_runtime_put(dai->dev); dev_err(&i2s->pdev->dev, "%s:%d Other DAI busy\n", __func__, __LINE__); @@ -727,7 +725,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) mod &= ~(sdf_mask | lrp_rlow | mod_slave); mod |= tmp; writel(mod, priv->addr + I2SMOD); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); pm_runtime_put(dai->dev); return 0; @@ -812,11 +810,11 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); mod = readl(priv->addr + I2SMOD); mod = (mod & ~mask) | val; writel(mod, priv->addr + I2SMOD); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); @@ -944,6 +942,7 @@ static int config_setup(struct i2s_dai *i2s) static int i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); struct snd_soc_pcm_runtime *rtd = substream->private_data; struct i2s_dai *i2s = to_info(rtd->cpu_dai); @@ -954,10 +953,10 @@ static int i2s_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: pm_runtime_get_sync(dai->dev); - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); if (config_setup(i2s)) { - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); return -EINVAL; } @@ -966,12 +965,12 @@ static int i2s_trigger(struct snd_pcm_substream *substream, else i2s_txctrl(i2s, 1); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); if (capture) { i2s_rxctrl(i2s, 0); @@ -981,7 +980,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream, i2s_fifo(i2s, FIC_TXFLUSH); } - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); pm_runtime_put(dai->dev); break; } @@ -1081,13 +1080,13 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) i2s->rfs = 0; i2s->bfs = 0; - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); i2s_txctrl(i2s, 0); i2s_rxctrl(i2s, 0); i2s_fifo(i2s, FIC_TXFLUSH); i2s_fifo(other, FIC_TXFLUSH); i2s_fifo(i2s, FIC_RXFLUSH); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); /* Gate CDCLK by default */ if (!is_opened(other)) @@ -1107,9 +1106,9 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) if (!is_secondary(i2s)) { if (i2s->quirks & QUIRK_NEED_RSTCLR) { - spin_lock_irqsave(i2s->lock, flags); + spin_lock_irqsave(&priv->lock, flags); writel(0, i2s->priv->addr + I2SCON); - spin_unlock_irqrestore(i2s->lock, flags); + spin_unlock_irqrestore(&priv->lock, flags); } } @@ -1316,13 +1315,13 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) ARRAY_SIZE(p_names), CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, priv->addr + I2SMOD, reg_info->rclksrc_off, - 1, 0, i2s->lock); + 1, 0, &priv->lock); priv->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev, i2s_clk_name[CLK_I2S_RCLK_PSR], i2s_clk_name[CLK_I2S_RCLK_SRC], CLK_SET_RATE_PARENT, - priv->addr + I2SPSR, 8, 6, 0, i2s->lock); + priv->addr + I2SPSR, 8, 6, 0, &priv->lock); p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR]; priv->clk_data.clk_num = 2; @@ -1332,7 +1331,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) i2s_clk_name[CLK_I2S_CDCLK], p_names[0], CLK_SET_RATE_PARENT, priv->addr + I2SMOD, reg_info->cdclkcon_off, - CLK_GATE_SET_TO_DISABLE, i2s->lock); + CLK_GATE_SET_TO_DISABLE, &priv->lock); priv->clk_data.clk_num += 1; priv->clk_data.clks = priv->clk_table; @@ -1410,8 +1409,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai = &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1]; - spin_lock_init(&priv->spinlock); - pri_dai->lock = &priv->spinlock; + spin_lock_init(&priv->lock); if (!np) { if (i2s_pdata == NULL) { @@ -1473,7 +1471,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (quirks & QUIRK_SEC_DAI) { sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1]; - sec_dai->lock = &priv->spinlock; sec_dai->variant_regs = pri_dai->variant_regs; sec_dai->dma_playback.addr = regs_base + I2STXDS; sec_dai->dma_playback.chan_name = "tx-sec"; From patchwork Thu Feb 7 17:00:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFC9C1823 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDE2A2E0D3 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D297A2E0BD; Thu, 7 Feb 2019 17:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3E862E0D8 for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DA45A267A8A; Thu, 7 Feb 2019 18:01:48 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7B62E267A41; Thu, 7 Feb 2019 18:01:46 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 36FF6267A29 for ; Thu, 7 Feb 2019 18:01:37 +0100 (CET) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170136epoutp04ba4ca1fad605a97f12946ecaaf90e9a5~BI5tJ7zkm0210902109epoutp04c; Thu, 7 Feb 2019 17:01:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170136epoutp04ba4ca1fad605a97f12946ecaaf90e9a5~BI5tJ7zkm0210902109epoutp04c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558896; bh=v0QYoUYQ1jkCiuyAyrRfcxHIWZM8fqjtDbainT6kzvQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=kTFhFXY9/k2lfwcQmRs4KpTrhR6TygT+KNnucZcOh/PU14kcLpgYMmUm1KNPgnW+o zEIC6LKCHDDTcPdOAN3XhuCvtaKV/9XEQzSV2dQbD4gIH1aErxoaF9XW3OQhY6yQn5 xY3P4THovtRiyAvRmuFR9bYcIQeNhcZ0sNrfmNpc= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190207170135epcas2p21e393f999ac0480e6f0a957825b89c57~BI5sCGNLQ1763817638epcas2p2U; Thu, 7 Feb 2019 17:01:35 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 70.07.04134.F646C5C5; Fri, 8 Feb 2019 02:01:35 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190207170134epcas2p1a22a5c2f680f33fe562fa22f3aec9e6a~BI5rO30nu2511325113epcas2p1L; Thu, 7 Feb 2019 17:01:34 +0000 (GMT) X-AuditID: b6c32a47-8c3ff70000001026-76-5c5c646fe3b6 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id FF.B8.03689.E646C5C5; Fri, 8 Feb 2019 02:01:34 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:34 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:22 +0100 Message-id: <20190207170028.720-15-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7bCmmW5+SkyMwcFFEhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6Mm8/amAt2mFW8OvSBtYHxmU4XIyeH hICJxJw1P9i7GLk4hAR2MEpc3HGfDcL5zigxcedMIIcDrOrdaUOI+G5Gie+fv0B1/GKUODNx LiPIKDYBQ4neo31gtoiAmMTtOZ3MIEXMAi1MEnPmLmUGSQgLJEqsX/gNrIhFQFVi4qHZTCA2 r4CVxPMNyxkhbpKXON+7jh3E5gSK39q/gwWiRlDix+R7YDYzUM3BK89ZQBZICBxhk7jYsI8F otlFYmnbHCYIW1ri2aqNUEOrJXZt72aGaOhglGi5sJ0ZImEtcfj4RVaIqXwSHYf/skP8zCvR 0SYEUeIhseD7UxaIl3sZJZZ0f2SfwCg1C8lRs5ActYCRaRWjWGpBcW56arFRgbFecWJucWle ul5yfu4mRnCca7nvYNx2zucQowAHoxIP7wXtmBgh1sSy4srcQ4wSHMxKIryyCUAh3pTEyqrU ovz4otKc1OJDjNIcLErivA+l50YLCaQnlqRmp6YWpBbBZJk4OKUaGCfYPvB/vDDztrhB18zE //rRqznqplmelZ9wLM3UdqHjhZVrtk5SWML792KH2fmXdcFTJ/K96Ip4KffV41xowkax3LX2 729zbn124JWMGAcz57crdlcPFu/9FteQf9n5smr6lUcZNZf0AxVXOyelHjN0u7Hydc/qgszr mkc5uQLuPjwxe4mFQ4cSS3FGoqEWc1FxIgBkyUtf7wIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd28lJgYg7ZJChZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6Mm8/amAt2mFW8OvSBtYHxmU4XIweH hICJxLvThl2MXBxCAjsZJTaf+84G4fxilOi98Y25i5GTg03AUKL3aB8jiC0iICZxe04nM0gR s0ATk8Su2xfZQRLCAokS6xd+AytiEVCVmHhoNhOIzStgJfF8w3KwuISAvMT53nVg9ZxA8Vv7 d7CA2EIClhIfJjSxQtQLSvyYfA8szgxUf/DKc5YJjHyzkKRmIUktYGRaxSiZWlCcm55bbFRg lJdarlecmFtcmpeul5yfu4kRGMTbDmv172B8vCT+EKMAB6MSD+8F7ZgYIdbEsuLK3EOMEhzM SiK8sglAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rz8+ccihQTSE0tSs1NTC1KLYLJMHJxSDYy8 ZZuT/TK/h5U8bnsSXdBzL8Q1bU2ta9Q6XXnjA7KC9y1ZpvN/jfnatYDvOjvH9psHTl65/J91 SryV4XSfvh7B+yJlzO8m8/m4C1yfx57+IWSOztKPymvULKaxes2c2ygeUVo8d9W3KapnpBr3 K1UtLlgcYp0ozvbI9b9PnuouoUXq3RoHnyqxFGckGmoxFxUnAgC150j4XgIAAA== X-CMS-MailID: 20190207170134epcas2p1a22a5c2f680f33fe562fa22f3aec9e6a CMS-TYPE: 102P X-CMS-RootMailID: 20190207170134epcas2p1a22a5c2f680f33fe562fa22f3aec9e6a References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 14/22] ASoC: samsung: i2s: Move IP variant data to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The IP variant data is another thing common for both DAIs, move it to the driver's common data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index c7499e25ce2b..6ea0f0050fc8 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -85,7 +85,6 @@ struct i2s_dai { struct snd_dmaengine_dai_dma_data idma_playback; dma_filter_fn filter; u32 quirks; - const struct samsung_i2s_variant_regs *variant_regs; struct samsung_i2s_priv *priv; }; @@ -122,6 +121,8 @@ struct samsung_i2s_priv { u32 suspend_i2scon; u32 suspend_i2spsr; + const struct samsung_i2s_variant_regs *variant_regs; + /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; @@ -146,7 +147,7 @@ static inline bool is_slave(struct i2s_dai *i2s) struct samsung_i2s_priv *priv = i2s->priv; u32 mod = readl(priv->addr + I2SMOD); - return (mod & (1 << i2s->variant_regs->mss_off)) ? true : false; + return (mod & (1 << priv->variant_regs->mss_off)) ? true : false; } /* If this interface of the controller is transmitting data */ @@ -261,8 +262,8 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) struct samsung_i2s_priv *priv = i2s->priv; u32 rfs; - rfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->rfs_off; - rfs &= i2s->variant_regs->rfs_mask; + rfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->rfs_off; + rfs &= priv->variant_regs->rfs_mask; switch (rfs) { case 7: return 192; @@ -281,9 +282,9 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { struct samsung_i2s_priv *priv = i2s->priv; u32 mod = readl(priv->addr + I2SMOD); - int rfs_shift = i2s->variant_regs->rfs_off; + int rfs_shift = priv->variant_regs->rfs_off; - mod &= ~(i2s->variant_regs->rfs_mask << rfs_shift); + mod &= ~(priv->variant_regs->rfs_mask << rfs_shift); switch (rfs) { case 192: @@ -321,8 +322,8 @@ static inline unsigned get_bfs(struct i2s_dai *i2s) struct samsung_i2s_priv *priv = i2s->priv; u32 bfs; - bfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->bfs_off; - bfs &= i2s->variant_regs->bfs_mask; + bfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->bfs_off; + bfs &= priv->variant_regs->bfs_mask; switch (bfs) { case 8: return 256; @@ -343,7 +344,7 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) struct samsung_i2s_priv *priv = i2s->priv; u32 mod = readl(priv->addr + I2SMOD); int tdm = i2s->quirks & QUIRK_SUPPORTS_TDM; - int bfs_shift = i2s->variant_regs->bfs_off; + int bfs_shift = priv->variant_regs->bfs_off; /* Non-TDM I2S controllers do not support BCLK > 48 * FS */ if (!tdm && bfs > 48) { @@ -351,7 +352,7 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) return; } - mod &= ~(i2s->variant_regs->bfs_mask << bfs_shift); + mod &= ~(priv->variant_regs->bfs_mask << bfs_shift); switch (bfs) { case 48: @@ -408,7 +409,7 @@ static void i2s_txctrl(struct i2s_dai *i2s, int on) { struct samsung_i2s_priv *priv = i2s->priv; void __iomem *addr = priv->addr; - int txr_off = i2s->variant_regs->txr_off; + int txr_off = priv->variant_regs->txr_off; u32 con = readl(addr + I2SCON); u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off); @@ -459,7 +460,7 @@ static void i2s_rxctrl(struct i2s_dai *i2s, int on) { struct samsung_i2s_priv *priv = i2s->priv; void __iomem *addr = priv->addr; - int txr_off = i2s->variant_regs->txr_off; + int txr_off = priv->variant_regs->txr_off; u32 con = readl(addr + I2SCON); u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off); @@ -516,7 +517,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); - const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs; + const struct samsung_i2s_variant_regs *i2s_regs = priv->variant_regs; unsigned int cdcon_mask = 1 << i2s_regs->cdclkcon_off; unsigned int rsrc_mask = 1 << i2s_regs->rclksrc_off; u32 mod, mask, val = 0; @@ -644,9 +645,9 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) u32 mod, tmp = 0; unsigned long flags; - lrp_shift = i2s->variant_regs->lrp_off; - sdf_shift = i2s->variant_regs->sdf_off; - mod_slave = 1 << i2s->variant_regs->mss_off; + lrp_shift = priv->variant_regs->lrp_off; + sdf_shift = priv->variant_regs->sdf_off; + mod_slave = 1 << priv->variant_regs->mss_off; sdf_mask = MOD_SDF_MASK << sdf_shift; lrp_rlow = MOD_LR_RLOW << lrp_shift; @@ -1023,7 +1024,6 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) struct i2s_dai *i2s = to_info(dai); u32 reg = readl(priv->addr + I2SFIC); snd_pcm_sframes_t delay; - const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs; WARN_ON(!pm_runtime_active(dai->dev)); @@ -1032,7 +1032,7 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) else if (is_secondary(i2s)) delay = FICS_TXCOUNT(readl(priv->addr + I2SFICS)); else - delay = (reg >> i2s_regs->ftx0cnt_off) & 0x7f; + delay = (reg >> priv->variant_regs->ftx0cnt_off) & 0x7f; return delay; } @@ -1280,7 +1280,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) const char *p_names[2] = { NULL }; struct device *dev = &priv->pdev->dev; struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); - const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs; + const struct samsung_i2s_variant_regs *reg_info = priv->variant_regs; const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)]; struct clk *rclksrc; int ret, i; @@ -1399,6 +1399,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + priv->variant_regs = i2s_dai_data->i2s_variant_regs; + quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks; num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1; priv->pdev = pdev; @@ -1457,7 +1459,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->dma_playback.addr_width = 4; pri_dai->dma_capture.addr_width = 4; pri_dai->quirks = quirks; - pri_dai->variant_regs = i2s_dai_data->i2s_variant_regs; pri_dai->priv = priv; if (quirks & QUIRK_PRI_6CHAN) @@ -1471,7 +1472,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (quirks & QUIRK_SEC_DAI) { sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1]; - sec_dai->variant_regs = pri_dai->variant_regs; sec_dai->dma_playback.addr = regs_base + I2STXDS; sec_dai->dma_playback.chan_name = "tx-sec"; From patchwork Thu Feb 7 17:00:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D8E31823 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A99B2E0BD for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DE0C2E0D4; Thu, 7 Feb 2019 17:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B560C2E0CE for ; Thu, 7 Feb 2019 17:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 507BE267A29; Thu, 7 Feb 2019 18:01:53 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 434E1267A9C; Thu, 7 Feb 2019 18:01:51 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 37985267A65 for ; Thu, 7 Feb 2019 18:01:42 +0100 (CET) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170140epoutp04380c3a62e9df46097905441e03b5908b~BI5wV-U-p0210902109epoutp04d; Thu, 7 Feb 2019 17:01:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170140epoutp04380c3a62e9df46097905441e03b5908b~BI5wV-U-p0210902109epoutp04d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558900; bh=aGjZmBj4J2RdwxqCubwjqbk7/XJNZ/DzGPohe0TJiIQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=AuUWpIgirztIh9vUrSNhN35kZgWONIxCgazRfllO7gOr1aVR+lcyM1mpy5HleYrmA z+0JqSMKIVKmVnUH7gVM3Zm06/omVr5iu3DsI5fNeCtWj+7M52o5ivYYajX4NoeZzr CqOm9yrrg000BoYrBdBU0b2K5firESRttlNa6icY= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170139epcas2p31d62ff1321b48ca68726993c760d2776~BI5viyqf42769227692epcas2p3g; Thu, 7 Feb 2019 17:01:39 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id DA.B6.04093.3746C5C5; Fri, 8 Feb 2019 02:01:39 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170138epcas2p31134b2beee877922d27fab5c79fdc7b1~BI5ull-6v2773527735epcas2p3E; Thu, 7 Feb 2019 17:01:38 +0000 (GMT) X-AuditID: b6c32a48-18bff70000000ffd-42-5c5c64730c41 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A0.C8.03689.1746C5C5; Fri, 8 Feb 2019 02:01:38 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:37 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:23 +0100 Message-id: <20190207170028.720-16-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLIsWRmVeSWpSXmKPExsWy7bCmhW5xSkyMwbKFPBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6M2Rd+shd06VfcmbiTpYHxpFoXIyeH hICJxLOf3xi7GLk4hAR2MErMOPuNHcL5zijxetthZpiqc+u3sEIkdjNKbOh8ygTh/GKUWPny ATtIFZuAoUTv0T5GEFtEQEzi9pxOZpAiZoEWJok5c5eCjRIWiJWYvfAMK4jNIqAqceH5N7A4 r4CVxM9nnxkh1slLnO9dBzaUEyh+a/8OFogaQYkfk++B2cxANQevPGcBWSAhcIRN4v+XR2wQ zS4SC+evgbKlJZ6t2gg1tFpi1/ZuZoiGDkaJlgvboZ6zljh8/CIrxFQ+iY7Df4E2cwDFeSU6 2oQgSjwkNvw6yQzxci+jxOm329kmMErNQnLULCRHLWBkWsUollpQnJueWmxUYKJXnJhbXJqX rpecn7uJERzpWh47GA+c8znEKMDBqMTDe0E7JkaINbGsuDL3EKMEB7OSCK9sAlCINyWxsiq1 KD++qDQntfgQozQHi5I470PpudFCAumJJanZqakFqUUwWSYOTqkGRvuHlgcXT3/97OrlV0/e yD6VSwu/YMn+6O5Vnc3LdasePGsrDIyOk+/cYKBz9jnPl4Dp86u04yNvrDzxMbNMuLxVwcTS MuaX1uwnBn/2xN/6Ubfpvhqb4JsPCm+TL6hWL7xXVHQmJvcT66Z4vyTOKdYn085YNuyQedlS 4Cx0KWSR+Oblls9knymxFGckGmoxFxUnAgDAe7o68AIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd2ilJgYg+6FrBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6M2Rd+shd06VfcmbiTpYHxpFoXIyeH hICJxLn1W1i7GLk4hAR2MkqsuPqTHcL5xSjx/e80VpAqNgFDid6jfYwgtoiAmMTtOZ3MIEXM Ak1MErtuX2QHSQgLxErMXngGrIFFQFXiwvNvzCA2r4CVxM9nnxkh1slLnO9dB1bPCRS/tX8H C4gtJGAp8WFCEytEvaDEj8n3wOLMQPUHrzxnmcDINwtJahaS1AJGplWMkqkFxbnpucVGBUZ5 qeV6xYm5xaV56XrJ+bmbGIFhvO2wVv8OxsdL4g8xCnAwKvHwXtCOiRFiTSwrrsw9xCjBwawk wiubABTiTUmsrEotyo8vKs1JLT7EKM3BoiTOy59/LFJIID2xJDU7NbUgtQgmy8TBKdXAaBNw /dueoyv40ja+FXumc1NRcHWEFrdeh/fDlfa/zuTczVmi+eXvm43Jf08eOFWu3uLPKTJr36nO 17Nc/RWnZEn+1S+QV/t+8quyTeas2ZX3p39o/xoR0bO372pNHkNV6rE/n07sMDfu/HgihJH9 1TKGRsZJqRuSf+/ln/NXUPPr/LKwH5NjtyqxFGckGmoxFxUnAgCDl2MgXwIAAA== X-CMS-MailID: 20190207170138epcas2p31134b2beee877922d27fab5c79fdc7b1 CMS-TYPE: 102P X-CMS-RootMailID: 20190207170138epcas2p31134b2beee877922d27fab5c79fdc7b1 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 15/22] ASoC: samsung: i2s: Move quirks data to common driver data structure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The quirk flags are common for the primary and the secondary DAI so move respective field from struct i2s_dai to common driver data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 6ea0f0050fc8..e11d678e9c1f 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -84,7 +84,6 @@ struct i2s_dai { struct snd_dmaengine_dai_dma_data dma_capture; struct snd_dmaengine_dai_dma_data idma_playback; dma_filter_fn filter; - u32 quirks; struct samsung_i2s_priv *priv; }; @@ -122,19 +121,13 @@ struct samsung_i2s_priv { u32 suspend_i2spsr; const struct samsung_i2s_variant_regs *variant_regs; + u32 quirks; /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; }; -struct i2s_dai *samsung_i2s_get_pri_dai(struct device *dev) -{ - struct samsung_i2s_priv *priv = dev_get_drvdata(dev); - - return &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1]; -} - /* Returns true if this is the 'overlay' stereo DAI */ static inline bool is_secondary(struct i2s_dai *i2s) { @@ -343,7 +336,7 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) { struct samsung_i2s_priv *priv = i2s->priv; u32 mod = readl(priv->addr + I2SMOD); - int tdm = i2s->quirks & QUIRK_SUPPORTS_TDM; + int tdm = priv->quirks & QUIRK_SUPPORTS_TDM; int bfs_shift = priv->variant_regs->bfs_off; /* Non-TDM I2S controllers do not support BCLK > 48 * FS */ @@ -563,7 +556,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, case SAMSUNG_I2S_RCLKSRC_1: /* clock corrsponding to IISMOD[10] := 1 */ mask = 1 << i2s_regs->rclksrc_off; - if ((i2s->quirks & QUIRK_NO_MUXPSR) + if ((priv->quirks & QUIRK_NO_MUXPSR) || (clk_id == SAMSUNG_I2S_RCLKSRC_0)) clk_id = 0; else @@ -830,8 +823,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, /* We set constraints on the substream acc to the version of I2S */ static int i2s_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) + struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; @@ -847,7 +841,7 @@ static int i2s_startup(struct snd_pcm_substream *substream, else i2s->mode |= DAI_MANAGER; - if (!any_active(i2s) && (i2s->quirks & QUIRK_NEED_RSTCLR)) + if (!any_active(i2s) && (priv->quirks & QUIRK_NEED_RSTCLR)) writel(CON_RSTCLR, i2s->priv->addr + I2SCON); spin_unlock_irqrestore(&lock, flags); @@ -929,7 +923,7 @@ static int config_setup(struct i2s_dai *i2s) if (is_slave(i2s)) return 0; - if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { + if (!(priv->quirks & QUIRK_NO_MUXPSR)) { psr = priv->rclk_srcrate / i2s->frmclk / rfs; writel(((psr - 1) << 8) | PSR_PSREN, priv->addr + I2SPSR); dev_dbg(&i2s->pdev->dev, @@ -1068,10 +1062,10 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); - if (i2s->quirks & QUIRK_NEED_RSTCLR) + if (priv->quirks & QUIRK_NEED_RSTCLR) writel(CON_RSTCLR, priv->addr + I2SCON); - if (i2s->quirks & QUIRK_SUPPORTS_IDMA) + if (priv->quirks & QUIRK_SUPPORTS_IDMA) idma_reg_addr_init(priv->addr, i2s->sec_dai->idma_playback.addr); } @@ -1099,13 +1093,14 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); unsigned long flags; pm_runtime_get_sync(dai->dev); if (!is_secondary(i2s)) { - if (i2s->quirks & QUIRK_NEED_RSTCLR) { + if (priv->quirks & QUIRK_NEED_RSTCLR) { spin_lock_irqsave(&priv->lock, flags); writel(0, i2s->priv->addr + I2SCON); spin_unlock_irqrestore(&priv->lock, flags); @@ -1279,7 +1274,6 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" }; const char *p_names[2] = { NULL }; struct device *dev = &priv->pdev->dev; - struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); const struct samsung_i2s_variant_regs *reg_info = priv->variant_regs; const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)]; struct clk *rclksrc; @@ -1305,7 +1299,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) return -ENOMEM; } - if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { + if (!(priv->quirks & QUIRK_NO_MUXPSR)) { /* Activate the prescaler */ u32 val = readl(priv->addr + I2SPSR); writel(val | PSR_PSREN, priv->addr + I2SPSR); @@ -1399,11 +1393,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->variant_regs = i2s_dai_data->i2s_variant_regs; - quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks; num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1; priv->pdev = pdev; + priv->variant_regs = i2s_dai_data->i2s_variant_regs; + priv->quirks = quirks; ret = i2s_alloc_dais(priv, i2s_dai_data, num_dais); if (ret < 0) @@ -1458,7 +1452,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->dma_capture.chan_name = "rx"; pri_dai->dma_playback.addr_width = 4; pri_dai->dma_capture.addr_width = 4; - pri_dai->quirks = quirks; pri_dai->priv = priv; if (quirks & QUIRK_PRI_6CHAN) @@ -1481,7 +1474,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) } sec_dai->dma_playback.addr_width = 4; - sec_dai->quirks = quirks; sec_dai->idma_playback.addr = idma_addr; sec_dai->pri_dai = pri_dai; sec_dai->priv = priv; From patchwork Thu Feb 7 17:00:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C17C13B4 for ; Thu, 7 Feb 2019 18:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D2EB2E4CB for ; Thu, 7 Feb 2019 18:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 612EC2E4CD; Thu, 7 Feb 2019 18:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEA5D2E4CC for ; Thu, 7 Feb 2019 18:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E1411267A79; Thu, 7 Feb 2019 18:01:56 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7A323267A48; Thu, 7 Feb 2019 18:01:52 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 8CBCE267A57 for ; Thu, 7 Feb 2019 18:01:44 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170143epoutp0443f0e171e8fd152689cd827e505244aa~BI5zL1Nwa3094230942epoutp047; Thu, 7 Feb 2019 17:01:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170143epoutp0443f0e171e8fd152689cd827e505244aa~BI5zL1Nwa3094230942epoutp047 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558903; bh=d2ZZc+KAorTY5urEQl6SCVVmJJZuh9QNvYlYv4J/q+w=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=AzGK8A7G7svVQX8NuyRi793A6R6OCxMj2yuEdHFOHLFn3JJ7a3Br0Sf5I+tDPaFsg FSSuwStFziQsYpet4npIoKm8YyxToafqv8PW6DgSWXfGP+o5qT4/iwkBU4Z6gqRCSc 0FeJ5Tgpahh+y8/e4Dhq/ZqyG2+hOhFpHJIHRIrE= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170142epcas1p2ef94647a292547ef4de33c67774aaa94~BI5y2cAQ01808618086epcas1p2r; Thu, 7 Feb 2019 17:01:42 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 59.C9.04173.6746C5C5; Fri, 8 Feb 2019 02:01:42 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170141epcas1p29a038bfd0df69df10e916ea8a695a85b~BI5x2HAHh1833218332epcas1p2n; Thu, 7 Feb 2019 17:01:41 +0000 (GMT) X-AuditID: b6c32a36-5c1ff7000000104d-40-5c5c64768445 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F3.D8.04015.5746C5C5; Fri, 8 Feb 2019 02:01:41 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:41 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:24 +0100 Message-id: <20190207170028.720-17-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsWy7bCmnm5ZSkyMwZfzmhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MxTvPsRe8EKmY+kyzgXGmYBcjJ4eE gInEwd51bCC2kMAORolzf9y7GLmA7O+MEkuP72OHKfrRsoAdIrGbUeLGxiVQHb8YJe6cigSx 2QQMJXqP9jGC2CICYhK353QygzQwC7QwScyZu5QZJCEs4C7Rfu0lC4jNIqAqcXVSC5jNK2Al 0Xq1mRFim7zE+d51YJs5geK39u+AqhGU+DH5HpjNDFRz8MpzFpAFEgJ72CT2L7wA1ewi0dd7 gLWLkQPIlpa4dNQWIlwtsWt7NzNEfQejRMuF7cwQCWuJw8cvskIM5ZN497UHqpdXoqNNCKLE Q2LWvu8sEN/3MkrcvPeadQKj1CwkN81CctMCRqZVjGKpBcW56anFhgVGesWJucWleel6yfm5 mxjBEa5ltoNx0TmfQ4wCHIxKPLwaejExQqyJZcWVuYcYJTiYlUR4ZROAQrwpiZVVqUX58UWl OanFhxilOViUxHnXOzjHCAmkJ5akZqemFqQWwWSZODilGhhLZe3nqSs9nr/4DWP1yTU/+hqu Bx02tKueldn1QLvv48mrzAc3/uGJvnRHssm4/8v2K/9y+vr365ln+B4obu93rXJd9GbfaS4W lsoXcday06Qapr+1SEuatEScNb066nfzk1geTsFTF8Mvnn3t7fT9t8j9OTVmeyNs4wJrwyrv 60WsU3FkSVNiKc5INNRiLipOBADB7Qj+7AIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jAd3SlJgYg3Nv1SyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZi3eeYy94IVIx9ZlmA+NMwS5GTg4J AROJHy0L2LsYuTiEBHYySiw+cIEFJCEk8ItRom2dMYjNJmAo0Xu0jxHEFhEQk7g9p5MZpIFZ oIlJYtfti+wgCWEBd4n2ay/BmlkEVCWuTmoBs3kFrCRarzYzQmyTlzjfuw6snhMofmv/Dqhl lhIfJjSxQtQLSvyYfA8szgxUf/DKc5YJjHyzkKRmIUktYGRaxSiZWlCcm55bbFRgmJdarlec mFtcmpeul5yfu4kRGMLbDmv17WC8vyT+EKMAB6MSD+8F7ZgYIdbEsuLK3EOMEhzMSiK8sglA Id6UxMqq1KL8+KLSnNTiQ4zSHCxK4ry3845FCgmkJ5akZqemFqQWwWSZODilGhiDpt/7lK/i cOOoKS+XWpzXY4NlC8/EzY/j8+3js6ie+WpRZMQRv5bKVXNn3DLocD3+31jxWFupxLLDQbVb zxle9mGaaNUqrie8fLFzw7Wj5nc+Zz45ZT4921Qyb1JWZdvtiQ+LDzw3Ly8LSL+kvT3oV1zs jVPXC1fO+rs68dSOoF5uub+Z28yUWIozEg21mIuKEwHrmE6fXQIAAA== X-CMS-MailID: 20190207170141epcas1p29a038bfd0df69df10e916ea8a695a85b CMS-TYPE: 101P X-CMS-RootMailID: 20190207170141epcas1p29a038bfd0df69df10e916ea8a695a85b References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 16/22] ASoC: samsung: i2s: Get rid of a static spinlock X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes the spinlock serializing access to the primary/secondary PCM a per I2S controller lock, rather than a global one. There is no need to have a global lock across multiple I2S controllers in the SoC. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index e11d678e9c1f..9931d007bc13 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -88,9 +88,6 @@ struct i2s_dai { struct samsung_i2s_priv *priv; }; -/* Lock for cross i/f checks */ -static DEFINE_SPINLOCK(lock); - struct samsung_i2s_priv { struct platform_device *pdev; struct platform_device *pdev_sec; @@ -101,6 +98,9 @@ struct samsung_i2s_priv { /* Spinlock protecting access to the device's registers */ spinlock_t lock; + /* Lock for cross i/f checks */ + spinlock_t pcm_lock; + /* CPU DAIs and their corresponding drivers */ struct i2s_dai *dai; struct snd_soc_dai_driver *dai_drv; @@ -832,7 +832,7 @@ static int i2s_startup(struct snd_pcm_substream *substream, pm_runtime_get_sync(dai->dev); - spin_lock_irqsave(&lock, flags); + spin_lock_irqsave(&priv->pcm_lock, flags); i2s->mode |= DAI_OPENED; @@ -844,7 +844,7 @@ static int i2s_startup(struct snd_pcm_substream *substream, if (!any_active(i2s) && (priv->quirks & QUIRK_NEED_RSTCLR)) writel(CON_RSTCLR, i2s->priv->addr + I2SCON); - spin_unlock_irqrestore(&lock, flags); + spin_unlock_irqrestore(&priv->pcm_lock, flags); return 0; } @@ -852,11 +852,12 @@ static int i2s_startup(struct snd_pcm_substream *substream, static void i2s_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; - spin_lock_irqsave(&lock, flags); + spin_lock_irqsave(&priv->pcm_lock, flags); i2s->mode &= ~DAI_OPENED; i2s->mode &= ~DAI_MANAGER; @@ -868,7 +869,7 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, i2s->rfs = 0; i2s->bfs = 0; - spin_unlock_irqrestore(&lock, flags); + spin_unlock_irqrestore(&priv->pcm_lock, flags); pm_runtime_put(dai->dev); } @@ -1406,6 +1407,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai = &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1]; spin_lock_init(&priv->lock); + spin_lock_init(&priv->pcm_lock); if (!np) { if (i2s_pdata == NULL) { From patchwork Thu Feb 7 17:00:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E880B14E1 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5BF42E09B for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA40D2E0CA; Thu, 7 Feb 2019 17:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB3102E0D6 for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D861E267AA9; Thu, 7 Feb 2019 18:02:01 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7F895267AA4; Thu, 7 Feb 2019 18:01:59 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id C8F3B267A5A for ; Thu, 7 Feb 2019 18:01:48 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190207170146epoutp0321ba0c5a7aa5ffd07731aca3fadd2979~BI52mF0o60204102041epoutp03E; Thu, 7 Feb 2019 17:01:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190207170146epoutp0321ba0c5a7aa5ffd07731aca3fadd2979~BI52mF0o60204102041epoutp03E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558906; bh=17PT2mwYeZ1xIdmx14GcCgntVpOPFfO7GPS5kzEuzD8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=TMuQp7YLgNeZqHLuFnhdhIDIYy1ocSAex9C1CaMPkELWW+/OPAMX8gHDuj+/VYPmz DNZL/6qzuhAOr/zljdYZdXchIBusFEl/nRIZzfcm2j+baxevmH0ep2kFUyCV8bodwn 0EiPB6Ce44RBM8SmFZttnKnpAXxWhbR8rlqJUdys= Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170145epcas1p11ec47d3714aecb68f3213798f217a8b6~BI51qzojl2132521325epcas1p1d; Thu, 7 Feb 2019 17:01:45 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 6F.E9.04288.9746C5C5; Fri, 8 Feb 2019 02:01:45 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170145epcas1p465da0715aa629b525c17d263c1b49a68~BI51M1G2o1456614566epcas1p4V; Thu, 7 Feb 2019 17:01:45 +0000 (GMT) X-AuditID: b6c32a38-c0fff700000010c0-a6-5c5c6479c123 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 68.D8.04015.9746C5C5; Fri, 8 Feb 2019 02:01:45 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:45 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:25 +0100 Message-id: <20190207170028.720-18-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmvm5lSkyMwe8nmhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MHd/3shWcMKs4PK+DuYHxgU4XIyeH hICJxM3ZT5i6GLk4hAR2MEps67/CCuF8Z5RoWrKTCabqc9dydhBbSGA3o8S9AwoQRb8YJd7N X88IkmATMJToPdoHZosIiEncntPJDFLELNDCJDFn7lJmkISwQKDEhMudYFNZBFQljh2+BNbA K2AlcfPlPzaIbfIS53vXgW3jBIrf2r+DBaJGUOLH5HtgNjNQzcErz1lAFkgIHGCT2Nm8mxWi 2UXi40mQUzmAbGmJS0dtIcLVEru2dzND1HcwSrRc2M4MkbCWOHz8IivEUD6Jd197WCF6eSU6 2oQgSjwkbjStYIH4uJdRYsX7NywTGKVmIblpFpKbFjAyrWIUSy0ozk1PLTYsMNErTswtLs1L 10vOz93ECI5yLYsdjHvO+RxiFOBgVOLhvaAdEyPEmlhWXJl7iFGCg1lJhFc2ASjEm5JYWZVa lB9fVJqTWnyIUZqDRUmcd72Dc4yQQHpiSWp2ampBahFMlomDU6qBMcf+2Ofalk/9bz+rv30v XXExvqqW/7afVJ9qYZijadypORb7j2b1ruds3MN82aaO9dtp9jzZNZGWznY37sWXFH3cwm86 4dkW16dHDZfNt/crOLAj8pz/upf5bSGPlTXZ5k+8Ht3Mu//RFYm5/I0zIu1+7/m86nJYGI+7 0O8Snrsdk69M1nsfp8RSnJFoqMVcVJwIABF75BHuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd3KlJgYg1kXeSyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZO77vZSs4YVZxeF4HcwPjA50uRk4O CQETic9dy9m7GLk4hAR2Mkocvv6WESQhJPCLUWLTWjcQm03AUKL3aB9YXERATOL2nE5mkAZm gSYmiV23L7KDJIQF/CUuttxmArFZBFQljh2+BNbAK2AlcfPlPzaIbfIS53vXgdVzAsVv7d/B ArHMUuLDhCZWiHpBiR+T74HFmYHqD155zjKBkW8WktQsJKkFjEyrGCVTC4pz03OLjQoM81LL 9YoTc4tL89L1kvNzNzECg3jbYa2+HYz3l8QfYhTgYFTi4b2gHRMjxJpYVlyZe4hRgoNZSYRX NgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPd23rFIIYH0xJLU7NTUgtQimCwTB6dUA2P5uk8G +p9O8WllxnsqvxHW5t93hdXC5udkLQnG3S87Xq/aptAVkrOujOHTuoVLhW4euM176VKg08e0 0+FLDV/2SZ3UTI3UrlbcF3J3wnqVGYzRpd9q/H8ejZ7ad37a8pyAHQkNa6948zsyTlVY2rRz 86QVfJ9r7ZIzKpfPkr+vE99u8vZqtJgSS3FGoqEWc1FxIgDNrzu4XgIAAA== X-CMS-MailID: 20190207170145epcas1p465da0715aa629b525c17d263c1b49a68 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170145epcas1p465da0715aa629b525c17d263c1b49a68 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 17/22] ASoC: samsung: odroid: Add support for secondary CPU DAI X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds DPCM links in order to support the secondary I2S interface. For the secondary PCM interface to be actually available one more entry should be added to the sound-dai property in sound/cpu node in DT. The changes in driver are done in a way so we are backwards compatible with existing DTS/DTB, i.e. if the cpu sound-dai property contains only one entry only one PCM will be registered. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/odroid.c | 132 +++++++++++++++++++++++++++---------- 1 file changed, 96 insertions(+), 36 deletions(-) diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c index e7b371b07230..bab61e8278a0 100644 --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -17,21 +18,24 @@ struct odroid_priv { struct snd_soc_card card; - struct snd_soc_dai_link dai_link; - struct clk *clk_i2s_bus; struct clk *sclk_i2s; }; -static int odroid_card_startup(struct snd_pcm_substream *substream) +static int odroid_card_fe_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, 2); + return 0; } -static int odroid_card_hw_params(struct snd_pcm_substream *substream, +static const struct snd_soc_ops odroid_card_fe_ops = { + .startup = odroid_card_fe_startup, +}; + +static int odroid_card_be_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -86,19 +90,56 @@ static int odroid_card_hw_params(struct snd_pcm_substream *substream, return 0; } -static const struct snd_soc_ops odroid_card_ops = { - .startup = odroid_card_startup, - .hw_params = odroid_card_hw_params, +static const struct snd_soc_ops odroid_card_be_ops = { + .hw_params = odroid_card_be_hw_params, +}; + +static struct snd_soc_dai_link odroid_card_dais[] = { + { + /* Primary FE <-> BE link */ + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .ops = &odroid_card_fe_ops, + .name = "Primary", + .stream_name = "Primary", + .platform_name = "3830000.i2s", + .dynamic = 1, + .dpcm_playback = 1, + }, { + /* BE <-> CODECs link */ + .name = "I2S Mixer", + .cpu_name = "snd-soc-dummy", + .cpu_dai_name = "snd-soc-dummy-dai", + .platform_name = "snd-soc-dummy", + .ops = &odroid_card_be_ops, + .no_pcm = 1, + .dpcm_playback = 1, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + }, { + /* Secondary FE <-> BE link */ + .playback_only = 1, + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .ops = &odroid_card_fe_ops, + .name = "Secondary", + .stream_name = "Secondary", + .platform_name = "samsung-i2s-sec", + .dynamic = 1, + .dpcm_playback = 1, + } }; + static int odroid_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *cpu, *codec; + struct device_node *cpu, *cpu_dai, *codec; struct odroid_priv *priv; - struct snd_soc_dai_link *link; struct snd_soc_card *card; - int ret; + struct snd_soc_dai_link *link, *codec_link; + int num_pcms, ret, i; + struct of_phandle_args args = {}; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -130,45 +171,67 @@ static int odroid_audio_probe(struct platform_device *pdev) return ret; } - link = &priv->dai_link; - - link->ops = &odroid_card_ops; - link->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBS_CFS; - - card->dai_link = &priv->dai_link; - card->num_links = 1; + card->dai_link = odroid_card_dais; + card->num_links = ARRAY_SIZE(odroid_card_dais); cpu = of_get_child_by_name(dev->of_node, "cpu"); codec = of_get_child_by_name(dev->of_node, "codec"); + link = card->dai_link; + codec_link = &card->dai_link[1]; - link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0); - if (!link->cpu_of_node) { - dev_err(dev, "Failed parsing cpu/sound-dai property\n"); - return -EINVAL; + /* + * For backwards compatibility create the secondary CPU DAI link only + * if there are 2 CPU DAI entries in the cpu sound-dai property in DT. + */ + num_pcms = of_count_phandle_with_args(cpu, "sound-dai", + "#sound-dai-cells"); + if (num_pcms == 1) + card->num_links--; + + for (i = 0; i < num_pcms; i++, link += 2) { + ret = of_parse_phandle_with_args(cpu, "sound-dai", + "#sound-dai-cells", i, &args); + if (ret < 0) + return ret; + + if (!args.np) { + dev_err(dev, "sound-dai property parse error: %d\n", ret); + return -EINVAL; + } + + ret = snd_soc_get_dai_name(&args, &link->cpu_dai_name); + of_node_put(args.np); + + if (ret < 0) + return ret; } - ret = snd_soc_of_get_dai_link_codecs(dev, codec, link); + cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); + of_node_put(cpu); + of_node_put(codec); + + ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link); if (ret < 0) goto err_put_codec_n; - link->platform_of_node = link->cpu_of_node; - - link->name = "Primary"; - link->stream_name = link->name; - + /* Set capture capability only for boards with the MAX98090 CODEC */ + if (codec_link->num_codecs > 1) { + card->dai_link[0].dpcm_capture = 1; + card->dai_link[1].dpcm_capture = 1; + } - priv->sclk_i2s = of_clk_get_by_name(link->cpu_of_node, "i2s_opclk1"); + priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); if (IS_ERR(priv->sclk_i2s)) { ret = PTR_ERR(priv->sclk_i2s); - goto err_put_i2s_n; + goto err_put_codec_n; } - priv->clk_i2s_bus = of_clk_get_by_name(link->cpu_of_node, "iis"); + priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); if (IS_ERR(priv->clk_i2s_bus)) { ret = PTR_ERR(priv->clk_i2s_bus); goto err_put_sclk; } + of_node_put(cpu_dai); ret = devm_snd_soc_register_card(dev, card); if (ret < 0) { @@ -182,10 +245,8 @@ static int odroid_audio_probe(struct platform_device *pdev) clk_put(priv->clk_i2s_bus); err_put_sclk: clk_put(priv->sclk_i2s); -err_put_i2s_n: - of_node_put(link->cpu_of_node); err_put_codec_n: - snd_soc_of_put_dai_link_codecs(link); + snd_soc_of_put_dai_link_codecs(codec_link); return ret; } @@ -193,8 +254,7 @@ static int odroid_audio_remove(struct platform_device *pdev) { struct odroid_priv *priv = platform_get_drvdata(pdev); - of_node_put(priv->dai_link.cpu_of_node); - snd_soc_of_put_dai_link_codecs(&priv->dai_link); + snd_soc_of_put_dai_link_codecs(&priv->card.dai_link[1]); clk_put(priv->sclk_i2s); clk_put(priv->clk_i2s_bus); From patchwork Thu Feb 7 17:00:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD96B6C2 for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAD612E0CF for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D1D42E0D3; Thu, 7 Feb 2019 17:41:22 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 683F52E09B for ; Thu, 7 Feb 2019 17:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7C27C267A78; Thu, 7 Feb 2019 18:02:04 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7E176267AAC; Thu, 7 Feb 2019 18:02:02 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id 91694267A57 for ; Thu, 7 Feb 2019 18:01:52 +0100 (CET) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190207170150epoutp012c1493ee35803f5b6ca2c94785c3a3e4~BI56Ts6Ql1148911489epoutp01V; Thu, 7 Feb 2019 17:01:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190207170150epoutp012c1493ee35803f5b6ca2c94785c3a3e4~BI56Ts6Ql1148911489epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558910; bh=pL58VYA2iP//lSOa90ooRRRRaI6aFNhaYrJ2L7mJ+Io=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=XvmaT/V+LZ4HUbYIwWpYZb2webzuTAfkqDZdDcwlg6ouxy8Mq2TgB8SWucIeYTMsT ujY+UVi/aCI5q+oPNmwc4c99UELDm/i7jAk/0cnzauTI4gDUyOt6jv0p178RMsy61j Y+ixZ4nAoQyr8Rm5tXcIV5P0hQ51fBZ7Eoim80Vs= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190207170149epcas2p2cfebd1f93f524fc5714d7f52832fb0a5~BI55RRRBi1763917639epcas2p2h; Thu, 7 Feb 2019 17:01:49 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 77.07.04134.D746C5C5; Fri, 8 Feb 2019 02:01:49 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190207170148epcas2p2e0f4a1e154cb8cd52d257978a669e84c~BI54jZ-J11763317633epcas2p2u; Thu, 7 Feb 2019 17:01:48 +0000 (GMT) X-AuditID: b6c32a47-8abff70000001026-89-5c5c647d8705 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id CA.C8.03689.C746C5C5; Fri, 8 Feb 2019 02:01:48 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:48 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:26 +0100 Message-id: <20190207170028.720-19-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmuW5tSkyMwcJedYsrFw8xWWycsZ7V YurDJ2wW589vYLf4dqWDyeLyrjlsFjPO72OyWHvkLrvF4TftrBYXV3xhcuDy2PC5ic1j56y7 7B6bVnWyefRtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfG7WsdTAVXpCuOTO5iaWCcJN7FyMkh IWAicf35R5YuRi4OIYEdjBIbZu6Ccr4zSlxbPpcdpur9z8fsEIndjBKH//RBVf1ilOhufMsM UsUmYCjRe7SPEcQWERCTuD2nkxmkiFmghUliztylQA4Hh7BAtMTVq1EgNSwCqhLf375hAbF5 BawkGu4tY4TYJi9xvncd2GZOoPit/TugagQlfky+B2YzA9UcvPIc7AgJgQNsEudufWSGaHaR 2LBtPxuELS3xbNVGqKHVEru2dzNDNHQwSrRc2A7VYC1x+PhFVoipfBIdh/+ygxwqIcAr0dEm BFHiIbFz1TmwciGBXkaJV7v0JzBKzUJy0ywkNy1gZFrFKJZaUJybnlpsVGCsV5yYW1yal66X nJ+7iREc5VruOxi3nfM5xCjAwajEw3tBOyZGiDWxrLgy9xCjBAezkgivbAJQiDclsbIqtSg/ vqg0J7X4EKM0B4uSOO9D6bnRQgLpiSWp2ampBalFMFkmDk6pBka+jYIJ4kvapht/26DvvSyG XWhNG5/nV4XXt3eppcW/FpysJNjYXy3E9L/l5trokksf2nf4uv3f9uTCjUc8vOw7k94e81O7 YLKbg+u0uHxpvAhHkd+dKrFtvTdEHbgeuG58m/ozsN638I6OZ0MPK1f8zm21q/rkeXMzue33 W6Q3r92iZLjytRJLcUaioRZzUXEiAAUCI7HuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd2alJgYg0Wb9S2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZt691MBVcka44MrmLpYFxkngXIyeH hICJxPufj9m7GLk4hAR2MkqcmnOcDcL5xShx8vJPZpAqNgFDid6jfYwgtoiAmMTtOZ3MIEXM Ak1MErtuX2QHSQgLREu87JwMVsQioCrx/e0bFhCbV8BKouHeMkaIdfIS53vXgdVzAsVv7d8B ViMkYCnxYUITK0S9oMSPyffA4sxA9QevPGeZwMg3C0lqFpLUAkamVYySqQXFuem5xUYFRnmp 5XrFibnFpXnpesn5uZsYgWG87bBW/w7Gx0viDzEKcDAq8fBe0I6JEWJNLCuuzD3EKMHBrCTC K5sAFOJNSaysSi3Kjy8qzUktPsQozcGiJM7Ln38sUkggPbEkNTs1tSC1CCbLxMEp1cAYr3mL zdVOLUTb4sCxzAXJOyepuSaJrVQRtn4Te/D+xsxrmQlB91dzhgcK6nStKfpx01tn5dv8jB82 KeF1bs8iCtvf9s5Zesq2J8WR892fJafSK0W5tR+niezV53s7rUj+0tY5D5TCFi3jktPez8i4 dFN4q+DT8+YcO/62+le+SJhi2FjyYYoSS3FGoqEWc1FxIgBIKSDZXwIAAA== X-CMS-MailID: 20190207170148epcas2p2e0f4a1e154cb8cd52d257978a669e84c CMS-TYPE: 102P X-CMS-RootMailID: 20190207170148epcas2p2e0f4a1e154cb8cd52d257978a669e84c References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 18/22] ASoC: samsung: Specify DMA channel names through custom DMA config X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This is a part of conversion of Samsung platforms to use the custom DMA config for specifying DMA channel names, in addition to passing custom DMA device for the secondary CPU DAI's "PCM" component for some variants of the I2S controller. We also don't set the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME any more as setting it wouldn't allow to specify DMA channels through the custom DMA config. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/dmaengine.c | 12 ++++-------- sound/soc/samsung/i2s.c | 2 +- sound/soc/samsung/s3c2412-i2s.c | 2 +- sound/soc/samsung/s3c24xx-i2s.c | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c index 84601fa9aa46..302871974cb3 100644 --- a/sound/soc/samsung/dmaengine.c +++ b/sound/soc/samsung/dmaengine.c @@ -28,7 +28,6 @@ int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, const char *tx, const char *rx, struct device *dma_dev) { - unsigned int flags = SND_DMAENGINE_PCM_FLAG_COMPAT; struct snd_dmaengine_pcm_config *pcm_conf; pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL); @@ -39,14 +38,11 @@ int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, pcm_conf->compat_filter_fn = filter; pcm_conf->dma_dev = dma_dev; - if (dev->of_node) { - pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx; - pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx; - } else { - flags |= SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME; - } + pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx; + pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx; - return devm_snd_dmaengine_pcm_register(dev, pcm_conf, flags); + return devm_snd_dmaengine_pcm_register(dev, pcm_conf, + SND_DMAENGINE_PCM_FLAG_COMPAT); } EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register); diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 9931d007bc13..2e91d183dd41 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1460,7 +1460,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->drv->playback.channels_max = 6; ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter, - NULL, NULL, NULL); + "tx", "rx", NULL); if (ret < 0) goto err_disable_clk; diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 67dfa27ae321..c08638b0e458 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -177,7 +177,7 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ret = samsung_asoc_dma_platform_register(&pdev->dev, pdata->dma_filter, - NULL, NULL, NULL); + "tx", "rx", NULL); if (ret) { pr_err("failed to register the DMA: %d\n", ret); return ret; diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index ba0f2b94f8d4..a8026b640c95 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -446,7 +446,7 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO; ret = samsung_asoc_dma_platform_register(&pdev->dev, NULL, - NULL, NULL, NULL); + "tx", "rx", NULL); if (ret) { dev_err(&pdev->dev, "Failed to register the DMA: %d\n", ret); return ret; From patchwork Thu Feb 7 17:00:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2CE56C2 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EF4F2E0D3 for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BCC72E0CA; Thu, 7 Feb 2019 17:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAACE2E0DD for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EF8A6267A4E; Thu, 7 Feb 2019 18:02:07 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8236A267A1F; Thu, 7 Feb 2019 18:02:05 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id 62649267A71 for ; Thu, 7 Feb 2019 18:01:55 +0100 (CET) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170153epoutp04c48aed19c984e1b53e6c2c11e1dc17dc~BI58kqNL73094230942epoutp049; Thu, 7 Feb 2019 17:01:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170153epoutp04c48aed19c984e1b53e6c2c11e1dc17dc~BI58kqNL73094230942epoutp049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558913; bh=fE4+fVEIOL9bpW/wkLXBtj63zNa5bOjpGy4ol9fWdv8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=FnR6rUvN3DUp81jVsg7oU4bvzZvEAgTueTTdJzldFJKMpn79Aj7bwArDixEX0GZzE 361dWVoKsMhKGlLkkKp/P86nBdxfx91SZpzkRDs5J41/BChFb8QGjqtLTvDOy5N0cd JyDNqxYj0bV6Of8peho2/yRyqNOD3+swBdAcp6iM= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190207170152epcas1p13536f1de7bd4d93f1b2b10b84c125fa0~BI58Ei3F23187031870epcas1p1d; Thu, 7 Feb 2019 17:01:52 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.C9.04173.0846C5C5; Fri, 8 Feb 2019 02:01:52 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190207170152epcas1p254264a82287a54dc2452f5e73daab13d~BI570EVrh1779017790epcas1p21; Thu, 7 Feb 2019 17:01:52 +0000 (GMT) X-AuditID: b6c32a36-5d9ff7000000104d-4b-5c5c6480d51a Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 19.D8.04015.0846C5C5; Fri, 8 Feb 2019 02:01:52 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:52 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:27 +0100 Message-id: <20190207170028.720-20-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Re0hTYRjG+c5tZ6PZcTP9mlmw7oKmEXHohmDBCYKK/ouJHtpBJafrHO/+ M2velpNAEhkzUotk1aZHa85L5dawIpqzQbGhJBQlySDUtNLI7RD43/M+z+99eT4+ElVFMA1Z XFrO8aVsiZZQYE99B7MyTHqdLsuxupsOBb0IPdDpwunbc58JOhDol9E/Q80I/X7ETtCdgWcI /fjljIz2LTThdLBvCclRMP2L1wnGY5uRMaKjhWDahhyAWRR3XsAvK07ouZLiSo4/dKpAUeRt iCLGP4nVrkERMYGmrRYgJyF1BM523kAtQEGqqGEARzs8iDSsAOhr92EWQMaptaVqyR8FMGwe w6ThN4ADvUt47BRBZUOrvw3EdBKVDCP2lvhZlDIj0N51H40Fauo8/NLxWhbTGLUXRr81IDGt pI7B5VA9InXaBQNWZ5yRb/jh58OYxCTC1fbZuEY3mInQ13gLSL0goHtwDkjLp2HjmhNItVPh tP+kZNfBEfdNVOKbATRPuVEpOA59k0FcOpoAo8utuLSrhM2NKglhYPTOByC92ApgvX9Gdgto bJs62TZ1ugsQB0jmjIKhkBOyjYczBdYgVJQWZl4pM4gg/uXpR4dBz7tzXkCRQLtFeSBTp1Ph bKVQY/ACSKLaJGVawYal1LM1tRxfls9XlHCCF6SSmDZF6crJ1amoQracu8pxRo7/nyKkXGMC 1qlJ9V92G2neQ3Bv7O0mjytV7A70VLI7uoo1+sQ0en9o4lJKnt+C9ojm6XTS5Wy4d43JGGr1 KCIP1d3usDgYpKp6F1fG+z6N9+XWRZ/w89x6cMxX5d73qnHux3z9g0cXt4cXbOG3eVVBeUKy 42yEW/915mO+Gqvt/q7TYkIRm52O8gL7DzTQMOnuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jAd2GlJgYg+6TIhZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MQ63vmAp+C1as37yJqYGxnb+LkYND QsBE4s+Xii5GLg4hgZ2MEu1vWxkhnF+MEvem3mXpYuTkYBMwlOg92scIYosIiEncntPJDFLE LNDEJLHr9kV2kEnCAr4SX2bog9SwCKhKvHvRygRi8wpYSXy90ghmSwjIS5zvXccOYnMCxW/t 3wE2X0jAUuLDhCZWiHpBiR+T74HFmYHqD155zjKBkW8WktQsJKkFjEyrGCVTC4pz03OLjQoM 81LL9YoTc4tL89L1kvNzNzECQ3jbYa2+HYz3l8QfYhTgYFTi4b2gHRMjxJpYVlyZe4hRgoNZ SYRXNgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPd23rFIIYH0xJLU7NTUgtQimCwTB6dUA6OG +iTWyFYDuRUVd/RLz+Qz8pzXCPpqJbhFMvPjoaY3PivbUw3XXYxLrFM+U8D5qnPdgUfOvMem 6piwFlyac8eo8nVQxI/uFs2D+R6W+zsXb79qZu5859mJlkfX8spfbwjdrBgxx8jBr7Kr+K5q friN1DOD51NCewqO8uWHlK+U1fXWPcnroMRSnJFoqMVcVJwIAJUpFRldAgAA X-CMS-MailID: 20190207170152epcas1p254264a82287a54dc2452f5e73daab13d CMS-TYPE: 101P X-CMS-RootMailID: 20190207170152epcas1p254264a82287a54dc2452f5e73daab13d References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 19/22] ASoC: samsung: Drop DAI DMA data chan_name assignments X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP There is now no need to pass DMA channel names through the DAI DMA data, custom DMA config of the PCM is now used for this purpose. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 4 ---- sound/soc/samsung/s3c2412-i2s.c | 2 -- sound/soc/samsung/s3c24xx-i2s.c | 2 -- 3 files changed, 8 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 2e91d183dd41..f012d892e6dc 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1450,8 +1450,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) } pri_dai->dma_playback.addr = regs_base + I2STXD; pri_dai->dma_capture.addr = regs_base + I2SRXD; - pri_dai->dma_playback.chan_name = "tx"; - pri_dai->dma_capture.chan_name = "rx"; pri_dai->dma_playback.addr_width = 4; pri_dai->dma_capture.addr_width = 4; pri_dai->priv = priv; @@ -1466,9 +1464,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (quirks & QUIRK_SEC_DAI) { sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1]; - sec_dai->dma_playback.addr = regs_base + I2STXDS; - sec_dai->dma_playback.chan_name = "tx-sec"; if (!np) { sec_dai->dma_playback.filter_data = i2s_pdata->dma_play_sec; diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index c08638b0e458..a00e35147e50 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -35,12 +35,10 @@ #include static struct snd_dmaengine_dai_dma_data s3c2412_i2s_pcm_stereo_out = { - .chan_name = "tx", .addr_width = 4, }; static struct snd_dmaengine_dai_dma_data s3c2412_i2s_pcm_stereo_in = { - .chan_name = "rx", .addr_width = 4, }; diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index a8026b640c95..600b3b4cdb5b 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -31,12 +31,10 @@ #include "s3c24xx-i2s.h" static struct snd_dmaengine_dai_dma_data s3c24xx_i2s_pcm_stereo_out = { - .chan_name = "tx", .addr_width = 2, }; static struct snd_dmaengine_dai_dma_data s3c24xx_i2s_pcm_stereo_in = { - .chan_name = "rx", .addr_width = 2, }; From patchwork Thu Feb 7 17:00:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 924C3186E for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ED6C2E0BD for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733102E09B; Thu, 7 Feb 2019 17:41:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3E172E0D7 for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AA89F267A56; Thu, 7 Feb 2019 18:02:11 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8DD6D267AB0; Thu, 7 Feb 2019 18:02:08 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id DA532267AA2 for ; Thu, 7 Feb 2019 18:01:57 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190207170156epoutp0414a065d9435af0416cfd5b70fc1d2c68~BI5-imwo32868228682epoutp04Y; Thu, 7 Feb 2019 17:01:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190207170156epoutp0414a065d9435af0416cfd5b70fc1d2c68~BI5-imwo32868228682epoutp04Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558916; bh=d1QdZW54N39Z367Kilg9uJNunzzoarzixDx+XjVp7dU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=FOP6xLF+eEY19tT6ZdJwwQWdXkNKp8ZULPzATG2glxtxRs7x5GnxXbgiDjOPZQZR7 1kTc0wiySqZR0UbOUBzXfKuLVaP1JNFzcms7eAAKd2GbOFRcQFHD7G43+4CtRjbPeu EA0A7cYG3tYAUvRM0zA0GSckedYAdPGKIFlNcK7Q= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190207170156epcas1p330f0f7cb567f9fc9ae14d7599b3b6b84~BI5-USzIl2640626406epcas1p3C; Thu, 7 Feb 2019 17:01:56 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 97.B3.04074.4846C5C5; Fri, 8 Feb 2019 02:01:56 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170155epcas1p42ba30c540d35290c010b5bfa4645e3b1~BI5-FNFPH1738517385epcas1p4V; Thu, 7 Feb 2019 17:01:55 +0000 (GMT) X-AuditID: b6c32a35-297ff70000000fea-93-5c5c6484d60f Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id C9.D8.04015.3846C5C5; Fri, 8 Feb 2019 02:01:55 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00MP9F8VXL10@mmp1.samsung.com>; Fri, 08 Feb 2019 02:01:55 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Date: Thu, 07 Feb 2019 18:00:28 +0100 Message-id: <20190207170028.720-21-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170028.720-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmnm5LSkyMweSjLBZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6MGdPesRVsla74/LSVpYHxpVgXIyeH hICJRMOdM6xdjFwcQgI7GCUmvf7GBOF8Z5To2nGeBaaqp+c3O0RiN6PEvfP72SCcX4wSP09M YQepYhMwlOg92scIYosIiEncntPJDFLELNDCJDFn7lJmkISwQLrE9u5HYDaLgKrEup7ZQA0c HLwCVhJ35iVDbJOXON+7DmwmJ1D41v4dYFfwCghK/Jh8D8xmBqo5eOU5C8h8CYEjbBIP5p5i hWh2kTj6bx0byEwJAWmJS0dtIcLVEru2dzND1HcwSrRc2M4MkbCWOHz8IivEUD6Jd197WCF6 eSU62oQgSjwkLm74zAzxcC+jxMd1PxgnMErNQnLTLCQ3LWBkWsUollpQnJueWmxYYKhXnJhb XJqXrpecn7uJERzlWqY7GKec8znEKMDBqMTDq6EXEyPEmlhWXJl7iFGCg1lJhFc2ASjEm5JY WZValB9fVJqTWnyIUZqDRUmcd72Dc4yQQHpiSWp2ampBahFMlomDU6qBUTHTn01ZJrDAPmaG 45n7Vn8fnV/eXTnl5mmzV8u/z/lTtPN7rOubmZtnzGL+vcTR90vwhosLzPyuqJUmuSkeeVnu 7fWSYau7RdaUN8UGj5ZIVL+8Pke5fO2nG0cDC67E8zKc/LnmhNmeV1/DDl7kitJSuu14t6yy zSWLr3Gyh3ry/WUKs9OWb1ViKc5INNRiLipOBABjE1nA7gIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAd3mlJgYg5f7TC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZM6a9YyvYKl3x+WkrSwPjS7EuRk4O CQETiZ6e3+xdjFwcQgI7GSW6Ti5ggnB+MUo0bn7NDFLFJmAo0Xu0jxHEFhEQk7g9p5MZpIhZ oIlJYtfti+wgCWGBdInt3Y/AGlgEVCXW9cwGauDg4BWwkrgzLxlim7zE+d51YOWcQOFb+3ew gNhCApYSHyY0sYLYvAKCEj8m3wOLMwPVH7zynGUCI98sJKlZSFILGJlWMUqmFhTnpucWGxUY 5qWW6xUn5haX5qXrJefnbmIEBvG2w1p9OxjvL4k/xCjAwajEw3tBOyZGiDWxrLgy9xCjBAez kgivbAJQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/tvGORQgLpiSWp2ampBalFMFkmDk6pBsaU gM9JpfElKrafzyy7L6Zwq8naz+xf5oa7j2pLJ/sn35/n/E9ZxUToVMnzTV+sF8gnHnX9smt9 b3RHiUmq+Utvzsxph/nPphfn8dlY7Y+dGVf1aqFQYeiz9nnruhS2z7/OrW1ckxDvv+LZE/vN nFd71G+K1vZO6vX7xvbxslrNIblLXq/n/FZiKc5INNRiLipOBABNTmiEXgIAAA== X-CMS-MailID: 20190207170155epcas1p42ba30c540d35290c010b5bfa4645e3b1 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170155epcas1p42ba30c540d35290c010b5bfa4645e3b1 References: <20190207170028.720-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, krzk@kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 20/22] ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP There is now no users of this flag so remove it together with related data structure field. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- include/sound/dmaengine_pcm.h | 6 ------ sound/soc/soc-generic-dmaengine-pcm.c | 21 ++++----------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index 2c4cfaa135a6..764c787928a4 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -63,7 +63,6 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) * @slave_id: Slave requester id for the DMA channel. * @filter_data: Custom DMA channel filter data, this will usually be used when * requesting the DMA channel. - * @chan_name: Custom channel name to use when requesting DMA channel. * @fifo_size: FIFO size of the DAI controller in bytes * @flags: PCM_DAI flags, only SND_DMAENGINE_PCM_DAI_FLAG_PACK for now */ @@ -73,7 +72,6 @@ struct snd_dmaengine_dai_dma_data { u32 maxburst; unsigned int slave_id; void *filter_data; - const char *chan_name; unsigned int fifo_size; unsigned int flags; }; @@ -99,10 +97,6 @@ void snd_dmaengine_pcm_set_config_from_dai_data( * playback. */ #define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3) -/* - * The PCM streams have custom channel names specified. - */ -#define SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME BIT(4) /** * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 1b44e363c50c..f1ab6285a085 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -265,7 +265,6 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) struct dmaengine_pcm *pcm = soc_component_to_pcm(component); const struct snd_dmaengine_pcm_config *config = pcm->config; struct device *dev = component->dev; - struct snd_dmaengine_dai_dma_data *dma_data; struct snd_pcm_substream *substream; size_t prealloc_buffer_size; size_t max_buffer_size; @@ -285,19 +284,9 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!substream) continue; - dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - if (!pcm->chan[i] && - ((pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME) || - (config && config->chan_names[i]))) { - const char *chan_name = dma_data->chan_name; - - if (config && config->chan_names[i]) - chan_name = config->chan_names[i]; - + if (!pcm->chan[i] && config && config->chan_names[i]) pcm->chan[i] = dma_request_slave_channel(dev, - chan_name); - } + config->chan_names[i]); if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, @@ -420,10 +409,8 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, const char *name; struct dma_chan *chan; - if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT | - SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) || - (!dev->of_node && !(config && config->dma_dev && - config->dma_dev->of_node))) + if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || (!dev->of_node && + !(config && config->dma_dev && config->dma_dev->of_node))) return 0; if (config && config->dma_dev) { From patchwork Thu Feb 7 17:02:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12350186D for ; Thu, 7 Feb 2019 17:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3B192E0BD for ; Thu, 7 Feb 2019 17:41:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E82D52E0D0; Thu, 7 Feb 2019 17:41:22 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80EF32E0CA for ; Thu, 7 Feb 2019 17:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 39378267A5A; Thu, 7 Feb 2019 18:02:51 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5523F267A53; Thu, 7 Feb 2019 18:02:48 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id 51A5A267A05 for ; Thu, 7 Feb 2019 18:02:46 +0100 (CET) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190207170244epoutp01c80b02be00c9a0574b6b80a7c19ce577~BI6sl5Vrt1148811488epoutp01e; Thu, 7 Feb 2019 17:02:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190207170244epoutp01c80b02be00c9a0574b6b80a7c19ce577~BI6sl5Vrt1148811488epoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558964; bh=J2fEmrpa9P+9AF6G1uzK4HmVkrvrdiclGfzK5O2Xtxk=; h=From:To:Cc:Subject:Date:References:From; b=acZJ2Ap5Ji9PvsYiMxa7qjLGjAY0bC4dgsEzYo1kgw/AM8rFncCnVmkeL6vbSvCYU yuQw6v5cE9jsTM/UdFgRRxhDf5XrNa6eDsH8rvteyYScpDu+nhARtj3SdVNZD3xs7R XyVQD6KPuH4UsjQDtyXSNsOVU0FVUnnWuHl5MfXA= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190207170244epcas1p487d24a7d4290f14f00ccc97ba06d9584~BI6sSu1Nj1738517385epcas1p45; Thu, 7 Feb 2019 17:02:44 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 22.E7.04069.4B46C5C5; Fri, 8 Feb 2019 02:02:44 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190207170244epcas1p3f0037d3a98ed63b71e8daf14090befe3~BI6sEIiLK2941329413epcas1p3E; Thu, 7 Feb 2019 17:02:44 +0000 (GMT) X-AuditID: b6c32a37-971ff70000000fe5-a8-5c5c64b4d798 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 9B.D8.04015.4B46C5C5; Fri, 8 Feb 2019 02:02:44 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00KT6FC5GS70@mmp2.samsung.com>; Fri, 08 Feb 2019 02:02:44 +0900 (KST) From: Sylwester Nawrocki To: krzk@kernel.org Date: Thu, 07 Feb 2019 18:02:17 +0100 Message-id: <20190207170218.851-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRmVeSWpSXmKPExsWy7bCmge6WlJgYg7XbJC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZP6Z9Zy7Yz1Fx5FkXcwPjB7YuRk4O CQETiYdPLjN3MXJxCAnsYJRY1fKXFcL5zihx89EuRpiq2dM/QSU2MEp0LH3FBuH8YpTY8qiF FaSKTcBQovdoH1iHiICwxL2ly9lBipgF2pkk1l66xgySEBYIk/h5eSlYA4uAqsTR71/YQWxe AUuJY7duQ62Tlzjfuw4qLijxY/I9FhCbGSh+8MpzFpChEgIr2CT6X3ewQzS4SOx8+xcowQFk S0tcOmoLEa6W2LW9mxmivoNRouXCdmaIhLXE4eMXWSGG8km8+9rDCtHLK9HRJgRR4iGx+9JK sL1CArESe44uZZrAKDkLyUmzkJy0gJFpFaNYakFxbnpqsWGBsV5xYm5xaV66XnJ+7iZGcDRr me9g3HDO5xCjAAejEg+vhl5MjBBrYllxZe4hRgkOZiURXtkEoBBvSmJlVWpRfnxRaU5q8SFG aQ4WJXHe9Q7OMUIC6YklqdmpqQWpRTBZJg5OqQZGxlTDDoGK4tx1a69lxZ+04OT1Tzf59ZyX 18TwSGeu8Zlbu5WZbT6dma088dmtZV/v2dyNudm72UuI1adT+tjCnvKDATmSpxmDC8/rKFpV FO/q3pWpt9qgXsUl+HQ0S0Wuqv39WRZz6k6cenxv65U7hhtFTlmeiMuNT+417dk43+6wXJbf vwYlluKMREMt5qLiRABX5U014gIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCLMWRmVeSWpSXmKPExsVy+t9jQd0tKTExBsuecFpcuXiIyWLjjPWs FlMfPmGzOH9+A7vFtysdTBaXd81hs5hxfh+Txdojd9ktDr9pZ7W4uOILkwOXx4bPTWweO2fd ZffYtKqTzaNvyypGj8+b5AJYo7hsUlJzMstSi/TtErgyfkz7zlywn6PiyLMu5gbGD2xdjJwc EgImErOnf2LtYuTiEBJYxygxafklRgjnF6PExRfHmEGq2AQMJXqP9jGC2CICwhL3li5nByli FmhlkljzeiU7SEJYIEzi5+WlrCA2i4CqxNHvX8DivAKWEsdu3WaEWCcvcb53HVRcUOLH5Hss IDYzUPzglecsExh5ZiFJzUKSWsDItIpRMrWgODc9t9iowDAvtVyvODG3uDQvXS85P3cTIzAs tx3W6tvBeH9J/CFGAQ5GJR7eC9oxMUKsiWXFlbmHGCU4mJVEeGUTgEK8KYmVValF+fFFpTmp xYcYpTlYlMR5b+cdixQSSE8sSc1OTS1ILYLJMnFwSjUw2pvzz9zbvVHSMs6HN3NR6qNliRHT drxqbj8vwml841rQA6nLK/vyPHpnvmF5uo0t1/Xpc1fjr2senGE/4pFWzeC9c+mT5JZLJZme ie4d6nFV+ka9joKr3c1W2O79HrXi09Pnf5h1+lb2Pf780jHNO3bN5/v+Zz6w8hev9TzU+Evd VnRtJe9hJZbijERDLeai4kQATZHs7EcCAAA= X-CMS-MailID: 20190207170244epcas1p3f0037d3a98ed63b71e8daf14090befe3 CMS-TYPE: 101P X-CMS-RootMailID: 20190207170244epcas1p3f0037d3a98ed63b71e8daf14090befe3 References: Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, broonie@kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 21/22] ARM: dts: exynos5422-odroidxu3: Add support for secondary DAI X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch extends DAPM routing and adds secondary CPU DAI entry to support the secondary audio PCM interface on Odroid XU3. Signed-off-by: Sylwester Nawrocki --- arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi b/arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi index e84544b220b9..51a843bd65ed 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi +++ b/arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi @@ -24,7 +24,9 @@ "Headphone Jack", "MICBIAS", "IN1", "Headphone Jack", "Speakers", "SPKL", - "Speakers", "SPKR"; + "Speakers", "SPKR", + "I2S Playback", "Mixer DAI TX", + "HiFi Playback", "Mixer DAI TX"; assigned-clocks = <&clock CLK_MOUT_EPLL>, <&clock CLK_MOUT_MAU_EPLL>, @@ -51,7 +53,7 @@ <196608000>; cpu { - sound-dai = <&i2s0 0>; + sound-dai = <&i2s0 0>, <&i2s0 1>; }; codec { sound-dai = <&hdmi>, <&max98090>; From patchwork Thu Feb 7 17:02:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10801675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5026B18E8 for ; Thu, 7 Feb 2019 17:41:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D1D92E09B for ; Thu, 7 Feb 2019 17:41:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30F392E0CF; Thu, 7 Feb 2019 17:41:24 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0E9C2E0CC for ; Thu, 7 Feb 2019 17:41:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B4404267AA1; Thu, 7 Feb 2019 18:02:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F0DD0267A53; Thu, 7 Feb 2019 18:02:57 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 9F1512679E2 for ; Thu, 7 Feb 2019 18:02:52 +0100 (CET) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190207170251epoutp024f250e9dcd5174868bfbdf066908210d~BI6yjA48C0594405944epoutp02L; Thu, 7 Feb 2019 17:02:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190207170251epoutp024f250e9dcd5174868bfbdf066908210d~BI6yjA48C0594405944epoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549558971; bh=4BtKSXjyFABIOkbv9PZbmRs71Y9FKXhmWxqvv2v/ukY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=X2sEsIpKS6rXIondiO2s2h26PWBV7P/GJIYLFW3fC/qPTgTZk5irdWGTE8P6KEI4p Wn6mYIYTw7kLUQbJSjbSIdsDgGzlWsCntP9eo8Y/OP26rTMsM7udhEOJe6BqERFKNM S5310aLXDsxYcS+79onPW9ZHU9ntupoW0kVoM6Hg= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170250epcas2p33d3f59e286f844df3ea271ea9b8c5c26~BI6xfrRia2816128161epcas2p3c; Thu, 7 Feb 2019 17:02:50 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 05.A7.04138.9B46C5C5; Fri, 8 Feb 2019 02:02:49 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190207170249epcas2p3ece5f4f132365051527cb0d3a5d80b02~BI6xRxv4t0502405024epcas2p32; Thu, 7 Feb 2019 17:02:49 +0000 (GMT) X-AuditID: b6c32a45-60bff7000000102a-49-5c5c64b98e3a Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 7C.C8.03689.9B46C5C5; Fri, 8 Feb 2019 02:02:49 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMK00KT6FC5GS70@mmp2.samsung.com>; Fri, 08 Feb 2019 02:02:49 +0900 (KST) From: Sylwester Nawrocki To: krzk@kernel.org Date: Thu, 07 Feb 2019 18:02:18 +0100 Message-id: <20190207170218.851-2-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190207170218.851-1-s.nawrocki@samsung.com> MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7bCmhe7OlJgYg/NLrC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZV45KFpxhr9j7+RNjA+M0ti5GTg4J AROJ3XO/s3cxcnEICexglFi1vIkRwvnOKPF97Td2mKrnC3uZIRIbGCUevdkLVfWLUeLtz9eM IFVsAoYSvUf7wGwRAWGJe0uXg81lFmhnklh76RozSEJYIEziydV3LF2MHBwsAqoSLefB6nkF LCWuf37MArFNXuJ87zqwzZwCVhJrt05kgagRlPgx+R6YzQxUc/DKc6j6PWwSfQ1yELaLRMPL lUwQtrTEs1UbGSHsaold27vBPpAQ6GCUaLmwnRkiYS1x+PhFVoihfBIdh/+yg9wmIcAr0dEm BFHiITF/cS/Uw72MEtueH2adwCg1C8lNs5DctICRaRWjWGpBcW56arFRgaFecWJucWleul5y fu4mRnCMa7nuYJxxzucQowAHoxIP7wXtmBgh1sSy4srcQ4wSHMxKIryyCUAh3pTEyqrUovz4 otKc1OJDjNIcLErivI+k50YLCaQnlqRmp6YWpBbBZJk4OKUaGNlO1sgsn7rgrvm9JVu92hfv sD115dsHpoxXb6+rb+va8Mn450bRzuS5V+TEllw6NOtL+eMvHEvE0pb0Fx91ypoSdNNWNoHP Wtqm6uKmxkqG1T7xHe6s/t+Dbtz5oRvu52sc9pjzRye/a3pJRFLLzBQB9lUmPbmzdp8Rmnz5 0NKGdqXIKcWKXUosxRmJhlrMRcWJACe0U27tAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jQd2dKTExBmtfaFlcuXiIyWLjjPWs FlMfPmGzOH9+A7vFtysdTBaXd81hs5hxfh+Txdojd9ktDr9pZ7W4uOILkwOXx4bPTWweO2fd ZffYtKqTzaNvyypGj8+b5AJYo7hsUlJzMstSi/TtErgyrhyVLDjDXrH38yfGBsZpbF2MnBwS AiYSzxf2MncxcnEICaxjlFh6vpsdwvnFKHHsaRtYFZuAoUTv0T5GEFtEQFji3tLlYEXMAq1M Emter2QHSQgLhEk8ufqOpYuRg4NFQFWi5TxYPa+ApcT1z49ZILbJS5zvXQdWzilgJbF260Sw uBBQzb1zE1kh6gUlfky+BxZnBqo/eOU5ywRGvllIUrOQpBYwMq1ilEwtKM5Nzy02KjDKSy3X K07MLS7NS9dLzs/dxAgM4W2Htfp3MD5eEn+IUYCDUYmH94J2TIwQa2JZcWXuIUYJDmYlEV7Z BKAQb0piZVVqUX58UWlOavEhRmkOFiVxXv78Y5FCAumJJanZqakFqUUwWSYOTqkGxlkd574J 1r62inppZ1idEul889RSbZbbZqtVTD8eC8x08E/Y8Tn2a1Q8x27tlkf/6taZRP3w+vjusKNw 8f7DwTFX5/7IX9vPLXp/gaM/92GrJ0F8QmGTkyMdtd34C7TeecY6L4/59sNO5N0Hj84Ipmi3 TbO/bZBcNp1VyK4wVH4F/551/orRSizFGYmGWsxFxYkAzAGNyV0CAAA= X-CMS-MailID: 20190207170249epcas2p3ece5f4f132365051527cb0d3a5d80b02 CMS-TYPE: 102P X-CMS-RootMailID: 20190207170249epcas2p3ece5f4f132365051527cb0d3a5d80b02 References: <20190207170218.851-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, broonie@kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH 22/22] ARM: dts: exynos5422-odroidxu4: Add support for secondary DAI X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch extends DAPM routing and adds secondary CPU DAI entry to support the secondary audio PCM interface on Odroid XU4. Signed-off-by: Sylwester Nawrocki --- arch/arm/boot/dts/exynos5422-odroidxu4.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts index 122174ea9e0a..892d389d6d09 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts +++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts @@ -33,6 +33,8 @@ compatible = "samsung,odroid-xu3-audio"; model = "Odroid-XU4"; + samsung,audio-routing = "I2S Playback", "Mixer DAI TX"; + assigned-clocks = <&clock CLK_MOUT_EPLL>, <&clock CLK_MOUT_MAU_EPLL>, <&clock CLK_MOUT_USER_MAU_EPLL>, @@ -58,7 +60,7 @@ <196608000>; cpu { - sound-dai = <&i2s0 0>; + sound-dai = <&i2s0 0>, <&i2s0 1>; }; codec {