ptp: remember the adjusted frequency
authorRichard Cochran <richardcochran@gmail.com>
Sat, 22 Sep 2012 07:02:01 +0000 (07:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 22 Sep 2012 19:41:29 +0000 (15:41 -0400)
This patch adds a field to the representation of a PTP hardware clock in
order to remember the frequency adjustment value dialed by the user.

Adding this field will let us answer queries in the manner of adjtimex
in a follow on patch.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_clock.c
drivers/ptp/ptp_private.h

index 966875dcda569b1d44a668fa4cc71b884b8d8444..67e628ee0365c161cfd2b90658051396fba842d1 100644 (file)
@@ -147,6 +147,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
        } else if (tx->modes & ADJ_FREQUENCY) {
 
                err = ops->adjfreq(ops, scaled_ppm_to_ppb(tx->freq));
+               ptp->dialed_frequency = tx->freq;
        }
 
        return err;
index 4d5b5082c3b19d4766be52dbed3904aa5f4cd6c9..69d32070cc654526c4391229f89140e8eff35303 100644 (file)
@@ -45,6 +45,7 @@ struct ptp_clock {
        dev_t devid;
        int index; /* index into clocks.map */
        struct pps_device *pps_source;
+       long dialed_frequency; /* remembers the frequency adjustment */
        struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
        struct mutex tsevq_mux; /* one process at a time reading the fifo */
        wait_queue_head_t tsev_wq;