aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_clock.c16
-rw-r--r--drivers/ptp/ptp_ixp46x.c2
-rw-r--r--drivers/ptp/ptp_pch.c2
-rw-r--r--drivers/ptp/ptp_private.h1
4 files changed, 15 insertions, 6 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 1e528b539a07..79f4bce061bd 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -143,10 +143,12 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
143 kt = timespec_to_ktime(ts); 143 kt = timespec_to_ktime(ts);
144 delta = ktime_to_ns(kt); 144 delta = ktime_to_ns(kt);
145 err = ops->adjtime(ops, delta); 145 err = ops->adjtime(ops, delta);
146
147 } else if (tx->modes & ADJ_FREQUENCY) { 146 } else if (tx->modes & ADJ_FREQUENCY) {
148
149 err = ops->adjfreq(ops, scaled_ppm_to_ppb(tx->freq)); 147 err = ops->adjfreq(ops, scaled_ppm_to_ppb(tx->freq));
148 ptp->dialed_frequency = tx->freq;
149 } else if (tx->modes == 0) {
150 tx->freq = ptp->dialed_frequency;
151 err = 0;
150 } 152 }
151 153
152 return err; 154 return err;
@@ -180,7 +182,8 @@ static void delete_ptp_clock(struct posix_clock *pc)
180 182
181/* public interface */ 183/* public interface */
182 184
183struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info) 185struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
186 struct device *parent)
184{ 187{
185 struct ptp_clock *ptp; 188 struct ptp_clock *ptp;
186 int err = 0, index, major = MAJOR(ptp_devt); 189 int err = 0, index, major = MAJOR(ptp_devt);
@@ -213,7 +216,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info)
213 init_waitqueue_head(&ptp->tsev_wq); 216 init_waitqueue_head(&ptp->tsev_wq);
214 217
215 /* Create a new device in our class. */ 218 /* Create a new device in our class. */
216 ptp->dev = device_create(ptp_class, NULL, ptp->devid, ptp, 219 ptp->dev = device_create(ptp_class, parent, ptp->devid, ptp,
217 "ptp%d", ptp->index); 220 "ptp%d", ptp->index);
218 if (IS_ERR(ptp->dev)) 221 if (IS_ERR(ptp->dev))
219 goto no_device; 222 goto no_device;
@@ -300,6 +303,11 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
300 pps_get_ts(&evt); 303 pps_get_ts(&evt);
301 pps_event(ptp->pps_source, &evt, PTP_PPS_EVENT, NULL); 304 pps_event(ptp->pps_source, &evt, PTP_PPS_EVENT, NULL);
302 break; 305 break;
306
307 case PTP_CLOCK_PPSUSR:
308 pps_event(ptp->pps_source, &event->pps_times,
309 PTP_PPS_EVENT, NULL);
310 break;
303 } 311 }
304} 312}
305EXPORT_SYMBOL(ptp_clock_event); 313EXPORT_SYMBOL(ptp_clock_event);
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c
index e03c40692b00..d49b85164fd2 100644
--- a/drivers/ptp/ptp_ixp46x.c
+++ b/drivers/ptp/ptp_ixp46x.c
@@ -298,7 +298,7 @@ static int __init ptp_ixp_init(void)
298 298
299 ixp_clock.caps = ptp_ixp_caps; 299 ixp_clock.caps = ptp_ixp_caps;
300 300
301 ixp_clock.ptp_clock = ptp_clock_register(&ixp_clock.caps); 301 ixp_clock.ptp_clock = ptp_clock_register(&ixp_clock.caps, NULL);
302 302
303 if (IS_ERR(ixp_clock.ptp_clock)) 303 if (IS_ERR(ixp_clock.ptp_clock))
304 return PTR_ERR(ixp_clock.ptp_clock); 304 return PTR_ERR(ixp_clock.ptp_clock);
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 3a9c17eced10..e624e4dd2abb 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -627,7 +627,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
627 } 627 }
628 628
629 chip->caps = ptp_pch_caps; 629 chip->caps = ptp_pch_caps;
630 chip->ptp_clock = ptp_clock_register(&chip->caps); 630 chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev);
631 631
632 if (IS_ERR(chip->ptp_clock)) 632 if (IS_ERR(chip->ptp_clock))
633 return PTR_ERR(chip->ptp_clock); 633 return PTR_ERR(chip->ptp_clock);
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index 4d5b5082c3b1..69d32070cc65 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -45,6 +45,7 @@ struct ptp_clock {
45 dev_t devid; 45 dev_t devid;
46 int index; /* index into clocks.map */ 46 int index; /* index into clocks.map */
47 struct pps_device *pps_source; 47 struct pps_device *pps_source;
48 long dialed_frequency; /* remembers the frequency adjustment */
48 struct timestamp_event_queue tsevq; /* simple fifo for time stamps */ 49 struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
49 struct mutex tsevq_mux; /* one process at a time reading the fifo */ 50 struct mutex tsevq_mux; /* one process at a time reading the fifo */
50 wait_queue_head_t tsev_wq; 51 wait_queue_head_t tsev_wq;