linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aya Levin <ayal@nvidia.com>
To: vincent.cheng.xh@renesas.com, richardcochran@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 net-next 1/3] ptp: Add adjphase function to support phase offset control.
Date: Thu, 4 Aug 2022 14:40:25 +0300	[thread overview]
Message-ID: <228ceba4-47a8-49ef-994a-fe898cdc7fc1@nvidia.com> (raw)
In-Reply-To: <1588390538-24589-2-git-send-email-vincent.cheng.xh@renesas.com>



On 5/2/2020 6:35 AM, vincent.cheng.xh@renesas.com wrote:
> From: Vincent Cheng <vincent.cheng.xh@renesas.com>
> 
> Adds adjust phase function to take advantage of a PHC
> clock's hardware filtering capability that uses phase offset
> control word instead of frequency offset control word.
> 
> Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
> ---
>   drivers/ptp/ptp_clock.c          | 3 +++
>   include/linux/ptp_clock_kernel.h | 6 +++++-
>   2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index acabbe7..fc984a8 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -146,6 +146,9 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
>   		else
>   			err = ops->adjfreq(ops, ppb);
>   		ptp->dialed_frequency = tx->freq;
> +	} else if (tx->modes & ADJ_OFFSET) {
> +		if (ops->adjphase)
> +			err = ops->adjphase(ops, tx->offset);
>   	} else if (tx->modes == 0) {
>   		tx->freq = ptp->dialed_frequency;
>   		err = 0;
> diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
> index 121a7ed..31144d9 100644
> --- a/include/linux/ptp_clock_kernel.h
> +++ b/include/linux/ptp_clock_kernel.h
> @@ -36,7 +36,7 @@ struct ptp_system_timestamp {
>   };
>   
>   /**
> - * struct ptp_clock_info - decribes a PTP hardware clock
> + * struct ptp_clock_info - describes a PTP hardware clock
>    *
>    * @owner:     The clock driver should set to THIS_MODULE.
>    * @name:      A short "friendly name" to identify the clock and to
> @@ -65,6 +65,9 @@ struct ptp_system_timestamp {
>    *            parameter delta: Desired frequency offset from nominal frequency
>    *            in parts per billion
>    *
> + * @adjphase:  Adjusts the phase offset of the hardware clock.
> + *             parameter delta: Desired change in nanoseconds.
> + *
>    * @adjtime:  Shifts the time of the hardware clock.
>    *            parameter delta: Desired change in nanoseconds.
>    *
> @@ -128,6 +131,7 @@ struct ptp_clock_info {
>   	struct ptp_pin_desc *pin_config;
>   	int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm);
>   	int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
> +	int (*adjphase)(struct ptp_clock_info *ptp, s32 phase);
Hi,

Please explain the difference in the output between adjphase and 
adjtime. I'd expect both to add delta to current time. Am I missing 
something?

Thanks,
Aya
>   	int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
>   	int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
>   	int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts,

  parent reply	other threads:[~2022-08-04 11:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02  3:35 [PATCH v2 net-next 0/3] ptp: Add adjust phase to support phase offset vincent.cheng.xh
2020-05-02  3:35 ` [PATCH v2 net-next 1/3] ptp: Add adjphase function to support phase offset control vincent.cheng.xh
2020-05-02 20:09   ` Richard Cochran
2022-08-04 11:40   ` Aya Levin [this message]
2022-08-04 13:29     ` Vincent Cheng
2020-05-02  3:35 ` [PATCH v2 net-next 2/3] ptp: Add adjust_phase to ptp_clock_caps capability vincent.cheng.xh
2020-05-02  3:35 ` [PATCH v2 net-next 3/3] ptp: ptp_clockmatrix: Add adjphase() to support PHC write phase mode vincent.cheng.xh
2020-05-02 20:09   ` Richard Cochran
2020-05-02 23:31 ` [PATCH v2 net-next 0/3] ptp: Add adjust phase to support phase offset David Miller

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=228ceba4-47a8-49ef-994a-fe898cdc7fc1@nvidia.com \
    --to=ayal@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=vincent.cheng.xh@renesas.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).