From patchwork Wed Jul 26 14:17:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 108772 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp881936obm; Wed, 26 Jul 2017 07:21:26 -0700 (PDT) X-Received: by 10.223.163.85 with SMTP id d21mr994045wrb.33.1501078886378; Wed, 26 Jul 2017 07:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501078886; cv=none; d=google.com; s=arc-20160816; b=QH8FIP4VGimkKROHo0P3/Kgeh+yIz9dV3yUWT60JMjoDTyMSl0BNuRMibSjjPLlmif QOvI6H4Idl2wqs/tLXlwuAdHjkuguf6ceQ3ZvlgGXoJ/l1r8jjUVewkzz5AXxPkHiQGE frELPXo01PkH2T2l1LYbxzOzslsbA2jHaffC6omW/MRpZsh/0hLMpda37sWMrUYdeK4g Iq9UWa5gOQ3Ut102HgXfaIy6l1xlI4AMuqScT4dTecl/rexfym+CQqmuH94G3DXZYkRJ BqrS4frc3Ok0jirO4xzZbBn2hRuujLu1s2X91U0AP5yi7OYdvbdF8uoIRbNTlN/+NMCt NXcg== 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 :delivered-to:arc-authentication-results; bh=LZfdgrL45VxivJ54ub1bR9f0ZorRS3+3RaPqAXsmmVE=; b=dmubg2bWfz9nk7jeJF1dt8Q4YQUPmM7CfvpCpMad/CnOTaXlqgqk5utAd9R+6HNC/E bP7xKDFLX4wjmNh8mLnBHEzkPbiX2nmxgFImFnTrMKTKhXVUeKT1xYS7zS9fYx2LutW1 M6g7zLBjoKqWzOsA2OYXxhwXcsyucxB8ZZ9YFCzCuQqaaAaIAiQV/loWWiKGKuhghlIq n8g5iFt96o2nvh06MfBmAsB6Vjd7dmYTVLm1aG/IBcphyI5GZR5qojOjBMhyODA/bC/1 +YBf8sZj9Oq6tEYlzY9u4SLRbxgnlcheKI+jNIx+WnWSOzi4WiADhFVtbw9d1vphFQ3V iWew== ARC-Authentication-Results: i=1; mx.google.com; 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 x46si13811191wrb.449.2017.07.26.07.21.26; Wed, 26 Jul 2017 07:21:26 -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; 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 4BE8E267478; Wed, 26 Jul 2017 16:18:26 +0200 (CEST) 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 B6165267575; Wed, 26 Jul 2017 16:18:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 8B1DF267472 for ; Wed, 26 Jul 2017 16:17:45 +0200 (CEST) Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1daN86-0000g2-UL; Wed, 26 Jul 2017 14:17:41 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1daN84-0003iM-A8; Wed, 26 Jul 2017 15:17:36 +0100 From: Mark Brown To: oder_chiou@realtek.com In-Reply-To: <1500881663-28990-1-git-send-email-oder_chiou@realtek.com> Message-Id: Date: Wed, 26 Jul 2017 15:17:36 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: Oder Chiou , jack.yu@realtek.com, alsa-devel@alsa-project.org, hychao@google.com, harshapriya.n@intel.com, lgirdwood@gmail.com, albertchen@realtek.com, broonie@kernel.org, shumingf@realtek.com, bardliao@realtek.com, flove@realtek.com Subject: [alsa-devel] Applied "ASoC: rt5514: Add the I2S ASRC support" 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: rt5514: Add the I2S ASRC support 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 1628ef89042fdb90aaea657942455e00e160174d Mon Sep 17 00:00:00 2001 From: "oder_chiou@realtek.com" Date: Mon, 24 Jul 2017 15:34:23 +0800 Subject: [PATCH] ASoC: rt5514: Add the I2S ASRC support The patch adds the I2S ASRC support. Signed-off-by: Oder Chiou Signed-off-by: Mark Brown --- sound/soc/codecs/rt5514.c | 19 +++++++++++++++++++ sound/soc/codecs/rt5514.h | 7 +++++++ 2 files changed, 26 insertions(+) -- 2.13.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index a105c84ef555..882fdc4a6fd4 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c @@ -63,6 +63,7 @@ static const struct reg_sequence rt5514_patch[] = { {RT5514_SRC_CTRL, 0x44000eee}, {RT5514_ANA_CTRL_LDO10, 0x00028604}, {RT5514_ANA_CTRL_ADCFED, 0x00000800}, + {RT5514_ASRC_IN_CTRL1, 0x00000003}, }; static const struct reg_default rt5514_reg[] = { @@ -471,6 +472,15 @@ static int rt5514_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, return 0; } +static int rt5514_i2s_use_asrc(struct snd_soc_dapm_widget *source, + struct snd_soc_dapm_widget *sink) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); + struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); + + return (rt5514->sysclk > rt5514->lrck * 384); +} + static const struct snd_soc_dapm_widget rt5514_dapm_widgets[] = { /* Input Lines */ SND_SOC_DAPM_INPUT("DMIC1L"), @@ -541,6 +551,10 @@ static const struct snd_soc_dapm_widget rt5514_dapm_widgets[] = { RT5514_POW_PLL1_LDO_BIT, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("PLL1", RT5514_PWR_ANA2, RT5514_POW_PLL1_BIT, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY_S("ASRC AD1", 1, RT5514_CLK_CTRL2, + RT5514_CLK_AD0_ASRC_EN_BIT, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY_S("ASRC AD2", 1, RT5514_CLK_CTRL2, + RT5514_CLK_AD1_ASRC_EN_BIT, 0, NULL, 0), /* ADC Mux */ SND_SOC_DAPM_MUX("Stereo1 DMIC Mux", SND_SOC_NOPM, 0, 0, @@ -638,6 +652,7 @@ static const struct snd_soc_dapm_route rt5514_dapm_routes[] = { { "Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXR" }, { "Stereo1 ADC MIX", NULL, "adc stereo1 filter" }, { "adc stereo1 filter", NULL, "PLL1", rt5514_is_sys_clk_from_pll }, + { "adc stereo1 filter", NULL, "ASRC AD1", rt5514_i2s_use_asrc }, { "Stereo2 DMIC Mux", "DMIC1", "DMIC1" }, { "Stereo2 DMIC Mux", "DMIC2", "DMIC2" }, @@ -654,6 +669,7 @@ static const struct snd_soc_dapm_route rt5514_dapm_routes[] = { { "Stereo2 ADC MIX", NULL, "Stereo2 ADC MIXR" }, { "Stereo2 ADC MIX", NULL, "adc stereo2 filter" }, { "adc stereo2 filter", NULL, "PLL1", rt5514_is_sys_clk_from_pll }, + { "adc stereo2 filter", NULL, "ASRC AD2", rt5514_i2s_use_asrc }, { "AIF1TX", NULL, "Stereo1 ADC MIX"}, { "AIF1TX", NULL, "Stereo2 ADC MIX"}, @@ -706,6 +722,9 @@ static int rt5514_hw_params(struct snd_pcm_substream *substream, regmap_update_bits(rt5514->regmap, RT5514_I2S_CTRL1, RT5514_I2S_DL_MASK, val_len); + regmap_update_bits(rt5514->regmap, RT5514_CLK_CTRL1, + RT5514_CLK_AD_ANA1_SEL_MASK, + (pre_div + 1) << RT5514_CLK_AD_ANA1_SEL_SFT); regmap_update_bits(rt5514->regmap, RT5514_CLK_CTRL2, RT5514_CLK_SYS_DIV_OUT_MASK | RT5514_SEL_ADC_OSR_MASK, pre_div << RT5514_CLK_SYS_DIV_OUT_SFT | diff --git a/sound/soc/codecs/rt5514.h b/sound/soc/codecs/rt5514.h index 75024a4bb7f5..2dc40e6d8b3f 100644 --- a/sound/soc/codecs/rt5514.h +++ b/sound/soc/codecs/rt5514.h @@ -37,6 +37,7 @@ #define RT5514_PLL3_CALIB_CTRL5 0x2124 #define RT5514_DELAY_BUF_CTRL1 0x2140 #define RT5514_DELAY_BUF_CTRL3 0x2148 +#define RT5514_ASRC_IN_CTRL1 0x2180 #define RT5514_DOWNFILTER0_CTRL1 0x2190 #define RT5514_DOWNFILTER0_CTRL2 0x2194 #define RT5514_DOWNFILTER0_CTRL3 0x2198 @@ -197,8 +198,14 @@ #define RT5514_CLK_AD0_EN_BIT 23 #define RT5514_CLK_DMIC_OUT_SEL_MASK (0x7 << 8) #define RT5514_CLK_DMIC_OUT_SEL_SFT 8 +#define RT5514_CLK_AD_ANA1_SEL_MASK (0xf << 0) +#define RT5514_CLK_AD_ANA1_SEL_SFT 0 /* RT5514_CLK_CTRL2 (0x2108) */ +#define RT5514_CLK_AD1_ASRC_EN (0x1 << 17) +#define RT5514_CLK_AD1_ASRC_EN_BIT 17 +#define RT5514_CLK_AD0_ASRC_EN (0x1 << 16) +#define RT5514_CLK_AD0_ASRC_EN_BIT 16 #define RT5514_CLK_SYS_DIV_OUT_MASK (0x7 << 8) #define RT5514_CLK_SYS_DIV_OUT_SFT 8 #define RT5514_SEL_ADC_OSR_MASK (0x7 << 4)