From: Ivan Vecera <ivecera@redhat.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: Prathosh Satish <Prathosh.Satish@microchip.com>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org,
Michal Schmidt <mschmidt@redhat.com>,
Petr Oros <poros@redhat.com>
Subject: Re: [PATCH net-next 3/5] dpll: zl3073x: Implement phase offset monitor feature
Date: Tue, 15 Jul 2025 16:18:55 +0200 [thread overview]
Message-ID: <dba89108-0302-4773-af40-8026a5c12f5b@redhat.com> (raw)
In-Reply-To: <e6801550-fb58-4a94-9405-b14e13c0e936@redhat.com>
On 15. 07. 25 3:02 odp., Paolo Abeni wrote:
> On 7/10/25 5:38 PM, Ivan Vecera wrote:
>> @@ -536,8 +539,38 @@ zl3073x_dpll_input_pin_phase_offset_get(const struct dpll_pin *dpll_pin,
>> return 0;
>> }
>>
>> - /* Report the latest measured phase offset for the connected ref */
>> - *phase_offset = pin->phase_offset * DPLL_PHASE_OFFSET_DIVIDER;
>> + ref_phase = pin->phase_offset;
>> +
>> + /* The DPLL being locked to a higher freq than the current ref
>> + * the phase offset is modded to the period of the signal
>> + * the dpll is locked to.
>> + */
>> + if (ZL3073X_DPLL_REF_IS_VALID(conn_ref) && conn_ref != ref) {
>> + u32 conn_freq, ref_freq;
>> +
>> + /* Get frequency of connected ref */
>> + rc = zl3073x_dpll_input_ref_frequency_get(zldpll, conn_ref,
>> + &conn_freq);
>> + if (rc)
>> + return rc;
>> +
>> + /* Get frequency of given ref */
>> + rc = zl3073x_dpll_input_ref_frequency_get(zldpll, ref,
>> + &ref_freq);
>> + if (rc)
>> + return rc;
>> +
>> + if (conn_freq > ref_freq) {
>> + s64 conn_period;
>> + int div_factor;
>> +
>> + conn_period = div_s64(PSEC_PER_SEC, conn_freq);
>> + div_factor = div64_s64(ref_phase, conn_period);
>> + ref_phase -= conn_period * div_factor;
>
> It's not obvious to me that the above div64_s64() will yield a 32b value
> for every possible arguments/configuration. Possibly a comment would
> help (or just use s64 for div_factor).
Practically it should not happen due to maximal reference frequency but
it will be safer use s64 here also for div_factor..
Will fix in v2.
Thanks,
Ivan
next prev parent reply other threads:[~2025-07-15 14:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 15:38 [PATCH net-next 0/5] dpll: zl3073x: Add misc features Ivan Vecera
2025-07-10 15:38 ` [PATCH net-next 1/5] dpll: zl3073x: Add support to get/set esync on pins Ivan Vecera
2025-07-14 14:13 ` Prathosh.Satish
2025-07-15 12:52 ` Paolo Abeni
2025-07-15 14:10 ` Ivan Vecera
2025-07-10 15:38 ` [PATCH net-next 2/5] dpll: zl3073x: Add support to get phase offset on connected input pin Ivan Vecera
2025-07-14 14:14 ` Prathosh.Satish
2025-07-10 15:38 ` [PATCH net-next 3/5] dpll: zl3073x: Implement phase offset monitor feature Ivan Vecera
2025-07-14 14:15 ` Prathosh.Satish
2025-07-15 13:02 ` Paolo Abeni
2025-07-15 14:18 ` Ivan Vecera [this message]
2025-07-10 15:38 ` [PATCH net-next 4/5] dpll: zl3073x: Add support to adjust phase Ivan Vecera
2025-07-14 14:15 ` Prathosh.Satish
2025-07-15 13:12 ` Paolo Abeni
2025-07-15 14:24 ` Ivan Vecera
2025-07-10 15:38 ` [PATCH net-next 5/5] dpll: zl3073x: Add support to get fractional frequency offset Ivan Vecera
2025-07-14 10:55 ` [PATCH net-next 0/5] dpll: zl3073x: Add misc features Jiri Pirko
2025-07-14 14:11 ` Prathosh.Satish
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=dba89108-0302-4773-af40-8026a5c12f5b@redhat.com \
--to=ivecera@redhat.com \
--cc=Prathosh.Satish@microchip.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mschmidt@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=poros@redhat.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;
as well as URLs for NNTP newsgroup(s).