Lines Matching full:ptp
2 * PTP 1588 clock support - sysfs interface.
28 struct ptp_clock *ptp = dev_get_drvdata(dev); in clock_name_show() local
29 return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); in clock_name_show()
37 struct ptp_clock *ptp = dev_get_drvdata(dev); \
38 return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->var); \
53 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_enable_store() local
54 struct ptp_clock_info *ops = ptp->info; in extts_enable_store()
78 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_fifo_show() local
79 struct timestamp_event_queue *queue = &ptp->tsevq; in extts_fifo_show()
87 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()
185 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_is_attribute_visible() local
186 struct ptp_clock_info *info = ptp->info; in ptp_is_attribute_visible()
214 static int ptp_pin_name2index(struct ptp_clock *ptp, const char *name) in ptp_pin_name2index() argument
217 for (i = 0; i < ptp->info->n_pins; i++) { in ptp_pin_name2index()
218 if (!strcmp(ptp->info->pin_config[i].name, name)) in ptp_pin_name2index()
227 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_show() local
231 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_show()
235 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_show()
238 func = ptp->info->pin_config[index].func; in ptp_pin_show()
239 chan = ptp->info->pin_config[index].chan; in ptp_pin_show()
241 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_show()
249 struct ptp_clock *ptp = dev_get_drvdata(dev); in ptp_pin_store() local
257 index = ptp_pin_name2index(ptp, attr->attr.name); in ptp_pin_store()
261 if (mutex_lock_interruptible(&ptp->pincfg_mux)) in ptp_pin_store()
263 err = ptp_set_pinfunc(ptp, index, func, chan); in ptp_pin_store()
264 mutex_unlock(&ptp->pincfg_mux); in ptp_pin_store()
271 int ptp_populate_pin_groups(struct ptp_clock *ptp) in ptp_populate_pin_groups() argument
273 struct ptp_clock_info *info = ptp->info; in ptp_populate_pin_groups()
279 ptp->pin_dev_attr = kcalloc(n_pins, sizeof(*ptp->pin_dev_attr), in ptp_populate_pin_groups()
281 if (!ptp->pin_dev_attr) in ptp_populate_pin_groups()
284 ptp->pin_attr = kcalloc(1 + n_pins, sizeof(*ptp->pin_attr), GFP_KERNEL); in ptp_populate_pin_groups()
285 if (!ptp->pin_attr) in ptp_populate_pin_groups()
289 struct device_attribute *da = &ptp->pin_dev_attr[i]; in ptp_populate_pin_groups()
295 ptp->pin_attr[i] = &da->attr; in ptp_populate_pin_groups()
298 ptp->pin_attr_group.name = "pins"; in ptp_populate_pin_groups()
299 ptp->pin_attr_group.attrs = ptp->pin_attr; in ptp_populate_pin_groups()
301 ptp->pin_attr_groups[0] = &ptp->pin_attr_group; in ptp_populate_pin_groups()
306 kfree(ptp->pin_dev_attr); in ptp_populate_pin_groups()
311 void ptp_cleanup_pin_groups(struct ptp_clock *ptp) in ptp_cleanup_pin_groups() argument
313 kfree(ptp->pin_attr); in ptp_cleanup_pin_groups()
314 kfree(ptp->pin_dev_attr); in ptp_cleanup_pin_groups()