aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ptp/ptp_clock.c')
-rw-r--r--drivers/ptp/ptp_clock.c16
1 files changed, 12 insertions, 4 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);