[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YvLJJkV2GRJWl7tA@hoboy.vegasvil.org>
Date: Tue, 9 Aug 2022 13:52:54 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Csókás Bence <Csokas.Bence@...lan.hu>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] fec: Allow changing the PPS channel
On Tue, Aug 09, 2022 at 07:36:55AM +0000, Csókás Bence wrote:
> > Don't use a private, custom sysfs knob. The core PTP layer provides
> > an API for that already.
>
> Does it? I seem to have missed it. Can you point me at some docs?
See include/uapi/linux/ptp_clock.h:
/*
* Bits of the ptp_perout_request.flags field:
*/
#define PTP_PEROUT_ONE_SHOT (1<<0)
#define PTP_PEROUT_DUTY_CYCLE (1<<1)
#define PTP_PEROUT_PHASE (1<<2)
/*
* flag fields valid for the new PTP_PEROUT_REQUEST2 ioctl.
*/
#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT | \
PTP_PEROUT_DUTY_CYCLE | \
PTP_PEROUT_PHASE)
...
struct ptp_perout_request {
union {
/*
* Absolute start time.
* Valid only if (flags & PTP_PEROUT_PHASE) is unset.
*/
struct ptp_clock_time start;
/*
* Phase offset. The signal should start toggling at an
* unspecified integer multiple of the period, plus this value.
* The start time should be "as soon as possible".
* Valid only if (flags & PTP_PEROUT_PHASE) is set.
*/
struct ptp_clock_time phase;
};
struct ptp_clock_time period; /* Desired period, zero means disable. */
unsigned int index; /* Which channel to configure. */
unsigned int flags;
union {
/*
* The "on" time of the signal.
* Must be lower than the period.
* Valid only if (flags & PTP_PEROUT_DUTY_CYCLE) is set.
*/
struct ptp_clock_time on;
/* Reserved for future use. */
unsigned int rsv[4];
};
};
There is also an API to select pins, with ptp_pin_function,
ptp_pin_desc, PTP_PIN_GETFUNC, PTP_PIN_SETFUNC.
> Also, does it have support for setting pulse mode (i.e. high, low, toggle)?
You can produce a signal with any duty cycle that you wish. No
support for inverted output, but you could add it if it is important
to you.
Thanks,
Richard
Powered by blists - more mailing lists