Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2964773iog; Mon, 20 Jun 2022 08:23:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uq5k3QLCskR2M7zH8mY2CRPT78Io1aIFplG1WXL1fV7BmzKu0LW07fBUkHsA8TbzkBQ0XL X-Received: by 2002:a17:902:b216:b0:16a:854:e641 with SMTP id t22-20020a170902b21600b0016a0854e641mr16914720plr.154.1655738580475; Mon, 20 Jun 2022 08:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655738580; cv=none; d=google.com; s=arc-20160816; b=a+HrIFy5LGjfwO3Sn2c85jBt0ehDMBaXAgh15vK0LmYaOY11PuvukU4muhfcsngORw LHscdCELzEGm43WbDiW3Up1U/+g+lOzbkZv5w8QSzjBgQ6UsxXG1a+SlhhosEyJxr8w4 TRBTkJ4vWeQMbNBee2+xO8XZ1LeuTNH3hi3rJKcpWvwZgqzcAK/IV2NomTWF2nqzxxI8 94iZ9Qwk0bgjYcpx9T8ejFY/6gEyAxiCRX5mVZqWwkEZH/q8mSNLoO29ZsvGxQ0q24Fn r+BHotRaP+ORwN3Ybf+4uDqyySc8sCaaEoPXwRY7uPNZ+VApZ/r7Ut+6kZnRwTxJJZiV MBhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7ewEZnNsxOZTVju+CEJ5hgOrSOYqZSapIr7+fGOkEWs=; b=MMFrwC7eo5s5F06gW5w1Amyzw6Bg9P7oyzc/mszrEUfWS1J4+8etzVPAECjFEf3OcV h3PfthSbGfKF+HBR1ABe8ChQEbR+VZA0mWVlHl8cgISj8k9fVTWBVEsmas8SRuWKJPlG fckzjSiBfXGVEiZqFIF+zwZ9/2S7YOhcywsJpIx8MWs5Fv1NgDwlpm0u1KaBcor+7sob KIIRrEJi0yoRhvWNN6jUCV/b31Xw3p1mH99SFCIvilTDMB+3Aya7S9p9lbUv/DVQojoF YyHSTsOTVVk4ldeIpYGo9XUOX4FBVFKMn0Cvs1gv+RcZjCEwcuS33qBKRBRma0Ut8ZZf YrmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bge1Sada; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p24-20020a056a000a1800b0050d5cf88e9esi12646787pfh.367.2022.06.20.08.22.47; Mon, 20 Jun 2022 08:23:00 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bge1Sada; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349240AbiFTOFi (ORCPT + 99 others); Mon, 20 Jun 2022 10:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350535AbiFTNxl (ORCPT ); Mon, 20 Jun 2022 09:53:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5546D12761; Mon, 20 Jun 2022 06:20:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B343A60AC0; Mon, 20 Jun 2022 13:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76A05C3411B; Mon, 20 Jun 2022 13:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655731194; bh=uDO5nkW3n7id8M1f7aDZx0zjUV7GsY+47TRMg3RV4e4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bge1Sadacq4HQ6pJK/aa0SaWKQ6Vetbpo/1aiJ0KEqjS90DhzQOgi6uwNJlAhF0hJ yAy/nhTEOQFevwqO6MPfgPpWfb30nushgQwxbYF6YpIlZeAM34+UE1aQ6iuf8zA+oH Rr3JCjWQ3RewPV7Es9DWSXw5DKXfC2NX7xy9vqPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Lin , John Hsu , Seven Li , Hui Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 182/240] ASoC: nau8822: Add operation for internal PLL off and on Date: Mon, 20 Jun 2022 14:51:23 +0200 Message-Id: <20220620124744.266534259@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124737.799371052@linuxfoundation.org> References: <20220620124737.799371052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Hui Wang [ Upstream commit aeca8a3295022bcec46697f16e098140423d8463 ] We tried to enable the audio on an imx6sx EVB with the codec nau8822, after setting the internal PLL fractional parameters, the audio still couldn't work and the there was no sdma irq at all. After checking with the section "8.1.1 Phase Locked Loop (PLL) Design Example" of "NAU88C22 Datasheet Rev 0.6", we found we need to turn off the PLL before programming fractional parameters and turn on the PLL after programming. After this change, the audio driver could record and play sound and the sdma's irq is triggered when playing or recording. Cc: David Lin Cc: John Hsu Cc: Seven Li Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20220530040151.95221-2-hui.wang@canonical.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/nau8822.c | 4 ++++ sound/soc/codecs/nau8822.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c index 78db3bd0b3bc..cd163978792e 100644 --- a/sound/soc/codecs/nau8822.c +++ b/sound/soc/codecs/nau8822.c @@ -740,6 +740,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int pll_id, int source, pll_param->pll_int, pll_param->pll_frac, pll_param->mclk_scaler, pll_param->pre_factor); + snd_soc_component_update_bits(component, + NAU8822_REG_POWER_MANAGEMENT_1, NAU8822_PLL_EN_MASK, NAU8822_PLL_OFF); snd_soc_component_update_bits(component, NAU8822_REG_PLL_N, NAU8822_PLLMCLK_DIV2 | NAU8822_PLLN_MASK, (pll_param->pre_factor ? NAU8822_PLLMCLK_DIV2 : 0) | @@ -757,6 +759,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int pll_id, int source, pll_param->mclk_scaler << NAU8822_MCLKSEL_SFT); snd_soc_component_update_bits(component, NAU8822_REG_CLOCKING, NAU8822_CLKM_MASK, NAU8822_CLKM_PLL); + snd_soc_component_update_bits(component, + NAU8822_REG_POWER_MANAGEMENT_1, NAU8822_PLL_EN_MASK, NAU8822_PLL_ON); return 0; } diff --git a/sound/soc/codecs/nau8822.h b/sound/soc/codecs/nau8822.h index 489191ff187e..b45d42c15de6 100644 --- a/sound/soc/codecs/nau8822.h +++ b/sound/soc/codecs/nau8822.h @@ -90,6 +90,9 @@ #define NAU8822_REFIMP_3K 0x3 #define NAU8822_IOBUF_EN (0x1 << 2) #define NAU8822_ABIAS_EN (0x1 << 3) +#define NAU8822_PLL_EN_MASK (0x1 << 5) +#define NAU8822_PLL_ON (0x1 << 5) +#define NAU8822_PLL_OFF (0x0 << 5) /* NAU8822_REG_AUDIO_INTERFACE (0x4) */ #define NAU8822_AIFMT_MASK (0x3 << 3) -- 2.35.1