Lines Matching +full:hot +full:- +full:plug
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
25 #include <linux/media-bus-format.h>
50 * [ CRTC ---> ] Encoder ---> Bridge A ---> Bridge B
88 * drm_atomic_helper_commit_modeset_disables() (either directly in hand-rolled
89 * commit check and commit tail handlers, or through the higher-level
98 * connector-related operations exposed by the bridge (see the overview
110 * - The upstream driver doesn't use the component framework and isn't a
111 * MIPI-DSI host. In this case, the bridge driver will probe at some
115 * - The upstream driver doesn't use the component framework, but is a
116 * MIPI-DSI host. The bridge device uses the MIPI-DCS commands to be
119 * device (and MIPI-DSI host) is present. The upstream driver will be
126 * - The upstream driver uses the component framework and is a MIPI-DSI
127 * host. The bridge device uses the MIPI-DCS commands to be
131 * - The upstream driver uses the component framework and is a MIPI-DSI
139 * MIPI-DSI host driver case) is to split the operations like this:
141 * - The MIPI-DSI host driver must run mipi_dsi_host_register() in its
142 * probe hook. It will make sure that the MIPI-DSI host sticks around,
145 * - In its probe hook, the bridge driver must try to find its MIPI-DSI
146 * host, register as a MIPI-DSI device and attach the MIPI-DSI device
149 * - In its &struct mipi_dsi_host_ops.attach hook, the MIPI-DSI host can
155 * the bridge driver are functional and we can't have a deadlock-like
168 * must not be assumed that it is LP-11.
169 * pre_enable should initialise the PHY, set the data lanes to LP-11, and the
170 * clock lane to either LP-11 or HS depending on the mode_flag
174 * called before the DSI host. If the DSI peripheral requires LP-11 and/or
183 * should stop transmitting video, and the data lanes should return to the LP-11
202 * drm_bridge_add - add the given bridge to the global bridge list
208 mutex_init(&bridge->hpd_mutex); in drm_bridge_add()
210 if (bridge->ops & DRM_BRIDGE_OP_HDMI) in drm_bridge_add()
211 bridge->ycbcr_420_allowed = !!(bridge->supported_formats & in drm_bridge_add()
215 list_add_tail(&bridge->list, &bridge_list); in drm_bridge_add()
226 * devm_drm_bridge_add - devm managed version of drm_bridge_add()
244 * drm_bridge_remove - remove the given bridge from the global bridge list
251 list_del_init(&bridge->list); in drm_bridge_remove()
254 mutex_destroy(&bridge->hpd_mutex); in drm_bridge_remove()
264 state = bridge->funcs->atomic_duplicate_state(bridge); in drm_bridge_atomic_duplicate_priv_state()
265 return state ? &state->base : NULL; in drm_bridge_atomic_duplicate_priv_state()
275 bridge->funcs->atomic_destroy_state(bridge, state); in drm_bridge_atomic_destroy_priv_state()
284 * drm_bridge_attach - attach the bridge to an encoder's chain
296 * If non-NULL the previous bridge must be already attached by a call to this
299 * Note that bridges attached to encoders are auto-detached during encoder
313 return -EINVAL; in drm_bridge_attach()
315 if (previous && (!previous->dev || previous->encoder != encoder)) in drm_bridge_attach()
316 return -EINVAL; in drm_bridge_attach()
318 if (bridge->dev) in drm_bridge_attach()
319 return -EBUSY; in drm_bridge_attach()
321 bridge->dev = encoder->dev; in drm_bridge_attach()
322 bridge->encoder = encoder; in drm_bridge_attach()
325 list_add(&bridge->chain_node, &previous->chain_node); in drm_bridge_attach()
327 list_add(&bridge->chain_node, &encoder->bridge_chain); in drm_bridge_attach()
329 if (bridge->funcs->attach) { in drm_bridge_attach()
330 ret = bridge->funcs->attach(bridge, flags); in drm_bridge_attach()
335 if (bridge->funcs->atomic_reset) { in drm_bridge_attach()
338 state = bridge->funcs->atomic_reset(bridge); in drm_bridge_attach()
344 drm_atomic_private_obj_init(bridge->dev, &bridge->base, in drm_bridge_attach()
345 &state->base, in drm_bridge_attach()
352 if (bridge->funcs->detach) in drm_bridge_attach()
353 bridge->funcs->detach(bridge); in drm_bridge_attach()
356 bridge->dev = NULL; in drm_bridge_attach()
357 bridge->encoder = NULL; in drm_bridge_attach()
358 list_del(&bridge->chain_node); in drm_bridge_attach()
360 if (ret != -EPROBE_DEFER) in drm_bridge_attach()
362 bridge->of_node, encoder->name, ret); in drm_bridge_attach()
364 dev_err_probe(encoder->dev->dev, -EPROBE_DEFER, in drm_bridge_attach()
366 bridge->of_node, encoder->name); in drm_bridge_attach()
377 if (WARN_ON(!bridge->dev)) in drm_bridge_detach()
380 if (bridge->funcs->atomic_reset) in drm_bridge_detach()
381 drm_atomic_private_obj_fini(&bridge->base); in drm_bridge_detach()
383 if (bridge->funcs->detach) in drm_bridge_detach()
384 bridge->funcs->detach(bridge); in drm_bridge_detach()
386 list_del(&bridge->chain_node); in drm_bridge_detach()
387 bridge->dev = NULL; in drm_bridge_detach()
398 * - The encoder-related operations support control of the bridges in the
407 * finer-grained control.
414 * Mixing atomic and non-atomic versions of the operations is not supported.
416 * - The bus format negotiation operations
424 * encoder-related operations. This feature is not supported by the legacy
427 * - The connector-related operations support implementing a &drm_connector
438 * an externally-implemented &drm_connector. Those operations are
446 * Bridge drivers shall implement the connector-related operations for all
451 * controller of the SoC. Support for the connector-related operations on the
462 * read-only memory.
466 * connected-related bridge operations. Connector creation is then controlled
480 * drm_bridge_chain_mode_valid - validate the mode against all bridges in the
505 encoder = bridge->encoder; in drm_bridge_chain_mode_valid()
506 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_valid()
509 if (!bridge->funcs->mode_valid) in drm_bridge_chain_mode_valid()
512 ret = bridge->funcs->mode_valid(bridge, info, mode); in drm_bridge_chain_mode_valid()
522 * drm_bridge_chain_mode_set - set proposed mode for all bridges in the
542 encoder = bridge->encoder; in drm_bridge_chain_mode_set()
543 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_set()
544 if (bridge->funcs->mode_set) in drm_bridge_chain_mode_set()
545 bridge->funcs->mode_set(bridge, mode, adjusted_mode); in drm_bridge_chain_mode_set()
551 * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain
571 encoder = bridge->encoder; in drm_atomic_bridge_chain_disable()
572 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_disable()
573 if (iter->funcs->atomic_disable) { in drm_atomic_bridge_chain_disable()
582 iter->funcs->atomic_disable(iter, old_bridge_state); in drm_atomic_bridge_chain_disable()
583 } else if (iter->funcs->disable) { in drm_atomic_bridge_chain_disable()
584 iter->funcs->disable(iter); in drm_atomic_bridge_chain_disable()
596 if (old_state && bridge->funcs->atomic_post_disable) { in drm_atomic_bridge_call_post_disable()
605 bridge->funcs->atomic_post_disable(bridge, in drm_atomic_bridge_call_post_disable()
607 } else if (bridge->funcs->post_disable) { in drm_atomic_bridge_call_post_disable()
608 bridge->funcs->post_disable(bridge); in drm_atomic_bridge_call_post_disable()
613 * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges
628 * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E
645 encoder = bridge->encoder; in drm_atomic_bridge_chain_post_disable()
647 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_post_disable()
650 if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { in drm_atomic_bridge_chain_post_disable()
653 if (next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
662 list_for_each_entry_from(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
664 if (!next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
670 if (list_is_last(&next->chain_node, in drm_atomic_bridge_chain_post_disable()
671 &encoder->bridge_chain)) { in drm_atomic_bridge_chain_post_disable()
678 list_for_each_entry_from_reverse(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
701 if (old_state && bridge->funcs->atomic_pre_enable) { in drm_atomic_bridge_call_pre_enable()
710 bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); in drm_atomic_bridge_call_pre_enable()
711 } else if (bridge->funcs->pre_enable) { in drm_atomic_bridge_call_pre_enable()
712 bridge->funcs->pre_enable(bridge); in drm_atomic_bridge_call_pre_enable()
717 * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in
731 * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E
748 encoder = bridge->encoder; in drm_atomic_bridge_chain_pre_enable()
750 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
751 if (iter->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
755 &encoder->bridge_chain, in drm_atomic_bridge_chain_pre_enable()
760 if (!next->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
769 list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
785 if (iter->pre_enable_prev_first) in drm_atomic_bridge_chain_pre_enable()
796 * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain
815 encoder = bridge->encoder; in drm_atomic_bridge_chain_enable()
816 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_enable()
817 if (bridge->funcs->atomic_enable) { in drm_atomic_bridge_chain_enable()
826 bridge->funcs->atomic_enable(bridge, old_bridge_state); in drm_atomic_bridge_chain_enable()
827 } else if (bridge->funcs->enable) { in drm_atomic_bridge_chain_enable()
828 bridge->funcs->enable(bridge); in drm_atomic_bridge_chain_enable()
838 if (bridge->funcs->atomic_check) { in drm_atomic_bridge_check()
842 bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_check()
845 return -EINVAL; in drm_atomic_bridge_check()
847 ret = bridge->funcs->atomic_check(bridge, bridge_state, in drm_atomic_bridge_check()
851 } else if (bridge->funcs->mode_fixup) { in drm_atomic_bridge_check()
852 if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, in drm_atomic_bridge_check()
853 &crtc_state->adjusted_mode)) in drm_atomic_bridge_check()
854 return -EINVAL; in drm_atomic_bridge_check()
873 cur_state = drm_atomic_get_new_bridge_state(crtc_state->state, in select_bus_fmt_recursive()
882 if (!cur_bridge->funcs->atomic_get_input_bus_fmts) { in select_bus_fmt_recursive()
897 cur_state->input_bus_cfg.format = MEDIA_BUS_FMT_FIXED; in select_bus_fmt_recursive()
898 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
905 * If the driver implements ->atomic_get_input_bus_fmts() it in select_bus_fmt_recursive()
909 return -EINVAL; in select_bus_fmt_recursive()
911 in_bus_fmts = cur_bridge->funcs->atomic_get_input_bus_fmts(cur_bridge, in select_bus_fmt_recursive()
918 return -ENOTSUPP; in select_bus_fmt_recursive()
920 return -ENOMEM; in select_bus_fmt_recursive()
923 cur_state->input_bus_cfg.format = in_bus_fmts[0]; in select_bus_fmt_recursive()
924 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
933 if (ret != -ENOTSUPP) in select_bus_fmt_recursive()
938 cur_state->input_bus_cfg.format = in_bus_fmts[i]; in select_bus_fmt_recursive()
939 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
958 * support transcoding into a specific output format -ENOTSUPP is returned and
960 * combinations worked, -ENOTSUPP is returned and the atomic modeset will fail.
985 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_select_bus_fmts()
986 struct drm_encoder *encoder = bridge->encoder; in drm_atomic_bridge_chain_select_bus_fmts()
993 last_bridge = list_last_entry(&encoder->bridge_chain, in drm_atomic_bridge_chain_select_bus_fmts()
995 last_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_chain_select_bus_fmts()
998 if (last_bridge->funcs->atomic_get_output_bus_fmts) { in drm_atomic_bridge_chain_select_bus_fmts()
999 const struct drm_bridge_funcs *funcs = last_bridge->funcs; in drm_atomic_bridge_chain_select_bus_fmts()
1002 * If the driver implements ->atomic_get_output_bus_fmts() it in drm_atomic_bridge_chain_select_bus_fmts()
1006 return -EINVAL; in drm_atomic_bridge_chain_select_bus_fmts()
1008 out_bus_fmts = funcs->atomic_get_output_bus_fmts(last_bridge, in drm_atomic_bridge_chain_select_bus_fmts()
1014 return -ENOTSUPP; in drm_atomic_bridge_chain_select_bus_fmts()
1016 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1021 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1023 if (conn->display_info.num_bus_formats && in drm_atomic_bridge_chain_select_bus_fmts()
1024 conn->display_info.bus_formats) in drm_atomic_bridge_chain_select_bus_fmts()
1025 out_bus_fmts[0] = conn->display_info.bus_formats[0]; in drm_atomic_bridge_chain_select_bus_fmts()
1033 if (ret != -ENOTSUPP) in drm_atomic_bridge_chain_select_bus_fmts()
1070 output_flags = conn->display_info.bus_flags; in drm_atomic_bridge_propagate_bus_flags()
1079 output_flags = next_bridge_state->input_bus_cfg.flags; in drm_atomic_bridge_propagate_bus_flags()
1082 bridge_state->output_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1090 bridge_state->input_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1094 * drm_atomic_bridge_chain_check() - Do an atomic check on the bridge chain
1112 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_check()
1125 encoder = bridge->encoder; in drm_atomic_bridge_chain_check()
1126 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_check()
1137 crtc_state->state); in drm_atomic_bridge_chain_check()
1152 * drm_bridge_detect - check if anything is attached to the bridge output
1166 if (!(bridge->ops & DRM_BRIDGE_OP_DETECT)) in drm_bridge_detect()
1169 return bridge->funcs->detect(bridge); in drm_bridge_detect()
1174 * drm_bridge_get_modes - fill all modes currently valid for the sink into the
1190 if (!(bridge->ops & DRM_BRIDGE_OP_MODES)) in drm_bridge_get_modes()
1193 return bridge->funcs->get_modes(bridge, connector); in drm_bridge_get_modes()
1198 * drm_bridge_edid_read - read the EDID data of the connected display
1212 if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) in drm_bridge_edid_read()
1215 return bridge->funcs->edid_read(bridge, connector); in drm_bridge_edid_read()
1220 * drm_bridge_hpd_enable - enable hot plug detection for the bridge
1222 * @cb: hot-plug detection callback
1223 * @data: data to be passed to the hot-plug detection callback
1226 * and @data as hot plug notification callback. From now on the @cb will be
1228 * until hot plug notification gets disabled with drm_bridge_hpd_disable().
1230 * Hot plug detection is supported only if the DRM_BRIDGE_OP_HPD flag is set in
1231 * bridge->ops. This function shall not be called when the flag is not set.
1233 * Only one hot plug detection callback can be registered at a time, it is an
1234 * error to call this function when hot plug detection is already enabled for
1242 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_enable()
1245 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1247 if (WARN(bridge->hpd_cb, "Hot plug detection already enabled\n")) in drm_bridge_hpd_enable()
1250 bridge->hpd_cb = cb; in drm_bridge_hpd_enable()
1251 bridge->hpd_data = data; in drm_bridge_hpd_enable()
1253 if (bridge->funcs->hpd_enable) in drm_bridge_hpd_enable()
1254 bridge->funcs->hpd_enable(bridge); in drm_bridge_hpd_enable()
1257 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1262 * drm_bridge_hpd_disable - disable hot plug detection for the bridge
1265 * Call &drm_bridge_funcs.hpd_disable if implemented and unregister the hot
1266 * plug detection callback previously registered with drm_bridge_hpd_enable().
1270 * Hot plug detection is supported only if the DRM_BRIDGE_OP_HPD flag is set in
1271 * bridge->ops. This function shall not be called when the flag is not set.
1275 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_disable()
1278 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1279 if (bridge->funcs->hpd_disable) in drm_bridge_hpd_disable()
1280 bridge->funcs->hpd_disable(bridge); in drm_bridge_hpd_disable()
1282 bridge->hpd_cb = NULL; in drm_bridge_hpd_disable()
1283 bridge->hpd_data = NULL; in drm_bridge_hpd_disable()
1284 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1289 * drm_bridge_hpd_notify - notify hot plug detection events
1293 * Bridge drivers shall call this function to report hot plug events when they
1294 * detect a change in the output status, when hot plug detection has been
1302 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1303 if (bridge->hpd_cb) in drm_bridge_hpd_notify()
1304 bridge->hpd_cb(bridge->hpd_data, status); in drm_bridge_hpd_notify()
1305 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1311 * of_drm_find_bridge - find the bridge corresponding to the device node in
1326 if (bridge->of_node == np) { in of_drm_find_bridge()