Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1278844ybh; Thu, 16 Jul 2020 07:56:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFdsUEXCzA9xGtZJxZb9jtZ+utRABHhmnw4wBOTRe7ta8zYaiGyTaW1q5k/FjrbGD9vp5V X-Received: by 2002:a50:d09c:: with SMTP id v28mr4884397edd.58.1594911407627; Thu, 16 Jul 2020 07:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594911407; cv=none; d=google.com; s=arc-20160816; b=OWLXNyHonpR+4tLvtH99AWk166+ZjfPZtgTmF4HEteB/FTSHca10Wk+v4JwAb5oTH8 8FHjVxMBZJqfo/iOgZMB4d6U4tJODF7YfcDRyK4c9Ffw52At6s2AcWZR27W3MI8gOmyC yfMaeeXJDedzVSB1Wn14mlG0cKNLnd0lJuZh1ISHjN892z9fy8oDlJrxzbTmnNaVgext AX4GiCM2jLStAm/7j3Xw4H3Fq6XstTliNXArAj1qp0g6H18mQmXET9VMmS5yoptPE/dd QsRtQQ/UBPJfxld8mpGw6tHpMmSWYdUYCIpsyyHOZ0Y9VCmSre/sYuBWXLVvgN3MUoeM 2mlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h8Ku+IDVViotP1tkGAZkezuIu7SQKstAHuCx6OUShFU=; b=vpKFTaXDoJpbLxI7VX+++823YEcyU5s4+ysY5ew+dFL8MuvMiDvmwjflX+pL8ioSwj hyJ2XDvTRuDbuV9TOcdwuDrotVXbMFZnTyFeFo/JrPYNrFwp9qoUduLO6yFe9YCMXyA1 AHhLfYL2hC9BpL0T9reNZwl0JHRyW5ZfNDm6tSf1KAOmBgX36d7h8f1LCq8+W3H1hw4T uB/l1MguMrGe6TqGOUC0H9LSiWvf923gQCj9CnV/+5bLxy4oV26T5HxY3mLt6bZXH/KC CPaRUqH6U3+Uw1SttZ0+lkZZXmKkjcZ3CGG5Aq4f8sxLOYtZgI4MGiF0d+jOI6zsAYJ/ lPqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss22si3364192ejb.530.2020.07.16.07.56.24; Thu, 16 Jul 2020 07:56:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbgGPOwk (ORCPT + 99 others); Thu, 16 Jul 2020 10:52:40 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46556 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbgGPOwj (ORCPT ); Thu, 16 Jul 2020 10:52:39 -0400 Received: from xps.home (unknown [IPv6:2a01:e35:2fb5:1510:95f7:ce7f:fb76:c54a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aferraris) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id E5D742A50D8; Thu, 16 Jul 2020 15:52:37 +0100 (BST) From: Arnaud Ferraris To: alsa-devel@alsa-project.org Cc: Timur Tabi , Nicolin Chen , Xiubo Li , Fabio Estevam , Shengjiu Wang , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, kernel@collabora.com, Arnaud Ferraris Subject: [PATCH 1/2] ASoC: fsl_asrc: make sure the input and output clocks are different Date: Thu, 16 Jul 2020 16:52:00 +0200 Message-Id: <20200716145201.186270-2-arnaud.ferraris@collabora.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200716145201.186270-1-arnaud.ferraris@collabora.com> References: <20200716145201.186270-1-arnaud.ferraris@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current clock selection algorithm might select the same clock for both input and output. This can happen when, for instance, the output sample rate is a multiple of the input rate. This patch makes sure it always selects distinct input and output clocks. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl_asrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 02c81d2e34ad..bfd35b9c0781 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -622,7 +622,8 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv, clk_rate = clk_get_rate(asrc_priv->asrck_clk[clk_index]); /* Only match a perfect clock source with no remainder */ if (clk_rate != 0 && (clk_rate / rate[j]) <= 1024 && - (clk_rate % rate[j]) == 0) + (clk_rate % rate[j]) == 0 && + (j == 0 || i != select_clk[j-1])) break; } -- 2.27.0