• Home
  • Raw
  • Download

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); \
26 return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->var); \
41 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_enable_store() local
42 struct ptp_clock_info *ops = ptp->info; in extts_enable_store()
66 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_fifo_show() local
67 struct timestamp_event_queue *queue = &ptp->tsevq; in extts_fifo_show()
75 if (mutex_lock_interruptible(&ptp->tsevq_mux)) in extts_fifo_show()
93 mutex_unlock(&ptp->tsevq_mux); in extts_fifo_show()
102 struct ptp_clock *ptp = dev_get_drvdata(dev); in period_store() local
103 struct ptp_clock_info *ops = ptp->info; in period_store()
130 struct ptp_clock *ptp = dev_get_drvdata(dev); in pps_enable_store() local
131 struct ptp_clock_info *ops = ptp->info; in pps_enable_store()
155 struct ptp_clock *ptp = dev_get_drvdata(dev); in unregister_vclock() local
156 struct ptp_clock_info *info = ptp->info; in unregister_vclock()
177 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_show() local
180 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_show()
183 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->n_vclocks); in n_vclocks_show()
185 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_show()
194 struct ptp_clock *ptp = dev_get_drvdata(dev); in n_vclocks_store() local
202 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in n_vclocks_store()
205 if (num > ptp->max_vclocks) { in n_vclocks_store()
206 dev_err(dev, "max value is %d\n", ptp->max_vclocks); in n_vclocks_store()
211 if (num > ptp->n_vclocks) { in n_vclocks_store()
212 for (i = 0; i < num - ptp->n_vclocks; i++) { in n_vclocks_store()
213 vclock = ptp_vclock_register(ptp); in n_vclocks_store()
217 *(ptp->vclock_index + ptp->n_vclocks + i) = in n_vclocks_store()
226 if (num < ptp->n_vclocks) { in n_vclocks_store()
227 i = ptp->n_vclocks - num; in n_vclocks_store()
231 for (i = 1; i <= ptp->n_vclocks - num; i++) in n_vclocks_store()
232 *(ptp->vclock_index + ptp->n_vclocks - i) = -1; in n_vclocks_store()
240 ptp->n_vclocks = num; in n_vclocks_store()
241 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
245 mutex_unlock(&ptp->n_vclocks_mux); in n_vclocks_store()
253 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_show() local
256 size = snprintf(page, PAGE_SIZE - 1, "%u\n", ptp->max_vclocks); in max_vclocks_show()
265 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_vclocks_store() local
274 if (max == ptp->max_vclocks) in max_vclocks_store()
277 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in max_vclocks_store()
280 if (max < ptp->n_vclocks) in max_vclocks_store()
290 size = sizeof(int) * ptp->n_vclocks; in max_vclocks_store()
291 memcpy(vclock_index, ptp->vclock_index, size); in max_vclocks_store()
293 kfree(ptp->vclock_index); in max_vclocks_store()
294 ptp->vclock_index = vclock_index; in max_vclocks_store()
295 ptp->max_vclocks = max; in max_vclocks_store()
297 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
301 mutex_unlock(&ptp->n_vclocks_mux); in max_vclocks_store()
329 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_is_attribute_visible() local
330 struct ptp_clock_info *info = ptp->info; in ptp_is_attribute_visible()
345 if (ptp->is_virtual_clock) in ptp_is_attribute_visible()
362 static int ptp_pin_name2index(struct ptp_clock *ptp, const char *name) in ptp_pin_name2index() argument
365 for (i = 0; i < ptp->info->n_pins; i++) { in ptp_pin_name2index()
366 if (!strcmp(ptp->info->pin_config[i].name, name)) in ptp_pin_name2index()
375 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_show() local
379 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_show()
383 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_show()
386 func = ptp->info->pin_config[index].func; in ptp_pin_show()
387 chan = ptp->info->pin_config[index].chan; in ptp_pin_show()
389 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_show()
397 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_store() local
405 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_store()
409 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_store()
411 err = ptp_set_pinfunc(ptp, index, func, chan); in ptp_pin_store()
412 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_store()
419 int ptp_populate_pin_groups(struct ptp_clock *ptp) in ptp_populate_pin_groups() argument
421 struct ptp_clock_info *info = ptp->info; in ptp_populate_pin_groups()
427 ptp->pin_dev_attr = kcalloc(n_pins, sizeof(*ptp->pin_dev_attr), in ptp_populate_pin_groups()
429 if (!ptp->pin_dev_attr) in ptp_populate_pin_groups()
432 ptp->pin_attr = kcalloc(1 + n_pins, sizeof(*ptp->pin_attr), GFP_KERNEL); in ptp_populate_pin_groups()
433 if (!ptp->pin_attr) in ptp_populate_pin_groups()
437 struct device_attribute *da = &ptp->pin_dev_attr[i]; in ptp_populate_pin_groups()
443 ptp->pin_attr[i] = &da->attr; in ptp_populate_pin_groups()
446 ptp->pin_attr_group.name = "pins"; in ptp_populate_pin_groups()
447 ptp->pin_attr_group.attrs = ptp->pin_attr; in ptp_populate_pin_groups()
449 ptp->pin_attr_groups[0] = &ptp->pin_attr_group; in ptp_populate_pin_groups()
454 kfree(ptp->pin_dev_attr); in ptp_populate_pin_groups()
459 void ptp_cleanup_pin_groups(struct ptp_clock *ptp) in ptp_cleanup_pin_groups() argument
461 kfree(ptp->pin_attr); in ptp_cleanup_pin_groups()
462 kfree(ptp->pin_dev_attr); in ptp_cleanup_pin_groups()