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: 743104 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vqHqP0fYKz9s82 for ; Fri, 24 Mar 2017 20:16:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IMCxcAkm"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vqHqN6JSlzDqgQ for ; Fri, 24 Mar 2017 20:16:48 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IMCxcAkm"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vqHnM1J89zDqcy for ; Fri, 24 Mar 2017 20:15:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IMCxcAkm"; dkim-atps=neutral Received: by mail-wm0-x243.google.com with SMTP id u132so1952250wmg.1 for ; Fri, 24 Mar 2017 02:15:03 -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=p1nYSBtcLNNkBX9YBuGuD+GmToE27XAobXq1CIPUZsH2WL2Hx3q1OedmgxhznpFzXI eTx1e6ZUzm+UKSwrVSO4cDc7cmFjGLc9DWM4z65paI/Sn5KsWBF8nOUzqJtfrJt6t6SF fo60Gx9XVn51JlV9VcKtwfWrIwY/Mt8j17LUaTJDioWX5KRmqRdwBYTBq3/EWz/awk/J CJ8A+Zugfu3HdWMeu3fvScrYfmiOF03d4EbFT9h8ddPkxBBaM9EfuJtOc0S5tEF5dFzA Ae6u2/T+CCad74gmF0wqebFug1IAHEHioEN4oAo7yuw1sCB2qJWWugb7WSrO1LFvGE7F MEvw== X-Gm-Message-State: AFeK/H0bCM+UlRzGl/ZpPG73Gp8tZJEmZFV1h8yXKnoeCoNvhnCLscFsjS3be7HkXfWNgA== 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 Subject: [PATCH v2] ASoC: imx-wm8960: Let codec driver enable/disable its MCLK 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: daniel.baluta@nxp.com, timur@tabi.org, Xiubo.Lee@gmail.com, linux-kernel@vger.kernel.org, shengjiu.wang@nxp.com, tiwai@suse.com, perex@perex.cz, nicoleotsuka@gmail.com, mihai.serban@nxp.com, viorel.suman@nxp.com, fabio.estevam@nxp.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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);