• Home
  • Raw
  • Download

Lines Matching full:pps

2  * PPS core file
54 struct pps_device *pps = file->private_data; in pps_cdev_poll() local
56 poll_wait(file, &pps->queue, wait); in pps_cdev_poll()
63 struct pps_device *pps = file->private_data; in pps_cdev_fasync() local
64 return fasync_helper(fd, file, on, &pps->async_queue); in pps_cdev_fasync()
67 static int pps_cdev_pps_fetch(struct pps_device *pps, struct pps_fdata *fdata) in pps_cdev_pps_fetch() argument
69 unsigned int ev = pps->last_ev; in pps_cdev_pps_fetch()
74 err = wait_event_interruptible(pps->queue, in pps_cdev_pps_fetch()
75 ev != pps->last_ev); in pps_cdev_pps_fetch()
79 dev_dbg(pps->dev, "timeout %lld.%09d\n", in pps_cdev_pps_fetch()
87 pps->queue, in pps_cdev_pps_fetch()
88 ev != pps->last_ev, in pps_cdev_pps_fetch()
97 dev_dbg(pps->dev, "pending signal caught\n"); in pps_cdev_pps_fetch()
107 struct pps_device *pps = file->private_data; in pps_cdev_ioctl() local
115 dev_dbg(pps->dev, "PPS_GETPARAMS\n"); in pps_cdev_ioctl()
117 spin_lock_irq(&pps->lock); in pps_cdev_ioctl()
120 params = pps->params; in pps_cdev_ioctl()
122 spin_unlock_irq(&pps->lock); in pps_cdev_ioctl()
131 dev_dbg(pps->dev, "PPS_SETPARAMS\n"); in pps_cdev_ioctl()
141 dev_dbg(pps->dev, "capture mode unspecified (%x)\n", in pps_cdev_ioctl()
147 if ((params.mode & ~pps->info.mode) != 0) { in pps_cdev_ioctl()
148 dev_dbg(pps->dev, "unsupported capabilities (%x)\n", in pps_cdev_ioctl()
153 spin_lock_irq(&pps->lock); in pps_cdev_ioctl()
156 pps->params = params; in pps_cdev_ioctl()
161 dev_dbg(pps->dev, "time format unspecified (%x)\n", in pps_cdev_ioctl()
163 pps->params.mode |= PPS_TSFMT_TSPEC; in pps_cdev_ioctl()
165 if (pps->info.mode & PPS_CANWAIT) in pps_cdev_ioctl()
166 pps->params.mode |= PPS_CANWAIT; in pps_cdev_ioctl()
167 pps->params.api_version = PPS_API_VERS; in pps_cdev_ioctl()
174 pps->params.assert_off_tu.flags = 0; in pps_cdev_ioctl()
175 pps->params.clear_off_tu.flags = 0; in pps_cdev_ioctl()
177 spin_unlock_irq(&pps->lock); in pps_cdev_ioctl()
182 dev_dbg(pps->dev, "PPS_GETCAP\n"); in pps_cdev_ioctl()
184 err = put_user(pps->info.mode, iuarg); in pps_cdev_ioctl()
193 dev_dbg(pps->dev, "PPS_FETCH\n"); in pps_cdev_ioctl()
199 err = pps_cdev_pps_fetch(pps, &fdata); in pps_cdev_ioctl()
204 spin_lock_irq(&pps->lock); in pps_cdev_ioctl()
206 fdata.info.assert_sequence = pps->assert_sequence; in pps_cdev_ioctl()
207 fdata.info.clear_sequence = pps->clear_sequence; in pps_cdev_ioctl()
208 fdata.info.assert_tu = pps->assert_tu; in pps_cdev_ioctl()
209 fdata.info.clear_tu = pps->clear_tu; in pps_cdev_ioctl()
210 fdata.info.current_mode = pps->current_mode; in pps_cdev_ioctl()
212 spin_unlock_irq(&pps->lock); in pps_cdev_ioctl()
223 dev_dbg(pps->dev, "PPS_KC_BIND\n"); in pps_cdev_ioctl()
234 if ((bind_args.edge & ~pps->info.mode) != 0) { in pps_cdev_ioctl()
235 dev_err(pps->dev, "unsupported capabilities (%x)\n", in pps_cdev_ioctl()
244 dev_err(pps->dev, "invalid kernel consumer bind" in pps_cdev_ioctl()
249 err = pps_kc_bind(pps, &bind_args); in pps_cdev_ioctl()
266 struct pps_device *pps = file->private_data; in pps_cdev_compat_ioctl() local
276 dev_dbg(pps->dev, "PPS_FETCH\n"); in pps_cdev_compat_ioctl()
285 err = pps_cdev_pps_fetch(pps, &fdata); in pps_cdev_compat_ioctl()
290 spin_lock_irq(&pps->lock); in pps_cdev_compat_ioctl()
292 compat.info.assert_sequence = pps->assert_sequence; in pps_cdev_compat_ioctl()
293 compat.info.clear_sequence = pps->clear_sequence; in pps_cdev_compat_ioctl()
294 compat.info.current_mode = pps->current_mode; in pps_cdev_compat_ioctl()
296 memcpy(&compat.info.assert_tu, &pps->assert_tu, in pps_cdev_compat_ioctl()
298 memcpy(&compat.info.clear_tu, &pps->clear_tu, in pps_cdev_compat_ioctl()
301 spin_unlock_irq(&pps->lock); in pps_cdev_compat_ioctl()
315 struct pps_device *pps = container_of(inode->i_cdev, in pps_cdev_open() local
317 file->private_data = pps; in pps_cdev_open()
318 kobject_get(&pps->dev->kobj); in pps_cdev_open()
324 struct pps_device *pps = container_of(inode->i_cdev, in pps_cdev_release() local
326 kobject_put(&pps->dev->kobj); in pps_cdev_release()
347 struct pps_device *pps = dev_get_drvdata(dev); in pps_device_destruct() local
349 cdev_del(&pps->cdev); in pps_device_destruct()
352 pr_debug("deallocating pps%d\n", pps->id); in pps_device_destruct()
354 idr_remove(&pps_idr, pps->id); in pps_device_destruct()
358 kfree(pps); in pps_device_destruct()
361 int pps_register_cdev(struct pps_device *pps) in pps_register_cdev() argument
368 * Get new ID for the new PPS source. After idr_alloc() calling in pps_register_cdev()
371 err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); in pps_register_cdev()
374 pr_err("%s: too many PPS sources in the system\n", in pps_register_cdev()
375 pps->info.name); in pps_register_cdev()
380 pps->id = err; in pps_register_cdev()
383 devt = MKDEV(MAJOR(pps_devt), pps->id); in pps_register_cdev()
385 cdev_init(&pps->cdev, &pps_cdev_fops); in pps_register_cdev()
386 pps->cdev.owner = pps->info.owner; in pps_register_cdev()
388 err = cdev_add(&pps->cdev, devt, 1); in pps_register_cdev()
391 pps->info.name, MAJOR(pps_devt), pps->id); in pps_register_cdev()
394 pps->dev = device_create(pps_class, pps->info.dev, devt, pps, in pps_register_cdev()
395 "pps%d", pps->id); in pps_register_cdev()
396 if (IS_ERR(pps->dev)) { in pps_register_cdev()
397 err = PTR_ERR(pps->dev); in pps_register_cdev()
402 pps->dev->release = pps_device_destruct; in pps_register_cdev()
404 pr_debug("source %s got cdev (%d:%d)\n", pps->info.name, in pps_register_cdev()
405 MAJOR(pps_devt), pps->id); in pps_register_cdev()
410 cdev_del(&pps->cdev); in pps_register_cdev()
414 idr_remove(&pps_idr, pps->id); in pps_register_cdev()
420 void pps_unregister_cdev(struct pps_device *pps) in pps_unregister_cdev() argument
422 pr_debug("unregistering pps%d\n", pps->id); in pps_unregister_cdev()
423 pps->lookup_cookie = NULL; in pps_unregister_cdev()
424 device_destroy(pps_class, pps->dev->devt); in pps_unregister_cdev()
428 * Look up a pps device by magic cookie.
432 * This is a bit of a kludge that is currently used only by the PPS
437 * It's initialized to NULL when the pps device is created, and if a
441 * so that it will not be used again, even if the pps device cannot
447 struct pps_device *pps; in pps_lookup_dev() local
451 idr_for_each_entry(&pps_idr, pps, id) in pps_lookup_dev()
452 if (cookie == pps->lookup_cookie) in pps_lookup_dev()
455 return pps; in pps_lookup_dev()
473 pps_class = class_create(THIS_MODULE, "pps"); in pps_init()
480 err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); in pps_init()