• Home
  • Raw
  • Download

Lines Matching full:ptp

3  * PTP 1588 clock support - sysfs interface.
16 struct ptp_clock *ptp = dev_get_drvdata(dev); in clock_name_show() local
17 return sysfs_emit(page, "%s\n", ptp->info->name); in clock_name_show()
25 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_phase_adjustment_show() local
28 ptp->info->getmaxphase(ptp->info)); in max_phase_adjustment_show()
36 struct ptp_clock *ptp = dev_get_drvdata(dev); \
37 return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->var); \
52 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_enable_store() local
53 struct ptp_clock_info *ops = ptp->info; in extts_enable_store()
77 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_fifo_show() local
78 struct timestamp_event_queue *queue = &ptp->tsevq; in extts_fifo_show()
86 if (mutex_lock_interruptible(&ptp->tsevq_mux)) in extts_fifo_show()
104 mutex_unlock(&ptp->tsevq_mux); in extts_fifo_show()
113 struct ptp_clock *ptp = dev_get_drvdata(dev); in period_store() local
114 struct ptp_clock_info *ops = ptp->info; in period_store()
141 struct ptp_clock *ptp = dev_get_drvdata(dev); in pps_enable_store() local
142 struct ptp_clock_info *ops = ptp->info; in pps_enable_store()
166 struct ptp_clock *ptp = dev_get_drvdata(dev); in unregister_vclock() local
167 struct ptp_clock_info *info = ptp->info; in unregister_vclock()
172 dev_info(dev->parent, "delete virtual clock ptp%d\n", in unregister_vclock()
188 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_show() local
191 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_show()
194 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->n_vclocks); in n_vclocks_show()
196 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_show()
205 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_store() local
213 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_store()
216 if (num > ptp->max_vclocks) { in n_vclocks_store()
217 dev_err(dev, "max value is %d\n", ptp->max_vclocks); in n_vclocks_store()
222 if (num > ptp->n_vclocks) { in n_vclocks_store()
223 for (i = 0; i < num - ptp->n_vclocks; i++) { in n_vclocks_store()
224 vclock = ptp_vclock_register(ptp); in n_vclocks_store()
228 *(ptp->vclock_index + ptp->n_vclocks + i) = in n_vclocks_store()
231 dev_info(dev, "new virtual clock ptp%d\n", in n_vclocks_store()
237 if (num < ptp->n_vclocks) { in n_vclocks_store()
238 i = ptp->n_vclocks - num; in n_vclocks_store()
242 for (i = 1; i <= ptp->n_vclocks - num; i++) in n_vclocks_store()
243 *(ptp->vclock_index + ptp->n_vclocks - i) = -1; in n_vclocks_store()
247 if (!ptp->has_cycles) { in n_vclocks_store()
254 ptp->n_vclocks = num; in n_vclocks_store()
255 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
259 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
267 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_show() local
270 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->max_vclocks); in max_vclocks_show()
279 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_store() local
288 if (max == ptp->max_vclocks) in max_vclocks_store()
291 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in max_vclocks_store()
294 if (max < ptp->n_vclocks) in max_vclocks_store()
304 size = sizeof(int) * ptp->n_vclocks; in max_vclocks_store()
305 memcpy(vclock_index, ptp->vclock_index, size); in max_vclocks_store()
307 kfree(ptp->vclock_index); in max_vclocks_store()
308 ptp->vclock_index = vclock_index; in max_vclocks_store()
309 ptp->max_vclocks = max; in max_vclocks_store()
311 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
315 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
344 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_is_attribute_visible() local
345 struct ptp_clock_info *info = ptp->info; in ptp_is_attribute_visible()
360 if (ptp->is_virtual_clock) in ptp_is_attribute_visible()
380 static int ptp_pin_name2index(struct ptp_clock *ptp, const char *name) in ptp_pin_name2index() argument
383 for (i = 0; i < ptp->info->n_pins; i++) { in ptp_pin_name2index()
384 if (!strcmp(ptp->info->pin_config[i].name, name)) in ptp_pin_name2index()
393 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_show() local
397 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_show()
401 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_show()
404 func = ptp->info->pin_config[index].func; in ptp_pin_show()
405 chan = ptp->info->pin_config[index].chan; in ptp_pin_show()
407 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_show()
415 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_store() local
423 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_store()
427 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_store()
429 err = ptp_set_pinfunc(ptp, index, func, chan); in ptp_pin_store()
430 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_store()
437 int ptp_populate_pin_groups(struct ptp_clock *ptp) in ptp_populate_pin_groups() argument
439 struct ptp_clock_info *info = ptp->info; in ptp_populate_pin_groups()
445 ptp->pin_dev_attr = kcalloc(n_pins, sizeof(*ptp->pin_dev_attr), in ptp_populate_pin_groups()
447 if (!ptp->pin_dev_attr) in ptp_populate_pin_groups()
450 ptp->pin_attr = kcalloc(1 + n_pins, sizeof(*ptp->pin_attr), GFP_KERNEL); in ptp_populate_pin_groups()
451 if (!ptp->pin_attr) in ptp_populate_pin_groups()
455 struct device_attribute *da = &ptp->pin_dev_attr[i]; in ptp_populate_pin_groups()
461 ptp->pin_attr[i] = &da->attr; in ptp_populate_pin_groups()
464 ptp->pin_attr_group.name = "pins"; in ptp_populate_pin_groups()
465 ptp->pin_attr_group.attrs = ptp->pin_attr; in ptp_populate_pin_groups()
467 ptp->pin_attr_groups[0] = &ptp->pin_attr_group; in ptp_populate_pin_groups()
472 kfree(ptp->pin_dev_attr); in ptp_populate_pin_groups()
477 void ptp_cleanup_pin_groups(struct ptp_clock *ptp) in ptp_cleanup_pin_groups() argument
479 kfree(ptp->pin_attr); in ptp_cleanup_pin_groups()
480 kfree(ptp->pin_dev_attr); in ptp_cleanup_pin_groups()