From patchwork Tue Aug 29 19:25:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9928141 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 ECAC4602B9 for ; Tue, 29 Aug 2017 19:39:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE3972018F for ; Tue, 29 Aug 2017 19:39:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2DB028A49; Tue, 29 Aug 2017 19:39:12 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0559128A4E for ; Tue, 29 Aug 2017 19:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Owner; bh=J99iSRrk2sz86mHkVWYY6laXvX8KhY+FeG3csRAa6dk=; b=Ulb qMuA4WN4IWntSNFJLdBNrzzdXdbwAQ3lN1I7PPVDsoXpyIVL5BVu08oerbgGsA3QZYmyjlim6rmhY wiQPuJF1n0UNCVbBAvZwFVVOjWDmzXgp+O0TvzDwt4ZJ5TsflDcl4WsTybsWM2uwKqCnSPjeovKOk FxG8SxHTytnP3R0+EkFaLGs95vqNOqmN/Iv1AWmNe8RnYupAteTTlU2PWfjNuRrPZ37qAwlr8j0XM q1Mgvs3DPcDYLAtXE6AB0bqsqoPmx7iiZXILHf1C+zU0mjYQ0Lh6RQVYIgq27kfdhSBCJom1pSoXc kLRArRoX8SxL3hWaX4qeTNxSC0nLwfg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmmLi-0007n7-EO; Tue, 29 Aug 2017 19:38:58 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmmAL-00029Q-K8; Tue, 29 Aug 2017 19:27:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=IplYOXAh/1LzHdRlidv13rRObNNbECVDgtT7cldLWRE=; b=NghgJWbDYiLaMOy9auH4w7fH51 WBY3al4gSAMqAm0Ng4UPsx31fNhODO/C7DmVcZcwIqwiSHhtPs7iBwvhH8jEWp3C0rBJfaL2cv8TP gHaoWGcKxC8vHyTFuHfiR83JirA88POQvP3od6QfendpeYcCi4YBvHJ8w2GV43AiYQL1AhgP2BRwu I/c72PBcR1plPKroOMFjVNYmiefZtDkOFOv/bGqqRbDLnb6MHji6EmL5bxHVLRU2EfxLGngtrHdUr KcUhvdp1reZek5Arboi9vkdYY7MXm2oJXbtRz92QBL3vFdg5yp1AGwGjuQanJEKupD1Med5PpcX72 rMN4bCEA==; Received: from heliosphere.sirena.org.uk ([2a01:7e01::f03c:91ff:fed4:a3b6]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmmAI-0005kB-C3; Tue, 29 Aug 2017 19:27:12 +0000 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=IplYOXAh/1LzHdRlidv13rRObNNbECVDgtT7cldLWRE=; b=bfqTtXE3Nr8/ 8lwdvGwg879c2MZOscVk6thAGtvFbrRrnbvhCtTqplg8VHpCULvx44BcdJkodzwaJSIM45yC4o+Jh V/6ORLoNohY+jumVDlToR9QUwlEjGZ7mPb/zPOkHQGVWxqhwF8CKdb66ZaGbmjqwGfjRZMU2AjnIZ V/JjI=; Received: from 92.40.248.112.threembb.co.uk ([92.40.248.112] 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 1dmm97-0003x3-N7; Tue, 29 Aug 2017 19:25:57 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id CA3324400E7; Tue, 29 Aug 2017 20:25:56 +0100 (BST) From: Mark Brown To: Jeffy Chen Subject: Applied "ASoC: rockchip: Add support for DMIC codec" to the asoc tree In-Reply-To: <20170822153555.20735-8-jeffy.chen@rock-chips.com> Message-Id: <20170829192556.CA3324400E7@finisterre.ee.mobilebroadband> Date: Tue, 29 Aug 2017 20:25:56 +0100 (BST) X-Bad-Reply: In-Reply-To but no 'Re:' in Subject. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170829_202710_453177_40FBF513 X-CRM114-Status: GOOD ( 21.74 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, dianders@chromium.org, heiko@sntech.de, briannorris@chromium.org, linux-kernel@vger.kernel.org, Liam Girdwood , linux-rockchip@lists.infradead.org, Mark Brown , Takashi Iwai , dgreid@chromium.org, mka@chromium.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: rockchip: Add support for DMIC codec has been applied to the asoc tree at git://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 626d84db64d746f63eadf5e241fc2211419e11b8 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Thu, 24 Aug 2017 12:52:26 +0800 Subject: [PATCH] ASoC: rockchip: Add support for DMIC codec Add support for optional dmic codec. Signed-off-by: Jeffy Chen Signed-off-by: Mark Brown --- sound/soc/rockchip/Kconfig | 1 + sound/soc/rockchip/rk3399_gru_sound.c | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig index 8f0d0d8d34e6..b0825370d262 100644 --- a/sound/soc/rockchip/Kconfig +++ b/sound/soc/rockchip/Kconfig @@ -69,6 +69,7 @@ config SND_SOC_RK3399_GRU_SOUND select SND_SOC_DA7219 select SND_SOC_RT5514_SPI select SND_SOC_HDMI_CODEC + select SND_SOC_DMIC help Say Y or M here if you want to add support multiple codecs for SoC audio on Rockchip RK3399 GRU boards. diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 91aab5c18f3b..5ab25962cabd 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -267,6 +267,28 @@ static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream, return 0; } +static int rockchip_sound_dmic_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + unsigned int mclk; + int ret; + + mclk = params_rate(params) * SOUND_FS; + + ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, 0, mclk, 0); + if (ret) { + dev_err(rtd->card->dev, "%s() error setting sysclk to %u: %d\n", + __func__, mclk, ret); + return ret; + } + + /* Wait for DMIC stable */ + msleep(dmic_wakeup_delay); + + return 0; +} + static const struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; @@ -283,6 +305,10 @@ static struct snd_soc_ops rockchip_sound_cdndp_ops = { .hw_params = rockchip_sound_cdndp_hw_params, }; +static struct snd_soc_ops rockchip_sound_dmic_ops = { + .hw_params = rockchip_sound_dmic_hw_params, +}; + static struct snd_soc_card rockchip_sound_card = { .name = "rk3399-gru-sound", .owner = THIS_MODULE, @@ -297,6 +323,7 @@ static struct snd_soc_card rockchip_sound_card = { enum { DAILINK_CDNDP, DAILINK_DA7219, + DAILINK_DMIC, DAILINK_MAX98357A, DAILINK_RT5514, DAILINK_RT5514_DSP, @@ -305,6 +332,7 @@ enum { static const char * const dailink_compat[] = { [DAILINK_CDNDP] = "rockchip,rk3399-cdn-dp", [DAILINK_DA7219] = "dlg,da7219", + [DAILINK_DMIC] = "dmic-codec", [DAILINK_MAX98357A] = "maxim,max98357a", [DAILINK_RT5514] = "realtek,rt5514-i2c", [DAILINK_RT5514_DSP] = "realtek,rt5514-spi", @@ -329,6 +357,14 @@ static const struct snd_soc_dai_link rockchip_dais[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, }, + [DAILINK_DMIC] = { + .name = "DMIC", + .stream_name = "DMIC PCM", + .codec_dai_name = "dmic-hifi", + .ops = &rockchip_sound_dmic_ops, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + }, [DAILINK_MAX98357A] = { .name = "MAX98357A", .stream_name = "MAX98357A PCM",