From patchwork Tue Aug 29 19:26:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9928169 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 D85D1602B9 for ; Tue, 29 Aug 2017 19:44:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA3B228A32 for ; Tue, 29 Aug 2017 19:44:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF18528A46; Tue, 29 Aug 2017 19:44:24 +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 5580F28A32 for ; Tue, 29 Aug 2017 19:44:24 +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=lwvX6kr9yMpkwvAKXPizJ7ClLYBWasPXve07+Byk5ZU=; b=mqU xhKFNODMiO+wDkr53NUNAiu7AJ/+wRevhrjy6ZBJSr+bYprL+1Ar7BrvbhE2xrUfbybrBhKGt9KKS zIboPgWYLh+3AF6L80p2zxklBRaq4YRGc23FWfX3vCGJ/hr52c6YVp85MQWAjYwJUNSepaMRcC+B6 IixwtuCru9bLMvURgqfZs6vy7430J06NPRRcaT3B7YQntb/jsoq8gvs3WEEgcyJzRZRao5EFnyUWe p4mkwTYmsWQ4AeJ8XepLdNnVJ4+lLZYpLt+0j3N/27W0GLliT+G1l9y6Br9CgSCT5WRki6BkFDNtL SUvGyDgXiGbYoF6614Z39NVZW2lqy9w==; 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 1dmmQx-0002Pb-RK; Tue, 29 Aug 2017 19:44:23 +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 1dmmQa-0001vq-HM; Tue, 29 Aug 2017 19:44:00 +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=oDeGIVDFUUqlqEZLCHuyWespM1Io6qLiFFtSLdirpQY=; b=S+5s8/RQ7PYE5clWL2xIuqFFFV H4gtR0WE9eu+r+iyuDXLTTdQRvKvHaVDzEeMVNgBJa3rZYKRwHE9IAnjkJpCNprCRlwv5Pust9NhT cye7x0wYjlBMxMYV0e/4T2KitMaofHqMtkHfopT/QE+zvEUmCFkOY7fBTpJ4yir2xJaj1h2tfseOH E8GsBdvLwEuUOiovME7F6oyswFsH2ylYFoRhbP1Uzc1RnvsXIgye7gnUtx8scnHOLvzZ6oBKUk6F0 HX6UXza9EIHvzcF0isPpuKfSd008/x0v+rWuxAXTZn6yA6dpkn6MchOgQ2jd89KF5mCmknpPg+diU llz/k93w==; 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 1dmmAk-0005m2-O1; Tue, 29 Aug 2017 19:27:40 +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=oDeGIVDFUUqlqEZLCHuyWespM1Io6qLiFFtSLdirpQY=; b=Z5dUFvrN9BxJ 8R9l/A8eb970iYGLxVP63qkfNphysOTmxxibiInkpRsAS9ToGBmSUTaBSS/XSwMBU2YNY9A5eJp0h 79cIdn0qXBpAmVqg6U4yj0B2OqN7l82/jCLcuIc5NE72Grxcq3DJNQ58zE5DLWskaxoA/SgXvkgib yFCGY=; 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 1dmm9V-0003xH-6V; Tue, 29 Aug 2017 19:26:25 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id ACAF14400E7; Tue, 29 Aug 2017 20:26:10 +0100 (BST) From: Mark Brown To: Jeffy Chen Subject: Applied "ASoC: rockchip: Add support for DP codec" to the asoc tree In-Reply-To: <20170817044417.22069-8-jeffy.chen@rock-chips.com> Message-Id: <20170829192610.ACAF14400E7@finisterre.ee.mobilebroadband> Date: Tue, 29 Aug 2017 20:26:10 +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_202738_805185_433525AF X-CRM114-Status: GOOD ( 26.50 ) 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 DP 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 3313faf1053ee6cb90045f6877f11e2f61ead63a Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Thu, 24 Aug 2017 12:52:25 +0800 Subject: [PATCH] ASoC: rockchip: Add support for DP codec Add support for optional cdn dp codec. Signed-off-by: Jeffy Chen Signed-off-by: Mark Brown --- sound/soc/rockchip/Kconfig | 1 + sound/soc/rockchip/rk3399_gru_sound.c | 59 +++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig index c84487805876..8f0d0d8d34e6 100644 --- a/sound/soc/rockchip/Kconfig +++ b/sound/soc/rockchip/Kconfig @@ -68,6 +68,7 @@ config SND_SOC_RK3399_GRU_SOUND select SND_SOC_RT5514 select SND_SOC_DA7219 select SND_SOC_RT5514_SPI + select SND_SOC_HDMI_CODEC 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 347c34d0db4c..91aab5c18f3b 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -228,6 +228,45 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } +static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int mclk, ret; + + /* in bypass mode, the mclk has to be one of the frequencies below */ + switch (params_rate(params)) { + case 8000: + case 16000: + case 24000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk = 12288000; + break; + case 11025: + case 22050: + case 44100: + case 88200: + mclk = 11289600; + break; + default: + return -EINVAL; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret < 0) { + dev_err(codec_dai->dev, "Can't set cpu clock out %d\n", ret); + return ret; + } + + return 0; +} + static const struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; @@ -240,6 +279,10 @@ static const struct snd_soc_ops rockchip_sound_da7219_ops = { .hw_params = rockchip_sound_da7219_hw_params, }; +static struct snd_soc_ops rockchip_sound_cdndp_ops = { + .hw_params = rockchip_sound_cdndp_hw_params, +}; + static struct snd_soc_card rockchip_sound_card = { .name = "rk3399-gru-sound", .owner = THIS_MODULE, @@ -252,6 +295,7 @@ static struct snd_soc_card rockchip_sound_card = { }; enum { + DAILINK_CDNDP, DAILINK_DA7219, DAILINK_MAX98357A, DAILINK_RT5514, @@ -259,6 +303,7 @@ enum { }; static const char * const dailink_compat[] = { + [DAILINK_CDNDP] = "rockchip,rk3399-cdn-dp", [DAILINK_DA7219] = "dlg,da7219", [DAILINK_MAX98357A] = "maxim,max98357a", [DAILINK_RT5514] = "realtek,rt5514-i2c", @@ -266,6 +311,14 @@ static const char * const dailink_compat[] = { }; static const struct snd_soc_dai_link rockchip_dais[] = { + [DAILINK_CDNDP] = { + .name = "DP", + .stream_name = "DP PCM", + .codec_dai_name = "i2s-hifi", + .ops = &rockchip_sound_cdndp_ops, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + }, [DAILINK_DA7219] = { .name = "DA7219", .stream_name = "DA7219 PCM", @@ -316,7 +369,7 @@ static int rockchip_sound_codec_node_match(struct device_node *np_codec) static int rockchip_sound_of_parse_dais(struct device *dev, struct snd_soc_card *card) { - struct device_node *np_cpu; + struct device_node *np_cpu, *np_cpu0, *np_cpu1; struct device_node *np_codec; struct snd_soc_dai_link *dai; int i, index; @@ -326,7 +379,8 @@ static int rockchip_sound_of_parse_dais(struct device *dev, if (!card->dai_link) return -ENOMEM; - np_cpu = of_parse_phandle(dev->of_node, "rockchip,cpu", 0); + np_cpu0 = of_parse_phandle(dev->of_node, "rockchip,cpu", 0); + np_cpu1 = of_parse_phandle(dev->of_node, "rockchip,cpu", 1); card->num_links = 0; for (i = 0; i < ARRAY_SIZE(rockchip_dais); i++) { @@ -342,6 +396,7 @@ static int rockchip_sound_of_parse_dais(struct device *dev, if (index < 0) continue; + np_cpu = (index == DAILINK_CDNDP) ? np_cpu1 : np_cpu0; if (!np_cpu) { dev_err(dev, "Missing 'rockchip,cpu' for %s\n", rockchip_dais[index].name);