From patchwork Tue Mar 20 01:21:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 132105 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp253059ljb; Mon, 19 Mar 2018 18:21:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELv8EEBhRx0Ds2Kv4FTwaIVlOnn2CBwjK2AdRkso6tFqv6gvi5gchyVR4hzJMTPX8onbGpK0 X-Received: by 10.28.146.71 with SMTP id u68mr587017wmd.107.1521508902572; Mon, 19 Mar 2018 18:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521508902; cv=none; d=google.com; s=arc-20160816; b=ALbPAfT20NGER2cJc25WPvg4yECtfhAGZkUCwkMCvIUycku+cgI0QlsJLbuBVFINIQ D7m7vhMGFwKV3CnH7a9Nbqz8N0k6KnDwU4OmwlL0IcTVdrHGVZf0GlHavsbPXDkhIx+m aMuNDpakQz4SnEaTxWUuj+BL10bRkoRRHUEv1RLbDTkDaVYiQbB7GTM3VYzH73uXCXEY KieLkvLLzBYUicbH6F9taru1LMNhWS9aJcbIQ55FwkPBbHhdqBr59gej3hxWSwe0WhVE Utonm3rKgHMSgyqY4iosclkjCodvyB2PqqHMelEm6QDllCxjocoKDvdxVceLetFzCBVG oEiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=xrlKX+unU0bEv0ZExeYUG+7ECENizAbJhL3RqIRcUeM=; b=XDpVIBwpcDndFEb3/ZRG4Hi0Br5594T343Zz/WkdonFb2Le3pegSYO0WdlmT7nkn99 EinJWqkxB3cs9eBH9lgQsErryG3kdCs7l5MKrOniMloEBJHxeTsMdJQzPyeAoXD/lVXh m5UUW8sSmDYMmm25fGIRh5JnF3UhVeUXF9PHPMXGsG3E6ClpsI8nLppLlOIWDcjdAHAp tIWdXYFQYTuPB0nE1FlDGCF2M6AFn4BBFlklA7huv3r1Tux1uNPenwa9+Xo9hMIZTEFr nIvC4RbwxjwwZoHxoNNPDOMCmTCKoyF0akxH5bMfq30P5wPOgYEX0Ox+JsWC3cC+jbbV KEbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=LnQFezeE; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id i24si455060wrb.223.2018.03.19.18.21.42; Mon, 19 Mar 2018 18:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=LnQFezeE; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3F2D92672B9; Tue, 20 Mar 2018 02:21:41 +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 5B9842672C1; Tue, 20 Mar 2018 02:21:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 05CE72672B2 for ; Tue, 20 Mar 2018 02:21:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=DXQN/D6xD1zVwsP+xbgBt1jepD4Oy6qlF7QRbH4hEqo=; b=LnQFezeEjF7W 17c6DgcGCzekI+mHUl3dUn1g2LW++SBTc9y7rI9lEyPE5HK2pnQ4Zm2gpdtMjc3QyD1wKP/XzWWbx 8EWvsuvj1ETryhW3z9QqLoLaEtT8zaeo2ZDKA5o58mKp+4Q7FZ2zoJHJodgGm9ETeLF/RM2cM/pZ0 wh1C4=; Received: from [218.255.99.6] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ey5y3-0007AW-Gm; Tue, 20 Mar 2018 01:21:35 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id ADB6F44007A; Tue, 20 Mar 2018 01:21:32 +0000 (GMT) From: Mark Brown To: Akshu Agrawal In-Reply-To: <1520921250-30124-2-git-send-email-akshu.agrawal@amd.com> Message-Id: <20180320012132.ADB6F44007A@finisterre.ee.mobilebroadband> Date: Tue, 20 Mar 2018 01:21:32 +0000 (GMT) Cc: tiwai@suse.de, alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com, akshu.agrawal@amd.com Subject: [alsa-devel] Applied "ASoC: amd: Enable da7219 master clock using common clock framework" to the asoc tree 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 The patch ASoC: amd: Enable da7219 master clock using common clock framework has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From c88d311533563e6dadc244930a36125d592f5ec5 Mon Sep 17 00:00:00 2001 From: Akshu Agrawal Date: Mon, 19 Mar 2018 11:07:42 +0530 Subject: [PATCH] ASoC: amd: Enable da7219 master clock using common clock framework DA7219 is clock master for other codecs. DA7219 has exposed clock control by using common clock framework and same is used to enable and disable clock for all codecs in the system. TEST=aplay -D hw:0,0 -vv arecord -D hw:0,0 -f dat -d 5 -vv aplay -D hw:0,1 -vv Signed-off-by: Akshu Agrawal Signed-off-by: Mark Brown --- sound/soc/amd/acp-da7219-max98357a.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index d07c2a1d5d9e..99c6b5ce5c6c 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -42,11 +43,13 @@ #define DUAL_CHANNEL 2 static struct snd_soc_jack cz_jack; +struct clk *da7219_dai_clk; static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) { int ret; struct snd_soc_card *card = rtd->card; + struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = codec_dai->component; @@ -66,6 +69,8 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return ret; } + da7219_dai_clk = clk_get(codec->dev, "da7219-dai-clks"); + ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | SND_JACK_BTN_0 | SND_JACK_BTN_1 | @@ -81,6 +86,28 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } +static int cz_da7219_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + + ret = clk_prepare_enable(da7219_dai_clk); + if (ret < 0) { + dev_err(rtd->dev, "can't enable master clock %d\n", ret); + return ret; + } + + return ret; +} + +static int cz_da7219_hw_free(struct snd_pcm_substream *substream) +{ + clk_disable_unprepare(da7219_dai_clk); + + return 0; +} + static const unsigned int channels[] = { DUAL_CHANNEL, }; @@ -119,9 +146,21 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) } static struct snd_soc_ops cz_da7219_cap_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, .startup = cz_fe_startup, }; +static struct snd_soc_ops cz_max_play_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, +}; + +static struct snd_soc_ops cz_dmic_cap_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, +}; + static struct snd_soc_dai_link cz_dai_7219_98357[] = { { .name = "amd-da7219-play-cap", @@ -147,6 +186,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .dpcm_playback = 1, + .ops = &cz_max_play_ops, }, { .name = "dmic", @@ -158,6 +198,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .dpcm_capture = 1, + .ops = &cz_dmic_cap_ops, }, };