Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp722015lqt; Tue, 19 Mar 2024 01:28:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxYwYhjrSMx0ApSxWNG7uncqutokYOk2PPC/Y7LXF4vO+2MwUm7YzV7GGqozvkwZDQ4TsA07FZM531eP3BgMo7marsQWhsQZjnH9Hc1w== X-Google-Smtp-Source: AGHT+IFz9Y+7CMwsHx1LWBrJhS4EZ8OqGTjeyq9bfMUAwln3EDXKdEegwPHLyd62BLhApdfnW5Qj X-Received: by 2002:a05:6808:3091:b0:3c3:7e22:7f7f with SMTP id bl17-20020a056808309100b003c37e227f7fmr9786429oib.9.1710836922043; Tue, 19 Mar 2024 01:28:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710836922; cv=pass; d=google.com; s=arc-20160816; b=MVqSiIGNpIv+Vdi9DA6WgGO5hGeeXdg625Wlr8LW16qylATj/TlbA/EkwNN6jQU/2L ++O5zO75loRgJ2ZErFogi9o8OYvjdPXvwKOZYRjzOfWKocdp/ucoQwsMz6QlErsBv/qH o12ul66TFv6YRdwQbsnLtxG3MUVEUNn34aqzqSmKyQBUkxnqMzAOri+wCphYNqpnc4s3 nrj8WQo/5V89417KRcz5ic5f7P7Q5ZUPfgaBfUv9p68AKTJ9ml0ZPLdV8vTImTyUGXl1 qmbvwCAEY8Ix1Jtt5EI4lm6t9sovz3RcLqSyazEDIA23GzvWRaXXQ5LuVj1aOIV3rdak HqgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:in-reply-to:date:subject:cc:to:from:user-agent :references:dkim-signature; bh=hgFFAPN7B2IdqbSbHOUWcvyqPwWPHdQWlex71RuQvmY=; fh=FBLjVxL87hekrP7dtUqoHI5SJBy020NycIpHV1IXaiQ=; b=RikBr2HdG1Wq0666ZrryRTwNqwDhhxcMIIvBTLkmth2bUqjLrRrCRhj2KR1/PZM3GK EoM9GlSuv4/64JEVSxjnY5F1u2k0IB4tmM6dWujdS1/QmDI63Ev2mVbuuySvdyGhbK5v OufYn4qxy0Ar5YeXnBuSU/RDvPYG2tU1RDA4l3TTD2zeFAN79merfxyV7H0mMovyCt+O XhCuNS7SRYgQDX0yMfQMgJ1qHzls5kWKYI/EM8wxiYLJhl56IPNC4se4NDiEI/WKcfSy dxuF5Zy05RBiJtrNZDSrbGXmY/OR84bEgDcbIh6U5I/3QNejNMjfWREhkd/CEBAxrr5q iMBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=oqQDhAkp; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-107235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107235-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fn26-20020a056a002fda00b006e6b77f6aabsi10457428pfb.263.2024.03.19.01.28.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 01:28:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=oqQDhAkp; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-107235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107235-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA914282F84 for ; Tue, 19 Mar 2024 08:28:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A96554746; Tue, 19 Mar 2024 08:28:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="oqQDhAkp" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8892754773 for ; Tue, 19 Mar 2024 08:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710836917; cv=none; b=MRQz/joBx/RL0F5EqvWf8HaULaAcMZS/Al6ibtYeFFEWrRe9YG58sr3CAdT1uubZ+Fv5GL8RCemPzvR1TohrmV0jPM0LOgYZqIRoxJjaOJmtEGdm1qJeUCSxoQEFxJVxSdALu2JON4grESN1w35HTmuSJQ4Tj5VDHt87chJasvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710836917; c=relaxed/simple; bh=wEOu2J6N3RicgE6VdikhaGkAHK9MlBxWFNBPisxCRwo=; h=References:From:To:Cc:Subject:Date:In-reply-to:Message-ID: MIME-Version:Content-Type; b=RZD80G8Ype8ESDnoXg88sSymIf3LJu6AjyHfiQeYVKLWV+lAp6+xzWfJkk7Useu3QvLavNavidxfRy5TM301ApuI75+lHyZbOlhWCcVsZusx/xz4YVo/7T/mM+/kPqkcmf+rUW50ghwCrwtAIICfcEsLD9i1sJWaXaw6rHmiKKc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=oqQDhAkp; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41461c256c4so5873325e9.0 for ; Tue, 19 Mar 2024 01:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1710836913; x=1711441713; darn=vger.kernel.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=hgFFAPN7B2IdqbSbHOUWcvyqPwWPHdQWlex71RuQvmY=; b=oqQDhAkpgLw5OUssGrIeyW21nyYmJJfiZEzHuuJBv2Q+Teo8dmTaCaztY2Y5JCM4lI OrjeHBZVNkizeBLsQ6o0vtAyBE3daTkROgs77VU5qAK9HSi7dMa2ypmLmCJhU8EyAKqM 1vz3J+bF7xJKd8XN4QSiWaU103vA/Qo5kuLbkIM8BvT4ArTM7CKHwbJLmdbLCmOeJwCT +jkyoXRxHAHi31KJT4jkwL8idnVo28psaU0d/7m0n7oJdxMfEFziTNxWG7lwoTzcwCeH MLmAM/aA/ylmz3Aqy8++f6N4E4eHxMeM8o5rLbYodh46bSJljU0f5g0mHK5kID0q7PkW JAPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710836913; x=1711441713; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hgFFAPN7B2IdqbSbHOUWcvyqPwWPHdQWlex71RuQvmY=; b=t/E2cTfMvqn69T56revcth8RUlV7Yv0tYXQzcwaqpWQs8jc/uxfgyMvXrErTZJY0mI Kabt8Pc1khj8YDA22WBSvqEZNWgS1ZVbBDF+7x7LDuJ6mMwZEDvquFPAf3DcW5mmFlmB ROEE6f+rlOz7zSRDNqvcenz7kqd1w6S3HcPmgTCkE+jHxi8DjuAXiUo7bjtcmhGumK7c A29Jlx9h+1X6FTEvX/zU/Vu9oeAOtMEkb4jpcF5ba67xtzfB1aSX/tHGQZSyQ+Igwx+G LoDhPN4AjdmfyMxjgIGSHx7jOwSWghFbrBeZvye2YHqG4qTPNestdokucsKJSssSU30g Am5A== X-Forwarded-Encrypted: i=1; AJvYcCXXZ7IdBdigWp2tL46SkXcze535/cEm8xkYsBnRmOQTJ6wPa7FR0lF6FEkVgTYXydjW8Jo31eeTEd6RGVRK3+xNHn9jIB7yTnHe/LiY X-Gm-Message-State: AOJu0YwHwC7SIBCOPYvEnxBFyEaPUSX+9oYW+qJe80DHUsHeU96nJMBS 0MUb6l1taIpnflMIA5RO4HnKTqj84K45H/maQGyr7s2mDnbuOC+X/f5qfjufJ9U= X-Received: by 2002:adf:a358:0:b0:341:8666:ce2e with SMTP id d24-20020adfa358000000b003418666ce2emr913294wrb.0.1710836912716; Tue, 19 Mar 2024 01:28:32 -0700 (PDT) Received: from localhost ([2a01:e0a:3c5:5fb1:a757:fdcf:e3d7:eaed]) by smtp.gmail.com with ESMTPSA id ay25-20020a5d6f19000000b0033e3cb02cefsm11883313wrb.86.2024.03.19.01.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 01:28:32 -0700 (PDT) References: <20240314232201.2102178-1-jan.dakinevich@salutedevices.com> <20240314232201.2102178-2-jan.dakinevich@salutedevices.com> <1j8r2jj24k.fsf@starbuckisacylon.baylibre.com> <1jedc7hlg4.fsf@starbuckisacylon.baylibre.com> User-agent: mu4e 1.10.8; emacs 29.2 From: Jerome Brunet To: Jan Dakinevich Cc: Jerome Brunet , Neil Armstrong , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Kevin Hilman , Martin Blumenstingl , Liam Girdwood , Mark Brown , Linus Walleij , Jaroslav Kysela , Takashi Iwai , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org, kernel@salutedevices.com Subject: Re: [PATCH 01/25] clk: meson: a1: restrict an amount of 'hifi_pll' params Date: Tue, 19 Mar 2024 09:21:27 +0100 In-reply-to: Message-ID: <1jsf0mfwwg.fsf@starbuckisacylon.baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue 19 Mar 2024 at 01:35, Jan Dakinevich wrote: > On 3/18/24 13:17, Jerome Brunet wrote: >> >> On Sun 17 Mar 2024 at 17:17, Jan Dakinevich wrote: >> >>> On 3/15/24 11:58, Jerome Brunet wrote: >>>> >>>> On Fri 15 Mar 2024 at 02:21, Jan Dakinevich wrote: >>>> >>>>> Existing values were insufficient to produce accurate clock for audio >>>>> devices. New values are safe and most suitable to produce 48000Hz sample >>>>> rate. >>>> >>>> The hifi pll is not about 48k only. I see no reason to restrict the PLL >>>> to a single setting. >>>>> You've provided no justification why the PLL driver can't reach the same >>>> setting for 48k. The setting below is just the crude part. the fine >>>> tuning is done done with the frac parameter so I doubt this provides a >>>> more accurate rate. >>>> >>> >>> You are right, it is not about 48k only. However, there are two issues. >>> >>> First, indeed, I could just extend the range of multipliers to 1..255. >> >> Why 1..255 ? This is not what I'm pointing out >> >> According to the datasheet - the range is 32 - 64, as currently >> set in the driver. >> > > Could you point where in the doc the range 32..64 is documented? > Documentation that I have may be not so complete, but I don't see there > any mention about it. > > Anyway, range 32..64 of multipliers is not enough to produce accurate > clock, and a need 128 for 48kHz. A1 datasheet v0.4 - Section 7.6.3.2 > >> The change you have provided request a multipler of 128/5 = 25,6 >> If you put assigned-rate = 614400000 in DT, I see no reason can find the >> same solution on its own. >> > > The reasoning is following. I don't know why 32..64 range was declared > for this clock, and whether it would be safe to extend it and include > 128, which is required for 48kHz. But I know, that multiplier=128 is > safe and works fine (together divider=5). You have not answer my remark. Mainline does not do everything like the AML SDK does. Saying you are copying it because you know it works (in your opinion) is not good enough. I'm telling you that your hack is not necessary and so far, you have not demonstrated that it is. Also the multiplier range in m/n, not m alone. > >>> But I am unsure if hifi_pll is able to handle whole range of >>> mulptipliers. The value 128 is taken from Amlogic's branch, and I am >>> pretty sure that it works. >> >>> >>> Second, unfortunately frac parameter currently doesn't work. When frac >>> is used enabling of hifi_pll fails in meson_clk_pll_wait_lock(). I see >>> it when try to use 44100Hz and multipliers' range is set to 1..255. So, >>> support of other rates than 48k requires extra effort. >> >> Then your change is even more problematic because it certainly does not >> disable frac ... which you say is broken. >> >> That parameter should be removed with a proper comment explaining why >> you are disabling it. That type a limitation / known issue should be >> mentionned in your change. >> > > Handling of frac should not be removed, it should be fixed to achieve > another rates. But that is not the goal of this commit. You argued that frac was broken and that was partly why you introduced this work around. I'm telling you this approach is incorrect. So either : * Remove frac for now, until it is fixed, because it is broken and add comment clearly explaining that quirk. * Or fix it now. Your choice. > > >>> >>>>> >>>>> Signed-off-by: Jan Dakinevich >>>>> --- >>>>> drivers/clk/meson/a1-pll.c | 8 ++++---- >>>>> 1 file changed, 4 insertions(+), 4 deletions(-) >>>>> >>>>> diff --git a/drivers/clk/meson/a1-pll.c b/drivers/clk/meson/a1-pll.c >>>>> index 4325e8a6a3ef..00e06d03445b 100644 >>>>> --- a/drivers/clk/meson/a1-pll.c >>>>> +++ b/drivers/clk/meson/a1-pll.c >>>>> @@ -74,9 +74,9 @@ static struct clk_regmap fixed_pll = { >>>>> }, >>>>> }; >>>>> >>>>> -static const struct pll_mult_range hifi_pll_mult_range = { >>>>> - .min = 32, >>>>> - .max = 64, >>>>> +static const struct pll_params_table hifi_pll_params_table[] = { >>>>> + PLL_PARAMS(128, 5), >>>>> + { }, >>>>> }; >>>>> >>>>> static const struct reg_sequence hifi_init_regs[] = { >>>>> @@ -124,7 +124,7 @@ static struct clk_regmap hifi_pll = { >>>>> .shift = 6, >>>>> .width = 1, >>>>> }, >>>>> - .range = &hifi_pll_mult_range, >>>>> + .table = hifi_pll_params_table, >>>>> .init_regs = hifi_init_regs, >>>>> .init_count = ARRAY_SIZE(hifi_init_regs), >>>>> }, >>>> >>>> >> >> -- Jerome