Lines Matching refs:bridge
163 void drm_bridge_add(struct drm_bridge *bridge) in drm_bridge_add() argument
165 mutex_init(&bridge->hpd_mutex); in drm_bridge_add()
168 list_add_tail(&bridge->list, &bridge_list); in drm_bridge_add()
178 void drm_bridge_remove(struct drm_bridge *bridge) in drm_bridge_remove() argument
181 list_del_init(&bridge->list); in drm_bridge_remove()
184 mutex_destroy(&bridge->hpd_mutex); in drm_bridge_remove()
191 struct drm_bridge *bridge = drm_priv_to_bridge(obj); in drm_bridge_atomic_duplicate_priv_state() local
194 state = bridge->funcs->atomic_duplicate_state(bridge); in drm_bridge_atomic_duplicate_priv_state()
203 struct drm_bridge *bridge = drm_priv_to_bridge(obj); in drm_bridge_atomic_destroy_priv_state() local
205 bridge->funcs->atomic_destroy_state(bridge, state); in drm_bridge_atomic_destroy_priv_state()
236 int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, in drm_bridge_attach() argument
242 if (!encoder || !bridge) in drm_bridge_attach()
248 if (bridge->dev) in drm_bridge_attach()
251 bridge->dev = encoder->dev; in drm_bridge_attach()
252 bridge->encoder = encoder; in drm_bridge_attach()
255 list_add(&bridge->chain_node, &previous->chain_node); in drm_bridge_attach()
257 list_add(&bridge->chain_node, &encoder->bridge_chain); in drm_bridge_attach()
259 if (bridge->funcs->attach) { in drm_bridge_attach()
260 ret = bridge->funcs->attach(bridge, flags); in drm_bridge_attach()
265 if (bridge->funcs->atomic_reset) { in drm_bridge_attach()
268 state = bridge->funcs->atomic_reset(bridge); in drm_bridge_attach()
274 drm_atomic_private_obj_init(bridge->dev, &bridge->base, in drm_bridge_attach()
282 if (bridge->funcs->detach) in drm_bridge_attach()
283 bridge->funcs->detach(bridge); in drm_bridge_attach()
286 bridge->dev = NULL; in drm_bridge_attach()
287 bridge->encoder = NULL; in drm_bridge_attach()
288 list_del(&bridge->chain_node); in drm_bridge_attach()
292 bridge->of_node, encoder->name, ret); in drm_bridge_attach()
302 void drm_bridge_detach(struct drm_bridge *bridge) in drm_bridge_detach() argument
304 if (WARN_ON(!bridge)) in drm_bridge_detach()
307 if (WARN_ON(!bridge->dev)) in drm_bridge_detach()
310 if (bridge->funcs->atomic_reset) in drm_bridge_detach()
311 drm_atomic_private_obj_fini(&bridge->base); in drm_bridge_detach()
313 if (bridge->funcs->detach) in drm_bridge_detach()
314 bridge->funcs->detach(bridge); in drm_bridge_detach()
316 list_del(&bridge->chain_node); in drm_bridge_detach()
317 bridge->dev = NULL; in drm_bridge_detach()
424 bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, in drm_bridge_chain_mode_fixup() argument
430 if (!bridge) in drm_bridge_chain_mode_fixup()
433 encoder = bridge->encoder; in drm_bridge_chain_mode_fixup()
434 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_fixup()
435 if (!bridge->funcs->mode_fixup) in drm_bridge_chain_mode_fixup()
438 if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode)) in drm_bridge_chain_mode_fixup()
463 drm_bridge_chain_mode_valid(struct drm_bridge *bridge, in drm_bridge_chain_mode_valid() argument
469 if (!bridge) in drm_bridge_chain_mode_valid()
472 encoder = bridge->encoder; in drm_bridge_chain_mode_valid()
473 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_valid()
476 if (!bridge->funcs->mode_valid) in drm_bridge_chain_mode_valid()
479 ret = bridge->funcs->mode_valid(bridge, info, mode); in drm_bridge_chain_mode_valid()
498 void drm_bridge_chain_disable(struct drm_bridge *bridge) in drm_bridge_chain_disable() argument
503 if (!bridge) in drm_bridge_chain_disable()
506 encoder = bridge->encoder; in drm_bridge_chain_disable()
511 if (iter == bridge) in drm_bridge_chain_disable()
528 void drm_bridge_chain_post_disable(struct drm_bridge *bridge) in drm_bridge_chain_post_disable() argument
532 if (!bridge) in drm_bridge_chain_post_disable()
535 encoder = bridge->encoder; in drm_bridge_chain_post_disable()
536 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_post_disable()
537 if (bridge->funcs->post_disable) in drm_bridge_chain_post_disable()
538 bridge->funcs->post_disable(bridge); in drm_bridge_chain_post_disable()
555 void drm_bridge_chain_mode_set(struct drm_bridge *bridge, in drm_bridge_chain_mode_set() argument
561 if (!bridge) in drm_bridge_chain_mode_set()
564 encoder = bridge->encoder; in drm_bridge_chain_mode_set()
565 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_set()
566 if (bridge->funcs->mode_set) in drm_bridge_chain_mode_set()
567 bridge->funcs->mode_set(bridge, mode, adjusted_mode); in drm_bridge_chain_mode_set()
583 void drm_bridge_chain_pre_enable(struct drm_bridge *bridge) in drm_bridge_chain_pre_enable() argument
588 if (!bridge) in drm_bridge_chain_pre_enable()
591 encoder = bridge->encoder; in drm_bridge_chain_pre_enable()
596 if (iter == bridge) in drm_bridge_chain_pre_enable()
612 void drm_bridge_chain_enable(struct drm_bridge *bridge) in drm_bridge_chain_enable() argument
616 if (!bridge) in drm_bridge_chain_enable()
619 encoder = bridge->encoder; in drm_bridge_chain_enable()
620 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_enable()
621 if (bridge->funcs->enable) in drm_bridge_chain_enable()
622 bridge->funcs->enable(bridge); in drm_bridge_chain_enable()
639 void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, in drm_atomic_bridge_chain_disable() argument
645 if (!bridge) in drm_atomic_bridge_chain_disable()
648 encoder = bridge->encoder; in drm_atomic_bridge_chain_disable()
664 if (iter == bridge) in drm_atomic_bridge_chain_disable()
683 void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, in drm_atomic_bridge_chain_post_disable() argument
688 if (!bridge) in drm_atomic_bridge_chain_post_disable()
691 encoder = bridge->encoder; in drm_atomic_bridge_chain_post_disable()
692 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_post_disable()
693 if (bridge->funcs->atomic_post_disable) { in drm_atomic_bridge_chain_post_disable()
698 bridge); in drm_atomic_bridge_chain_post_disable()
702 bridge->funcs->atomic_post_disable(bridge, in drm_atomic_bridge_chain_post_disable()
704 } else if (bridge->funcs->post_disable) { in drm_atomic_bridge_chain_post_disable()
705 bridge->funcs->post_disable(bridge); in drm_atomic_bridge_chain_post_disable()
724 void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, in drm_atomic_bridge_chain_pre_enable() argument
730 if (!bridge) in drm_atomic_bridge_chain_pre_enable()
733 encoder = bridge->encoder; in drm_atomic_bridge_chain_pre_enable()
749 if (iter == bridge) in drm_atomic_bridge_chain_pre_enable()
767 void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, in drm_atomic_bridge_chain_enable() argument
772 if (!bridge) in drm_atomic_bridge_chain_enable()
775 encoder = bridge->encoder; in drm_atomic_bridge_chain_enable()
776 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_enable()
777 if (bridge->funcs->atomic_enable) { in drm_atomic_bridge_chain_enable()
782 bridge); in drm_atomic_bridge_chain_enable()
786 bridge->funcs->atomic_enable(bridge, old_bridge_state); in drm_atomic_bridge_chain_enable()
787 } else if (bridge->funcs->enable) { in drm_atomic_bridge_chain_enable()
788 bridge->funcs->enable(bridge); in drm_atomic_bridge_chain_enable()
794 static int drm_atomic_bridge_check(struct drm_bridge *bridge, in drm_atomic_bridge_check() argument
798 if (bridge->funcs->atomic_check) { in drm_atomic_bridge_check()
803 bridge); in drm_atomic_bridge_check()
807 ret = bridge->funcs->atomic_check(bridge, bridge_state, in drm_atomic_bridge_check()
811 } else if (bridge->funcs->mode_fixup) { in drm_atomic_bridge_check()
812 if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, in drm_atomic_bridge_check()
941 drm_atomic_bridge_chain_select_bus_fmts(struct drm_bridge *bridge, in drm_atomic_bridge_chain_select_bus_fmts() argument
946 struct drm_encoder *encoder = bridge->encoder; in drm_atomic_bridge_chain_select_bus_fmts()
991 ret = select_bus_fmt_recursive(bridge, last_bridge, crtc_state, in drm_atomic_bridge_chain_select_bus_fmts()
1003 drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge, in drm_atomic_bridge_propagate_bus_flags() argument
1011 bridge_state = drm_atomic_get_new_bridge_state(state, bridge); in drm_atomic_bridge_propagate_bus_flags()
1017 next_bridge = drm_bridge_get_next_bridge(bridge); in drm_atomic_bridge_propagate_bus_flags()
1068 int drm_atomic_bridge_chain_check(struct drm_bridge *bridge, in drm_atomic_bridge_chain_check() argument
1077 if (!bridge) in drm_atomic_bridge_chain_check()
1080 ret = drm_atomic_bridge_chain_select_bus_fmts(bridge, crtc_state, in drm_atomic_bridge_chain_check()
1085 encoder = bridge->encoder; in drm_atomic_bridge_chain_check()
1103 if (iter == bridge) in drm_atomic_bridge_chain_check()
1124 enum drm_connector_status drm_bridge_detect(struct drm_bridge *bridge) in drm_bridge_detect() argument
1126 if (!(bridge->ops & DRM_BRIDGE_OP_DETECT)) in drm_bridge_detect()
1129 return bridge->funcs->detect(bridge); in drm_bridge_detect()
1147 int drm_bridge_get_modes(struct drm_bridge *bridge, in drm_bridge_get_modes() argument
1150 if (!(bridge->ops & DRM_BRIDGE_OP_MODES)) in drm_bridge_get_modes()
1153 return bridge->funcs->get_modes(bridge, connector); in drm_bridge_get_modes()
1169 struct edid *drm_bridge_get_edid(struct drm_bridge *bridge, in drm_bridge_get_edid() argument
1172 if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) in drm_bridge_get_edid()
1175 return bridge->funcs->get_edid(bridge, connector); in drm_bridge_get_edid()
1197 void drm_bridge_hpd_enable(struct drm_bridge *bridge, in drm_bridge_hpd_enable() argument
1202 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_enable()
1205 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1207 if (WARN(bridge->hpd_cb, "Hot plug detection already enabled\n")) in drm_bridge_hpd_enable()
1210 bridge->hpd_cb = cb; in drm_bridge_hpd_enable()
1211 bridge->hpd_data = data; in drm_bridge_hpd_enable()
1213 if (bridge->funcs->hpd_enable) in drm_bridge_hpd_enable()
1214 bridge->funcs->hpd_enable(bridge); in drm_bridge_hpd_enable()
1217 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1233 void drm_bridge_hpd_disable(struct drm_bridge *bridge) in drm_bridge_hpd_disable() argument
1235 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_disable()
1238 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1239 if (bridge->funcs->hpd_disable) in drm_bridge_hpd_disable()
1240 bridge->funcs->hpd_disable(bridge); in drm_bridge_hpd_disable()
1242 bridge->hpd_cb = NULL; in drm_bridge_hpd_disable()
1243 bridge->hpd_data = NULL; in drm_bridge_hpd_disable()
1244 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1259 void drm_bridge_hpd_notify(struct drm_bridge *bridge, in drm_bridge_hpd_notify() argument
1262 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1263 if (bridge->hpd_cb) in drm_bridge_hpd_notify()
1264 bridge->hpd_cb(bridge->hpd_data, status); in drm_bridge_hpd_notify()
1265 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1281 struct drm_bridge *bridge; in of_drm_find_bridge() local
1285 list_for_each_entry(bridge, &bridge_list, list) { in of_drm_find_bridge()
1286 if (bridge->of_node == np) { in of_drm_find_bridge()
1288 return bridge; in of_drm_find_bridge()