From patchwork Tue Mar 18 20:30:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 3849161 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 896EC9F369 for ; Tue, 18 Mar 2014 20:29:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 982BB202A1 for ; Tue, 18 Mar 2014 20:29:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1840020165 for ; Tue, 18 Mar 2014 20:28:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9DC6C262632; Tue, 18 Mar 2014 21:28:56 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 59035261AC9; Tue, 18 Mar 2014 21:28:46 +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 0EDAB261ADF; Tue, 18 Mar 2014 21:28:45 +0100 (CET) Received: from lynxeye.de (ns.lynxeye.de [87.118.118.114]) by alsa0.perex.cz (Postfix) with ESMTP id 14E04261ABF for ; Tue, 18 Mar 2014 21:28:38 +0100 (CET) Received: by lynxeye.de (Postfix, from userid 501) id 8608A18B4261; Tue, 18 Mar 2014 21:28:35 +0100 (CET) Received: from tellur.localdomain (p57B5F61C.dip0.t-ipconnect.de [87.181.246.28]) by lynxeye.de (Postfix) with ESMTPA id E3AB218B425E; Tue, 18 Mar 2014 21:28:32 +0100 (CET) From: Lucas Stach To: linux-tegra@vger.kernel.org Date: Tue, 18 Mar 2014 21:30:49 +0100 Message-Id: <1395174649-1493-1-git-send-email-dev@lynxeye.de> X-Mailer: git-send-email 1.8.5.3 Cc: alsa-devel@alsa-project.org, Stephen Warren , Liam Girdwood , Stefan Agner , Mark Brown , Thierry Reding Subject: [alsa-devel] [PATCH v3] ASOC: tegra: move AC97 clock handling to the machine driver 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 On Tegra the convention is to have a single machine driver that's controlling the whole audio subsystem. This was introduced after the AC97 driver was merged and ever since AC97 has been broken. Move the clock handling to the machine driver, to be in line with the other Tegra drivers and give the machine driver full control over the single Tegra audio PLL. Signed-off-by: Lucas Stach Acked-by: Stephen Warren Tested-by: --- v2: - remove redundant clock rate setting - defer removal of err_clk_put label to avoid conflict with Stephens dma channel cleanup v3: - rebased to 3.14-rc1 - no functional change - reword commit message CC: Liam Girdwood CC: Mark Brown CC: Thierry Reding CC: Stephen Warren CC: Stefan Agner CC: alsa-devel@alsa-project.org --- sound/soc/tegra/tegra20_ac97.c | 15 +-------------- sound/soc/tegra/tegra20_ac97.h | 1 - sound/soc/tegra/tegra_wm9712.c | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index cf5e1cf..29f8832 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -37,7 +37,6 @@ #include #include -#include "tegra_asoc_utils.h" #include "tegra20_ac97.h" #define DRV_NAME "tegra20-ac97" @@ -376,18 +375,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ac97->playback_dma_data.maxburst = 4; - ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); - if (ret) - goto err_clk_put; - - ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data); - if (ret) - goto err_asoc_utils_fini; - ret = clk_prepare_enable(ac97->clk_ac97); if (ret) { dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); - goto err_asoc_utils_fini; + goto err; } ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); @@ -419,8 +410,6 @@ err_unregister_component: snd_soc_unregister_component(&pdev->dev); err_clk_disable_unprepare: clk_disable_unprepare(ac97->clk_ac97); -err_asoc_utils_fini: - tegra_asoc_utils_fini(&ac97->util_data); err_clk_put: err: snd_soc_set_ac97_ops(NULL); @@ -434,8 +423,6 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev) tegra_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); - tegra_asoc_utils_fini(&ac97->util_data); - clk_disable_unprepare(ac97->clk_ac97); snd_soc_set_ac97_ops(NULL); diff --git a/sound/soc/tegra/tegra20_ac97.h b/sound/soc/tegra/tegra20_ac97.h index 4acb3aa..0a39d82 100644 --- a/sound/soc/tegra/tegra20_ac97.h +++ b/sound/soc/tegra/tegra20_ac97.h @@ -90,6 +90,5 @@ struct tegra20_ac97 { struct regmap *regmap; int reset_gpio; int sync_gpio; - struct tegra_asoc_utils_data util_data; }; #endif /* __TEGRA20_AC97_H__ */ diff --git a/sound/soc/tegra/tegra_wm9712.c b/sound/soc/tegra/tegra_wm9712.c index 45b5789..25a7f82 100644 --- a/sound/soc/tegra/tegra_wm9712.c +++ b/sound/soc/tegra/tegra_wm9712.c @@ -29,10 +29,13 @@ #include #include +#include "tegra_asoc_utils.h" + #define DRV_NAME "tegra-snd-wm9712" struct tegra_wm9712 { struct platform_device *codec; + struct tegra_asoc_utils_data util_data; }; static const struct snd_soc_dapm_widget tegra_wm9712_dapm_widgets[] = { @@ -118,15 +121,25 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev) tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node; + ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); + if (ret) + goto codec_unregister; + + ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data); + if (ret) + goto asoc_utils_fini; + ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); - goto codec_unregister; + goto asoc_utils_fini; } return 0; +asoc_utils_fini: + tegra_asoc_utils_fini(&machine->util_data); codec_unregister: platform_device_del(machine->codec); codec_put: @@ -141,6 +154,8 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev) snd_soc_unregister_card(card); + tegra_asoc_utils_fini(&machine->util_data); + platform_device_unregister(machine->codec); return 0;