Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3025168rwb; Mon, 15 Aug 2022 16:23:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5aoNit/KuTdJ9JIltOZz1BcxjHNh880jmXHrW3hCd3Ydqg9mQn+tLNaFM6cFYmQ4G3WaLB X-Received: by 2002:a17:902:d2d1:b0:16e:eeac:29ab with SMTP id n17-20020a170902d2d100b0016eeeac29abmr19574852plc.125.1660605790114; Mon, 15 Aug 2022 16:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605790; cv=none; d=google.com; s=arc-20160816; b=TdHk/mK6D25gh5aWmrSMziVwAJmHPRLV+TybS6aSBBqpSMkGmbAEz/QnwQ2ZM8TrpG 8nzUmD6s3JfKIds+XsHvkMZNdNUyBNe6kYTzAhl03SLgKE4pNIcujaSphsPJbvezAyla AvXrsZbxnf/RnRPo8B/orsyn288gGHC6cQmgjQpNlqNweK/xP0qsEgHaJEyFwb1zTm1q YxGD41txLCE/7H8XhTeSh5nz7meZUWaPj2u1221ALNjh66+EgV9IDkZTyAKhHEDEpmP1 Yfq+xkzJ3y1f9oTBFRxjaD1NjkdtEMlUa/Ynzu7QAvofQAceLWVFKcrPclKuf7UyG1tx 2lDw== 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=5LQeeCuTZMYMdem2q9mVlglEVgnFoPpMo6rVuDx8LqA=; b=fnEwlmwKGz72NzxMveTjHCrvPRYlUxZs9ZDS7W3oR6qoZojFsnvABJSOCHJKplUX1l nv+fDwy7ioHkrz17sTQc1CO4mbr9o+o7JATZI9Zt1MOn0qcGc3w47apF7QMmyovif4Sq 57+tbQRDXneEWAkO6u+MHRfN6ssrFY0/g3hne7UYRHKx7XY+b1gNPccPSrUd7BcEg+Jl KfYQIrEFFkGqF7M9mqcSs3ttBBieS2e+oFcQyciOIRNk1GS785+Oghs4SbQqecstrc/1 MxQD7t0cz5XN3f4/Q04tBmWhHApT72xwWDHHmiCe1oxZuqpQoKRntiLE++w041T4hf9i LQ0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vl5Eumm5; 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 a27-20020a634d1b000000b004117e8114casi10582147pgb.483.2022.08.15.16.22.59; Mon, 15 Aug 2022 16:23:10 -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=vl5Eumm5; 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 S1351189AbiHOWhr (ORCPT + 99 others); Mon, 15 Aug 2022 18:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350628AbiHOWcB (ORCPT ); Mon, 15 Aug 2022 18:32:01 -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 E74E012BFFD; Mon, 15 Aug 2022 12:48:39 -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 3B5C76123B; Mon, 15 Aug 2022 19:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DA54C433C1; Mon, 15 Aug 2022 19:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592911; bh=hoC3688rHs7GdImLyycObxElTTb+PGyVRE6FR7k3NtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vl5Eumm5nWkXt9tXHSroJceqDKE/HiZUn/piR30C8nyf622mrKqqf05horENqj0ec 4ZRPTppi2ThgZ7/EJ9W7hBNjaZ2jyFZ9SIJUIFilvrb623wJTES9PzsiiHWKhZfk+f odD9TaEb/MBeRCf+JlFzLkXH4ghq635isKbv+n6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0865/1095] ASoC: imx-card: Fix DSD/PDM mclk frequency Date: Mon, 15 Aug 2022 20:04:24 +0200 Message-Id: <20220815180505.150844251@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Shengjiu Wang [ Upstream commit c0fabd12a8570cb932f13d9388f3d887ad44369b ] The DSD/PDM rate not only DSD64/128/256/512, which are the multiple rate of 44.1kHz, but also support the multiple rate of 8kHz, so can't force all mclk frequency to be 22579200Hz, need to assign the frequency according to rate. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1657100575-8261-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/imx-card.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 6f8efd838fcc..c0eb218a254b 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -17,6 +17,9 @@ #include "fsl_sai.h" +#define IMX_CARD_MCLK_22P5792MHZ 22579200 +#define IMX_CARD_MCLK_24P576MHZ 24576000 + enum codec_type { CODEC_DUMMY = 0, CODEC_AK5558 = 1, @@ -353,9 +356,14 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream, mclk_freq = akcodec_get_mclk_rate(substream, params, slots, slot_width); else mclk_freq = params_rate(params) * slots * slot_width; - /* Use the maximum freq from DSD512 (512*44100 = 22579200) */ - if (format_is_dsd(params)) - mclk_freq = 22579200; + + if (format_is_dsd(params)) { + /* Use the maximum freq from DSD512 (512*44100 = 22579200) */ + if (!(params_rate(params) % 11025)) + mclk_freq = IMX_CARD_MCLK_22P5792MHZ; + else + mclk_freq = IMX_CARD_MCLK_24P576MHZ; + } ret = snd_soc_dai_set_sysclk(cpu_dai, link_data->cpu_sysclk_id, mclk_freq, SND_SOC_CLOCK_OUT); -- 2.35.1