Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752758AbdDDHzD (ORCPT ); Tue, 4 Apr 2017 03:55:03 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:34357 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbdDDHzC (ORCPT ); Tue, 4 Apr 2017 03:55:02 -0400 MIME-Version: 1.0 In-Reply-To: <20170403135436.GV6986@localhost.localdomain> References: <1420615905-4078-1-git-send-email-zidan.wang@freescale.com> <1420615905-4078-2-git-send-email-zidan.wang@freescale.com> <20150114192703.GH3043@sirena.org.uk> <20150115133439.GA29323@b50113> <20170403133434.GU6986@localhost.localdomain> <20170403135436.GV6986@localhost.localdomain> From: Daniel Baluta Date: Tue, 4 Apr 2017 10:55:00 +0300 Message-ID: Subject: Re: [alsa-devel][PATCH v2 2/2] ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock To: Charles Keepax Cc: Mark Brown , Liam Girdwood , Jaroslav Kysela , tiwai@suse.de, Lars-Peter Clausen , patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org, Linux Kernel Mailing List , shengjiu.wang@nxp.com, mihai.serban@nxp.com, viorel.suman@nxp.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1796 Lines: 58 On Mon, Apr 3, 2017 at 4:54 PM, Charles Keepax wrote: > On Mon, Apr 03, 2017 at 04:39:40PM +0300, Daniel Baluta wrote: >> On Mon, Apr 3, 2017 at 4:34 PM, Charles Keepax >> wrote: >> > On Mon, Apr 03, 2017 at 04:16:23PM +0300, Daniel Baluta wrote: >> > Does this problem still remain after the relaxed clock >> > computation? The maths you quote depends on the derived BCLK >> > being exactly the correct speed for the audio, that is no longer >> > the case anymore. >> > >> > I would have thought the patch would cover both situations, as in >> > if we can produce a suitable LRCLK, then we just pick a BCLK we >> >> That! >> >> The problem for remaining rates is that we cannot derive the LRCLK >> >> >> + for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { >> + if (sysclk != dac_divs[j] * lrclk) >> + continue; >> >> > > If you can't generate the LRCLK you either need a different > source clock or to use the PLL. You don't want to be trying to > pull 44.1k audio over a link that is clocked on a 48k based > clock. Yup, this makes sense to me. > > Is the problem here that the PLL part of the code is making the > same assumption as the direct part of the code was, that the bclk > should be exact? Yes. After wm8960_configure_sysclk fails to find a LRCLK, we try to use the PLL. Anyhow, here we don't even reach to check if the PLL can be used because there is no solution for the following system: freq_out = sysclk * sysclk_divs[i]; sysclk = lrclk * dac_divs[j]; sysclk == bclk * bclk_divs[k] Perhaps, we can also try here to relax bitclk computation like we did for when sysclk was directly derived from mclk. thanks, Daniel.