public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: "Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Leo Yan" <leo.yan@linux.dev>,
	"Joseph Gates" <jgates@squareup.com>,
	"Georgi Djakov" <djakov@kernel.org>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	"Zac Crosby" <zac@squareup.com>, "Bastian Köcher" <git@kchr.de>,
	"Jeremy McNicoll" <jeremymc@redhat.com>,
	"Rohit Agarwal" <quic_rohiagar@quicinc.com>,
	"Melody Olvera" <quic_molvera@quicinc.com>,
	cros-qcom-dts-watchers@chromium.org,
	"Stephen Boyd" <swboyd@chromium.org>,
	"Rajendra Nayak" <quic_rjendra@quicinc.com>,
	"Martin Botka" <martin.botka@somainline.org>,
	"Jonathan Marek" <jonathan@marek.ca>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Tengfei Fan" <quic_tengfan@quicinc.com>,
	"Fenglin Wu" <quic_fenglinw@quicinc.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Abel Vesa" <abel.vesa@linaro.org>,
	"Alexandru Marc Serdeliuc" <serdeliuk@yahoo.com>,
	"Vladimir Zapolskiy" <vladimir.zapolskiy@linaro.org>,
	"Sibi Sankar" <quic_sibis@quicinc.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Jun Nie" <jun.nie@linaro.org>,
	"Vincent Knecht" <vincent.knecht@mailoo.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Stephan Gerhold" <stephan.gerhold@linaro.org>
Subject: Re: [PATCH v2 01/31] arm64: dts: qcom: msm8916: correct sleep clock frequency
Date: Sat, 30 Nov 2024 11:59:26 +0100	[thread overview]
Message-ID: <Z0rvVT98rPMXsTS_@gerhold.net> (raw)
In-Reply-To: <al3tckby2jg7imhieehqwemygf6y5csfg7xfjta7alawhwfqv7@6gha46tr3rhx>

On Sat, Nov 30, 2024 at 12:42:24PM +0200, Dmitry Baryshkov wrote:
>On Sat, Nov 30, 2024 at 11:21:56AM +0100, Stephan Gerhold wrote:
>> On Sat, Nov 30, 2024 at 03:44:13AM +0200, Dmitry Baryshkov wrote:
>> > The MSM8916 platform uses PM8916 to provide sleep clock. According to the
>> > documentation, that clock has 32.7645 kHz frequency. Correct the sleep
>> > clock definition.
>> >
>> > Fixes: f4fb6aeafaaa ("arm64: dts: qcom: msm8916: Add fixed rate on-board oscillators")
>> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>
>> Thanks for spotting this! This fix looks good independent of the more
>> controversial "arm64: dts: qcom: move board clocks to SoC DTSI files"
>> changes. Maybe move these to a separate series?
>>
>> > ---
>> > arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
>> > index 5e558bcc9d87893486352e5e211f131d4a1f67e5..8f35c9af18782aa1da7089988692e6588c4b7c5d 100644
>> > --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
>> > +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
>> > @@ -125,7 +125,7 @@ xo_board: xo-board {
>> > 		sleep_clk: sleep-clk {
>> > 			compatible = "fixed-clock";
>> > 			#clock-cells = <0>;
>> > -			clock-frequency = <32768>;
>> > +			clock-frequency = <32764>;
>>
>> To be precise the PM8916 specification says the sleep clock is "The 19.2
>> MHz XO divided by 586". Maybe we can actually describe it that way with
>> a fixed-factor-clock?
>>
>> 		sleep_clk: sleep-clk {
>> 			compatible = "fixed-factor-clock";
>> 			clocks = <&xo_board>;
>> 			#clock-cells = <0>;
>> 			clock-div = <586>;
>> 			clock-mult = <1>;
>> 		};
>
>I thought about it, but then it's also not complete truth (at least for
>some of PMICs, don't remember if that's the case for PM8916): there is
>an external XO and also there is an on-PMIC RC, which is further
>divided with PMIC actually selecting which source to use as a source for
>sleep_clk.
>

This exists on PM8916 as well, but I'm not sure it's worth taking it
into consideration here. The PM8916 specification says XO "is the source
of sleep clock when the device is in active and sleep mode". The RC is
used "during PMIC power-up" and "in active or sleep mode only if other
sources are unavailable".

>>
>> If we keep the fixed-clock with the hardcoded frequency I wonder if we
>> should put 32765 instead of 32764. If you calculate it exactly it's
>> slightly closer to 32765 than 32764. :-)
>>
>> 	19200000/586 = 32764.505119453926 = ~32765
>
>Well, I think according to the most typical rounding rules it is 32764.

I think typically you round up on .5? But it's not even exactly half-way
at .500 - given that it's .505, I think any rounding function other than
floor() should round that up to 32765. :-)

Thanks,
Stephan

  reply	other threads:[~2024-11-30 11:11 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30  1:44 [PATCH v2 00/31] arm64: dts: qcom: move board clocks to SoC DTSI files Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 01/31] arm64: dts: qcom: msm8916: correct sleep clock frequency Dmitry Baryshkov
2024-11-30 10:21   ` Stephan Gerhold
2024-11-30 10:42     ` Dmitry Baryshkov
2024-11-30 10:59       ` Stephan Gerhold [this message]
2024-11-30  1:44 ` [PATCH v2 02/31] arm64: dts: qcom: msm8939: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 03/31] arm64: dts: qcom: msm8994: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 04/31] arm64: dts: qcom: qcs404: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 05/31] arm64: dts: qcom: q[dr]u1000: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 06/31] arm64: dts: qcom: qrb4210-rb2: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 07/31] arm64: dts: qcom: sar2130p: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 08/31] arm64: dts: qcom: sc7280: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 09/31] arm64: dts: qcom: sdx75: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 10/31] arm64: dts: qcom: sm4450: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 11/31] arm64: dts: qcom: sm6125: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 12/31] arm64: dts: qcom: sm6375: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 13/31] arm64: dts: qcom: sm8250: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 14/31] arm64: dts: qcom: sm8350: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 15/31] arm64: dts: qcom: sm8450: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 16/31] arm64: dts: qcom: sm8550: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 17/31] arm64: dts: qcom: sm8650: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 18/31] arm64: dts: qcom: x1e80100: " Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 19/31] arm64: dts: qcom: sc8180x: drop extra XO clock frequencies Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 20/31] arm64: dts: qcom: ipq5018: move board clocks to ipq5018.dtsi file Dmitry Baryshkov
2024-11-30  9:29   ` Krzysztof Kozlowski
2024-11-30  9:57     ` Dmitry Baryshkov
2024-11-30 10:00       ` Krzysztof Kozlowski
2024-11-30 10:26         ` Dmitry Baryshkov
2024-11-30 10:43           ` Krzysztof Kozlowski
2024-11-30 11:08             ` Dmitry Baryshkov
2024-11-30 13:14             ` Konrad Dybcio
2024-11-30  1:44 ` [PATCH v2 21/31] arm64: dts: qcom: ipq5332: move board clocks to ipq5332.dtsi file Dmitry Baryshkov
2024-11-30  9:29   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 22/31] arm64: dts: qcom: ipq5424: move board clocks to ipq5424.dtsi file Dmitry Baryshkov
2024-11-30  9:30   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 23/31] arm64: dts: qcom: ipq9574: move board clocks to ipq9574.dtsi file Dmitry Baryshkov
2024-11-30  9:30   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 24/31] arm64: dts: qcom: qcm2290: move board clocks to qcm2290.dtsi file Dmitry Baryshkov
2024-11-30  9:30   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 25/31] arm64: dts: qcom: sc8280xp: move board clocks to sc8280xp.dtsi file Dmitry Baryshkov
2024-11-30  9:30   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 26/31] arm64: dts: qcom: sm6115: move board clocks to sm6115.dtsi file Dmitry Baryshkov
2024-11-30  9:30   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 27/31] arm64: dts: qcom: sm6375: move board clocks to sm6375.dtsi file Dmitry Baryshkov
2024-11-30  9:31   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 28/31] arm64: dts: qcom: sm8550: move board clocks to sm8550.dtsi file Dmitry Baryshkov
2024-11-30  9:31   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 29/31] arm64: dts: qcom: sm8650: move board clocks to sm8650.dtsi file Dmitry Baryshkov
2024-11-30  9:31   ` Krzysztof Kozlowski
2024-11-30  1:44 ` [PATCH v2 30/31] arm64: dts: qcom: sdm670: move board clocks to sdm670.dtsi file Dmitry Baryshkov
2024-11-30  1:44 ` [PATCH v2 31/31] arm64: dts: qcom: q[dr]u1000: move board clocks to qdu1000.dtsi file Dmitry Baryshkov
2024-11-30 10:18 ` [PATCH v2 00/31] arm64: dts: qcom: move board clocks to SoC DTSI files Marijn Suijten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0rvVT98rPMXsTS_@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=abel.vesa@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=cros-qcom-dts-watchers@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=git@kchr.de \
    --cc=jeremymc@redhat.com \
    --cc=jgates@squareup.com \
    --cc=jonathan@marek.ca \
    --cc=jun.nie@linaro.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.botka@somainline.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_fenglinw@quicinc.com \
    --cc=quic_molvera@quicinc.com \
    --cc=quic_rjendra@quicinc.com \
    --cc=quic_rohiagar@quicinc.com \
    --cc=quic_sibis@quicinc.com \
    --cc=quic_tengfan@quicinc.com \
    --cc=robh@kernel.org \
    --cc=serdeliuk@yahoo.com \
    --cc=shawn.guo@linaro.org \
    --cc=stephan.gerhold@linaro.org \
    --cc=swboyd@chromium.org \
    --cc=vincent.knecht@mailoo.org \
    --cc=vkoul@kernel.org \
    --cc=vladimir.zapolskiy@linaro.org \
    --cc=zac@squareup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox