Lines Matching +full:clock +full:- +full:detection +full:- +full:disable

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
80 * and disable (through drm_atomic_bridge_chain_disable() and
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
175 * the clock lane to be in HS mode prior to pre_enable, then it can set the
182 * The reverse also applies. The DSI host disable operation or stopping the CRTC
183 * should stop transmitting video, and the data lanes should return to the LP-11
184 * state. The DSI host &post_disable operation should disable the PHY.
190 * DSI host should initialise the interface, transmit the data, and then disable
202 * drm_bridge_add - add the given bridge to the global bridge list
208 mutex_init(&bridge->hpd_mutex); in drm_bridge_add()
211 list_add_tail(&bridge->list, &bridge_list); in drm_bridge_add()
222 * devm_drm_bridge_add - devm managed version of drm_bridge_add()
240 * drm_bridge_remove - remove the given bridge from the global bridge list
247 list_del_init(&bridge->list); in drm_bridge_remove()
250 mutex_destroy(&bridge->hpd_mutex); in drm_bridge_remove()
260 state = bridge->funcs->atomic_duplicate_state(bridge); in drm_bridge_atomic_duplicate_priv_state()
261 return state ? &state->base : NULL; in drm_bridge_atomic_duplicate_priv_state()
271 bridge->funcs->atomic_destroy_state(bridge, state); in drm_bridge_atomic_destroy_priv_state()
280 * drm_bridge_attach - attach the bridge to an encoder's chain
292 * If non-NULL the previous bridge must be already attached by a call to this
295 * Note that bridges attached to encoders are auto-detached during encoder
309 return -EINVAL; in drm_bridge_attach()
311 if (previous && (!previous->dev || previous->encoder != encoder)) in drm_bridge_attach()
312 return -EINVAL; in drm_bridge_attach()
314 if (bridge->dev) in drm_bridge_attach()
315 return -EBUSY; in drm_bridge_attach()
317 bridge->dev = encoder->dev; in drm_bridge_attach()
318 bridge->encoder = encoder; in drm_bridge_attach()
321 list_add(&bridge->chain_node, &previous->chain_node); in drm_bridge_attach()
323 list_add(&bridge->chain_node, &encoder->bridge_chain); in drm_bridge_attach()
325 if (bridge->funcs->attach) { in drm_bridge_attach()
326 ret = bridge->funcs->attach(bridge, flags); in drm_bridge_attach()
331 if (bridge->funcs->atomic_reset) { in drm_bridge_attach()
334 state = bridge->funcs->atomic_reset(bridge); in drm_bridge_attach()
340 drm_atomic_private_obj_init(bridge->dev, &bridge->base, in drm_bridge_attach()
341 &state->base, in drm_bridge_attach()
348 if (bridge->funcs->detach) in drm_bridge_attach()
349 bridge->funcs->detach(bridge); in drm_bridge_attach()
352 bridge->dev = NULL; in drm_bridge_attach()
353 bridge->encoder = NULL; in drm_bridge_attach()
354 list_del(&bridge->chain_node); in drm_bridge_attach()
356 if (ret != -EPROBE_DEFER) in drm_bridge_attach()
358 bridge->of_node, encoder->name, ret); in drm_bridge_attach()
360 dev_err_probe(encoder->dev->dev, -EPROBE_DEFER, in drm_bridge_attach()
362 bridge->of_node, encoder->name); in drm_bridge_attach()
373 if (WARN_ON(!bridge->dev)) in drm_bridge_detach()
376 if (bridge->funcs->atomic_reset) in drm_bridge_detach()
377 drm_atomic_private_obj_fini(&bridge->base); in drm_bridge_detach()
379 if (bridge->funcs->detach) in drm_bridge_detach()
380 bridge->funcs->detach(bridge); in drm_bridge_detach()
382 list_del(&bridge->chain_node); in drm_bridge_detach()
383 bridge->dev = NULL; in drm_bridge_detach()
394 * - The encoder-related operations support control of the bridges in the
398 * disable the bridge automatically.
400 * The enable and disable operations are split in
402 * &drm_bridge_funcs.disable and &drm_bridge_funcs.post_disable to provide
403 * finer-grained control.
410 * Mixing atomic and non-atomic versions of the operations is not supported.
412 * - The bus format negotiation operations
420 * encoder-related operations. This feature is not supported by the legacy
423 * - The connector-related operations support implementing a &drm_connector
434 * an externally-implemented &drm_connector. Those operations are
442 * Bridge drivers shall implement the connector-related operations for all
447 * controller of the SoC. Support for the connector-related operations on the
458 * read-only memory.
462 * connected-related bridge operations. Connector creation is then controlled
476 * drm_bridge_chain_mode_valid - validate the mode against all bridges in the
501 encoder = bridge->encoder; in drm_bridge_chain_mode_valid()
502 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_valid()
505 if (!bridge->funcs->mode_valid) in drm_bridge_chain_mode_valid()
508 ret = bridge->funcs->mode_valid(bridge, info, mode); in drm_bridge_chain_mode_valid()
518 * drm_bridge_chain_mode_set - set proposed mode for all bridges in the
538 encoder = bridge->encoder; in drm_bridge_chain_mode_set()
539 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_bridge_chain_mode_set()
540 if (bridge->funcs->mode_set) in drm_bridge_chain_mode_set()
541 bridge->funcs->mode_set(bridge, mode, adjusted_mode); in drm_bridge_chain_mode_set()
547 * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain
552 * &drm_bridge_funcs.disable) op for all the bridges in the encoder chain,
567 encoder = bridge->encoder; in drm_atomic_bridge_chain_disable()
568 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_disable()
569 if (iter->funcs->atomic_disable) { in drm_atomic_bridge_chain_disable()
578 iter->funcs->atomic_disable(iter, old_bridge_state); in drm_atomic_bridge_chain_disable()
579 } else if (iter->funcs->disable) { in drm_atomic_bridge_chain_disable()
580 iter->funcs->disable(iter); in drm_atomic_bridge_chain_disable()
592 if (old_state && bridge->funcs->atomic_post_disable) { in drm_atomic_bridge_call_post_disable()
601 bridge->funcs->atomic_post_disable(bridge, in drm_atomic_bridge_call_post_disable()
603 } else if (bridge->funcs->post_disable) { in drm_atomic_bridge_call_post_disable()
604 bridge->funcs->post_disable(bridge); in drm_atomic_bridge_call_post_disable()
609 * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges
624 * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E
641 encoder = bridge->encoder; in drm_atomic_bridge_chain_post_disable()
643 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_post_disable()
646 if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { in drm_atomic_bridge_chain_post_disable()
649 if (next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
658 list_for_each_entry_from(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
660 if (!next->pre_enable_prev_first) { in drm_atomic_bridge_chain_post_disable()
666 if (list_is_last(&next->chain_node, in drm_atomic_bridge_chain_post_disable()
667 &encoder->bridge_chain)) { in drm_atomic_bridge_chain_post_disable()
674 list_for_each_entry_from_reverse(next, &encoder->bridge_chain, in drm_atomic_bridge_chain_post_disable()
697 if (old_state && bridge->funcs->atomic_pre_enable) { in drm_atomic_bridge_call_pre_enable()
706 bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); in drm_atomic_bridge_call_pre_enable()
707 } else if (bridge->funcs->pre_enable) { in drm_atomic_bridge_call_pre_enable()
708 bridge->funcs->pre_enable(bridge); in drm_atomic_bridge_call_pre_enable()
713 * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in
727 * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E
744 encoder = bridge->encoder; in drm_atomic_bridge_chain_pre_enable()
746 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
747 if (iter->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
751 &encoder->bridge_chain, in drm_atomic_bridge_chain_pre_enable()
756 if (!next->pre_enable_prev_first) { in drm_atomic_bridge_chain_pre_enable()
765 list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_pre_enable()
781 if (iter->pre_enable_prev_first) in drm_atomic_bridge_chain_pre_enable()
792 * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain
811 encoder = bridge->encoder; in drm_atomic_bridge_chain_enable()
812 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_enable()
813 if (bridge->funcs->atomic_enable) { in drm_atomic_bridge_chain_enable()
822 bridge->funcs->atomic_enable(bridge, old_bridge_state); in drm_atomic_bridge_chain_enable()
823 } else if (bridge->funcs->enable) { in drm_atomic_bridge_chain_enable()
824 bridge->funcs->enable(bridge); in drm_atomic_bridge_chain_enable()
834 if (bridge->funcs->atomic_check) { in drm_atomic_bridge_check()
838 bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_check()
841 return -EINVAL; in drm_atomic_bridge_check()
843 ret = bridge->funcs->atomic_check(bridge, bridge_state, in drm_atomic_bridge_check()
847 } else if (bridge->funcs->mode_fixup) { in drm_atomic_bridge_check()
848 if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, in drm_atomic_bridge_check()
849 &crtc_state->adjusted_mode)) in drm_atomic_bridge_check()
850 return -EINVAL; in drm_atomic_bridge_check()
869 cur_state = drm_atomic_get_new_bridge_state(crtc_state->state, in select_bus_fmt_recursive()
878 if (!cur_bridge->funcs->atomic_get_input_bus_fmts) { in select_bus_fmt_recursive()
893 cur_state->input_bus_cfg.format = MEDIA_BUS_FMT_FIXED; in select_bus_fmt_recursive()
894 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
901 * If the driver implements ->atomic_get_input_bus_fmts() it in select_bus_fmt_recursive()
905 return -EINVAL; in select_bus_fmt_recursive()
907 in_bus_fmts = cur_bridge->funcs->atomic_get_input_bus_fmts(cur_bridge, in select_bus_fmt_recursive()
914 return -ENOTSUPP; in select_bus_fmt_recursive()
916 return -ENOMEM; in select_bus_fmt_recursive()
919 cur_state->input_bus_cfg.format = in_bus_fmts[0]; in select_bus_fmt_recursive()
920 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
929 if (ret != -ENOTSUPP) in select_bus_fmt_recursive()
934 cur_state->input_bus_cfg.format = in_bus_fmts[i]; in select_bus_fmt_recursive()
935 cur_state->output_bus_cfg.format = out_bus_fmt; in select_bus_fmt_recursive()
954 * support transcoding into a specific output format -ENOTSUPP is returned and
956 * combinations worked, -ENOTSUPP is returned and the atomic modeset will fail.
981 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_select_bus_fmts()
982 struct drm_encoder *encoder = bridge->encoder; in drm_atomic_bridge_chain_select_bus_fmts()
989 last_bridge = list_last_entry(&encoder->bridge_chain, in drm_atomic_bridge_chain_select_bus_fmts()
991 last_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in drm_atomic_bridge_chain_select_bus_fmts()
994 if (last_bridge->funcs->atomic_get_output_bus_fmts) { in drm_atomic_bridge_chain_select_bus_fmts()
995 const struct drm_bridge_funcs *funcs = last_bridge->funcs; in drm_atomic_bridge_chain_select_bus_fmts()
998 * If the driver implements ->atomic_get_output_bus_fmts() it in drm_atomic_bridge_chain_select_bus_fmts()
1002 return -EINVAL; in drm_atomic_bridge_chain_select_bus_fmts()
1004 out_bus_fmts = funcs->atomic_get_output_bus_fmts(last_bridge, in drm_atomic_bridge_chain_select_bus_fmts()
1010 return -ENOTSUPP; in drm_atomic_bridge_chain_select_bus_fmts()
1012 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1017 return -ENOMEM; in drm_atomic_bridge_chain_select_bus_fmts()
1019 if (conn->display_info.num_bus_formats && in drm_atomic_bridge_chain_select_bus_fmts()
1020 conn->display_info.bus_formats) in drm_atomic_bridge_chain_select_bus_fmts()
1021 out_bus_fmts[0] = conn->display_info.bus_formats[0]; in drm_atomic_bridge_chain_select_bus_fmts()
1029 if (ret != -ENOTSUPP) in drm_atomic_bridge_chain_select_bus_fmts()
1066 output_flags = conn->display_info.bus_flags; in drm_atomic_bridge_propagate_bus_flags()
1075 output_flags = next_bridge_state->input_bus_cfg.flags; in drm_atomic_bridge_propagate_bus_flags()
1078 bridge_state->output_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1086 bridge_state->input_bus_cfg.flags = output_flags; in drm_atomic_bridge_propagate_bus_flags()
1090 * drm_atomic_bridge_chain_check() - Do an atomic check on the bridge chain
1108 struct drm_connector *conn = conn_state->connector; in drm_atomic_bridge_chain_check()
1121 encoder = bridge->encoder; in drm_atomic_bridge_chain_check()
1122 list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { in drm_atomic_bridge_chain_check()
1133 crtc_state->state); in drm_atomic_bridge_chain_check()
1148 * drm_bridge_detect - check if anything is attached to the bridge output
1151 * If the bridge supports output detection, as reported by the
1157 * The detection status on success, or connector_status_unknown if the bridge
1158 * doesn't support output detection.
1162 if (!(bridge->ops & DRM_BRIDGE_OP_DETECT)) in drm_bridge_detect()
1165 return bridge->funcs->detect(bridge); in drm_bridge_detect()
1170 * drm_bridge_get_modes - fill all modes currently valid for the sink into the
1186 if (!(bridge->ops & DRM_BRIDGE_OP_MODES)) in drm_bridge_get_modes()
1189 return bridge->funcs->get_modes(bridge, connector); in drm_bridge_get_modes()
1194 * drm_bridge_edid_read - read the EDID data of the connected display
1208 if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) in drm_bridge_edid_read()
1211 return bridge->funcs->edid_read(bridge, connector); in drm_bridge_edid_read()
1216 * drm_bridge_hpd_enable - enable hot plug detection for the bridge
1218 * @cb: hot-plug detection callback
1219 * @data: data to be passed to the hot-plug detection callback
1226 * Hot plug detection is supported only if the DRM_BRIDGE_OP_HPD flag is set in
1227 * bridge->ops. This function shall not be called when the flag is not set.
1229 * Only one hot plug detection callback can be registered at a time, it is an
1230 * error to call this function when hot plug detection is already enabled for
1238 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_enable()
1241 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1243 if (WARN(bridge->hpd_cb, "Hot plug detection already enabled\n")) in drm_bridge_hpd_enable()
1246 bridge->hpd_cb = cb; in drm_bridge_hpd_enable()
1247 bridge->hpd_data = data; in drm_bridge_hpd_enable()
1249 if (bridge->funcs->hpd_enable) in drm_bridge_hpd_enable()
1250 bridge->funcs->hpd_enable(bridge); in drm_bridge_hpd_enable()
1253 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_enable()
1258 * drm_bridge_hpd_disable - disable hot plug detection for the bridge
1262 * plug detection callback previously registered with drm_bridge_hpd_enable().
1266 * Hot plug detection is supported only if the DRM_BRIDGE_OP_HPD flag is set in
1267 * bridge->ops. This function shall not be called when the flag is not set.
1271 if (!(bridge->ops & DRM_BRIDGE_OP_HPD)) in drm_bridge_hpd_disable()
1274 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1275 if (bridge->funcs->hpd_disable) in drm_bridge_hpd_disable()
1276 bridge->funcs->hpd_disable(bridge); in drm_bridge_hpd_disable()
1278 bridge->hpd_cb = NULL; in drm_bridge_hpd_disable()
1279 bridge->hpd_data = NULL; in drm_bridge_hpd_disable()
1280 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_disable()
1285 * drm_bridge_hpd_notify - notify hot plug detection events
1290 * detect a change in the output status, when hot plug detection has been
1298 mutex_lock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1299 if (bridge->hpd_cb) in drm_bridge_hpd_notify()
1300 bridge->hpd_cb(bridge->hpd_data, status); in drm_bridge_hpd_notify()
1301 mutex_unlock(&bridge->hpd_mutex); in drm_bridge_hpd_notify()
1307 * of_drm_find_bridge - find the bridge corresponding to the device node in
1322 if (bridge->of_node == np) { in of_drm_find_bridge()