Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755217AbdC1I7r (ORCPT ); Tue, 28 Mar 2017 04:59:47 -0400 Received: from mail-eopbgr30071.outbound.protection.outlook.com ([40.107.3.71]:56685 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754751AbdC1I7m (ORCPT ); Tue, 28 Mar 2017 04:59:42 -0400 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; From: Daniel Baluta To: , , CC: , , , , , , , Subject: [PATCH v3 1/2] ASoC: imx-wm8962: Let codec driver enable/disable its MCLK Date: Tue, 28 Mar 2017 11:58:51 +0300 Message-ID: <1490691532-2086-2-git-send-email-daniel.baluta@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490691532-2086-1-git-send-email-daniel.baluta@nxp.com> References: <1490691532-2086-1-git-send-email-daniel.baluta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.146.1] X-ClientProxiedBy: AM5PR04CA0020.eurprd04.prod.outlook.com (2603:10a6:206:1::33) To AM3PR04MB498.eurprd04.prod.outlook.com (2a01:111:e400:8826::23) X-MS-Office365-Filtering-Correlation-Id: f476ee1a-2427-46f5-df15-08d475b8ad9b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:AM3PR04MB498; X-Microsoft-Exchange-Diagnostics: 1;AM3PR04MB498;3:cm3i0aDgjcDVB75/LCop7A4YgkpMfS6k5O/nK27pogHtHo+u7Pb2Apf7F/DNPD9L7Wb44vQ6UDHiVr0b58Cpco3hofbKZxcPoTE+GO/MnuATOaJ1eCVWyadMqi+FlbxvN+nwvFlGU7Mm6ktxZEPB5hsoEX6sR6RZQr4rDsyxd27HQlikt8n1FK8boLWgkpwzHUW1ql3WCzTGU+g9C6lszlH3b/zgJ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xsBZTe5DXsT/7DxSfY3xYVtFWJcEXV22GoL3DhAPN9SX5n1x2ivJ9vksyNwiqtW3LepxdhzYp9DAr7UTJPcw3i9Larsm3ucnhHa2Mjm0vGAF2A2oRAtYtqTK8kMlk7/zH0AlkN1CgMHdz3ayaj3UVve1PHeCJmEhJhpGKkLKedB7x7bxIN+3AGbqzg7vK/ykOwtexP4YwbPxzcE76M9RTMveiKVMalno8+YseVFq/w5Rya03vp1dSKSBH23cANrJ1HwgweePfZ2N X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123558025)(20161123555025)(6072148);SRVR:AM3PR04MB498;BCL:0;PCL:0;RULEID:;SRVR:AM3PR04MB498; X-Microsoft-Exchange-Diagnostics: 1;AM3PR04MB498;4:6IZ/PdEOIErvAbEBoHJWupRRCbnxs9iw/dJlR4R+eZYwcJGM1G9wJuWsC4gdPtPAlL7w2aglVlLIcNXdi+PYcFgGr8Ed9/dk4TekNcLIXsH2L4FVFPdGvC6Aspc+aJtKV7JAXmBVXPeyffYD2ExQCu404W6XLMB5ucn+qbOz0+JIRiDJVKfe6BEqHXE76SdA4oW/vNkw0knANRa6ZLA+WEU9sIKF0yHqdSiIZkCsoCOnVN6Rkf3vbulbcgYyfqDPsDC4pKiSCUueI/bKoVPeI51OpEX9pdNDIr1wPRArzjvhl/6jnfklTaro+ZoeYrrgOFJffG2SLlDo3REFfuep9XpB/3nPY/zyzEL8jQsEPgLcA4ajJ9Wm1+eX5J16b/7kXEv3ur+TEF5iONO7g0yr/ahBWgV5Hx2ieTP5pzx1PkEa5j2xZf2Oo8zPTJPI/525sXKCKPn+IURKyOyQJnFNzV2Ml1Np3ssN/+WrSWtBPqYQUJVJUE8samK+y9stS4cksZLR9oJ/BaUBG2iknT+d/XapCl7TeCDeKpCIjiEe6sNB/eWoaSl5Lm36CY/KrG1TQnk7R2NZ9w+vZxFYwXZTTeXQhZ/Zii+TTUW0Go+f61VAhZJo261gc1AICfEAzifSSOpdzIgHZqHKM5H0TYqfYMs8WzWJB/VODA3TZ0a0L7k= X-Forefront-PRVS: 0260457E99 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39860400002)(39840400002)(39450400003)(39850400002)(39410400002)(50986999)(5003940100001)(76176999)(7416002)(2906002)(50466002)(38730400002)(66066001)(86362001)(33646002)(2201001)(6666003)(5660300001)(36756003)(4326008)(50226002)(25786009)(6486002)(8676002)(81166006)(6506006)(2950100002)(54906002)(305945005)(6512007)(189998001)(7736002)(42186005)(53936002)(3846002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR04MB498;H:fsr-ub1664-118.ea.freescale.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM3PR04MB498;23:4FJYjpgwbz11bwmCGgOxQKyhTISHkp+B2vcOMpKVVH?= =?us-ascii?Q?TKsUjQW2gEARRQBC4Y0egQy5lUcXIi4UYCEFQRDEpkw9Sx71boWTU9CTFEy1?= =?us-ascii?Q?IWTnq90MlmEyUtFzFV30/GiinO7yZw+bPcuBDNEICXAKV2roff9J7U6dl0Zz?= =?us-ascii?Q?aG28eLERw3id1qfVNqn5cYWNaJywPSeMsVbhN1L+W0D2G6T58re0TvNUzy73?= =?us-ascii?Q?GiYUw5Eha2ck1diRHI9rnYq3fdZRIJ1ulNQYtP3uvPLM2OGQYMypQ2XnwUhU?= =?us-ascii?Q?CDJwBLB8wc+2xh1QRNgFMwYoPNkD2Gnx5V3COI2AHN97G3xePsJDGjNTKCLX?= =?us-ascii?Q?Ys0rwPiSJideBTBWtyYnzf/l32gHISfMri+N6qHf9q0veEMNR51Np1yuUvZ3?= =?us-ascii?Q?SxiswDx7JSlO+Lu0Uo0IcEe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2wuLgaOPPocM+IjdwC1JuUCwL9Af/kcEA7D3W379OAQ3xl7UN5ylTiEi9LZjwSWmzg=;5:xYdv5qigGjqQigtXQTc59vplk6sSckAukUJvIBVEEXNC3a2KvqSALwzP+up0KxPwfRJSYZC7oEPBhgisADoxaTAnVwpzCKQT88SAHQEKK8tEw1EaQaCUY9vuRSfOy1yq800d/mnqWdWFvdcY4hJPUA==;24:tJ06VegMaLiRx8xs9v9IYtczyaoH/6pGEW4qk0bUg3hBIifqKpw1zLq+menI6hAkWFkNtGpr6p1zHJ9TAElnDlp3AB/lrr4K3glwJdQfjOA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM3PR04MB498;7:WwsogaETsk7S8nfGcXSvFjxtKemk/SqZGhKophfMFdocZ0tWuapi2RasumaKa5LE/XYogEML7Xa1oKrJxlDLf/UBh1IybyGECuuY2P5s7jX7u5zCQYG5B3YYGjYT+EfebqwriYg7xuyUGvu0yDwQUCytVopQZS8yRP5eUnKWTSXI+hWhYlbVlPwo0WnA0W2UFL/1dRmA2F3INxkVpBc9J2bgQLXeonoBcQnJxTrRqRWEku+/Ks/va3VYZt1nqDot1bRDfgyRsaUrhgCWiiBjoaP/1rqwUHMwQavkds4znjKPs0F/AsHN50rXKDxDynn8bXwwFBOrQy5LpZQtgfAPKw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2017 08:59:00.6483 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR04MB498 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3370 Lines: 115 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 --- 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); -- 2.7.4