linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "N, Pandith" <pandith.n@intel.com>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Sangannavar,
	Mallikarjunappa"  <mallikarjunappa.sangannavar@intel.com>,
	"D, Lakshmi Sowjanya" <lakshmi.sowjanya.d@intel.com>,
	"T R, Thejesh Reddy" <thejesh.reddy.t.r@intel.com>,
	"Hall, Christopher S" <christopher.s.hall@intel.com>,
	"Gross, Mark" <mark.gross@intel.com>
Subject: RE: PPS functionality for Intel Timed I/O
Date: Wed, 15 Feb 2023 07:09:01 +0000	[thread overview]
Message-ID: <BYAPR11MB3240C6789B4C04F3BDAE34D5E1A39@BYAPR11MB3240.namprd11.prod.outlook.com> (raw)
In-Reply-To: <f2788a74-19f8-8992-5b92-427c7b2a27ab@enneenne.com>

Hi Rodolfo,

> -----Original Message-----
> From: Rodolfo Giometti <giometti@enneenne.com>
> Sent: Monday, February 6, 2023 4:17 PM
> To: N, Pandith <pandith.n@intel.com>
> Cc: linux-kernel@vger.kernel.org; Sangannavar, Mallikarjunappa
> <mallikarjunappa.sangannavar@intel.com>; D, Lakshmi Sowjanya
> <lakshmi.sowjanya.d@intel.com>; T R, Thejesh Reddy
> <thejesh.reddy.t.r@intel.com>; Hall, Christopher S
> <christopher.s.hall@intel.com>
> Subject: Re: PPS functionality for Intel Timed I/O
> 
> On 06/02/23 11:16, N, Pandith wrote:
> > Hi Rodolfo,
> 
> Hi
> 
> >> -----Original Message-----
> >> From: Rodolfo Giometti <giometti@enneenne.com>
> >> Sent: Monday, January 30, 2023 7:57 PM
> >> To: N, Pandith <pandith.n@intel.com>
> >> Cc: linux-kernel@vger.kernel.org; Sangannavar, Mallikarjunappa
> >> <mallikarjunappa.sangannavar@intel.com>; D, Lakshmi Sowjanya
> >> <lakshmi.sowjanya.d@intel.com>; T R, Thejesh Reddy
> >> <thejesh.reddy.t.r@intel.com>; Hall, Christopher S
> >> <christopher.s.hall@intel.com>
> >> Subject: Re: PPS functionality for Intel Timed I/O
> 
> >> Within kernel sources PPS clients and PPS generators are placed into
> >> different directories, so I suppose is better to deploy two different pieces
> of code.
> >>
> > We are planning to add a new PPS generator driver in
> > drivers/pps/generators
> > i) Can this driver use pps_register_source to register Intel Timed I/O device
> for pulse generation ?
> 
> Nope. This function is for pps clients only. PPS generators should generate
> their pulses according to system clock so they don't needed any registrations
> at all under PPS layer.
> 
> > ii) To start/stop pulse, we are planning to add additional sysfs attribute
> from our main driver.
> > Something like : /sys/class/ppsX/enable_pin This is needed for users
> > to start/stop pulse generation.
> 
> If you are still talking about PPS generators they have no entries under
> /sys/class/ppsX/ (just clients have). So you can add an entry under your
> driver to do so.
> 
Thanks, we will add entry in our driver :)
> >> However pay attention to the fact that a PPS generator should be
> >> referred to system's main clock and not to peripherals' clock.
> >>
> > We can sync with the system time for pulse generation.
> 
> Mmm... I'm not sure this is correct since PPS generators should generate
> their pulses according to system clock and not according to their internal
> clocks even if they are synced with the system clock.
> 
Timed I/O and system time are both driven by the *same* hardware clock.
Timed I/O is a high precision device (nanoseconds), able to output pulses.
The driver gets the system time and schedules output 
at target_time in the future. 

struct timespec64 current_time;
current_time = ktime_get_real_ts64(&current_time);

target_time = current_time + offset_time;
cycles = translate_system_time_to_clock_cycles(target_time);
/* Translate function is developed as part of this driver development */

/* Schedule pulse at target_time */
write_timedio_reg(TIMEDIO_TRIGGER, cycles);

The output always triggers with ~20 ns precision.
It's not affected by system load or no need for drivers to disable interrupts for longer durations.
With this driver proposal, Intel Timed I/O as PPS generator will be useful in IoT and server applications.

> Ciao,
> 
> Rodolfo
> 
> --
> GNU/Linux Solutions                  e-mail: giometti@enneenne.com
> Linux Device Driver                          giometti@linux.it
> Embedded Systems                     phone:  +39 349 2432127
> UNIX programming                     skype:  rodolfo.giometti

Regards,
Pandith


  reply	other threads:[~2023-02-15  7:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 12:55 PPS functionality for Intel Timed I/O N, Pandith
2023-01-30 13:45 ` Rodolfo Giometti
2023-01-30 14:11   ` N, Pandith
2023-01-30 14:26     ` Rodolfo Giometti
2023-02-06 10:16       ` N, Pandith
2023-02-06 10:46         ` Rodolfo Giometti
2023-02-15  7:09           ` N, Pandith [this message]
2023-02-15  7:46             ` Rodolfo Giometti
2023-10-06  5:31               ` N, Pandith
2023-10-06  6:23                 ` Rodolfo Giometti
2023-10-06  8:34                   ` andriy.shevchenko
2023-10-06  8:34                     ` andriy.shevchenko
2023-10-06  8:57                       ` Rodolfo Giometti
2023-10-06  9:06                         ` andriy.shevchenko

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=BYAPR11MB3240C6789B4C04F3BDAE34D5E1A39@BYAPR11MB3240.namprd11.prod.outlook.com \
    --to=pandith.n@intel.com \
    --cc=christopher.s.hall@intel.com \
    --cc=giometti@enneenne.com \
    --cc=lakshmi.sowjanya.d@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mallikarjunappa.sangannavar@intel.com \
    --cc=mark.gross@intel.com \
    --cc=thejesh.reddy.t.r@intel.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).