Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2921904iog; Mon, 20 Jun 2022 07:33:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tphRyzsfShjZeOWlU/aLfoPbYCsV6jKaJ4Xs6+i+urxdK78pAH+g8syDoWsTlypoO6WwrP X-Received: by 2002:a65:6bd6:0:b0:39d:4f85:9ecf with SMTP id e22-20020a656bd6000000b0039d4f859ecfmr22330530pgw.336.1655735602360; Mon, 20 Jun 2022 07:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655735602; cv=none; d=google.com; s=arc-20160816; b=DKTEz6qAJ2nfBfZkSPoCS1brbcpJAMx9fwOHQcx3R8/sfr3aen/CTSICZw99PB5LUF NC7lilI3EcbJbuJg/ts11H+RLBCwd02c/m/LOS6nkPs7jsgG/D4Y0LtVIGzuQpY3cboN ohJEBatRLVhkuVZdAT+JRFzE725J1ak/DCtjE+PfqN4xlpH09DuKGBWcEtmIQcbFgxe5 3BkEYAAljN3qDYXJCB2Jgd+4hr6c8jZlj1SUPcjbiF2mbAWYBkbsmeuhD4QJx52IAqXz 3rz3p7Z+YXX30EwaqC99LAs/OhuNy4SN4lGStXAyLF3AanEl8SLoQx6Hp8HYzEQjv6mu x1kQ== 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=CjWGvIqrGITK9HvBR5IiKHWd/TEfd/N3LZpHdzTbc+c=; b=gXBhFub50evDaqSxAHjMGl4DKSgyM5loagrMYrpAzVCUUQYTNrYzjJgCRTGOoO0jzg bMe3ZwYYcaEsORnvORbZvkq3mvtWrqEQ9CLD94wBAOT+OLJo+v6429A8iAzxPZLDVUlY k7J+PJwF6myLyYPKasWKNK+p/8Aq+K+bzkUfC+OYDhUkXLtICmeE1DqUMELivj+N3wWy w2Y2UyF9dQogZpCKTY3bqhAkLIqXL8HVbC3UQFlTFLoVqGzfIgks6sronf/W0wPGPRd6 4LUVgrpYfC8+JarKyMfEKB4ODvzGc0JUtHdAxXO+eQRGOE1SEX4TCQ1fM108laK5oJyJ EvgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eyYqHwo6; 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 q21-20020a17090a2e1500b001e3015b93absi15619555pjd.12.2022.06.20.07.33.08; Mon, 20 Jun 2022 07:33:22 -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=eyYqHwo6; 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 S242876AbiFTNMS (ORCPT + 99 others); Mon, 20 Jun 2022 09:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245686AbiFTNJV (ORCPT ); Mon, 20 Jun 2022 09:09:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4DBC5F9D; Mon, 20 Jun 2022 06:03:55 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5EA86B811B9; Mon, 20 Jun 2022 13:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5403C3411B; Mon, 20 Jun 2022 13:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730069; bh=DwlLbd8GKUT6Ycqzy2yQZei1Q/LJ1eFQP4Yg2Ok8Y7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eyYqHwo6nJi9A1usGy2Rc7QA8KUVv0V0Kgof4x/S846YIBACkkp3vrUiJCapg9sG1 R0xpOMnaX/Sbpk2mZ66d1vr7wAPmVc+LhYE3hLZRkgzdoCnj/5OQ/ayd3Brl7OHlbC OVShvt95g4+IycXbpje1aiqgSY3PGwlEd549RIAY= 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.10 06/84] ASoC: nau8822: Add operation for internal PLL off and on Date: Mon, 20 Jun 2022 14:50:29 +0200 Message-Id: <20220620124721.074506001@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124720.882450983@linuxfoundation.org> References: <20220620124720.882450983@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 609aeeb27818..d831959d8ff7 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