Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3432462pxj; Mon, 24 May 2021 06:41:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD2/AnY2R9T0WZ8rul3MpLZ8G/ZscgdUmro3rQ/vZWqvY+85BdyRifnTpse7t134/C4WQ4 X-Received: by 2002:a05:6e02:e05:: with SMTP id a5mr13951349ilk.235.1621863688372; Mon, 24 May 2021 06:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621863688; cv=none; d=google.com; s=arc-20160816; b=c8hxmMvx6TMbaj/HzYH1JoHugJX6LV5pEuXxtpv/1v6Pgf6CACEaN48hZ8YmAPMxbb w+1OW73lM2uoVrthEYZGYvXm0h9xTBKbimhaOUzGXLo7FrVcm1mwQWHO8OEpTctxFh7R AulY9e8A6Dp/x1gnQIw8G8eGQ+helOp7VONpa6t+6/QDyMipoHGpsPvklzqLusHzR/u2 cxPm8oTofDdkRVgLQ0hShZbaRhzMt1iFW9xj3qdSSJaRd/csRjA4rifpoMEON+rynNio xu7n4BHZn46aRG5MXWO67iRiEvv91spuVHxuuEBHSeRbxM0KMWr1ZMZLC2UL32o+8KYs +F3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=+9LDxds78ZpBu8bZ2YStDaoNow/+xEuqsaqJfEUvzSs=; b=RoztbT1uYJRHmLVkvfuoOnNmvvr4jVQImyLhfSmv4hDXuzs9aw1Pvst2PM9U6TDnQG UzwNYb/h2Nu8R9oKLdkMCMtkRGztQ3NRFFDybOkgzQw3FTtgh8JqlMC8VV9MpAouoXuQ 7kcIsi/PbTXVAD24dwsaTWNSFdR0LE/M6+4V24o7hfFd1Xf4+liJUSnvKj2LRSUfsDfn X/JboDFM/vj09RvJAkQSqlfCnfY7Q6jKfRU0hoGq5CQvK/XOjJnCaIFlv1hSXhGvKKr4 O5E3pWrGwFaVJ/OoU4dRRZTx59M9M5BhDl3pcgdBV4qpyAi3INbZVLJx4Sull51DNt3q lTOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qu+hXeFu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si15268545jat.59.2021.05.24.06.41.14; Mon, 24 May 2021 06:41:28 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qu+hXeFu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbhEXNmD (ORCPT + 99 others); Mon, 24 May 2021 09:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232409AbhEXNmC (ORCPT ); Mon, 24 May 2021 09:42:02 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5077C061574; Mon, 24 May 2021 06:40:33 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id p20so33644940ljj.8; Mon, 24 May 2021 06:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+9LDxds78ZpBu8bZ2YStDaoNow/+xEuqsaqJfEUvzSs=; b=qu+hXeFuBGul/Wj3lSSso0pa0MhS9lqMA8CmDT6sB9XlIbhj+tB0N+7fUwaWqxVvEb t2XuhasWUa6of9i/F93O8IFlWMTmF1fyWQg/xbozp6wMpWPEelbV7SqrcX0/yrK8u21L NS8MtIWVaUGmVmBvXH+tuzqLz9dsY2/iRF0Y6NCOWsoKanKrhcT4Thik9efLJzOExrM1 ToS3oO4dJ7apJrn5s+ZlFEPLH8bc6d80sLIf9g62Wc1huqAPu1+XktJVxY1MY/qK4qnk 6Cvgl8f3piNBc5MD17ZePmaqWLV60+t3xdj/omYmTDtGmry4AIhgl4zR/s+HGIwP/dEr 7t0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+9LDxds78ZpBu8bZ2YStDaoNow/+xEuqsaqJfEUvzSs=; b=QSK/dXzE5R8+PzsowIyMD4T19WhYWOU60xXqq2N746yFuUQebi2OrHpE4uDJZuks3p mwNfep1YkoffRAtL2J3zUFTpl9i4X9LSgdA+TRVTdUvsDiPe+jnD38pejVisMYd2fCE3 hCChja3ri2MbrnuTyW5rH2dea8Tpf0ViiqAgWPGXFtLmhrDG9o+mYt+hLSTonI3Qn44P 1asor4ku4GRGt0htfkm37/w46/Pn7qDOCRvdkf/vSVXxcCebH6tztTMF0wC1UeHO6PzW g4Fq3573V34+RUk0LBUv3tD1LBOl4bwXirHLXNs7B9CRnLDNTN/JWNvNlIDKCPd9KbN0 wcMA== X-Gm-Message-State: AOAM530ogxL2gLrAeE1Wd4whBI6MNSz7dnAZQs9cmWXRfaj0PBPw7bBq hASKQnpsfda1DTNjvZ4TdeobPyFLJZw= X-Received: by 2002:a2e:a553:: with SMTP id e19mr16915323ljn.280.1621863631965; Mon, 24 May 2021 06:40:31 -0700 (PDT) Received: from [192.168.2.145] (109-252-193-110.dynamic.spd-mgts.ru. [109.252.193.110]) by smtp.googlemail.com with ESMTPSA id w17sm203610lfp.300.2021.05.24.06.40.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 May 2021 06:40:31 -0700 (PDT) Subject: Re: [PATCH v2 2/2] ASoC: tegra: Unify ASoC machine drivers To: Jon Hunter , Thierry Reding , Mark Brown , Takashi Iwai , Jaroslav Kysela , Ion Agorria , Svyatoslav Ryhel , Liam Girdwood Cc: alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210520175054.28308-1-digetx@gmail.com> <20210520175054.28308-3-digetx@gmail.com> <32171079-ed4e-1147-2272-5f11bc480c6a@nvidia.com> <91e53907-d87d-aeeb-4644-3926d4311daa@gmail.com> <6bc26992-e136-ef6a-a956-382b5cae5db7@nvidia.com> From: Dmitry Osipenko Message-ID: Date: Mon, 24 May 2021 16:40:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <6bc26992-e136-ef6a-a956-382b5cae5db7@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 24.05.2021 15:22, Jon Hunter пишет: > > > On 21/05/2021 20:05, Dmitry Osipenko wrote: > > ... > >>>> +unsigned int tegra_asoc_machine_mclk_rate(unsigned int srate) >>>> +{ >>>> + unsigned int mclk; >>>> + >>>> + switch (srate) { >>>> + case 64000: >>>> + case 88200: >>>> + case 96000: >>>> + mclk = 128 * srate; >>>> + break; >>>> + default: >>>> + mclk = 256 * srate; >>>> + break; >>>> + } >>>> + /* FIXME: Codec only requires >= 3MHz if OSR==0 */ >>>> + while (mclk < 6000000) >>>> + mclk *= 2; >>> >>> So this appears to be specific to the wm8903 codec or at least this is >>> where it came from. And given that the switch statement is not complete >>> in terms of the sample rates (ie. only has a subset), I am wondering if >>> set should keep this specific to the wm8903 codec? >> >> The RT5631 codec of Asus Transformers will re-use this function. > > OK, but does it need this FIXME part? That appears to be codec specific. Downstream RT5631 Tegra driver has exactly the same FIXME. Although, I now see that downstream RT5631 uses 384*srate for the default cases. I also see that WM8994 driver that we have in grate-kernel for Galaxy Tab and SGH-I927 also re-uses that mclk_rate function. >> IIUC, the default switch-case works properly for all rates below 64KHz, >> at least I haven't had any problems with it. Could you please clarify >> why you are saying that the switch statement appears to be incomplete? > > It looks a bit weird because less than 64kHz and greater than 96kHz we > use 256 and for only 64kHz, 88.2kHz and 96kHz we use 128. So it is not > clear to me which sample rates have actually been tested with this and > if this is complete or not? > > Is it intended that we use 256 for sample rates greater than 96kHz? The 128*srate gives MCLK >6MHZ for 64/88/96, 256*srate gives MCLK >6MHZ for rates below 64kHZ. Looks like the goal is to get MCLK >6MHZ. The WM8903 datasheet says: "The following operating frequency limits must be observed when configuring CLK_SYS. Failure to observe these limits will result in degraded noise performance and/or incorrect ADC/DAC functionality. If DAC_OSR = 0 then CLK_SYS 3MHz If DAC_OSR = 1 then CLK_SYS 6MHz" Where DAC_OSR is DAC Oversampling Control 0 = Low power (normal oversample) 1 = High performance (double rate) I see that DAC_OSR=0 by default, it can be switched to 1 by userspace ALSA control.