Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934752AbbKTGeA (ORCPT ); Fri, 20 Nov 2015 01:34:00 -0500 Received: from mail-bn1bon0112.outbound.protection.outlook.com ([157.56.111.112]:53522 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759333AbbKTGdc (ORCPT ); Fri, 20 Nov 2015 01:33:32 -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 V2 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device Date: Fri, 20 Nov 2015 14:17:52 +0800 Message-ID: <13b069f41f05e1d37ba7d698b2bb5417639055c3.1447997800.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;BY2FFO11OLC013;1:Gd2T5RUeZbACtee/theD44xKNKpS3whuSg6QbuQEUWqXe4nxQwqf5BWCe9AlVVxohtTYpB85J7cagv2fY+MYPU/FSKJGh94elhmYf2nBMqiV/iBzp75ZlSM3s45Oo2J5JWIL/VrvWmBUQ130Ug9MSdOYdbDfAR7ZVPHvA/wksZ1lNEHYQi9ZMyxNpyhSK4wxwBZUsb012kQZf8o5XngPozVLqNU6940/faCZwTjPdImUu48M9B6N9M/jWVHGhsg9G0ApFeU/kB3nl2TZcgb1xbExUA8ugSi6Iwjt8EHYLTEWwoPj9HOGhWZAgzxVFcAOf6D05qujn9zl82npwWmajDgPQoQRCPLGG/xbuZ6a7AyuYx38Nqtlazp8Dto9ZHdDqMvR/FQUDVeCXjtnru2vuQ== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(97736004)(5008740100001)(50226001)(87936001)(11100500001)(106466001)(6806005)(229853001)(19580395003)(50466002)(586003)(48376002)(92566002)(36756003)(104016004)(189998001)(69596002)(81156007)(5007970100001)(33646002)(76176999)(47776003)(50986999)(2950100001)(118296001)(77096005)(19580405001)(85326001)(5001960100002)(5001770100001)(575784001)(2201001)(5001920100001)(86362001)(5003940100001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB1230;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;DM2PR0301MB1230;2:XrZhKQFm3nhSVFivXYVYJ/4mzyIRETY5zZKwBYBv1CSe6Id0u3Okbo7Y7KroMrG2kRTeIG75SJOu58NJGO3JMKw4WSuhvdiFmaNeMNKfaHdVZZDz5jE75fxZFzXOo8AidmSgqZ5Ur2Q/1WgtJDh5sgLVi3ZyduOKqenrxvS6xIs=;3:UIezvLUc49boUkxrNRT3c0IbGNnv5XkJiem6KziXnwdyFTdLZ+e1Aj9aSCBSwB2tzltqQXbFRfFp29K/cMVPGwy/rqZQBV6Wdf1qWLLL37ADvuLtmUNpKcGuPG2SAM1mXaPr3rjfZo0dLfpZYinnkRe8icBVUV69o8+Z/zYFIt3AvdIV/DkxPk240q55rZItrckdYGK+k9r9wqQgSuOuIykJmJOix3NdtPRsyCT5GKQ=;25:pvLqxk9bvH8fTyP5YX6k9JznPOGC5iVOrxusTuLrl48CNyPl2XVG5WKxYi/5ZIe2GfntmGSFdJkoyJ0+PCCmlsiLf4IkZjVzWB+ZWzG311dRlhAQr9Wl0f9mDhZuT8oSI39BXjhLthKrIH3ThFrWZuVpO4STRVmR3JL3rxnz+o1q6zaBeNP5Im+7WhgD3JcMvB6Sh38YrOOAMERQ2G/sCNswZq+0ubsNZeBHM6Az21CiNLFNFZLOKdn/LIvj+U9LcLhr1OXXztu/LDjvpUPdNA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1230; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB1230;20:GxZz8E6tdrK8AJHUt1h6cCHBY6gNoSi37b1hVYKvVuCMXrvSAoWCPddE5InNT+1th7D6sHpTXKodmvrH0adx3iTDr8Udb/JUrjOhTWEK4RZGumv1XaPITXIckDSy3hh1/Q5yw+ga9h/cwdVkZ6GixseE7yiHIGfSMyj9NLL1pI/NxUpUca+NU0cNtLnN0c/PrPra62iXYE3siBedPTgLxVwSsvev1sEreJzH6ZgKI+4c/pAtGaVgMenUbUUJ0co+5Q2IhYKXvJg2OJK+hVKvASr8hSDF0dqY6yeLdBESAEOsv2VKqOKVd4Z0aQiRh6Mhx7o9e39MHS2mHyd5+a47jCsE3kdADDeyGBCf1yfocLg=;4:+a+aQMXjE6CKb9dEJpw9cSM9CxVGTaG8XPHj997kpqMoP3s3Lqd9txoSRwEoda3FFQz4pmE5Z6+t4HQKwl05MoLAH18NxsI15oY8yF+sSV1NBqyyTwTVr/KdCfKtIMQXzp9NAeSJBf8Cd32LfKAIhPMiBnzjK4PoM4cvrKZeUVQZjs76gPJtnaU3teYJcyZEGLWAMHodHDJakozKuFQ64XfyNYxDpo5DmPA83wEWAFJec8PU3vMTGuWpoCUnBXEqtGyez8ujZTQPuoG7ZzjuOm47ig5Ns9bzGk4wb35HFP9pSML3Qjok61ZqCbp64SfuP1XGYkpBbeIdydfIatBPOI8QZ8cPHkyfc5Axo9nmiSzh6lfHtcsJJmFYEAFVICLLFeKgg9wcluqhSy7TpKWMOw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:DM2PR0301MB1230;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1230; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR0301MB1230;23:EaHinkaBrsyqI81X3axwvxp1jVx4iJQI+93P0bu?= =?us-ascii?Q?2L/piWRMD5equdARAwP0PSqpPor0ZLX+pW4la0gbExeqdXmqlq5p3Vlt2rbH?= =?us-ascii?Q?KFNgJa+HDFa3QvY18tacWAkwp0wV+NVSNMmNbAEghBhEI8OZK7bfvhThHWyb?= =?us-ascii?Q?eU2nddGYzdnsDMNXgNliU+786UwZ0sqp7pii+gY64r4bls3TMfU6TIU7ls2V?= =?us-ascii?Q?j4uGGns30EhA4fsOLCx8iyxey/ZA4Vd86kuUOIZfzN8AWNVb88erNEYqk3j1?= =?us-ascii?Q?HNcbNmdnSTxwkmYPXjEgBfnVtYzXBmnzh2JbySyMs9t+XYsqtLDgBTrKGvuR?= =?us-ascii?Q?P/wSUzrT17VYiDnoxQ83PcpxPdTMYjcZMwoIJOH+8YI7m9ee8jz9vnxx7Q6o?= =?us-ascii?Q?T2XAPCPHitk34JLkT1miE+6P3f9M7cfUC+EY0PhcnHxvkOQu7x/0n1ad3tHi?= =?us-ascii?Q?wFbYMkKwyMux5VgPU78Mu9lLUNlaIuJ/hVUhl9dQBf+qkXF7MPM4qzwX6mqD?= =?us-ascii?Q?ACtnk+x8d429M85DcIBnB2zAWVw/JJENFWlm9o4sK/jQ2HD2vS8IfSiY00Rb?= =?us-ascii?Q?/1zI9WIibJTyaY58k1v1U6oalRW5KXCAvib7OXSTCBxrqAJHDq0rLpRtHPPK?= =?us-ascii?Q?nnYVEWhCL93qfckI1AyFlUFvB3sAucBR0McHhlPnJwDXtsW4BdN7LC+kIOIe?= =?us-ascii?Q?zlynbOuOuwC2U4p5BrfukuikrwULU7D8d8EKMIV+A8F8FDV8qAQvjqNCspRB?= =?us-ascii?Q?YZm9GN7UPqRag/zPFh5Oz+A9C5cXiZNsY94ygi5X/zbNi8Os19pQdEw1ACbX?= =?us-ascii?Q?9TdrsypeBjEPsIM9lMHHpaVnFjsyIeGrOnq8dI8Jcj+P+LDYKe2E+YVB8gjL?= =?us-ascii?Q?v7WVfkv1zCPiXrYuq7qKHDQmQzXq3opgD7APzqRVbVxvVtR/D9Dp0At4fJZQ?= =?us-ascii?Q?NFiBmX6qSaBpzn9Ot913pY+fzhEth7uHBQhfgC/rjj/82ITio6okZctwFJ29?= =?us-ascii?Q?Tkf269J4bZGoaoMaE5gf/L+JLTOMR6d9lgmHfxnY47xKiws9OGUxUdHjyE7L?= =?us-ascii?Q?39xNtmvvMCTEHjaDHNzTqLJ9H2MUoem5Fl/4Z8nH/emdmlRZZxhIJdNFxtDe?= =?us-ascii?Q?ApsYB7BiajOE=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB1230;5:ny71a2Z/4GDnlo+TxL+7AANzvFxf1Nhqv3vH9VmBhGQYOTPV03VHfjWqPDO2AIozUAFK0m8IgdQzJAyUTXcglI46lkrnRCuoSieuGJF+x/z5VWVY+WVkl3eO3RI8+0lOYSQC24xtdBX+MMgvOy3Stg==;24:WyVQzZdQ5M4cwl2iGR3ucBCblswl7qJ3zQiSOP8mCNSSrDa+KNN96F6U/mn4TlZVQITQeGT3Gnutm5WhUHE9xq5CP5sk5zlTBfgZBdPsjsM=;20:QrECsS7YXkSQ1gokDwVr3rJ9BJy4yrKZe2Gx0EH6n3Pr1wmJ4yyqUjGKXCh/h8o4oikWptyNRoOocbQN41Dnuw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 06:18:06.7363 (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: DM2PR0301MB1230 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3163 Lines: 85 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 | 2 ++ sound/soc/fsl/fsl_spdif.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt index b5ee32e..7bcd9d0 100644 --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt @@ -27,6 +27,8 @@ 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 needed when two spba master port + is used. - 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..d4b0ba3 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -106,6 +106,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 +475,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 +522,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 +557,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 +1271,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/