From patchwork Tue Nov 24 09:19:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 7688441 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 531899F1D3 for ; Tue, 24 Nov 2015 09:21:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64BEC20804 for ; Tue, 24 Nov 2015 09:21:23 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DCAC0207F3 for ; Tue, 24 Nov 2015 09:21:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 13ADB265B61; Tue, 24 Nov 2015 10:21:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9964D265DA8; Tue, 24 Nov 2015 10:20:18 +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 E953B265DA9; Tue, 24 Nov 2015 10:20:17 +0100 (CET) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0142.outbound.protection.outlook.com [207.46.100.142]) by alsa0.perex.cz (Postfix) with ESMTP id B71AF265CA8 for ; Tue, 24 Nov 2015 10:19:40 +0100 (CET) Received: from BLUPR03CA007.namprd03.prod.outlook.com (10.255.124.24) by DM2PR03MB559.namprd03.prod.outlook.com (10.141.83.156) with Microsoft SMTP Server (TLS) id 15.1.325.17; Tue, 24 Nov 2015 09:19:38 +0000 Received: from BN1AFFO11FD018.protection.gbl (10.255.124.4) by BLUPR03CA007.outlook.office365.com (10.255.124.24) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Tue, 24 Nov 2015 09:19:36 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=freescale.com; Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Tue, 24 Nov 2015 09:19:36 +0000 Received: from audiosh1.ap.freescale.net (audiosh1.ap.freescale.net [10.192.241.212]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id tAO9JJce007634; Tue, 24 Nov 2015 02:19:31 -0700 From: Shengjiu Wang To: , , , , , , , , , , , , Date: Tue, 24 Nov 2015 17:19:33 +0800 Message-ID: <02a93459781754faa531e37abb74470f9c90fafd.1448356624.git.shengjiu.wang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:HgwUhz2qMGxaepY2/aUPEJ9tLEV1bh+S/FWpbxYH7pYtuXyi8Mcx+qfh7DfWPDdGbP3jsmKpji5VVvnk7gGEQ3FY1fQmx1ETIjmgY2rtUBYULLN0ZyI9DPqEMSNO0cDBbMRpv+lrzhzDD44+oy/St25n4QzC+Q6e+3NwCUKRZ53WlR7UU/kl4YCCqJ013H8nNyxIF6PdEjQU1b8PBMEO86/dxY/3tFZCgiwnYIBMV4IOA5/KuMyjeVyuG417PPpGCABdIvBUrXOV2foxaIMKl61SbP+dzKToBKh45basItRo70Jhjd9JYpHCFzv9bjQlbI7anrVzUs0nZFV7ahPa432GRbwAUgNGYHBAltdwrD5dxP245QyTFKApyOzeVVOqwMlXLHeesUhz1X+hS7kDpw== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(87936001)(19580405001)(50466002)(11100500001)(86362001)(5003940100001)(47776003)(586003)(48376002)(50986999)(76176999)(5007970100001)(33646002)(92566002)(77096005)(2201001)(69596002)(5001920100001)(189998001)(81156007)(229853001)(85326001)(106466001)(104016004)(118296001)(5008740100001)(5001770100001)(36756003)(2950100001)(5001960100002)(19580395003)(97736004)(6806005)(50226001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR03MB559; H:az84smr01.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB559; 2:RiiXbDcrLP+eOr7DRWpmPhXmJ38JSwPvum43p2+Qo/8JPOhHbANIgoXbbd9WfCfSvtKO4MS+XDuT+4u4vMetALvEiHsJ3koBbZo19kQNVm/G82YhaFsMZXHeXJFKqCt8zhzMhfUvu+m5AYvLfmCCDBLcgNCytGF1wnfzklgQw/Q=; 3:BEM2NTaiJWdRnquNazC1noWhV4kTnZ6Pni1KaQycKMEmpGfbL3XT/pEQMHjh+d1s+FC3LSTBtLBb3hnI+RpE6/79qe7kyidGy+N23+QgE6nzzbMZT06ar3bS5rHJX3m4sKQ6Wz2zdspDHqyVDml0XSzPQ80uxm6RZLIVmaEtkZgWlFWwP+/ndpJMSo1Od6o3FHJx1geH2OKfP3JY26dy/YoK1l97qUsKn4HxOPrFt8k=; 25:7v74+7xjpF44SlSvBKfI8UXSBr1UWqZT0u4kUjgTFQl9OSavxaj6HdWg/J9T/ySSY5vFtJxsIE9ARD7AizTNbAnvjnSWm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UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:DM2PR03MB559; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB559; X-Forefront-PRVS: 0770F75EA9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB559; 23:f8f0h5WZ0JcPGI2rl7UJgSpl0v9tkhLC8hn+2+stt2?= =?us-ascii?Q?eDDPq6t/4w4lgv8akeWthQRzWtKYiVFjzMf+WBJnGIMjr7J7zcU2PGAXYEoB?= =?us-ascii?Q?dAdDDtpTSnAf7I5TkMcucKH8jjoAopT6zAqKjqU3o+DNB2H188wejg6pqamG?= =?us-ascii?Q?TgpA/qBx2TpPvAP4WMWjzScv45+WcTWgiz1xctSYUCJNK9gND9YIyqPwtjUg?= =?us-ascii?Q?SCJhzpzOwnkC0ZtZRh2fdXcU1As5YfvkCkNAgDDsZLbwkBvtIOCgjW8PiW3W?= =?us-ascii?Q?79Kf7Y0Mv1mRw5adsTZ3LXWHhcBDeOyOoQtGW7NcEJbL4TLsuUVbLPPEMou2?= =?us-ascii?Q?440YWmtxLx4cgh+mT93ClRYE6ZFPiR6p8MwL41K3Gahd/HMB0G2K25TJ1dva?= =?us-ascii?Q?Mh/XQ/jk2GQnoCxLNeVVCVtXcZDHl1rapfO4JfTXgxijw7lvx02EPmO792DB?= =?us-ascii?Q?fW4YyPHG4d4kQOe+3XKP5mg/dIPgcLRpz38lpRzx6lFSEkCKYiVWEEtGpiQQ?= =?us-ascii?Q?d/bvdz5L5YMKpSgJRBugZkTQT6C8Hx3xXPuzUSFXT6LfjmeIDh8fra5ip789?= =?us-ascii?Q?eKkDALW6S3k4v8MCGPYA0APikNrUdxbgZT/QpgFf+ultX25+KeZ1jwg7FaBr?= =?us-ascii?Q?NlezKr9/7ntFR94IHh23VccBh1yE5oop4hb/qy1DLOPluXIBK0hB0ldK1T8M?= =?us-ascii?Q?SqFBmMjt8gTcjuzruaTfq6e3XIzhasAGnKMRtkQZMj21GKWgSwUU5irhzaZM?= =?us-ascii?Q?KMS3UM+sHdpdmBDsMdZqPbFf3Ctl5u6FuiMIw9qq6IvlsKqCy9gxVHrLK7Z6?= =?us-ascii?Q?Kn21Py/oEJoi+TP6hVxsr/RsvNtH3TIg6nDbFcMVeA7uwC1vkuz+HF0wKGNR?= =?us-ascii?Q?Vn6YmWlmnSanHRO1QFZnbXHPSDxoYcsHWyry4qxlMO8q4ndEbM9T5uACBmVF?= =?us-ascii?Q?hX5T6+IwFWnfZeBpKWZdXWId6yvfDTIB9xBuGreB8eP0Uhqd1SoZIV3eMOVY?= =?us-ascii?Q?U5TFrg5GeBuLXVdrfLExAL39lBEFC0GQLVlUROIjNTexaOcvT8eYs4kInjB1?= =?us-ascii?Q?YovUbKvTe0wlhTfkEQAhof3pv+hfeRlhfQRYUfRXhq5OWnMA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB559; 5:ZJgM0kiJKGvNA0VZ8juNZwSRlGXK8YX/9syN2w0QFguXycvre2M5Dqb28SeteeRSf02MPBMcZ6GthZQaV1ZP4oU6Eo6hdaRLIdAFsz/crBOpSNEONUND2hR+n9pZFt/Wg01Kx2L3VXLo/YQcS47H2w==; 24:TOyG+DdfDCLcMYCJR9iCs2hhDT1j/+/vBYjkdiIHxz5N7bKnHZmt5BpJ+APFmBp9/kBN9VHFi+ksBn0tCBYohiTUoQ5g8/0O3NQff/Nzh88=; 20:XzQFn+zkuKSI4NKpF3yz2hiCFHTG5tKetIzVsTEw2SCiV8LWEsqaejaGzZj9jjy655oZVB7fvssnoJfvigysFg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 09:19:36.4221 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB559 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH V4 2/3] ASoC: fsl_spdif: spba clk is needed by spdif 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 SPDIF need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to SPDIF registers. Signed-off-by: Shengjiu Wang --- Documentation/devicetree/bindings/sound/fsl,spdif.txt | 5 +++++ sound/soc/fsl/fsl_spdif.c | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt index b5ee32e..4ca39dd 100644 --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt @@ -27,6 +27,11 @@ Required properties: Transceiver Clock Diagram" of SoC reference manual. It can also be referred to TxClk_Source bit of register SPDIF_STC. + "spba" The spba clock is required when SPDIF is placed as a + bus slave of the Shared Peripheral Bus and when two + or more bus masters (CPU, DMA or DSP) try to access + it. This property is optional depending on the SoC + design. - big-endian : If this property is absent, the native endian mode will be in use as default, or the big endian mode diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 28a8823..151849f 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -88,6 +88,7 @@ struct spdif_mixer_control { * @rxclk: rx clock sources for capture * @coreclk: core clock for register access via DMA * @sysclk: system clock for rx clock rate measurement + * @spbaclk: SPBA clock (optional, depending on SoC design) * @dma_params_tx: DMA parameters for transmit channel * @dma_params_rx: DMA parameters for receive channel */ @@ -106,6 +107,7 @@ struct fsl_spdif_priv { struct clk *rxclk; struct clk *coreclk; struct clk *sysclk; + struct clk *spbaclk; struct snd_dmaengine_dai_dma_data dma_params_tx; struct snd_dmaengine_dai_dma_data dma_params_rx; /* regcache for SRPC */ @@ -474,6 +476,14 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, return ret; } + if (!IS_ERR(spdif_priv->spbaclk)) { + ret = clk_prepare_enable(spdif_priv->spbaclk); + if (ret) { + dev_err(&pdev->dev, "failed to enable spba clock\n"); + goto err_spbaclk; + } + } + ret = spdif_softreset(spdif_priv); if (ret) { dev_err(&pdev->dev, "failed to soft reset\n"); @@ -515,6 +525,9 @@ disable_txclk: for (i--; i >= 0; i--) clk_disable_unprepare(spdif_priv->txclk[i]); err: + if (!IS_ERR(spdif_priv->spbaclk)) + clk_disable_unprepare(spdif_priv->spbaclk); +err_spbaclk: clk_disable_unprepare(spdif_priv->coreclk); return ret; @@ -548,6 +561,8 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, spdif_intr_status_clear(spdif_priv); regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_LOW_POWER, SCR_LOW_POWER); + if (!IS_ERR(spdif_priv->spbaclk)) + clk_disable_unprepare(spdif_priv->spbaclk); clk_disable_unprepare(spdif_priv->coreclk); } } @@ -1261,6 +1276,10 @@ static int fsl_spdif_probe(struct platform_device *pdev) return PTR_ERR(spdif_priv->coreclk); } + spdif_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); + if (IS_ERR(spdif_priv->spbaclk)) + dev_warn(&pdev->dev, "no spba clock in devicetree\n"); + /* Select clock source for rx/tx clock */ spdif_priv->rxclk = devm_clk_get(&pdev->dev, "rxtx1"); if (IS_ERR(spdif_priv->rxclk)) {