Lines Matching refs:dpll

154 dpll_xa_ref_dpll_add(struct xarray *xa_dplls, struct dpll_device *dpll,  in dpll_xa_ref_dpll_add()  argument
164 if (ref->dpll != dpll) in dpll_xa_ref_dpll_add()
179 ref->dpll = dpll; in dpll_xa_ref_dpll_add()
181 ret = xa_insert(xa_dplls, dpll->id, ref, GFP_KERNEL); in dpll_xa_ref_dpll_add()
192 xa_erase(xa_dplls, dpll->id); in dpll_xa_ref_dpll_add()
208 dpll_xa_ref_dpll_del(struct xarray *xa_dplls, struct dpll_device *dpll, in dpll_xa_ref_dpll_del() argument
216 if (ref->dpll != dpll) in dpll_xa_ref_dpll_del()
245 struct dpll_device *dpll; in dpll_device_alloc() local
248 dpll = kzalloc(sizeof(*dpll), GFP_KERNEL); in dpll_device_alloc()
249 if (!dpll) in dpll_device_alloc()
251 refcount_set(&dpll->refcount, 1); in dpll_device_alloc()
252 INIT_LIST_HEAD(&dpll->registration_list); in dpll_device_alloc()
253 dpll->device_idx = device_idx; in dpll_device_alloc()
254 dpll->clock_id = clock_id; in dpll_device_alloc()
255 dpll->module = module; in dpll_device_alloc()
256 ret = xa_alloc_cyclic(&dpll_device_xa, &dpll->id, dpll, xa_limit_32b, in dpll_device_alloc()
259 kfree(dpll); in dpll_device_alloc()
262 xa_init_flags(&dpll->pin_refs, XA_FLAGS_ALLOC); in dpll_device_alloc()
264 return dpll; in dpll_device_alloc()
284 struct dpll_device *dpll, *ret = NULL; in dpll_device_get() local
288 xa_for_each(&dpll_device_xa, index, dpll) { in dpll_device_get()
289 if (dpll->clock_id == clock_id && in dpll_device_get()
290 dpll->device_idx == device_idx && in dpll_device_get()
291 dpll->module == module) { in dpll_device_get()
292 ret = dpll; in dpll_device_get()
313 void dpll_device_put(struct dpll_device *dpll) in dpll_device_put() argument
316 if (refcount_dec_and_test(&dpll->refcount)) { in dpll_device_put()
317 ASSERT_DPLL_NOT_REGISTERED(dpll); in dpll_device_put()
318 WARN_ON_ONCE(!xa_empty(&dpll->pin_refs)); in dpll_device_put()
319 xa_destroy(&dpll->pin_refs); in dpll_device_put()
320 xa_erase(&dpll_device_xa, dpll->id); in dpll_device_put()
321 WARN_ON(!list_empty(&dpll->registration_list)); in dpll_device_put()
322 kfree(dpll); in dpll_device_put()
329 dpll_device_registration_find(struct dpll_device *dpll, in dpll_device_registration_find() argument
334 list_for_each_entry(reg, &dpll->registration_list, list) { in dpll_device_registration_find()
355 int dpll_device_register(struct dpll_device *dpll, enum dpll_type type, in dpll_device_register() argument
371 reg = dpll_device_registration_find(dpll, ops, priv); in dpll_device_register()
384 dpll->type = type; in dpll_device_register()
385 first_registration = list_empty(&dpll->registration_list); in dpll_device_register()
386 list_add_tail(&reg->list, &dpll->registration_list); in dpll_device_register()
392 xa_set_mark(&dpll_device_xa, dpll->id, DPLL_REGISTERED); in dpll_device_register()
393 dpll_device_create_ntf(dpll); in dpll_device_register()
410 void dpll_device_unregister(struct dpll_device *dpll, in dpll_device_unregister() argument
416 ASSERT_DPLL_REGISTERED(dpll); in dpll_device_unregister()
417 dpll_device_delete_ntf(dpll); in dpll_device_unregister()
418 reg = dpll_device_registration_find(dpll, ops, priv); in dpll_device_unregister()
426 if (!list_empty(&dpll->registration_list)) { in dpll_device_unregister()
430 xa_clear_mark(&dpll_device_xa, dpll->id, DPLL_REGISTERED); in dpll_device_unregister()
603 __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin, in __dpll_pin_register() argument
608 ret = dpll_xa_ref_pin_add(&dpll->pin_refs, pin, ops, priv, cookie); in __dpll_pin_register()
611 ret = dpll_xa_ref_dpll_add(&pin->dpll_refs, dpll, ops, priv, cookie); in __dpll_pin_register()
620 dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv, cookie); in __dpll_pin_register()
637 dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin, in dpll_pin_register() argument
648 if (WARN_ON(!(dpll->module == pin->module && in dpll_pin_register()
649 dpll->clock_id == pin->clock_id))) in dpll_pin_register()
652 ret = __dpll_pin_register(dpll, pin, ops, priv, NULL); in dpll_pin_register()
660 __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, in __dpll_pin_unregister() argument
664 dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv, cookie); in __dpll_pin_unregister()
665 dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv, cookie); in __dpll_pin_unregister()
680 void dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, in dpll_pin_unregister() argument
683 if (WARN_ON(xa_empty(&dpll->pin_refs))) in dpll_pin_unregister()
690 __dpll_pin_unregister(dpll, pin, ops, priv, NULL); in dpll_pin_unregister()
731 ret = __dpll_pin_register(ref->dpll, pin, ops, priv, parent); in dpll_pin_on_pin_register()
745 __dpll_pin_unregister(ref->dpll, pin, ops, priv, in dpll_pin_on_pin_register()
778 __dpll_pin_unregister(ref->dpll, pin, ops, priv, parent); in dpll_pin_on_pin_unregister()
784 dpll_device_registration_first(struct dpll_device *dpll) in dpll_device_registration_first() argument
788 reg = list_first_entry_or_null((struct list_head *)&dpll->registration_list, in dpll_device_registration_first()
794 void *dpll_priv(struct dpll_device *dpll) in dpll_priv() argument
798 reg = dpll_device_registration_first(dpll); in dpll_priv()
802 const struct dpll_device_ops *dpll_device_ops(struct dpll_device *dpll) in dpll_device_ops() argument
806 reg = dpll_device_registration_first(dpll); in dpll_device_ops()
821 void *dpll_pin_on_dpll_priv(struct dpll_device *dpll, in dpll_pin_on_dpll_priv() argument
827 ref = xa_load(&dpll->pin_refs, pin->pin_idx); in dpll_pin_on_dpll_priv()