[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY8PR11MB7364F43C08D75878205599A5C4E62@CY8PR11MB7364.namprd11.prod.outlook.com>
Date: Thu, 9 May 2024 04:38:49 +0000
From: "D, Lakshmi Sowjanya" <lakshmi.sowjanya.d@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: "tglx@...utronix.de" <tglx@...utronix.de>, "jstultz@...gle.com"
<jstultz@...gle.com>, "giometti@...eenne.com" <giometti@...eenne.com>,
"corbet@....net" <corbet@....net>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>, "Dong,
Eddie" <eddie.dong@...el.com>, "Hall, Christopher S"
<christopher.s.hall@...el.com>, "Brandeburg, Jesse"
<jesse.brandeburg@...el.com>, "davem@...emloft.net" <davem@...emloft.net>,
"alexandre.torgue@...s.st.com" <alexandre.torgue@...s.st.com>,
"joabreu@...opsys.com" <joabreu@...opsys.com>, "mcoquelin.stm32@...il.com"
<mcoquelin.stm32@...il.com>, "perex@...ex.cz" <perex@...ex.cz>,
"linux-sound@...r.kernel.org" <linux-sound@...r.kernel.org>, "Nguyen, Anthony
L" <anthony.l.nguyen@...el.com>, "peter.hilber@...nsynergy.com"
<peter.hilber@...nsynergy.com>, "N, Pandith" <pandith.n@...el.com>, "Mohan,
Subramanian" <subramanian.mohan@...el.com>, "T R, Thejesh Reddy"
<thejesh.reddy.t.r@...el.com>
Subject: RE: [PATCH v7 10/12] pps: generators: Add PPS Generator TIO Driver
> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Sent: Tuesday, April 30, 2024 7:23 PM
> To: D, Lakshmi Sowjanya <lakshmi.sowjanya.d@...el.com>
> Cc: tglx@...utronix.de; jstultz@...gle.com; giometti@...eenne.com;
> corbet@....net; linux-kernel@...r.kernel.org; x86@...nel.org;
> netdev@...r.kernel.org; linux-doc@...r.kernel.org; intel-wired-
> lan@...ts.osuosl.org; Dong, Eddie <eddie.dong@...el.com>; Hall, Christopher
> S <christopher.s.hall@...el.com>; Brandeburg, Jesse
> <jesse.brandeburg@...el.com>; davem@...emloft.net;
> alexandre.torgue@...s.st.com; joabreu@...opsys.com;
> mcoquelin.stm32@...il.com; perex@...ex.cz; linux-
> sound@...r.kernel.org; Nguyen, Anthony L <anthony.l.nguyen@...el.com>;
> peter.hilber@...nsynergy.com; N, Pandith <pandith.n@...el.com>; Mohan,
> Subramanian <subramanian.mohan@...el.com>; T R, Thejesh Reddy
> <thejesh.reddy.t.r@...el.com>
> Subject: Re: [PATCH v7 10/12] pps: generators: Add PPS Generator TIO Driver
>
> On Tue, Apr 30, 2024 at 02:22:23PM +0530, lakshmi.sowjanya.d@...el.com
> wrote:
> > From: Lakshmi Sowjanya D <lakshmi.sowjanya.d@...el.com>
> >
> > The Intel Timed IO PPS generator driver outputs a PPS signal using
> > dedicated hardware that is more accurate than software actuated PPS.
> > The Timed IO hardware generates output events using the ART timer.
> > The ART timer period varies based on platform type, but is less than
> > 100 nanoseconds for all current platforms. Timed IO output accuracy is
> > within 1 ART period.
> >
> > PPS output is enabled by writing '1' the 'enable' sysfs attribute. The
> > driver uses hrtimers to schedule a wake-up 10 ms before each event
> > (edge) target time. At wakeup, the driver converts the target time in
> > terms of CLOCK_REALTIME to ART trigger time and writes this to the
> > Timed IO hardware. The Timed IO hardware generates an event precisely
> > at the requested system time without software involvement.
>
> ...
>
> > +static enum hrtimer_restart hrtimer_callback(struct hrtimer *timer) {
> > + struct pps_tio *tio = container_of(timer, struct pps_tio, timer);
> > + ktime_t expires, now;
> > + u32 event_count;
> > +
> > + guard(spinlock)(&tio->lock);
> > +
> > + /* Check if any event is missed. If an event is missed, TIO will be
> disabled*/
> > + event_count = pps_tio_read(tio, TIOEC);
> > + if (tio->prev_count && tio->prev_count == event_count)
> > + goto err;
> > + tio->prev_count = event_count;
> > + expires = hrtimer_get_expires(timer);
> > + now = ktime_get_real();
>
> > + if (now - expires < SAFE_TIME_NS) {
> > + if (!pps_generate_next_pulse(tio, expires +
> SAFE_TIME_NS))
> > + return HRTIMER_NORESTART;
> > + } else {
>
> Redundant.
>
> > + goto err;
> > + }
>
> if (now - expires >= SAFE_TIME_NS)
> goto err;
>
> if (!pps_generate_next_pulse(tio, expires + SAFE_TIME_NS))
> return HRTIMER_NORESTART;
>
>
> > + hrtimer_forward(timer, now, NSEC_PER_SEC / 2);
> > + return HRTIMER_RESTART;
> > +err:
> > + dev_err(tio->dev, "Event missed, Disabling Timed I/O");
> > + pps_tio_disable(tio);
> > + return HRTIMER_NORESTART;
> > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
Thanks Andy,
Will update as suggested.
Regards,
Sowjanya
Powered by blists - more mailing lists