From patchwork Mon Mar 17 09:45:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Shen X-Patchwork-Id: 3842381 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A8B0BF540 for ; Mon, 17 Mar 2014 09:48:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85C6D201FE for ; Mon, 17 Mar 2014 09:48:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5F96F201BB for ; Mon, 17 Mar 2014 09:48:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6B2D0261663; Mon, 17 Mar 2014 10:48:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id BC21826109E; Mon, 17 Mar 2014 10:48: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 7BF0126171E; Mon, 17 Mar 2014 10:48:20 +0100 (CET) Received: from sjogate2.atmel.com (newsmtp5.atmel.com [204.2.163.5]) by alsa0.perex.cz (Postfix) with ESMTP id A51D1260799 for ; Mon, 17 Mar 2014 10:47:55 +0100 (CET) Received: from Dev4Android.corp.atmel.com ([10.217.2.124]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id s2H9coRk007024; Mon, 17 Mar 2014 02:41:03 -0700 (PDT) From: Bo Shen To: Mark Brown , nicolas.ferre@atmel.com Date: Mon, 17 Mar 2014 17:45:39 +0800 Message-Id: <1395049541-28128-7-git-send-email-voice.shen@atmel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1395049541-28128-1-git-send-email-voice.shen@atmel.com> References: <1395049541-28128-1-git-send-email-voice.shen@atmel.com> Cc: alsa-devel@alsa-project.org, Wolfram Sang , Takashi Iwai , linux-kernel@vger.kernel.org, Linus Walleij , Liam Girdwood , Bo Shen , Boris BREZILLON Subject: [alsa-devel] [PATCH 6/8] ASoC: atmel: support CCF based clks 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Boris BREZILLON Provide dev to clk_get function if we're using CCF based clks. CCF based prog clks support automatic parent selection when asking for a specific rate: remove the clk32k clk retrieval if we're using these clks. Signed-off-by: Boris BREZILLON [voice.shen@atmel.com: switch to devm manage function] Signed-off-by: Bo Shen Signed-off-by: Bo Shen --- sound/soc/atmel/atmel_wm8904.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c index b4e3690..a797d33 100644 --- a/sound/soc/atmel/atmel_wm8904.c +++ b/sound/soc/atmel/atmel_wm8904.c @@ -170,25 +170,26 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev) return ret; } - mclk = clk_get(NULL, "pck0"); + mclk = devm_clk_get(&pdev->dev, "pck0"); if (IS_ERR(mclk)) { dev_err(&pdev->dev, "failed to get pck0\n"); ret = PTR_ERR(mclk); goto err_set_audio; } - clk_src = clk_get(NULL, "clk32k"); - if (IS_ERR(clk_src)) { - dev_err(&pdev->dev, "failed to get clk32k\n"); - ret = PTR_ERR(clk_src); - goto err_set_audio; - } + if (!IS_ENABLED(CONFIG_COMMON_CLK)) { + clk_src = devm_clk_get(&pdev->dev, "clk32k"); + if (IS_ERR(clk_src)) { + dev_err(&pdev->dev, "failed to get clk32k\n"); + ret = PTR_ERR(clk_src); + goto err_set_audio; + } - ret = clk_set_parent(mclk, clk_src); - clk_put(clk_src); - if (ret != 0) { - dev_err(&pdev->dev, "failed to set MCLK parent\n"); - goto err_set_audio; + ret = clk_set_parent(mclk, clk_src); + if (ret != 0) { + dev_err(&pdev->dev, "failed to set MCLK parent\n"); + goto err_set_audio; + } } dev_info(&pdev->dev, "setting pck0 to %dHz\n", MCLK_RATE);