Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4362995ybl; Tue, 20 Aug 2019 10:44:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuNL0JpRDAxsJBMu8fJFwcM8bdpwqvGh6tYU9uY6Hm0jCZjXfuuheOaYT3AmPE/0pPfRyV X-Received: by 2002:a17:902:aa03:: with SMTP id be3mr29571371plb.240.1566323081805; Tue, 20 Aug 2019 10:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566323081; cv=none; d=google.com; s=arc-20160816; b=dIKLkQywkbUWP4xSfS+fR4uubHPu4sJojWY33EJodVfTloNa6wdKZFNWA2qTGLxBgJ /VywTdFek11kbnu+6YrhzLACFuAjExFoAYq5vXneVwpOxKonnusSpGzTDb03+2GmA8YT Lql9W/EjK3YsQxVDbq0wDYwV+AXXb60zwS7sgSN/TgMjnB3z2AMjPomDJuHHjaLShANW wlzS7kfnjC5MuRhrKyr30A+xXg6rbQ1rbY686UcoGA8XVB5XbdSkAekUa+NFDz+u7wcb k2yGf0ZJx78OeICNE3OBnSzfLUjxyt651rikVtaRhNe80wQiEkNNh5E2nM1zm73xKvr9 MgeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from; bh=cv4TUIOWFi+U3SKBDcKMgdYCwyfU6uWRpO1K0GUZKw4=; b=TKqRAs8KuQwLt0BeDIXOdQWx39HSo+IvBn/yjtlmcgMCHqiQzuTCl2S1G+q4DqX0Ob 41WF/UjV0tpGOoF2A01pkaLs8h0wYcQ1mY6sThRQLHbOWBUy70IPX5zflN5Ndq8Pi1b2 NmFdD6/KeMhPOuPYvfb5ViryMg2tvp41/MLCNrkfoz5VopNQLpbh4wbaECVXAeSYkfXG xs91EKwWeZoRYNAayzgxYCrunwlffiRrCIFWgtjP3vR0Bp3TDS4enqKwvqPcCVhJDyyG n7svQFG1TdvYESaDwdxBLkMmBr2M4rK9aElOAkYL43K3iycrunfEdnmoSvJM+QGXpd4p uX4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e33si12767045pld.416.2019.08.20.10.44.27; Tue, 20 Aug 2019 10:44:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730823AbfHTRl5 (ORCPT + 99 others); Tue, 20 Aug 2019 13:41:57 -0400 Received: from mail-wm1-f97.google.com ([209.85.128.97]:53568 "EHLO mail-wm1-f97.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730605AbfHTRlI (ORCPT ); Tue, 20 Aug 2019 13:41:08 -0400 Received: by mail-wm1-f97.google.com with SMTP id 10so3352972wmp.3 for ; Tue, 20 Aug 2019 10:41:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:message-id:date; bh=cv4TUIOWFi+U3SKBDcKMgdYCwyfU6uWRpO1K0GUZKw4=; b=pPcRKht82Qs8vPHt3Oboi+DKLg6CER7V8l88vuPGboLWp7jnEBjduwfwuNvVzHro+M lQHPiGsAl+oF4J31d6D2nV7m1WldTejYuQHjk9NFEPKTMNAxZBrlXh4A/Kzf4HPyma6l 7mSsTfMFjcqLm1Ij2vDczMOJcULKz4dZq+EXHKcCJ05fAryRaodj/QqCGPzo2odRCb7T cH8xVd0QjcwLKKIbwT8gMxgXoQ5tn1eMcEVfSBdvYeXgckfzMwPvOk5ztxY4M8pPHVhm s/1M9Dw1meukHH9xM1klv11yyhk8cj35WyVsUzlGbarg0eMHeWHoOq45UpG0kPYb7s8c 32Gg== X-Gm-Message-State: APjAAAW4Y0Io1TvDi4L78qFHDvVUeVQ/OO965ITzfV0aKDzt/Dp4fhn1 dsOZHkWCkWHPOzh3IaUDOJ27XcDEbIkkaBLUAdToj2ERUhe3jG5zo91IMm89RZ33tw== X-Received: by 2002:a1c:4d0c:: with SMTP id o12mr1296350wmh.62.1566322867460; Tue, 20 Aug 2019 10:41:07 -0700 (PDT) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk. [2a01:7e01::f03c:91ff:fed4:a3b6]) by smtp-relay.gmail.com with ESMTPS id x17sm4152wmk.48.2019.08.20.10.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 10:41:07 -0700 (PDT) X-Relaying-Domain: sirena.org.uk Received: from ypsilon.sirena.org.uk ([2001:470:1f1d:6b5::7]) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i0883-00033C-7z; Tue, 20 Aug 2019 17:41:07 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id A19B12742B4A; Tue, 20 Aug 2019 18:41:06 +0100 (BST) From: Mark Brown To: Maxime Ripard Cc: alsa-devel@alsa-project.org, broonie@kernel.org, Chen-Yu Tsai , codekipper@gmail.com, lgirdwood@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Brown , Maxime Ripard Subject: Applied "ASoC: sun4i-i2s: Rework MCLK divider calculation" to the asoc tree In-Reply-To: X-Patchwork-Hint: ignore Message-Id: <20190820174106.A19B12742B4A@ypsilon.sirena.org.uk> Date: Tue, 20 Aug 2019 18:41:06 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: sun4i-i2s: Rework MCLK divider calculation has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 8bcf62b73e5421df94deca95d7d7c152997fe5b4 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Mon, 19 Aug 2019 21:25:13 +0200 Subject: [PATCH] ASoC: sun4i-i2s: Rework MCLK divider calculation The MCLK divider calculation is currently computing the ideal divider using the oversample rate, the sample rate and the parent rate. However, since we have access to the frequency is supposed to be running at already, and as it turns out we're using it to compute the oversample rate, we can just use the ratio between the parent rate and the MCLK rate to simplify a bit the formula. Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/dcc5deb2eb650758d268bddd20f60ba58856d024.1566242458.git-series.maxime.ripard@bootlin.com Signed-off-by: Mark Brown --- sound/soc/sunxi/sun4i-i2s.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 77b7b81daf74..0a5fb9d4b289 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -240,11 +240,10 @@ static int sun4i_i2s_get_bclk_div(struct sun4i_i2s *i2s, } static int sun4i_i2s_get_mclk_div(struct sun4i_i2s *i2s, - unsigned int oversample_rate, - unsigned int module_rate, - unsigned int sampling_rate) + unsigned long parent_rate, + unsigned long mclk_rate) { - int div = module_rate / sampling_rate / oversample_rate; + int div = parent_rate / mclk_rate; int i; for (i = 0; i < ARRAY_SIZE(sun4i_i2s_mclk_div); i++) { @@ -323,8 +322,7 @@ static int sun4i_i2s_set_clk_rate(struct snd_soc_dai *dai, return -EINVAL; } - mclk_div = sun4i_i2s_get_mclk_div(i2s, oversample_rate, - clk_rate, rate); + mclk_div = sun4i_i2s_get_mclk_div(i2s, clk_rate, i2s->mclk_freq); if (mclk_div < 0) { dev_err(dai->dev, "Unsupported MCLK divider: %d\n", mclk_div); return -EINVAL; -- 2.20.1