From patchwork Fri Mar 24 09:14:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 9642433 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 F1F716020B for ; Fri, 24 Mar 2017 09:20:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2CA52521E for ; Fri, 24 Mar 2017 09:20:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D73B9283ED; Fri, 24 Mar 2017 09:20:57 +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 621512521E for ; Fri, 24 Mar 2017 09:20:56 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6959D26745A; Fri, 24 Mar 2017 10:15:05 +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 6F184267462; Fri, 24 Mar 2017 10:15:04 +0100 (CET) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by alsa0.perex.cz (Postfix) with ESMTP id 94B47267214 for ; Fri, 24 Mar 2017 10:15:00 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id n11so1966784wma.0 for ; Fri, 24 Mar 2017 02:15:00 -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=zdDnehKmKr8F7oBkP5PTsmuSrQJ14aSReRGbglDvHXU=; b=IMCxcAkmVnVh86wP4yimaL0h4GtMETMKRa5OzF5GAud1zB9A0zr6ib9DpdUibqBEhF 5PPJmGWMHcxAzJRMimnuvr45B6cmYLzHK10+UtXW0+VHfs79OlOrP+kq28zXOdovmVbv SKLon9TlAOBJzQMyRlKD0KGg3AvVmjyaHUF9qN7CfA0bFr8JLadvFFteqQ35S6FhdL/A i1YZYRJemfZOSOVA0wn39jzHCbYEH7YaH3BLQAnp8wHr98wfWiUXymHdD6mx9VyC/bvy 72pu6nqAPHI3/3rSoAx0Jqfejw/x1qEc+PEpWhVqTX7+Tmw0aYAI8aRwGTq8GoUgePDR ArwA== 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=zdDnehKmKr8F7oBkP5PTsmuSrQJ14aSReRGbglDvHXU=; b=jQp1DaqP30JQmaSt/1+8Om7q6+EBab+AC7aClxCzJjTwzSJfjWgj034D5LXfLoIT6i Nas2RtDv9f68+7jeB3Xi6TGHmplIPLA8Uj8TV4yT45b0y7ZGr56IkDYnKSvH8wzWZsR6 mvftI/2QbGIdItZ2L2vDbv8/gepHf4VuwdgBsbt4dVLxKRPzN8lIcqW4OYPCzHUeVvwA p4CC599ZifGMxWQgtZr/3w2mlGb8UVPuM4wsyNCtyKIIr4lkmXpmHicpp5SwStAGsOtA zJyb6uK3FJ0RL8cOCRH5uQ1NmGqNza5Vitye0StZF6DKm4rbCwkkPcdTzj/hygtBGhus j2SQ== X-Gm-Message-State: AFeK/H1796nNfr6FWDBLV3CwkcHkKbqWgdi2CLRkwmZDE9D7OE7ieVF5TvNWsGcjjs6tBQ== X-Received: by 10.28.22.129 with SMTP id 123mr1763347wmw.10.1490346899819; Fri, 24 Mar 2017 02:14:59 -0700 (PDT) Received: from oreo.local ([188.25.26.143]) by smtp.gmail.com with ESMTPSA id b82sm1658775wmh.4.2017.03.24.02.14.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 02:14:58 -0700 (PDT) From: Daniel Baluta To: lgirdwood@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org Date: Fri, 24 Mar 2017 11:14:48 +0200 Message-Id: <1490346888-30937-1-git-send-email-daniel.baluta@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: daniel.baluta@nxp.com, timur@tabi.org, Xiubo.Lee@gmail.com, linux-kernel@vger.kernel.org, shengjiu.wang@nxp.com, tiwai@suse.com, nicoleotsuka@gmail.com, mihai.serban@nxp.com, viorel.suman@nxp.com, fabio.estevam@nxp.com, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH v2] ASoC: imx-wm8960: 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: Daniel Baluta 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 driver accordingly. While at it, get rid of imx_wm8962_remove function since it is now empty. Signed-off-by: Daniel Baluta --- Changes since v1: * s/wm8960/imx-wm890/ in subject prefix * s/dirver/driver in commit message * took ownership over the patch from Nicolin Chen as per his agreement. 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);