Lines Matching refs:ptp
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()
103 mutex_unlock(&ptp->tsevq_mux); in extts_fifo_show()
112 struct ptp_clock *ptp = dev_get_drvdata(dev); in period_store() local
113 struct ptp_clock_info *ops = ptp->info; in period_store()
140 struct ptp_clock *ptp = dev_get_drvdata(dev); in pps_enable_store() local
141 struct ptp_clock_info *ops = ptp->info; in pps_enable_store()
165 struct ptp_clock *ptp = dev_get_drvdata(dev); in unregister_vclock() local
166 struct ptp_clock_info *info = ptp->info; in unregister_vclock()
187 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_show() local
190 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_show()
193 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->n_vclocks); in n_vclocks_show()
195 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_show()
204 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_store() local
212 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_store()
215 if (num > ptp->max_vclocks) { in n_vclocks_store()
216 dev_err(dev, "max value is %d\n", ptp->max_vclocks); in n_vclocks_store()
221 if (num > ptp->n_vclocks) { in n_vclocks_store()
222 for (i = 0; i < num - ptp->n_vclocks; i++) { in n_vclocks_store()
223 vclock = ptp_vclock_register(ptp); in n_vclocks_store()
227 *(ptp->vclock_index + ptp->n_vclocks + i) = in n_vclocks_store()
236 if (num < ptp->n_vclocks) { in n_vclocks_store()
237 i = ptp->n_vclocks - num; in n_vclocks_store()
241 for (i = 1; i <= ptp->n_vclocks - num; i++) in n_vclocks_store()
242 *(ptp->vclock_index + ptp->n_vclocks - i) = -1; in n_vclocks_store()
246 if (!ptp->has_cycles) { in n_vclocks_store()
253 ptp->n_vclocks = num; in n_vclocks_store()
254 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
258 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
266 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_show() local
269 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->max_vclocks); in max_vclocks_show()
278 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_store() local
287 if (max == ptp->max_vclocks) in max_vclocks_store()
290 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in max_vclocks_store()
293 if (max < ptp->n_vclocks) in max_vclocks_store()
303 size = sizeof(int) * ptp->n_vclocks; in max_vclocks_store()
304 memcpy(vclock_index, ptp->vclock_index, size); in max_vclocks_store()
306 kfree(ptp->vclock_index); in max_vclocks_store()
307 ptp->vclock_index = vclock_index; in max_vclocks_store()
308 ptp->max_vclocks = max; in max_vclocks_store()
310 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
314 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
343 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_is_attribute_visible() local
344 struct ptp_clock_info *info = ptp->info; in ptp_is_attribute_visible()
359 if (ptp->is_virtual_clock) in ptp_is_attribute_visible()
379 static int ptp_pin_name2index(struct ptp_clock *ptp, const char *name) in ptp_pin_name2index() argument
382 for (i = 0; i < ptp->info->n_pins; i++) { in ptp_pin_name2index()
383 if (!strcmp(ptp->info->pin_config[i].name, name)) in ptp_pin_name2index()
392 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_show() local
396 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_show()
400 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_show()
403 func = ptp->info->pin_config[index].func; in ptp_pin_show()
404 chan = ptp->info->pin_config[index].chan; in ptp_pin_show()
406 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_show()
414 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_store() local
422 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_store()
426 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_store()
428 err = ptp_set_pinfunc(ptp, index, func, chan); in ptp_pin_store()
429 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_store()
436 int ptp_populate_pin_groups(struct ptp_clock *ptp) in ptp_populate_pin_groups() argument
438 struct ptp_clock_info *info = ptp->info; in ptp_populate_pin_groups()
444 ptp->pin_dev_attr = kcalloc(n_pins, sizeof(*ptp->pin_dev_attr), in ptp_populate_pin_groups()
446 if (!ptp->pin_dev_attr) in ptp_populate_pin_groups()
449 ptp->pin_attr = kcalloc(1 + n_pins, sizeof(*ptp->pin_attr), GFP_KERNEL); in ptp_populate_pin_groups()
450 if (!ptp->pin_attr) in ptp_populate_pin_groups()
454 struct device_attribute *da = &ptp->pin_dev_attr[i]; in ptp_populate_pin_groups()
460 ptp->pin_attr[i] = &da->attr; in ptp_populate_pin_groups()
463 ptp->pin_attr_group.name = "pins"; in ptp_populate_pin_groups()
464 ptp->pin_attr_group.attrs = ptp->pin_attr; in ptp_populate_pin_groups()
466 ptp->pin_attr_groups[0] = &ptp->pin_attr_group; in ptp_populate_pin_groups()
471 kfree(ptp->pin_dev_attr); in ptp_populate_pin_groups()
476 void ptp_cleanup_pin_groups(struct ptp_clock *ptp) in ptp_cleanup_pin_groups() argument
478 kfree(ptp->pin_attr); in ptp_cleanup_pin_groups()
479 kfree(ptp->pin_dev_attr); in ptp_cleanup_pin_groups()