Lines Matching +full:display +full:- +full:related
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
25 #include <linux/media-bus-format.h>
49 * [ CRTC ---> ] Encoder ---> Bridge A ---> Bridge B
63 * DOC: display driver integration
65 * Display drivers are responsible for linking encoders with the first bridge
84 * For display drivers that use the atomic helpers
87 * drm_atomic_helper_commit_modeset_disables() (either directly in hand-rolled
88 * commit check and commit tail handlers, or through the higher-level
95 * the bridge chain. Display drivers may use the drm_bridge_connector_init()
97 * connector-related operations exposed by the bridge (see the overview
109 * - The upstream driver doesn't use the component framework and isn't a
110 * MIPI-DSI host. In this case, the bridge driver will probe at some
114 * - The upstream driver doesn't use the component framework, but is a
115 * MIPI-DSI host. The bridge device uses the MIPI-DCS commands to be
117 * display device and when it will probe it's assured that the display
118 * device (and MIPI-DSI host) is present. The upstream driver will be
125 * - The upstream driver uses the component framework and is a MIPI-DSI
126 * host. The bridge device uses the MIPI-DCS commands to be
130 * - The upstream driver uses the component framework and is a MIPI-DSI
138 * MIPI-DSI host driver case) is to split the operations like this:
140 * - The MIPI-DSI host driver must run mipi_dsi_host_register() in its
141 * probe hook. It will make sure that the MIPI-DSI host sticks around,
144 * - In its probe hook, the bridge driver must try to find its MIPI-DSI
145 * host, register as a MIPI-DSI device and attach the MIPI-DSI device
148 * - In its &struct mipi_dsi_host_ops.attach hook, the MIPI-DSI host can
154 * the bridge driver are functional and we can't have a deadlock-like
167 * must not be assumed that it is LP-11.
168 * pre_enable should initialise the PHY, set the data lanes to LP-11, and the
169 * clock lane to either LP-11 or HS depending on the mode_flag
173 * called before the DSI host. If the DSI peripheral requires LP-11 and/or
182 * should stop transmitting video, and the data lanes should return to the LP-11
201 * drm_bridge_add - add the given bridge to the global bridge list
207 mutex_init(&bridge->hpd_mutex); in drm_bridge_add()
210 list_add_tail(&bridge->list, &bridge_list); in drm_bridge_add()
221 * devm_drm_bridge_add - devm managed version of drm_bridge_add()
239 * drm_bridge_remove - remove the given bridge from the global bridge list
246 list_del_init(&bridge->list); in drm_bridge_remove()
249 mutex_destroy(&bridge->hpd_mutex); in drm_bridge_remove()
259 state = bridge->funcs->atomic_duplicate_state(bridge); in drm_bridge_atomic_duplicate_priv_state()
260 return state ? &state->base : NULL; in drm_bridge_atomic_duplicate_priv_state()
270 bridge->funcs->atomic_destroy_state(bridge, state); in drm_bridge_atomic_destroy_priv_state()
279 * drm_bridge_attach - attach the bridge to an encoder's chain
291 * If non-NULL the previous bridge must be already attached by a call to this
294 * Note that bridges attached to encoders are auto-detached during encoder
308 return -EINVAL; in drm_bridge_attach()
310 if (previous && (!previous->dev || previous->encoder != encoder)) in drm_bridge_attach()
311 return -EINVAL; in drm_bridge_attach()
313 if (bridge->dev) in drm_bridge_attach()
314 return -EBUSY; in drm_bridge_attach()
316 bridge->dev = encoder->dev; in drm_bridge_attach()
317 bridge->encoder = encoder; in drm_bridge_attach()
320 list_add(&bridge->chain_node, &previous->chain_node); in drm_bridge_attach()
322 list_add(&bridge->chain_node, &encoder->bridge_chain); in drm_bridge_attach()
324 if (bridge->funcs->attach) { in drm_bridge_attach()
325 ret = bridge->funcs->attach(bridge, flags); in drm_bridge_attach()
330 if (bridge->funcs->atomic_reset) { in drm_bridge_attach()
333 state = bridge->funcs->atomic_reset(bridge); in drm_bridge_attach()
339 drm_atomic_private_obj_init(bridge->dev, &bridge->base, in drm_bridge_attach()
340 &state->base, in drm_bridge_attach()
347 if (bridge->funcs->detach) in drm_bridge_attach()
348 bridge->funcs->detach(bridge); in drm_bridge_attach()
351 bridge->dev = NULL; in drm_bridge_attach()
352 bridge->encoder = NULL; in drm_bridge_attach()
353 list_del(&bridge->chain_node); in drm_bridge_attach()
357 bridge->of_node, encoder->name, ret); in drm_bridge_attach()
360 encoder->name, ret); in drm_bridge_attach()
372 if (WARN_ON(!bridge->dev)) in drm_bridge_detach()
375 if (bridge->funcs->atomic_reset) in drm_bridge_detach()
376 drm_atomic_private_obj_fini(&bridge->base); in drm_bridge_detach()
378 if (bridge->funcs->detach) in drm_bridge_detach()
379 bridge->funcs->detach(bridge); in drm_bridge_detach()
381 list_del(&bridge->chain_node); in drm_bridge_detach()
382 bridge->dev = NULL; in drm_bridge_detach()
393 * - The encoder-related operations support control of the bridges in the
402 * finer-grained control.
409 * Mixing atomic and non-atomic versions of the operations is not supported.
411 * - The bus format negotiation operations
416 * transparently for display drivers by the atomic modeset helpers. Only
419 * encoder-related operations. This feature is not supported by the legacy
422 * - The connector-related operations support implementing a &drm_connector
433 * an externally-implemented &drm_connector. Those operations are
437 * implemented, display drivers shall create a &drm_connector instance for
441 * Bridge drivers shall implement the connector-related operations for all
446 * controller of the SoC. Support for the connector-related operations on the
453 * flag will be set. Display drivers shall use the &drm_bridge.ops flags to
457 * read-only memory.
461 * connected-related bridge operations. Connector creation is then controlled
462 * by the flags argument to the drm_bridge_attach() function. Display drivers
469 * %DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is not set. New display drivers
475 * drm_bridge_chain_mode_fixup - fixup proposed mode for all bridges in the
498 encoder = bridge->encoder; in drm_bridge_chain_mode_fixup()
499 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_fixup()
500 if (!bridge->funcs->mode_fixup) in drm_bridge_chain_mode_fixup()
503 if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode)) in drm_bridge_chain_mode_fixup()
512 * drm_bridge_chain_mode_valid - validate the mode against all bridges in the
515 * @info: display info against which the mode shall be validated
537 encoder = bridge->encoder; in drm_bridge_chain_mode_valid()
538 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_valid()
541 if (!bridge->funcs->mode_valid) in drm_bridge_chain_mode_valid()
544 ret = bridge->funcs->mode_valid(bridge, info, mode); in drm_bridge_chain_mode_valid()
554 * drm_bridge_chain_mode_set - set proposed mode for all bridges in the
574 encoder = bridge->encoder; in drm_bridge_chain_mode_set()
575 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_set()
576 if (bridge->funcs->mode_set) in drm_bridge_chain_mode_set()
577 bridge->funcs->mode_set(bridge, mode, adjusted_mode); in drm_bridge_chain_mode_set()
583 * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain
603 encoder = bridge->encoder; in drm_atomic_bridge_chain_disable()
604 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_disable()
605 if (iter->funcs->atomic_disable) { in drm_atomic_bridge_chain_disable()
614 iter->funcs->atomic_disable(iter, old_bridge_state); in drm_atomic_bridge_chain_disable()
615 } else if (iter->funcs->disable) { in drm_atomic_bridge_chain_disable()
616 iter->funcs->disable(iter); in drm_atomic_bridge_chain_disable()
628 if (old_state && bridge->funcs->atomic_post_disable) { in drm_atomic_bridge_call_post_disable()
637 bridge->funcs->atomic_post_disable(bridge, in drm_atomic_bridge_call_post_disable()
639 } else if (bridge->funcs->post_disable) { in drm_atomic_bridge_call_post_disable()
640 bridge->funcs->post_disable(bridge); in drm_atomic_bridge_call_post_disable()
645 * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges
670 encoder = bridge->encoder; in drm_atomic_bridge_chain_post_disable()
672 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_post_disable()
675 if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { in drm_atomic_bridge_chain_post_disable()
678 if (next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
687 list_for_each_entry_from(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
689 if (next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
697 list_for_each_entry_from_reverse(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
720 if (old_state && bridge->funcs->atomic_pre_enable) { in drm_atomic_bridge_call_pre_enable()
729 bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); in drm_atomic_bridge_call_pre_enable()
730 } else if (bridge->funcs->pre_enable) { in drm_atomic_bridge_call_pre_enable()
731 bridge->funcs->pre_enable(bridge); in drm_atomic_bridge_call_pre_enable()
736 * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in
760 encoder = bridge->encoder; in drm_atomic_bridge_chain_pre_enable()
762 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
763 if (iter->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
767 &encoder->bridge_chain, in drm_atomic_bridge_chain_pre_enable()
772 if (!next->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
781 list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
797 if (iter->pre_enable_prev_first) in drm_atomic_bridge_chain_pre_enable()
808 * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain
827 encoder = bridge->encoder; in drm_atomic_bridge_chain_enable()
828 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_enable()
829 if (bridge->funcs->atomic_enable) { in drm_atomic_bridge_chain_enable()
838 bridge->funcs->atomic_enable(bridge, old_bridge_state); in drm_atomic_bridge_chain_enable()
839 } else if (bridge->funcs->enable) { in drm_atomic_bridge_chain_enable()
840 bridge->funcs->enable(bridge); in drm_atomic_bridge_chain_enable()
850 if (bridge->funcs->atomic_check) { in drm_atomic_bridge_check()
854 bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_check()
857 return -EINVAL; in drm_atomic_bridge_check()
859 ret = bridge->funcs->atomic_check(bridge, bridge_state, in drm_atomic_bridge_check()
863 } else if (bridge->funcs->mode_fixup) { in drm_atomic_bridge_check()
864 if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, in drm_atomic_bridge_check()
865 &crtc_state->adjusted_mode)) in drm_atomic_bridge_check()
866 return -EINVAL; in drm_atomic_bridge_check()
885 cur_state = drm_atomic_get_new_bridge_state(crtc_state->state, in select_bus_fmt_recursive()
894 if (!cur_bridge->funcs->atomic_get_input_bus_fmts) { in select_bus_fmt_recursive()
909 cur_state->input_bus_cfg.format = MEDIA_BUS_FMT_FIXED; in select_bus_fmt_recursive()
910 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
917 * If the driver implements ->atomic_get_input_bus_fmts() it in select_bus_fmt_recursive()
921 return -EINVAL; in select_bus_fmt_recursive()
923 in_bus_fmts = cur_bridge->funcs->atomic_get_input_bus_fmts(cur_bridge, in select_bus_fmt_recursive()
930 return -ENOTSUPP; in select_bus_fmt_recursive()
932 return -ENOMEM; in select_bus_fmt_recursive()
935 cur_state->input_bus_cfg.format = in_bus_fmts[0]; in select_bus_fmt_recursive()
936 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
945 if (ret != -ENOTSUPP) in select_bus_fmt_recursive()
950 cur_state->input_bus_cfg.format = in_bus_fmts[i]; in select_bus_fmt_recursive()
951 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
970 * support transcoding into a specific output format -ENOTSUPP is returned and
972 * combinations worked, -ENOTSUPP is returned and the atomic modeset will fail.
997 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_select_bus_fmts()
998 struct drm_encoder *encoder = bridge->encoder; in drm_atomic_bridge_chain_select_bus_fmts()
1005 last_bridge = list_last_entry(&encoder->bridge_chain, in drm_atomic_bridge_chain_select_bus_fmts()
1007 last_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_chain_select_bus_fmts()
1010 if (last_bridge->funcs->atomic_get_output_bus_fmts) { in drm_atomic_bridge_chain_select_bus_fmts()
1011 const struct drm_bridge_funcs *funcs = last_bridge->funcs; in drm_atomic_bridge_chain_select_bus_fmts()
1014 * If the driver implements ->atomic_get_output_bus_fmts() it in drm_atomic_bridge_chain_select_bus_fmts()
1018 return -EINVAL; in drm_atomic_bridge_chain_select_bus_fmts()
1020 out_bus_fmts = funcs->atomic_get_output_bus_fmts(last_bridge, in drm_atomic_bridge_chain_select_bus_fmts()
1026 return -ENOTSUPP; in drm_atomic_bridge_chain_select_bus_fmts()
1028 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1033 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1035 if (conn->display_info.num_bus_formats && in drm_atomic_bridge_chain_select_bus_fmts()
1036 conn->display_info.bus_formats) in drm_atomic_bridge_chain_select_bus_fmts()
1037 out_bus_fmts[0] = conn->display_info.bus_formats[0]; in drm_atomic_bridge_chain_select_bus_fmts()
1045 if (ret != -ENOTSUPP) in drm_atomic_bridge_chain_select_bus_fmts()
1082 output_flags = conn->display_info.bus_flags; in drm_atomic_bridge_propagate_bus_flags()
1091 output_flags = next_bridge_state->input_bus_cfg.flags; in drm_atomic_bridge_propagate_bus_flags()
1094 bridge_state->output_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1102 bridge_state->input_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1106 * drm_atomic_bridge_chain_check() - Do an atomic check on the bridge chain
1124 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_check()
1137 encoder = bridge->encoder; in drm_atomic_bridge_chain_check()
1138 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_check()
1149 crtc_state->state); in drm_atomic_bridge_chain_check()
1164 * drm_bridge_detect - check if anything is attached to the bridge output
1178 if (!(bridge->ops & DRM_BRIDGE_OP_DETECT)) in drm_bridge_detect()
1181 return bridge->funcs->detect(bridge); in drm_bridge_detect()
1186 * drm_bridge_get_modes - fill all modes currently valid for the sink into the
1202 if (!(bridge->ops & DRM_BRIDGE_OP_MODES)) in drm_bridge_get_modes()
1205 return bridge->funcs->get_modes(bridge, connector); in drm_bridge_get_modes()
1210 * drm_bridge_get_edid - get the EDID data of the connected display
1224 if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) in drm_bridge_get_edid()
1227 return bridge->funcs->get_edid(bridge, connector); in drm_bridge_get_edid()
1232 * drm_bridge_hpd_enable - enable hot plug detection for the bridge
1234 * @cb: hot-plug detection callback
1235 * @data: data to be passed to the hot-plug detection callback
1243 * bridge->ops. This function shall not be called when the flag is not set.
1254 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_enable()
1257 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1259 if (WARN(bridge->hpd_cb, "Hot plug detection already enabled\n")) in drm_bridge_hpd_enable()
1262 bridge->hpd_cb = cb; in drm_bridge_hpd_enable()
1263 bridge->hpd_data = data; in drm_bridge_hpd_enable()
1265 if (bridge->funcs->hpd_enable) in drm_bridge_hpd_enable()
1266 bridge->funcs->hpd_enable(bridge); in drm_bridge_hpd_enable()
1269 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1274 * drm_bridge_hpd_disable - disable hot plug detection for the bridge
1283 * bridge->ops. This function shall not be called when the flag is not set.
1287 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_disable()
1290 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1291 if (bridge->funcs->hpd_disable) in drm_bridge_hpd_disable()
1292 bridge->funcs->hpd_disable(bridge); in drm_bridge_hpd_disable()
1294 bridge->hpd_cb = NULL; in drm_bridge_hpd_disable()
1295 bridge->hpd_data = NULL; in drm_bridge_hpd_disable()
1296 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1301 * drm_bridge_hpd_notify - notify hot plug detection events
1314 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1315 if (bridge->hpd_cb) in drm_bridge_hpd_notify()
1316 bridge->hpd_cb(bridge->hpd_data, status); in drm_bridge_hpd_notify()
1317 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1323 * of_drm_find_bridge - find the bridge corresponding to the device node in
1338 if (bridge->of_node == np) { in of_drm_find_bridge()