2 * Copyright (c) 2016 Intel Corporation
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #ifndef __DRM_BRIDGE_H__
24 #define __DRM_BRIDGE_H__
26 #include <linux/list.h>
27 #include <linux/ctype.h>
29 #include <drm/drm_atomic.h>
30 #include <drm/drm_encoder.h>
31 #include <drm/drm_mode_object.h>
32 #include <drm/drm_modes.h>
35 struct drm_bridge_timings;
39 * struct drm_bus_cfg - bus configuration
41 * This structure stores the configuration of a physical bus between two
42 * components in an output pipeline, usually between two bridges, an encoder
43 * and a bridge, or a bridge and a connector.
45 * The bus configuration is stored in &drm_bridge_state separately for the
46 * input and output buses, as seen from the point of view of each bridge. The
47 * bus configuration of a bridge output is usually identical to the
48 * configuration of the next bridge's input, but may differ if the signals are
49 * modified between the two bridges, for instance by an inverter on the board.
50 * The input and output configurations of a bridge may differ if the bridge
51 * modifies the signals internally, for instance by performing format
52 * conversion, or modifying signals polarities.
56 * @format: format used on this bus (one of the MEDIA_BUS_FMT_* format)
58 * This field should not be directly modified by drivers
59 * (&drm_atomic_bridge_chain_select_bus_fmts() takes care of the bus
60 * format negotiation).
65 * @flags: DRM_BUS_* flags used on this bus
71 * struct drm_bridge_state - Atomic bridge state object
72 * @base: inherit from &drm_private_state
73 * @bridge: the bridge this state refers to
75 struct drm_bridge_state {
76 struct drm_private_state base;
78 struct drm_bridge *bridge;
81 * @input_bus_cfg: input bus configuration
83 struct drm_bus_cfg input_bus_cfg;
86 * @output_bus_cfg: input bus configuration
88 struct drm_bus_cfg output_bus_cfg;
91 static inline struct drm_bridge_state *
92 drm_priv_to_bridge_state(struct drm_private_state *priv)
94 return container_of(priv, struct drm_bridge_state, base);
98 * struct drm_bridge_funcs - drm_bridge control functions
100 struct drm_bridge_funcs {
104 * This callback is invoked whenever our bridge is being attached to a
107 * The @attach callback is optional.
111 * Zero on success, error code on failure.
113 int (*attach)(struct drm_bridge *bridge);
118 * This callback is invoked whenever our bridge is being detached from a
121 * The @detach callback is optional.
123 void (*detach)(struct drm_bridge *bridge);
128 * This callback is used to check if a specific mode is valid in this
129 * bridge. This should be implemented if the bridge has some sort of
130 * restriction in the modes it can display. For example, a given bridge
131 * may be responsible to set a clock value. If the clock can not
132 * produce all the values for the available modes then this callback
133 * can be used to restrict the number of modes to only the ones that
136 * This hook is used by the probe helpers to filter the mode list in
137 * drm_helper_probe_single_connector_modes(), and it is used by the
138 * atomic helpers to validate modes supplied by userspace in
139 * drm_atomic_helper_check_modeset().
141 * The @mode_valid callback is optional.
145 * Since this function is both called from the check phase of an atomic
146 * commit, and the mode validation in the probe paths it is not allowed
147 * to look at anything else but the passed-in mode, and validate it
148 * against configuration-invariant hardward constraints. Any further
149 * limits which depend upon the configuration can only be checked in
154 * drm_mode_status Enum
156 enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge,
157 const struct drm_display_mode *mode);
162 * This callback is used to validate and adjust a mode. The parameter
163 * mode is the display mode that should be fed to the next element in
164 * the display chain, either the final &drm_connector or the next
165 * &drm_bridge. The parameter adjusted_mode is the input mode the bridge
166 * requires. It can be modified by this callback and does not need to
167 * match mode. See also &drm_crtc_state.adjusted_mode for more details.
169 * This is the only hook that allows a bridge to reject a modeset. If
170 * this function passes all other callbacks must succeed for this
173 * The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup()
174 * is not called when &drm_bridge_funcs.atomic_check() is implemented,
175 * so only one of them should be provided.
179 * This function is called in the check phase of atomic modesets, which
180 * can be aborted for any reason (including on userspace's request to
181 * just check whether a configuration would be possible). Drivers MUST
182 * NOT touch any persistent state (hardware or software) or data
183 * structures except the passed in @state parameter.
185 * Also beware that userspace can request its own custom modes, neither
186 * core nor helpers filter modes to the list of probe modes reported by
187 * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure
188 * that modes are filtered consistently put any bridge constraints and
189 * limits checks into @mode_valid.
193 * True if an acceptable configuration is possible, false if the modeset
194 * operation should be rejected.
196 bool (*mode_fixup)(struct drm_bridge *bridge,
197 const struct drm_display_mode *mode,
198 struct drm_display_mode *adjusted_mode);
202 * This callback should disable the bridge. It is called right before
203 * the preceding element in the display pipe is disabled. If the
204 * preceding element is a bridge this means it's called before that
205 * bridge's @disable vfunc. If the preceding element is a &drm_encoder
206 * it's called right before the &drm_encoder_helper_funcs.disable,
207 * &drm_encoder_helper_funcs.prepare or &drm_encoder_helper_funcs.dpms
210 * The bridge can assume that the display pipe (i.e. clocks and timing
211 * signals) feeding it is still running when this callback is called.
213 * The @disable callback is optional.
215 void (*disable)(struct drm_bridge *bridge);
220 * This callback should disable the bridge. It is called right after the
221 * preceding element in the display pipe is disabled. If the preceding
222 * element is a bridge this means it's called after that bridge's
223 * @post_disable function. If the preceding element is a &drm_encoder
224 * it's called right after the encoder's
225 * &drm_encoder_helper_funcs.disable, &drm_encoder_helper_funcs.prepare
226 * or &drm_encoder_helper_funcs.dpms hook.
228 * The bridge must assume that the display pipe (i.e. clocks and timing
229 * singals) feeding it is no longer running when this callback is
232 * The @post_disable callback is optional.
234 void (*post_disable)(struct drm_bridge *bridge);
239 * This callback should set the given mode on the bridge. It is called
240 * after the @mode_set callback for the preceding element in the display
241 * pipeline has been called already. If the bridge is the first element
242 * then this would be &drm_encoder_helper_funcs.mode_set. The display
243 * pipe (i.e. clocks and timing signals) is off when this function is
246 * The adjusted_mode parameter is the mode output by the CRTC for the
247 * first bridge in the chain. It can be different from the mode
248 * parameter that contains the desired mode for the connector at the end
249 * of the bridges chain, for instance when the first bridge in the chain
250 * performs scaling. The adjusted mode is mostly useful for the first
251 * bridge in the chain and is likely irrelevant for the other bridges.
253 * For atomic drivers the adjusted_mode is the mode stored in
254 * &drm_crtc_state.adjusted_mode.
258 * If a need arises to store and access modes adjusted for other
259 * locations than the connection between the CRTC and the first bridge,
260 * the DRM framework will have to be extended with DRM bridge states.
262 void (*mode_set)(struct drm_bridge *bridge,
263 const struct drm_display_mode *mode,
264 const struct drm_display_mode *adjusted_mode);
268 * This callback should enable the bridge. It is called right before
269 * the preceding element in the display pipe is enabled. If the
270 * preceding element is a bridge this means it's called before that
271 * bridge's @pre_enable function. If the preceding element is a
272 * &drm_encoder it's called right before the encoder's
273 * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or
274 * &drm_encoder_helper_funcs.dpms hook.
276 * The display pipe (i.e. clocks and timing signals) feeding this bridge
277 * will not yet be running when this callback is called. The bridge must
278 * not enable the display link feeding the next bridge in the chain (if
279 * there is one) when this callback is called.
281 * The @pre_enable callback is optional.
283 void (*pre_enable)(struct drm_bridge *bridge);
288 * This callback should enable the bridge. It is called right after
289 * the preceding element in the display pipe is enabled. If the
290 * preceding element is a bridge this means it's called after that
291 * bridge's @enable function. If the preceding element is a
292 * &drm_encoder it's called right after the encoder's
293 * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or
294 * &drm_encoder_helper_funcs.dpms hook.
296 * The bridge can assume that the display pipe (i.e. clocks and timing
297 * signals) feeding it is running when this callback is called. This
298 * callback must enable the display link feeding the next bridge in the
299 * chain if there is one.
301 * The @enable callback is optional.
303 void (*enable)(struct drm_bridge *bridge);
306 * @atomic_pre_enable:
308 * This callback should enable the bridge. It is called right before
309 * the preceding element in the display pipe is enabled. If the
310 * preceding element is a bridge this means it's called before that
311 * bridge's @atomic_pre_enable or @pre_enable function. If the preceding
312 * element is a &drm_encoder it's called right before the encoder's
313 * &drm_encoder_helper_funcs.atomic_enable hook.
315 * The display pipe (i.e. clocks and timing signals) feeding this bridge
316 * will not yet be running when this callback is called. The bridge must
317 * not enable the display link feeding the next bridge in the chain (if
318 * there is one) when this callback is called.
320 * Note that this function will only be invoked in the context of an
321 * atomic commit. It will not be invoked from
322 * &drm_bridge_chain_pre_enable. It would be prudent to also provide an
323 * implementation of @pre_enable if you are expecting driver calls into
324 * &drm_bridge_chain_pre_enable.
326 * The @atomic_pre_enable callback is optional.
328 void (*atomic_pre_enable)(struct drm_bridge *bridge,
329 struct drm_bridge_state *old_bridge_state);
334 * This callback should enable the bridge. It is called right after
335 * the preceding element in the display pipe is enabled. If the
336 * preceding element is a bridge this means it's called after that
337 * bridge's @atomic_enable or @enable function. If the preceding element
338 * is a &drm_encoder it's called right after the encoder's
339 * &drm_encoder_helper_funcs.atomic_enable hook.
341 * The bridge can assume that the display pipe (i.e. clocks and timing
342 * signals) feeding it is running when this callback is called. This
343 * callback must enable the display link feeding the next bridge in the
344 * chain if there is one.
346 * Note that this function will only be invoked in the context of an
347 * atomic commit. It will not be invoked from &drm_bridge_chain_enable.
348 * It would be prudent to also provide an implementation of @enable if
349 * you are expecting driver calls into &drm_bridge_chain_enable.
351 * The @atomic_enable callback is optional.
353 void (*atomic_enable)(struct drm_bridge *bridge,
354 struct drm_bridge_state *old_bridge_state);
358 * This callback should disable the bridge. It is called right before
359 * the preceding element in the display pipe is disabled. If the
360 * preceding element is a bridge this means it's called before that
361 * bridge's @atomic_disable or @disable vfunc. If the preceding element
362 * is a &drm_encoder it's called right before the
363 * &drm_encoder_helper_funcs.atomic_disable hook.
365 * The bridge can assume that the display pipe (i.e. clocks and timing
366 * signals) feeding it is still running when this callback is called.
368 * Note that this function will only be invoked in the context of an
369 * atomic commit. It will not be invoked from
370 * &drm_bridge_chain_disable. It would be prudent to also provide an
371 * implementation of @disable if you are expecting driver calls into
372 * &drm_bridge_chain_disable.
374 * The @atomic_disable callback is optional.
376 void (*atomic_disable)(struct drm_bridge *bridge,
377 struct drm_bridge_state *old_bridge_state);
380 * @atomic_post_disable:
382 * This callback should disable the bridge. It is called right after the
383 * preceding element in the display pipe is disabled. If the preceding
384 * element is a bridge this means it's called after that bridge's
385 * @atomic_post_disable or @post_disable function. If the preceding
386 * element is a &drm_encoder it's called right after the encoder's
387 * &drm_encoder_helper_funcs.atomic_disable hook.
389 * The bridge must assume that the display pipe (i.e. clocks and timing
390 * signals) feeding it is no longer running when this callback is
393 * Note that this function will only be invoked in the context of an
394 * atomic commit. It will not be invoked from
395 * &drm_bridge_chain_post_disable.
396 * It would be prudent to also provide an implementation of
397 * @post_disable if you are expecting driver calls into
398 * &drm_bridge_chain_post_disable.
400 * The @atomic_post_disable callback is optional.
402 void (*atomic_post_disable)(struct drm_bridge *bridge,
403 struct drm_bridge_state *old_bridge_state);
406 * @atomic_duplicate_state:
408 * Duplicate the current bridge state object (which is guaranteed to be
411 * The atomic_duplicate_state() is optional. When not implemented the
412 * core allocates a drm_bridge_state object and calls
413 * &__drm_atomic_helper_bridge_duplicate_state() to initialize it.
416 * A valid drm_bridge_state object or NULL if the allocation fails.
418 struct drm_bridge_state *(*atomic_duplicate_state)(struct drm_bridge *bridge);
421 * @atomic_destroy_state:
423 * Destroy a bridge state object previously allocated by
424 * &drm_bridge_funcs.atomic_duplicate_state().
426 * The atomic_destroy_state hook is optional. When not implemented the
427 * core calls kfree() on the state.
429 void (*atomic_destroy_state)(struct drm_bridge *bridge,
430 struct drm_bridge_state *state);
433 * @atomic_get_output_bus_fmts:
435 * Return the supported bus formats on the output end of a bridge.
436 * The returned array must be allocated with kmalloc() and will be
437 * freed by the caller. If the allocation fails, NULL should be
438 * returned. num_output_fmts must be set to the returned array size.
439 * Formats listed in the returned array should be listed in decreasing
440 * preference order (the core will try all formats until it finds one
443 * This method is only called on the last element of the bridge chain
444 * as part of the bus format negotiation process that happens in
445 * &drm_atomic_bridge_chain_select_bus_fmts().
446 * This method is optional. When not implemented, the core will
447 * fall back to &drm_connector.display_info.bus_formats[0] if
448 * &drm_connector.display_info.num_bus_formats > 0,
449 * or to MEDIA_BUS_FMT_FIXED otherwise.
451 u32 *(*atomic_get_output_bus_fmts)(struct drm_bridge *bridge,
452 struct drm_bridge_state *bridge_state,
453 struct drm_crtc_state *crtc_state,
454 struct drm_connector_state *conn_state,
455 unsigned int *num_output_fmts);
458 * @atomic_get_input_bus_fmts:
460 * Return the supported bus formats on the input end of a bridge for
461 * a specific output bus format.
463 * The returned array must be allocated with kmalloc() and will be
464 * freed by the caller. If the allocation fails, NULL should be
465 * returned. num_output_fmts must be set to the returned array size.
466 * Formats listed in the returned array should be listed in decreasing
467 * preference order (the core will try all formats until it finds one
468 * that works). When the format is not supported NULL should be
469 * returned and *num_output_fmts should be set to 0.
471 * This method is called on all elements of the bridge chain as part of
472 * the bus format negotiation process that happens in
473 * &drm_atomic_bridge_chain_select_bus_fmts().
474 * This method is optional. When not implemented, the core will bypass
475 * bus format negotiation on this element of the bridge without
476 * failing, and the previous element in the chain will be passed
477 * MEDIA_BUS_FMT_FIXED as its output bus format.
479 * Bridge drivers that need to support being linked to bridges that are
480 * not supporting bus format negotiation should handle the
481 * output_fmt == MEDIA_BUS_FMT_FIXED case appropriately, by selecting a
482 * sensible default value or extracting this information from somewhere
483 * else (FW property, &drm_display_mode, &drm_display_info, ...)
485 * Note: Even if input format selection on the first bridge has no
486 * impact on the negotiation process (bus format negotiation stops once
487 * we reach the first element of the chain), drivers are expected to
488 * return accurate input formats as the input format may be used to
489 * configure the CRTC output appropriately.
491 u32 *(*atomic_get_input_bus_fmts)(struct drm_bridge *bridge,
492 struct drm_bridge_state *bridge_state,
493 struct drm_crtc_state *crtc_state,
494 struct drm_connector_state *conn_state,
496 unsigned int *num_input_fmts);
501 * This method is responsible for checking bridge state correctness.
502 * It can also check the state of the surrounding components in chain
503 * to make sure the whole pipeline can work properly.
505 * &drm_bridge_funcs.atomic_check() hooks are called in reverse
506 * order (from the last to the first bridge).
508 * This method is optional. &drm_bridge_funcs.mode_fixup() is not
509 * called when &drm_bridge_funcs.atomic_check() is implemented, so only
510 * one of them should be provided.
512 * If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or
513 * &drm_bridge_state.output_bus_cfg.flags it should should happen in
514 * this function. By default the &drm_bridge_state.output_bus_cfg.flags
515 * field is set to the next bridge
516 * &drm_bridge_state.input_bus_cfg.flags value or
517 * &drm_connector.display_info.bus_flags if the bridge is the last
518 * element in the chain.
521 * zero if the check passed, a negative error code otherwise.
523 int (*atomic_check)(struct drm_bridge *bridge,
524 struct drm_bridge_state *bridge_state,
525 struct drm_crtc_state *crtc_state,
526 struct drm_connector_state *conn_state);
531 * Reset the bridge to a predefined state (or retrieve its current
532 * state) and return a &drm_bridge_state object matching this state.
533 * This function is called at attach time.
535 * The atomic_reset hook is optional. When not implemented the core
536 * allocates a new state and calls &__drm_atomic_helper_bridge_reset().
539 * A valid drm_bridge_state object in case of success, an ERR_PTR()
540 * giving the reason of the failure otherwise.
542 struct drm_bridge_state *(*atomic_reset)(struct drm_bridge *bridge);
546 * struct drm_bridge_timings - timing information for the bridge
548 struct drm_bridge_timings {
552 * Tells what additional settings for the pixel data on the bus
553 * this bridge requires (like pixel signal polarity). See also
554 * &drm_display_info->bus_flags.
560 * Defines the time in picoseconds the input data lines must be
561 * stable before the clock edge.
567 * Defines the time in picoseconds taken for the bridge to sample the
568 * input signal after the clock edge.
574 * True if the bus operates in dual-link mode. The exact meaning is
575 * dependent on the bus type. For LVDS buses, this indicates that even-
576 * and odd-numbered pixels are received on separate links.
582 * struct drm_bridge - central DRM bridge control structure
585 /** @base: inherit from &drm_private_object */
586 struct drm_private_obj base;
587 /** @dev: DRM device this bridge belongs to */
588 struct drm_device *dev;
589 /** @encoder: encoder to which this bridge is connected */
590 struct drm_encoder *encoder;
591 /** @chain_node: used to form a bridge chain */
592 struct list_head chain_node;
594 /** @of_node: device node pointer to the bridge */
595 struct device_node *of_node;
597 /** @list: to keep track of all added bridges */
598 struct list_head list;
602 * the timing specification for the bridge, if any (may be NULL)
604 const struct drm_bridge_timings *timings;
605 /** @funcs: control functions */
606 const struct drm_bridge_funcs *funcs;
607 /** @driver_private: pointer to the bridge driver's internal context */
608 void *driver_private;
611 static inline struct drm_bridge *
612 drm_priv_to_bridge(struct drm_private_obj *priv)
614 return container_of(priv, struct drm_bridge, base);
617 void drm_bridge_add(struct drm_bridge *bridge);
618 void drm_bridge_remove(struct drm_bridge *bridge);
619 struct drm_bridge *of_drm_find_bridge(struct device_node *np);
620 int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
621 struct drm_bridge *previous);
624 * drm_bridge_get_next_bridge() - Get the next bridge in the chain
625 * @bridge: bridge object
628 * the next bridge in the chain after @bridge, or NULL if @bridge is the last.
630 static inline struct drm_bridge *
631 drm_bridge_get_next_bridge(struct drm_bridge *bridge)
633 if (list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain))
636 return list_next_entry(bridge, chain_node);
640 * drm_bridge_get_prev_bridge() - Get the previous bridge in the chain
641 * @bridge: bridge object
644 * the previous bridge in the chain, or NULL if @bridge is the first.
646 static inline struct drm_bridge *
647 drm_bridge_get_prev_bridge(struct drm_bridge *bridge)
649 if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
652 return list_prev_entry(bridge, chain_node);
656 * drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain
657 * @encoder: encoder object
660 * the first bridge in the chain, or NULL if @encoder has no bridge attached
663 static inline struct drm_bridge *
664 drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)
666 return list_first_entry_or_null(&encoder->bridge_chain,
667 struct drm_bridge, chain_node);
671 * drm_for_each_bridge_in_chain() - Iterate over all bridges present in a chain
672 * @encoder: the encoder to iterate bridges on
673 * @bridge: a bridge pointer updated to point to the current bridge at each
676 * Iterate over all bridges present in the bridge chain attached to @encoder.
678 #define drm_for_each_bridge_in_chain(encoder, bridge) \
679 list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)
681 bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
682 const struct drm_display_mode *mode,
683 struct drm_display_mode *adjusted_mode);
685 drm_bridge_chain_mode_valid(struct drm_bridge *bridge,
686 const struct drm_display_mode *mode);
687 void drm_bridge_chain_disable(struct drm_bridge *bridge);
688 void drm_bridge_chain_post_disable(struct drm_bridge *bridge);
689 void drm_bridge_chain_mode_set(struct drm_bridge *bridge,
690 const struct drm_display_mode *mode,
691 const struct drm_display_mode *adjusted_mode);
692 void drm_bridge_chain_pre_enable(struct drm_bridge *bridge);
693 void drm_bridge_chain_enable(struct drm_bridge *bridge);
695 int drm_atomic_bridge_chain_check(struct drm_bridge *bridge,
696 struct drm_crtc_state *crtc_state,
697 struct drm_connector_state *conn_state);
698 void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,
699 struct drm_atomic_state *state);
700 void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
701 struct drm_atomic_state *state);
702 void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
703 struct drm_atomic_state *state);
704 void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
705 struct drm_atomic_state *state);
708 drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge,
709 struct drm_bridge_state *bridge_state,
710 struct drm_crtc_state *crtc_state,
711 struct drm_connector_state *conn_state,
713 unsigned int *num_input_fmts);
715 void __drm_atomic_helper_bridge_reset(struct drm_bridge *bridge,
716 struct drm_bridge_state *state);
717 void __drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge,
718 struct drm_bridge_state *new);
720 static inline struct drm_bridge_state *
721 drm_atomic_get_bridge_state(struct drm_atomic_state *state,
722 struct drm_bridge *bridge)
724 struct drm_private_state *obj_state;
726 obj_state = drm_atomic_get_private_obj_state(state, &bridge->base);
727 if (IS_ERR(obj_state))
728 return ERR_CAST(obj_state);
730 return drm_priv_to_bridge_state(obj_state);
733 static inline struct drm_bridge_state *
734 drm_atomic_get_old_bridge_state(struct drm_atomic_state *state,
735 struct drm_bridge *bridge)
737 struct drm_private_state *obj_state;
739 obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base);
743 return drm_priv_to_bridge_state(obj_state);
746 static inline struct drm_bridge_state *
747 drm_atomic_get_new_bridge_state(struct drm_atomic_state *state,
748 struct drm_bridge *bridge)
750 struct drm_private_state *obj_state;
752 obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base);
756 return drm_priv_to_bridge_state(obj_state);
759 #ifdef CONFIG_DRM_PANEL_BRIDGE
760 struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel);
761 struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel,
763 void drm_panel_bridge_remove(struct drm_bridge *bridge);
764 struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
765 struct drm_panel *panel);
766 struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
767 struct drm_panel *panel,
769 struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);