From patchwork Thu Mar 23 12:01:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 9640935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BDA14601E9 for ; Thu, 23 Mar 2017 12:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE90E284D6 for ; Thu, 23 Mar 2017 12:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3281284E9; Thu, 23 Mar 2017 12:02:33 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no 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 81644284D6 for ; Thu, 23 Mar 2017 12:02:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7610826686A; Thu, 23 Mar 2017 13:02:23 +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 83675266A9D; Thu, 23 Mar 2017 13:02:21 +0100 (CET) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by alsa0.perex.cz (Postfix) with ESMTP id E87D126686A for ; Thu, 23 Mar 2017 13:02:15 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id x124so16137145wmf.3 for ; Thu, 23 Mar 2017 05:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3VFQ5k9tWzTgQqSUFPVFTmGj+UXsKcxNRrU2bgtyvcs=; b=u2F2mPWLiAZp9tjUxTFxQYC+QfxuzCVq+yB7jPBRH9ga2hLD9W4Lsc19PFvy4sxM9W bMWSQt0ctwlZ88p34YVsR8nLaN909Q3NbvjiFNjTY2uN4uIMoZivzy5xFt4CefC1O4cG 12ZvaW/0KeAjvMbUrNW1bL/FtsHx6hhK75UOQmF1B1pptuKEVW9wA1m2yQEEpMfBTJdQ NuZGqeIXh489ZY4R2LO+LssmmKQKzB+ISk7Y1gA+8dqE4au5hRQaO17zOyk2Q6PoM/J/ m716k1KQ4D3RNwbl+R6FWyjEItQjOHVEXEsEVSOATfS207euLIRtT26LaiWZr3WSnXGa sO8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3VFQ5k9tWzTgQqSUFPVFTmGj+UXsKcxNRrU2bgtyvcs=; b=UTizFUy0gRv5oTpnnHE8rNQcyrbaQ2MpCNKE/UciDExlY8DoOdgjkRCg5P8BzggFpT Sohhs3pvV/6Lj1q4tgFmNh2xgh0B7Pc0XxEMBJMmKgZKU+RqNmrWLIxhlrvq2OzPKkqo LmzxJBUAAKCXcvvyKO7CS+UfPNB3SP2rJfc6/I8iiMK/8Z0FKFRBTMbO/IkRz1KF6LXK MrMG45ZNP0bUuWY4LvTdMRzjYPt/F7QYRotf7UC8bqGpoVmWS7skHu5fMazL2UJvqYs6 nYDFEevVkMJN/FtzUa3aMHMrSac7XH0GVhe08YD+ttAigzD6NOTWoRd7JvopFTD5r6de 5FEg== X-Gm-Message-State: AFeK/H25pABI8aT5nKc6gp5edKPMikxgHc2FJK2/CgoV+TL62EU5csV/ua5yxzKRmMnNYQ== X-Received: by 10.28.216.141 with SMTP id p135mr13189586wmg.71.1490270535366; Thu, 23 Mar 2017 05:02:15 -0700 (PDT) Received: from oreo.local ([188.25.26.143]) by smtp.gmail.com with ESMTPSA id m80sm4035008wmi.34.2017.03.23.05.02.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Mar 2017 05:02:14 -0700 (PDT) From: Daniel Baluta To: timur@tabi.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, fabio.estevam@nxp.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Date: Thu, 23 Mar 2017 14:01:50 +0200 Message-Id: <1490270510-17061-1-git-send-email-daniel.baluta@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, shengjiu.wang@nxp.com, Nicolin Chen , linux-kernel@vger.kernel.org, viorel.suman@nxp.com, mihai.serban@nxp.com, daniel.baluta@nxp.com Subject: [alsa-devel] [PATCH] ASoC: WM8962: Let codec driver enable/disable its MCLK 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: Nicolin Chen WM8962 needs its MCLK when powerup in wm8962_resume(). Thus it's better to control the MCLK in codec driver. Thus remove the clock enable in machine dirver accordingly. While at it, get rid of imx_wm8962_remove function since it is now empty. Signed-off-by: Nicolin Chen Signed-off-by: Daniel Baluta --- sound/soc/fsl/imx-wm8962.c | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 1b60958..3d894d9 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c @@ -33,7 +33,6 @@ struct imx_wm8962_data { struct snd_soc_card card; char codec_dai_name[DAI_NAME_SIZE]; char platform_name[DAI_NAME_SIZE]; - struct clk *codec_clk; unsigned int clk_frequency; }; @@ -163,6 +162,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) struct imx_priv *priv = &card_priv; struct i2c_client *codec_dev; struct imx_wm8962_data *data; + struct clk *codec_clk; int int_port, ext_port; int ret; @@ -231,19 +231,14 @@ static int imx_wm8962_probe(struct platform_device *pdev) goto fail; } - data->codec_clk = devm_clk_get(&codec_dev->dev, NULL); - if (IS_ERR(data->codec_clk)) { - ret = PTR_ERR(data->codec_clk); + codec_clk = devm_clk_get(&codec_dev->dev, NULL); + if (IS_ERR(codec_clk)) { + ret = PTR_ERR(codec_clk); dev_err(&codec_dev->dev, "failed to get codec clk: %d\n", ret); goto fail; } - data->clk_frequency = clk_get_rate(data->codec_clk); - ret = clk_prepare_enable(data->codec_clk); - if (ret) { - dev_err(&codec_dev->dev, "failed to enable codec clk: %d\n", ret); - goto fail; - } + data->clk_frequency = clk_get_rate(codec_clk); data->dai.name = "HiFi"; data->dai.stream_name = "HiFi"; @@ -258,10 +253,10 @@ static int imx_wm8962_probe(struct platform_device *pdev) data->card.dev = &pdev->dev; ret = snd_soc_of_parse_card_name(&data->card, "model"); if (ret) - goto clk_fail; + goto fail; ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing"); if (ret) - goto clk_fail; + goto fail; data->card.num_links = 1; data->card.owner = THIS_MODULE; data->card.dai_link = &data->dai; @@ -277,16 +272,9 @@ static int imx_wm8962_probe(struct platform_device *pdev) ret = devm_snd_soc_register_card(&pdev->dev, &data->card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); - goto clk_fail; + goto fail; } - of_node_put(ssi_np); - of_node_put(codec_np); - - return 0; - -clk_fail: - clk_disable_unprepare(data->codec_clk); fail: of_node_put(ssi_np); of_node_put(codec_np); @@ -294,17 +282,6 @@ static int imx_wm8962_probe(struct platform_device *pdev) return ret; } -static int imx_wm8962_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - struct imx_wm8962_data *data = snd_soc_card_get_drvdata(card); - - if (!IS_ERR(data->codec_clk)) - clk_disable_unprepare(data->codec_clk); - - return 0; -} - static const struct of_device_id imx_wm8962_dt_ids[] = { { .compatible = "fsl,imx-audio-wm8962", }, { /* sentinel */ } @@ -318,7 +295,6 @@ static struct platform_driver imx_wm8962_driver = { .of_match_table = imx_wm8962_dt_ids, }, .probe = imx_wm8962_probe, - .remove = imx_wm8962_remove, }; module_platform_driver(imx_wm8962_driver);