Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3767838iog; Tue, 28 Jun 2022 02:16:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQFibMZ6azdb3nZDIT4bbgJZTQiDq5O8gXQHq1OnC1aQ6iuEo+3sXrF7zRFY+78qWEsp6F X-Received: by 2002:a63:6a42:0:b0:3fe:2556:c629 with SMTP id f63-20020a636a42000000b003fe2556c629mr17029276pgc.159.1656407769726; Tue, 28 Jun 2022 02:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656407769; cv=none; d=google.com; s=arc-20160816; b=D+wJQpEhLCk/72vboEVVSzefFNWvFcvmcgQdLjqNg6JItgfJlaY6HKUSorQKqR0af7 cr0VBU35MIeYRpmz+Rm6ST3qMu2/9IJfnf5TeBToVLbK+QlXgMR3RS4tV0lLXuE6uFN0 j+3OnGssAZR7XmDJy2fOENr/nXE8VHB4L+fMU8Zlo0s2Z4I4bRp5krKrMlp2pvXk66eU /suRlEfdG6GChMj6MfyrC4UgVCx9n+0pvqdyBXaohifT+kCX5iE1tMolC+liltB3tb94 e9U8DnDDcReYr0zPth1dwGJA/jcM3wvN4nPpUWFIhL9HgBsWb+mEEpf/Emijw9C9elo3 C/jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=XkcFx43P5RUvLt63ZJBLsIJ8F7XAw8JHmx2mbStphXI=; b=LXJE0UdDk7pFQjF+5Qq6N+qRBARDpbhjMWZJXhvxlXvnmJoN6OGd7aoTc9cRbLlnTC W30SWidY3ijgPNKhi1Ad75ns1kheEkxF2ZaISArbNl7cqvi4jdEFwCpk8QG4j/Uwy8Hb ZSsbc7rsLcbpovGqQue9a0K6zCZZX2msArW7LiM3VYhIBu2Swj27TgjYsapzL0ndqGvf XwlpN7EkkS+eXpuuS0w1DeZyt+8FlzCGyPyGjiESAzARkWodSFXYXG/zmgq/S/zjZPLh N9NpsecGx2V0blp0oGvhOtTHDIY1+bdafrk9Wv+UoetfTsaf+Sg9Riyj9Fv8hmfuInHR URZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nk16-20020a17090b195000b001e0b16a6bb9si16432253pjb.159.2022.06.28.02.15.58; Tue, 28 Jun 2022 02:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244326AbiF1Iye (ORCPT + 99 others); Tue, 28 Jun 2022 04:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241584AbiF1Iyc (ORCPT ); Tue, 28 Jun 2022 04:54:32 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9B42DA80 for ; Tue, 28 Jun 2022 01:54:31 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 9F98D2027B3; Tue, 28 Jun 2022 10:54:30 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 66FCA2027C9; Tue, 28 Jun 2022 10:54:30 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 3A9FD1802204; Tue, 28 Jun 2022 16:54:29 +0800 (+08) From: Shengjiu Wang To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_micfil: change micfil default settings Date: Tue, 28 Jun 2022 16:39:49 +0800 Message-Id: <1656405589-29850-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previous default settings resulted in loose dynamic range and low sound level. New default configuration changes: - outgain = 2 - quality mode = VLOW0 - dc remover = bypass Signed-off-by: Irina Patru Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_micfil.c | 22 ++++++++++++++++++---- sound/soc/fsl/fsl_micfil.h | 9 +++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c index 25c647ae080a..18ab80b68752 100644 --- a/sound/soc/fsl/fsl_micfil.c +++ b/sound/soc/fsl/fsl_micfil.c @@ -48,6 +48,7 @@ struct fsl_micfil { char name[32]; int irq[MICFIL_IRQ_LINES]; enum quality quality; + int dc_remover; }; struct fsl_micfil_soc_data { @@ -336,12 +337,25 @@ static const struct snd_soc_dai_ops fsl_micfil_dai_ops = { static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai) { struct fsl_micfil *micfil = dev_get_drvdata(cpu_dai->dev); - int ret; + struct device *dev = cpu_dai->dev; + unsigned int val = 0; + int ret, i; + + micfil->quality = QUALITY_VLOW0; - micfil->quality = QUALITY_MEDIUM; + /* set default gain to 2 */ + regmap_write(micfil->regmap, REG_MICFIL_OUT_CTRL, 0x22222222); - /* set default gain to max_gain */ - regmap_write(micfil->regmap, REG_MICFIL_OUT_CTRL, 0x77777777); + /* set DC Remover in bypass mode*/ + for (i = 0; i < MICFIL_OUTPUT_CHANNELS; i++) + val |= MICFIL_DC_BYPASS << MICFIL_DC_CHX_SHIFT(i); + ret = regmap_update_bits(micfil->regmap, REG_MICFIL_DC_CTRL, + MICFIL_DC_CTRL_CONFIG, val); + if (ret) { + dev_err(dev, "failed to set DC Remover mode bits\n"); + return ret; + } + micfil->dc_remover = MICFIL_DC_BYPASS; snd_soc_dai_init_dma_data(cpu_dai, NULL, &micfil->dma_params_rx); diff --git a/sound/soc/fsl/fsl_micfil.h b/sound/soc/fsl/fsl_micfil.h index 053caba3caf3..d60285dd07bc 100644 --- a/sound/soc/fsl/fsl_micfil.h +++ b/sound/soc/fsl/fsl_micfil.h @@ -73,6 +73,15 @@ #define MICFIL_FIFO_STAT_FIFOX_OVER(ch) BIT(ch) #define MICFIL_FIFO_STAT_FIFOX_UNDER(ch) BIT((ch) + 8) +/* MICFIL DC Remover Control Register -- REG_MICFIL_DC_CTRL */ +#define MICFIL_DC_CTRL_CONFIG GENMASK(15, 0) +#define MICFIL_DC_CHX_SHIFT(ch) ((ch) << 1) +#define MICFIL_DC_CHX(ch) GENMASK((((ch) << 1) + 1), ((ch) << 1)) +#define MICFIL_DC_CUTOFF_21HZ 0 +#define MICFIL_DC_CUTOFF_83HZ 1 +#define MICFIL_DC_CUTOFF_152Hz 2 +#define MICFIL_DC_BYPASS 3 + /* MICFIL HWVAD0 Control 1 Register -- REG_MICFIL_VAD0_CTRL1*/ #define MICFIL_VAD0_CTRL1_CHSEL GENMASK(26, 24) #define MICFIL_VAD0_CTRL1_CICOSR GENMASK(19, 16) -- 2.17.1