Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1895386ybh; Fri, 17 Jul 2020 04:17:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwexxrMDJWEjgze2rncZ8rwOvBIa/pmlt/hPITmcroWRQl3KHHtS7ioR2qSpBZdclV59FGk X-Received: by 2002:a17:906:b0d5:: with SMTP id bk21mr7791325ejb.93.1594984639616; Fri, 17 Jul 2020 04:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594984639; cv=none; d=google.com; s=arc-20160816; b=Bp8Y8APWynRY5knWpOgS6ZFMDeSV7gN9GPnWwx2TgjM/li53zwq2fngKBNlkB04d2Q QX54c4Zqpx+wBoVi7n4Sp4KbJQilppGPzDXYydpUmdddxFckpiuWJWA96idiDLFEOPP2 1nuNbytAEZFdW8NSqQ1taAcoykZvlNFd8yHFvffoEu3vVIKWztcXPtqX9K9AueDw4sEE Hz8+2Jo04LUatmvDSGbde0p+OQ/nu0ALlPr33jm+aHR+K7sWK40fvEYr1xSYhDkS6AJM +iQZbIiOPjuRK9V3slP8QC2SWhBGiBmREwaAtHbN/n5fIHiwFl32/5XijDYllcgh+qkb S/gw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=edbaIYoGL+3vTwC/NH6h0Kk8p9O7g2BAsiLYhvlhp40=; b=M0D61/0V2TQkl4BZdsCZ6qODNcORRlv/y5v8h244HCa6QSR3WLNcrCGaAi9UwusXoq 4tFkTBToKlZGLXANnyCBNKxGXaCMLCgNQRGsicWTvt9zQcern6wXwyQSzE7apUcm3tyP RWaFcZc23do54H5fNN8toaSaaBFyNjaeVS2Jk2lZS5WNQcHnZotCGbHqQeOFVLcpy3qO todr96Pm6IBp8Lg7QPY2wf6pk55oTrAljb8ETtpMk0bYxRXxYvJJmiPummnTWhWz0DMR HZ714l6F3KfY+FwESP0bnISGPuRM2xbgUW5fuicglZlcx7XDEkW1OZ3K9u+lHXEtPfWk g9XA== 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 yd6si4800174ejb.326.2020.07.17.04.16.56; Fri, 17 Jul 2020 04:17:19 -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 S1726238AbgGQLQs (ORCPT + 99 others); Fri, 17 Jul 2020 07:16:48 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:56328 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726013AbgGQLQr (ORCPT ); Fri, 17 Jul 2020 07:16:47 -0400 Received: from [IPv6:2a01:e35:2fb5:1510:c567:382e:1974:9868] (unknown [IPv6:2a01:e35:2fb5:1510:c567:382e:1974:9868]) (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 589032A5CA8; Fri, 17 Jul 2020 12:16:45 +0100 (BST) Subject: Re: [PATCH 0/4] ASoC: fsl_asrc: allow selecting arbitrary clocks To: Nicolin Chen Cc: kernel@collabora.com, Liam Girdwood , Mark Brown , Rob Herring , Timur Tabi , Xiubo Li , Fabio Estevam , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20200702142235.235869-1-arnaud.ferraris@collabora.com> <20200702184226.GA23935@Asurada-Nvidia> From: Arnaud Ferraris Autocrypt: addr=arnaud.ferraris@collabora.com; keydata= mQINBF6V3oEBEADExzr1s9YngScJ0KNMGen7k3cH1sn0h7tf7AFlXA94jXBgFyzIMT5lqey0 9LwcO6AIkFF+gRVAKIblkeacsy5W6OQXgdFMitx936oAcU0XYQ2X5NxCQHzEsWYzkLIZnFTB Ur3CW9HtAjAircED5KVJzA1GM8BEFfG3LoonWsw0CO9UN2arwT1uLARSPgL6LPpmo1IOSwJh D6vtOyzlRrLkw4KHzUobEiIjxzjXttH8TC3I6OSb8kavG08cmA+DMf/nLFxK0QbdOP2wSZ0w UTU6RBikuLmDBaT4PphuwtAgVwhO9l0PNRoYzugrXuRF0RCLpmJN05tz/o/w7Y8ieLgQE8Om xGKXJyo0T4wlUl9ARM9Y0ZIRhdI1alFspBcF63oyZmOAT+2fPLr6W0fEfmtMBhDaZun2ZdKR M1JwTTkh8jVLs3svM3Ch2JjiH0kgYA0oza5fXaB9s4Fa4fxpmacx8fawKR5r/BhmYNK15PPd YxIZJqnTJgCDI2G4tQ9K+Eev1rBo6i8n96rDqxTxdyQixMhxMmGtj6/bknpVIN947ABKDHdt UsWa4E+qwFrYDXT7RxhL+JGn4VrtIR1kpTJHfmVXnn+RW7JKdDkalvEuXJSOArszcgpDlYRq +ZT/ybdcmdtuz8+Ev0fig/9WdPBHwg5oKDlT6+iN0oISAzoFSQARAQABtC9Bcm5hdWQgRmVy cmFyaXMgPGFybmF1ZC5mZXJyYXJpc0Bjb2xsYWJvcmEuY29tPokCVAQTAQgAPhYhBHlts5Pc P/QCIrbqItPrtZZruZGWBQJeld7dAhsDBQkDwmcABQsJCAcDBRUKCQgLBRYCAwEAAh4BAheA AAo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2jhypQ1zRmrngf7M5 xZQG6fKWuIur3RI= Message-ID: Date: Fri, 17 Jul 2020 13:16:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200702184226.GA23935@Asurada-Nvidia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nic, Le 02/07/2020 à 20:42, Nicolin Chen a écrit : > Hi Arnaud, > > On Thu, Jul 02, 2020 at 04:22:31PM +0200, Arnaud Ferraris wrote: >> The current ASRC driver hardcodes the input and output clocks used for >> sample rate conversions. In order to allow greater flexibility and to >> cover more use cases, it would be preferable to select the clocks using >> device-tree properties. > > We recent just merged a new change that auto-selecting internal > clocks based on sample rates as the first option -- ideal ratio > mode is the fallback mode now. Please refer to: > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20200702&id=d0250cf4f2abfbea64ed247230f08f5ae23979f0 While working on fixing the automatic clock selection (see my v3), I came across another potential issue, which would be better explained with an example: - Input has sample rate 8kHz and uses clock SSI1 with rate 512kHz - Output has sample rate 16kHz and uses clock SSI2 with rate 1024kHz Let's say my v3 patch is merged, then the selected input clock will be SSI1, while the selected output clock will be SSI2. In that case, it's all good, as the driver will calculate the dividers right. Now, suppose a similar board has the input wired to SSI2 and output to SSI1, meaning we're now in the following case: - Input has sample rate 8kHz and uses clock SSI2 with rate 512kHz - Output has sample rate 16kHz and uses clock SSI1 with rate 1024kHz (the same result is achieved during capture with the initial example setup, as input and output properties are then swapped) In that case, the selected clocks will still be SSI1 for input (just because it appears first in the clock table), and SSI2 for output, meaning the calculated dividers will be: - input: 512 / 16 => 32 (should be 64) - output: 1024 / 8 => 128 (should be 64 here too) --- I can't see how the clock selection algorithm could be made smart enough to cover cases such as this one, as it would need to be aware of the exact relationship between the sample rate and the clock rate (my example demonstrates a case where the "sample rate to clock rate" multiplier is identical for both input and output, but this can't be assumed to be always the case). Therefore, I still believe being able to force clock selection using optional DT properties would make sense, while still using the auto-selection by default. Regards, Arnaud > > Having a quick review at your changes, I think the DT part may > not be necessary as it's more likely a software configuration. > I personally like the new auto-selecting solution more. > >> This series also fix register configuration and clock assignment so >> conversion can be conducted effectively in both directions with a good >> quality. > > If there's any further change that you feel you can improve on > the top of mentioned change after rebasing, I'd like to review. > > Thanks > Nic >