Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752928AbbKXHDs (ORCPT ); Tue, 24 Nov 2015 02:03:48 -0500 Received: from mail-bl2on0116.outbound.protection.outlook.com ([65.55.169.116]:4532 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752732AbbKXHDg (ORCPT ); Tue, 24 Nov 2015 02:03:36 -0500 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; From: Shengjiu Wang To: , , , , , , , , , , , , CC: , , , Subject: [PATCH V3 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device Date: Tue, 24 Nov 2015 15:03:29 +0800 Message-ID: <6f03afc87c7958b975df66b163c1186be979afb6.1448348336.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;BL2FFO11OLC012;1:EIGU3WolA1il5EUHpgN7UGuG7HpfhBoeB4UdJuwVdxPavAjkpxpC0T0mi3+yxMzXq4d4L5+JHLVlhkDlV2XNHpVh9nL9soUYN10EWS7h4tvLkz1vU4IuBR8RK18M3WcNPj4ATaga+whkhA5oUODUuivQgraq4b3MJPcy223EjQyO5gy3JyMxqpXbqyM2l9XJewqvGIlaxM1WsWFmIAIcdHSYLFAw+hiyGy8PE9QM+su61WYW7hAu9THOVdiPKzHJDSl0E9bBkIYeRGB5k5sirPg/BmSBj+8x8Pl/CGQ+xtu0Gk3tstAmgm/ISeVPFaL43wgzRUEg7Mde3QLShdQliXJGsfhMyEeOdUBAmGebb97MSMjSPM5hwhwn1AkUFSckTpO2vmRQm6wBbX7vq2ZKXg== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(50466002)(86362001)(50226001)(5001960100002)(69596002)(76176999)(11100500001)(48376002)(118296001)(106466001)(19580405001)(92566002)(2201001)(85326001)(87936001)(33646002)(2950100001)(50986999)(19580395003)(6806005)(5003940100001)(5001770100001)(77096005)(104016004)(189998001)(36756003)(81156007)(586003)(47776003)(229853001)(5001920100001)(5008740100001)(97736004)(5007970100001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB1232;H:az84smr01.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB1232;2:LfNHnsrH2MNsD69FCcliHFuoINJo3ZFwhCoQBrcydUhCQgojp2p1oRZHUD0c4CkagA6184rCe7fLieAfr1RV5F71BbJgLKyb5pdkcus14Mt3j/+cYimi2mc0pcASQ8Y2o5hgPQTSQkXxIqM6ejuanoTP/2ZsRkslALKu99OXGyE=;3:uDiB8YNnoyOR/UWp/NivPXsyMyMiBPjIdyu8awE6hTWuY0Ei55fBby0IvIqMWtVBrlZeoA1gMeigCes0mQQpqb9/hpdeORVd8aA6dvp7YThuPEGVABkyhuBf1Rg2Qu7lfFgotNe/WOGbUPJEryMn9BfWr1H+OBftXe7tR/A6i+pDVNdsRTZQjXUir1MHIUZ9hITDUNzxLCanxwPadxuPAn5jdIpLDmYPIInTk/YnV4I=;25:5jSbhSs/FY/j1uUhC45DqKA+8l7XDPSg/ukfEABYnQmpF3XrxR6xMKi81fpPLcPK/FKR59B20Tw9C33Iqv+X/Y3kcmRr/ggCKv8VHPG2EYLJyfqU2xcFccn1aI5nWjYqnlQPondt/hKu8Du2vaK8H0YIVJsFBCn8O14L/KzeWMeXJf4Z2G2G/KEPjV8zHInUe0eV8yCHBvd7XOLQjljfCMaxBm91ngMmuWJ2gmbp7J2EfYsDZREn1bk/V9XtCLwail0mwYHl61/AMK43kEA1xA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1232; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB1232;20:tiAvMCQFI2PtshT3uSdAC8UucpDJTeFTHzqQaCH5s9UQlFjxXZDOPZTtM9RTJ6H9flgX5BjpWM+Z77b20JkEKD3cmRISJct8H+fjt3Y23vgXeL1ZvajUUjclFf7JrRt7CSiGqmm4N8JtG7jMTJxBdfTA4IFYJ7BvXxy0JgQfDZ8E57al4g9ASiGafXH91SNgD/1Lev4A8+F82p8oyASKEly4mOOqwdnxWtfWf3YKGa4Ngs0TngrdZJ5EYPK4K6B2B+Ah7wfc0jCICJyKuMUmvyf0k9i735sBf+XwIR361rCPlIKj9lRE4XzjVyt4juM8N+bi0bJI6q/Jab+5WS+hGxeqVJY1PgNMmn9U89yJKFc=;4:IqzlKGcOqRk/ByPRlVzYpET+4idQNZG0yC1XWntlCs371pEZoWepSDP87xnPFYy7zUhTuh9AnP/MqXxVTBhac/cBfzmwMJgX0BRJulmDgGAhbAlSj2E1gtIKlS0+IgolhMFFXyYur+oG0eFnBEUh1rH+iI0szJx9nsyrUUuwwj33use0ZM8XsdyOXwLT8vqb+R+usVyobr8uoCnX6zCYkrYh4Jz9ziBZ44qOq9lRiR4WX6xuZ+JfCaw2N/eLeyqAu8+SZPuS0LYJ5mATUbPUCDBKLkyXNeB/op3DGnBSQXpkHZok/bNoCk91XlfoNLakvRD0b7p6y7qCkFRC0U0JQEKolwXdC1GREjRprNdBr9WMpTWeKIb0g8/CPDcYHXmi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046);SRVR:DM2PR0301MB1232;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1232; X-Forefront-PRVS: 0770F75EA9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR0301MB1232;23:sws1COlfJ+0LyplXT/8kOgiUAo+zL5ZRTQWmCZf?= =?us-ascii?Q?De2oS3w1enjw37rAuwyz8bgECtFDFT17J5M3MgdXq2t+G2YTSg91lx3Eq3VK?= =?us-ascii?Q?mUKwVbELG2QJb759xk8rq0uzReweye+NXkNVi28aVs4QCYwmjAjoTMf/l5ob?= =?us-ascii?Q?R16En2UezYe+iKl4hTsPi22WQF54JtrbV4UPns2mHdzbfcw3LfYfNiVCCIA9?= =?us-ascii?Q?a1PQKxja70hflRf9T2rTYoN5/MatDeNbakH3QjX2SsBAzKxESHEXHJNAN8gc?= =?us-ascii?Q?xUykRYWJMFt6EdSPRgR3ZjpGv2O4bs6GkvrsRRVnCsDSRl0vIQVJ0cyn7/vL?= =?us-ascii?Q?5pu//+4sRES3gbPQNudhq7qiyf8bhL9XCHw1VTKav58X+6Haq4PkspR2141N?= =?us-ascii?Q?ILGsaC6pVolsym5DJo90udz8vhOeML5PeR3zr3Tsak2J1oD3eMEHWD26Xl4G?= =?us-ascii?Q?Uv/TQXJh4379x/dvPGStnXj3qWUubdOKGTMomumpvDoCmxiE59i+hlXcnApa?= =?us-ascii?Q?LRHBEpfpUELiGOcxsCxPrSvbBhhWYitMnQeSX2A6c5KlxlEeXmYrhZ4fchIS?= =?us-ascii?Q?Fw5H5ygl822NVB0tk5kAhtAMIufK7XtTcDARI/lbV8pVAjGUI/hgvbOLs69D?= =?us-ascii?Q?2jOFcGWjmlzWl5fWEIe7uGS/rBB9oZiY7CnLSR76Owone6pFfIP5Eg92/cvN?= =?us-ascii?Q?132vF03gJ80+GLQxWcIbWNLEAIVaRCiY6husRc7Fr5M56lzKpExOMKRbS3OP?= =?us-ascii?Q?zTBrgbLO59GiALftWEoOCb89nxt/IjMBPNYWK2kTVE7waf21T26/1fJj1yFa?= =?us-ascii?Q?l1hkoURG0kJPPgQOHCTvVxF3V4iz2QLuIIxckP8bMf7Be+bQ7RgLM6e3Lkz0?= =?us-ascii?Q?Iba03Bpn+i8TE+SBEmETSHmYOolbj1VmMtwVUtO4nJDDeXuJGO/B7vxIJ8Dw?= =?us-ascii?Q?EXJcyAQiIkMS4b0wMRTVNX4Anhpe6wp1jUb2G3TM+wDpF1i25Qmo/pLp0q13?= =?us-ascii?Q?v99SuBkIuY2efm6LB9Ev++tFnh5ojmQc9HlKMD2D72leeZbqZeNcoUVdjupQ?= =?us-ascii?Q?nYeuBnOsnH8f5+mskumUdHoxnRnRU+wJRMrmQrJ+8coOPPhmfBA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB1232;5:Wfx2xRVvVOWV7C89fU2cfvy/U2i06Vv27HKIw+6UBGSqDgJAEXuP+PmGS9KxEbnDczCVXK7uhVDcXil/AJxq3+i5TpwJaxPuqqdvM7/L5mnZVSEZAio058xXKbf4aApUZ/WFp52YZRurzfQu9VIp0w==;24:/8JcPMVC5DOnBBxMfXSEyvNlnLIFt58N2FgzmnL7acSE8L4a5qs/Aw5vzVOJ8YSyWr1yIrbbpSB70siWJV0uYleCXMri34cTYBULWv/qGE0=;20:fhgREU+1WFsPmf7rXRGZnB6OXq7lnR4ztOGjpDbgkFI5hAJVxom69FMVAtoygrCGbciyFhOPBp8WwdANP8mjdA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 07:03:33.1970 (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: DM2PR0301MB1232 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3716 Lines: 96 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 | 15 +++++++++++++++ 2 files changed, 20 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..64e2a1f 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,12 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, return ret; } + 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 +523,8 @@ disable_txclk: for (i--; i >= 0; i--) clk_disable_unprepare(spdif_priv->txclk[i]); err: + clk_disable_unprepare(spdif_priv->spbaclk); +err_spbaclk: clk_disable_unprepare(spdif_priv->coreclk); return ret; @@ -548,6 +558,7 @@ 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); + clk_disable_unprepare(spdif_priv->spbaclk); clk_disable_unprepare(spdif_priv->coreclk); } } @@ -1261,6 +1272,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)) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/