Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (c) 2016 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Permission to use, copy, modify, distribute, and sell this software and its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * documentation for any purpose is hereby granted without fee, provided that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * the above copyright notice appear in all copies and that both that copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * notice and this permission notice appear in supporting documentation, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * that the name of the copyright holders not be used in advertising or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * publicity pertaining to distribution of the software without specific,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * written prior permission.  The copyright holders make no representations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * about the suitability of this software for any purpose.  It is provided "as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * is" without express or implied warranty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * OF THIS SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #ifndef __DRM_BRIDGE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define __DRM_BRIDGE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/ctype.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <drm/drm_atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <drm/drm_encoder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <drm/drm_mode_object.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <drm/drm_modes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) struct drm_bridge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) struct drm_bridge_timings;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct drm_connector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct drm_display_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) struct drm_panel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) struct edid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) struct i2c_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * enum drm_bridge_attach_flags - Flags for &drm_bridge_funcs.attach
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) enum drm_bridge_attach_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	 * @DRM_BRIDGE_ATTACH_NO_CONNECTOR: When this flag is set the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	 * shall not create a drm_connector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	DRM_BRIDGE_ATTACH_NO_CONNECTOR = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * struct drm_bridge_funcs - drm_bridge control functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) struct drm_bridge_funcs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	 * @attach:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	 * This callback is invoked whenever our bridge is being attached to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	 * &drm_encoder. The flags argument tunes the behaviour of the attach
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	 * operation (see DRM_BRIDGE_ATTACH_*).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	 * The @attach callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	 * Zero on success, error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	int (*attach)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		      enum drm_bridge_attach_flags flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	 * @detach:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	 * This callback is invoked whenever our bridge is being detached from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	 * &drm_encoder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	 * The @detach callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	void (*detach)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	 * @mode_valid:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	 * This callback is used to check if a specific mode is valid in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	 * bridge. This should be implemented if the bridge has some sort of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	 * restriction in the modes it can display. For example, a given bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	 * may be responsible to set a clock value. If the clock can not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	 * produce all the values for the available modes then this callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	 * can be used to restrict the number of modes to only the ones that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	 * can be displayed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 * This hook is used by the probe helpers to filter the mode list in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	 * drm_helper_probe_single_connector_modes(), and it is used by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 * atomic helpers to validate modes supplied by userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 * drm_atomic_helper_check_modeset().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	 * The @mode_valid callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * Since this function is both called from the check phase of an atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 * commit, and the mode validation in the probe paths it is not allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	 * to look at anything else but the passed-in mode, and validate it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	 * against configuration-invariant hardward constraints. Any further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	 * limits which depend upon the configuration can only be checked in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 * @mode_fixup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * drm_mode_status Enum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 					   const struct drm_display_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 					   const struct drm_display_mode *mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	 * @mode_fixup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * This callback is used to validate and adjust a mode. The parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 * mode is the display mode that should be fed to the next element in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 * the display chain, either the final &drm_connector or the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 * &drm_bridge. The parameter adjusted_mode is the input mode the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 * requires. It can be modified by this callback and does not need to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	 * match mode. See also &drm_crtc_state.adjusted_mode for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	 * This is the only hook that allows a bridge to reject a modeset. If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	 * this function passes all other callbacks must succeed for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	 * configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	 * The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 * is not called when &drm_bridge_funcs.atomic_check() is implemented,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	 * so only one of them should be provided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	 * This function is called in the check phase of atomic modesets, which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * can be aborted for any reason (including on userspace's request to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 * just check whether a configuration would be possible). Drivers MUST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	 * NOT touch any persistent state (hardware or software) or data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	 * structures except the passed in @state parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 * Also beware that userspace can request its own custom modes, neither
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * core nor helpers filter modes to the list of probe modes reported by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 * that modes are filtered consistently put any bridge constraints and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	 * limits checks into @mode_valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	 * True if an acceptable configuration is possible, false if the modeset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	 * operation should be rejected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	bool (*mode_fixup)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			   const struct drm_display_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			   struct drm_display_mode *adjusted_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	 * @disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 * This callback should disable the bridge. It is called right before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 * the preceding element in the display pipe is disabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 * preceding element is a bridge this means it's called before that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 * bridge's @disable vfunc. If the preceding element is a &drm_encoder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 * it's called right before the &drm_encoder_helper_funcs.disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	 * &drm_encoder_helper_funcs.prepare or &drm_encoder_helper_funcs.dpms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	 * hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	 * The bridge can assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	 * signals) feeding it is still running when this callback is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 * The @disable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	void (*disable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	 * @post_disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 * This callback should disable the bridge. It is called right after the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 * preceding element in the display pipe is disabled. If the preceding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * element is a bridge this means it's called after that bridge's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 * @post_disable function. If the preceding element is a &drm_encoder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	 * it's called right after the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 * &drm_encoder_helper_funcs.disable, &drm_encoder_helper_funcs.prepare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	 * or &drm_encoder_helper_funcs.dpms hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	 * The bridge must assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	 * singals) feeding it is no longer running when this callback is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	 * called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	 * The @post_disable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	void (*post_disable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * @mode_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	 * This callback should set the given mode on the bridge. It is called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	 * after the @mode_set callback for the preceding element in the display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	 * pipeline has been called already. If the bridge is the first element
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	 * pipe (i.e.  clocks and timing signals) is off when this function is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	 * The adjusted_mode parameter is the mode output by the CRTC for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	 * first bridge in the chain. It can be different from the mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	 * parameter that contains the desired mode for the connector at the end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	 * of the bridges chain, for instance when the first bridge in the chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	 * performs scaling. The adjusted mode is mostly useful for the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	 * bridge in the chain and is likely irrelevant for the other bridges.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	 * For atomic drivers the adjusted_mode is the mode stored in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 * &drm_crtc_state.adjusted_mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	 * If a need arises to store and access modes adjusted for other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	 * locations than the connection between the CRTC and the first bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	 * the DRM framework will have to be extended with DRM bridge states.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	void (*mode_set)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 			 const struct drm_display_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 			 const struct drm_display_mode *adjusted_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	 * @pre_enable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	 * This callback should enable the bridge. It is called right before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	 * the preceding element in the display pipe is enabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	 * preceding element is a bridge this means it's called before that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	 * bridge's @pre_enable function. If the preceding element is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	 * &drm_encoder it's called right before the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	 * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	 * &drm_encoder_helper_funcs.dpms hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	 * The display pipe (i.e. clocks and timing signals) feeding this bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	 * will not yet be running when this callback is called. The bridge must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	 * not enable the display link feeding the next bridge in the chain (if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	 * there is one) when this callback is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	 * The @pre_enable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	void (*pre_enable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	 * @enable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	 * This callback should enable the bridge. It is called right after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	 * the preceding element in the display pipe is enabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	 * preceding element is a bridge this means it's called after that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	 * bridge's @enable function. If the preceding element is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	 * &drm_encoder it's called right after the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	 * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	 * &drm_encoder_helper_funcs.dpms hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	 * The bridge can assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	 * signals) feeding it is running when this callback is called. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	 * callback must enable the display link feeding the next bridge in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	 * chain if there is one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	 * The @enable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	void (*enable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	 * @atomic_pre_enable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	 * This callback should enable the bridge. It is called right before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	 * the preceding element in the display pipe is enabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	 * preceding element is a bridge this means it's called before that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	 * bridge's @atomic_pre_enable or @pre_enable function. If the preceding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	 * element is a &drm_encoder it's called right before the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	 * &drm_encoder_helper_funcs.atomic_enable hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	 * The display pipe (i.e. clocks and timing signals) feeding this bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	 * will not yet be running when this callback is called. The bridge must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	 * not enable the display link feeding the next bridge in the chain (if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	 * there is one) when this callback is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	 * Note that this function will only be invoked in the context of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	 * atomic commit. It will not be invoked from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	 * &drm_bridge_chain_pre_enable. It would be prudent to also provide an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	 * implementation of @pre_enable if you are expecting driver calls into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	 * &drm_bridge_chain_pre_enable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	 * The @atomic_pre_enable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	void (*atomic_pre_enable)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 				  struct drm_bridge_state *old_bridge_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	 * @atomic_enable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	 * This callback should enable the bridge. It is called right after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	 * the preceding element in the display pipe is enabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	 * preceding element is a bridge this means it's called after that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	 * bridge's @atomic_enable or @enable function. If the preceding element
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	 * is a &drm_encoder it's called right after the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	 * &drm_encoder_helper_funcs.atomic_enable hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	 * The bridge can assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	 * signals) feeding it is running when this callback is called. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	 * callback must enable the display link feeding the next bridge in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	 * chain if there is one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	 * Note that this function will only be invoked in the context of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	 * atomic commit. It will not be invoked from &drm_bridge_chain_enable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	 * It would be prudent to also provide an implementation of @enable if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	 * you are expecting driver calls into &drm_bridge_chain_enable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	 * The @atomic_enable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	void (*atomic_enable)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 			      struct drm_bridge_state *old_bridge_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	 * @atomic_disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	 * This callback should disable the bridge. It is called right before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	 * the preceding element in the display pipe is disabled. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	 * preceding element is a bridge this means it's called before that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	 * bridge's @atomic_disable or @disable vfunc. If the preceding element
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	 * is a &drm_encoder it's called right before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	 * &drm_encoder_helper_funcs.atomic_disable hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	 * The bridge can assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	 * signals) feeding it is still running when this callback is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	 * Note that this function will only be invoked in the context of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	 * atomic commit. It will not be invoked from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	 * &drm_bridge_chain_disable. It would be prudent to also provide an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	 * implementation of @disable if you are expecting driver calls into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	 * &drm_bridge_chain_disable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	 * The @atomic_disable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	void (*atomic_disable)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 			       struct drm_bridge_state *old_bridge_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	 * @atomic_post_disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	 * This callback should disable the bridge. It is called right after the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	 * preceding element in the display pipe is disabled. If the preceding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	 * element is a bridge this means it's called after that bridge's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	 * @atomic_post_disable or @post_disable function. If the preceding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	 * element is a &drm_encoder it's called right after the encoder's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	 * &drm_encoder_helper_funcs.atomic_disable hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	 * The bridge must assume that the display pipe (i.e. clocks and timing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	 * signals) feeding it is no longer running when this callback is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	 * called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	 * Note that this function will only be invoked in the context of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	 * atomic commit. It will not be invoked from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	 * &drm_bridge_chain_post_disable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	 * It would be prudent to also provide an implementation of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	 * @post_disable if you are expecting driver calls into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	 * &drm_bridge_chain_post_disable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	 * The @atomic_post_disable callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	void (*atomic_post_disable)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 				    struct drm_bridge_state *old_bridge_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	 * @atomic_duplicate_state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	 * Duplicate the current bridge state object (which is guaranteed to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	 * non-NULL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	 * The atomic_duplicate_state hook is mandatory if the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	 * implements any of the atomic hooks, and should be left unassigned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	 * otherwise. For bridges that don't subclass &drm_bridge_state, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	 * drm_atomic_helper_bridge_duplicate_state() helper function shall be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	 * used to implement this hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	 * A valid drm_bridge_state object or NULL if the allocation fails.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	struct drm_bridge_state *(*atomic_duplicate_state)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	 * @atomic_destroy_state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	 * Destroy a bridge state object previously allocated by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	 * &drm_bridge_funcs.atomic_duplicate_state().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	 * The atomic_destroy_state hook is mandatory if the bridge implements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	 * any of the atomic hooks, and should be left unassigned otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	 * For bridges that don't subclass &drm_bridge_state, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	 * drm_atomic_helper_bridge_destroy_state() helper function shall be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	 * used to implement this hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	void (*atomic_destroy_state)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 				     struct drm_bridge_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	 * @atomic_get_output_bus_fmts:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	 * Return the supported bus formats on the output end of a bridge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	 * The returned array must be allocated with kmalloc() and will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	 * freed by the caller. If the allocation fails, NULL should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	 * returned. num_output_fmts must be set to the returned array size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	 * Formats listed in the returned array should be listed in decreasing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	 * preference order (the core will try all formats until it finds one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	 * that works).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	 * This method is only called on the last element of the bridge chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	 * as part of the bus format negotiation process that happens in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	 * &drm_atomic_bridge_chain_select_bus_fmts().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	 * This method is optional. When not implemented, the core will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	 * fall back to &drm_connector.display_info.bus_formats[0] if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	 * &drm_connector.display_info.num_bus_formats > 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	 * or to MEDIA_BUS_FMT_FIXED otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	u32 *(*atomic_get_output_bus_fmts)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 					   struct drm_bridge_state *bridge_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 					   struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 					   struct drm_connector_state *conn_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 					   unsigned int *num_output_fmts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	 * @atomic_get_input_bus_fmts:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	 * Return the supported bus formats on the input end of a bridge for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	 * a specific output bus format.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	 * The returned array must be allocated with kmalloc() and will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	 * freed by the caller. If the allocation fails, NULL should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	 * returned. num_output_fmts must be set to the returned array size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	 * Formats listed in the returned array should be listed in decreasing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	 * preference order (the core will try all formats until it finds one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	 * that works). When the format is not supported NULL should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	 * returned and num_output_fmts should be set to 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	 * This method is called on all elements of the bridge chain as part of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	 * the bus format negotiation process that happens in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	 * drm_atomic_bridge_chain_select_bus_fmts().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	 * This method is optional. When not implemented, the core will bypass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	 * bus format negotiation on this element of the bridge without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	 * failing, and the previous element in the chain will be passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 	 * MEDIA_BUS_FMT_FIXED as its output bus format.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	 * Bridge drivers that need to support being linked to bridges that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	 * not supporting bus format negotiation should handle the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	 * output_fmt == MEDIA_BUS_FMT_FIXED case appropriately, by selecting a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	 * sensible default value or extracting this information from somewhere
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	 * else (FW property, &drm_display_mode, &drm_display_info, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	 * Note: Even if input format selection on the first bridge has no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	 * impact on the negotiation process (bus format negotiation stops once
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	 * we reach the first element of the chain), drivers are expected to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	 * return accurate input formats as the input format may be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	 * configure the CRTC output appropriately.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	u32 *(*atomic_get_input_bus_fmts)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 					  struct drm_bridge_state *bridge_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 					  struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 					  struct drm_connector_state *conn_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 					  u32 output_fmt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 					  unsigned int *num_input_fmts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	 * @atomic_check:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 	 * This method is responsible for checking bridge state correctness.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	 * It can also check the state of the surrounding components in chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	 * to make sure the whole pipeline can work properly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	 * &drm_bridge_funcs.atomic_check() hooks are called in reverse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	 * order (from the last to the first bridge).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	 * This method is optional. &drm_bridge_funcs.mode_fixup() is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 	 * called when &drm_bridge_funcs.atomic_check() is implemented, so only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 	 * one of them should be provided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	 * If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 	 * &drm_bridge_state.output_bus_cfg.flags it should happen in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 	 * this function. By default the &drm_bridge_state.output_bus_cfg.flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 	 * field is set to the next bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 	 * &drm_bridge_state.input_bus_cfg.flags value or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 	 * &drm_connector.display_info.bus_flags if the bridge is the last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 	 * element in the chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	 * zero if the check passed, a negative error code otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	int (*atomic_check)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 			    struct drm_bridge_state *bridge_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 			    struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 			    struct drm_connector_state *conn_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	 * @atomic_reset:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	 * Reset the bridge to a predefined state (or retrieve its current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	 * state) and return a &drm_bridge_state object matching this state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	 * This function is called at attach time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	 * The atomic_reset hook is mandatory if the bridge implements any of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 	 * the atomic hooks, and should be left unassigned otherwise. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	 * bridges that don't subclass &drm_bridge_state, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	 * drm_atomic_helper_bridge_reset() helper function shall be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	 * implement this hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	 * Note that the atomic_reset() semantics is not exactly matching the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	 * reset() semantics found on other components (connector, plane, ...).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	 * 1. The reset operation happens when the bridge is attached, not when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	 *    drm_mode_config_reset() is called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	 * 2. It's meant to be used exclusively on bridges that have been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	 *    converted to the ATOMIC API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	 * A valid drm_bridge_state object in case of success, an ERR_PTR()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	 * giving the reason of the failure otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	struct drm_bridge_state *(*atomic_reset)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	 * @detect:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	 * Check if anything is attached to the bridge output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	 * This callback is optional, if not implemented the bridge will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	 * considered as always having a component attached to its output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 	 * Bridges that implement this callback shall set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 	 * DRM_BRIDGE_OP_DETECT flag in their &drm_bridge->ops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	 * drm_connector_status indicating the bridge output status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	enum drm_connector_status (*detect)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	 * @get_modes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	 * Fill all modes currently valid for the sink into the &drm_connector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	 * with drm_mode_probed_add().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	 * The @get_modes callback is mostly intended to support non-probeable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 	 * displays such as many fixed panels. Bridges that support reading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	 * EDID shall leave @get_modes unimplemented and implement the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 	 * &drm_bridge_funcs->get_edid callback instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	 * This callback is optional. Bridges that implement it shall set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	 * DRM_BRIDGE_OP_MODES flag in their &drm_bridge->ops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	 * The connector parameter shall be used for the sole purpose of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	 * filling modes, and shall not be stored internally by bridge drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 	 * for future usage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	 * The number of modes added by calling drm_mode_probed_add().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	int (*get_modes)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 			 struct drm_connector *connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	 * @get_edid:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	 * Read and parse the EDID data of the connected display.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	 * The @get_edid callback is the preferred way of reporting mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	 * information for a display connected to the bridge output. Bridges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	 * that support reading EDID shall implement this callback and leave
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	 * the @get_modes callback unimplemented.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	 * The caller of this operation shall first verify the output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	 * connection status and refrain from reading EDID from a disconnected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	 * output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 	 * This callback is optional. Bridges that implement it shall set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	 * DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	 * The connector parameter shall be used for the sole purpose of EDID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	 * retrieval and parsing, and shall not be stored internally by bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	 * drivers for future usage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	 * An edid structure newly allocated with kmalloc() (or similar) on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	 * success, or NULL otherwise. The caller is responsible for freeing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	 * the returned edid structure with kfree().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	struct edid *(*get_edid)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 				 struct drm_connector *connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	 * @hpd_notify:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	 * Notify the bridge of hot plug detection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	 * This callback is optional, it may be implemented by bridges that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	 * need to be notified of display connection or disconnection for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	 * internal reasons. One use case is to reset the internal state of CEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	 * controllers for HDMI bridges.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	void (*hpd_notify)(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 			   enum drm_connector_status status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	 * @hpd_enable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	 * Enable hot plug detection. From now on the bridge shall call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 	 * drm_bridge_hpd_notify() each time a change is detected in the output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 	 * connection status, until hot plug detection gets disabled with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 	 * @hpd_disable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	 * This callback is optional and shall only be implemented by bridges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 	 * that support hot-plug notification without polling. Bridges that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 	 * implement it shall also implement the @hpd_disable callback and set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 	 * the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	void (*hpd_enable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	 * @hpd_disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 	 * Disable hot plug detection. Once this function returns the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 	 * shall not call drm_bridge_hpd_notify() when a change in the output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 	 * connection status occurs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 	 * This callback is optional and shall only be implemented by bridges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	 * that support hot-plug notification without polling. Bridges that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	 * implement it shall also implement the @hpd_enable callback and set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 	 * the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	void (*hpd_disable)(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)  * struct drm_bridge_timings - timing information for the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) struct drm_bridge_timings {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 	 * @input_bus_flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 	 * Tells what additional settings for the pixel data on the bus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 	 * this bridge requires (like pixel signal polarity). See also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 	 * &drm_display_info->bus_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 	u32 input_bus_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 	 * @setup_time_ps:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 	 * Defines the time in picoseconds the input data lines must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 	 * stable before the clock edge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 	u32 setup_time_ps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	 * @hold_time_ps:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	 * Defines the time in picoseconds taken for the bridge to sample the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 	 * input signal after the clock edge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 	u32 hold_time_ps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 	 * @dual_link:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	 * True if the bus operates in dual-link mode. The exact meaning is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 	 * dependent on the bus type. For LVDS buses, this indicates that even-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	 * and odd-numbered pixels are received on separate links.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	bool dual_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671)  * enum drm_bridge_ops - Bitmask of operations supported by the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) enum drm_bridge_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	 * @DRM_BRIDGE_OP_DETECT: The bridge can detect displays connected to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	 * its output. Bridges that set this flag shall implement the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 	 * &drm_bridge_funcs->detect callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	DRM_BRIDGE_OP_DETECT = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 	 * @DRM_BRIDGE_OP_EDID: The bridge can retrieve the EDID of the display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 	 * connected to its output. Bridges that set this flag shall implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) 	 * the &drm_bridge_funcs->get_edid callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 	DRM_BRIDGE_OP_EDID = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 	 * @DRM_BRIDGE_OP_HPD: The bridge can detect hot-plug and hot-unplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 	 * without requiring polling. Bridges that set this flag shall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) 	 * implement the &drm_bridge_funcs->hpd_enable and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 	 * &drm_bridge_funcs->hpd_disable callbacks if they support enabling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) 	 * and disabling hot-plug detection dynamically.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) 	DRM_BRIDGE_OP_HPD = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 	 * @DRM_BRIDGE_OP_MODES: The bridge can retrieve the modes supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 	 * by the display at its output. This does not include reading EDID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 	 * which is separately covered by @DRM_BRIDGE_OP_EDID. Bridges that set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 	 * this flag shall implement the &drm_bridge_funcs->get_modes callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 	DRM_BRIDGE_OP_MODES = BIT(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)  * struct drm_bridge - central DRM bridge control structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) struct drm_bridge {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) 	/** @base: inherit from &drm_private_object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) 	struct drm_private_obj base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 	/** @dev: DRM device this bridge belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) 	struct drm_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 	/** @encoder: encoder to which this bridge is connected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 	struct drm_encoder *encoder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 	/** @chain_node: used to form a bridge chain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 	struct list_head chain_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 	/** @of_node: device node pointer to the bridge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 	struct device_node *of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	/** @list: to keep track of all added bridges */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 	 * @timings:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 	 * the timing specification for the bridge, if any (may be NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 	const struct drm_bridge_timings *timings;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 	/** @funcs: control functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 	const struct drm_bridge_funcs *funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) 	/** @driver_private: pointer to the bridge driver's internal context */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 	void *driver_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) 	/** @ops: bitmask of operations supported by the bridge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) 	enum drm_bridge_ops ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 	 * @type: Type of the connection at the bridge output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 	 * (DRM_MODE_CONNECTOR_*). For bridges at the end of this chain this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 	 * identifies the type of connected display.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 	int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) 	 * @interlace_allowed: Indicate that the bridge can handle interlaced
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 	 * modes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 	bool interlace_allowed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 	 * @ddc: Associated I2C adapter for DDC access, if any.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 	struct i2c_adapter *ddc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) 	/** private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) 	 * @hpd_mutex: Protects the @hpd_cb and @hpd_data fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) 	struct mutex hpd_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) 	 * @hpd_cb: Hot plug detection callback, registered with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) 	 * drm_bridge_hpd_enable().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) 	void (*hpd_cb)(void *data, enum drm_connector_status status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) 	 * @hpd_data: Private data passed to the Hot plug detection callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) 	 * @hpd_cb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) 	void *hpd_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) static inline struct drm_bridge *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) drm_priv_to_bridge(struct drm_private_obj *priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 	return container_of(priv, struct drm_bridge, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) void drm_bridge_add(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) void drm_bridge_remove(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) struct drm_bridge *of_drm_find_bridge(struct device_node *np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) 		      struct drm_bridge *previous,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) 		      enum drm_bridge_attach_flags flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779)  * drm_bridge_get_next_bridge() - Get the next bridge in the chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)  * @bridge: bridge object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782)  * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783)  * the next bridge in the chain after @bridge, or NULL if @bridge is the last.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) static inline struct drm_bridge *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) drm_bridge_get_next_bridge(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) 	if (list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) 	return list_next_entry(bridge, chain_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795)  * drm_bridge_get_prev_bridge() - Get the previous bridge in the chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796)  * @bridge: bridge object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798)  * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799)  * the previous bridge in the chain, or NULL if @bridge is the first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) static inline struct drm_bridge *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) drm_bridge_get_prev_bridge(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) 	if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) 	return list_prev_entry(bridge, chain_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)  * drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812)  * @encoder: encoder object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814)  * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815)  * the first bridge in the chain, or NULL if @encoder has no bridge attached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816)  * to it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) static inline struct drm_bridge *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) 	return list_first_entry_or_null(&encoder->bridge_chain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) 					struct drm_bridge, chain_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826)  * drm_for_each_bridge_in_chain() - Iterate over all bridges present in a chain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827)  * @encoder: the encoder to iterate bridges on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828)  * @bridge: a bridge pointer updated to point to the current bridge at each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829)  *	    iteration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831)  * Iterate over all bridges present in the bridge chain attached to @encoder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) #define drm_for_each_bridge_in_chain(encoder, bridge)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) 	list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) 				 const struct drm_display_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) 				 struct drm_display_mode *adjusted_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) enum drm_mode_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) drm_bridge_chain_mode_valid(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) 			    const struct drm_display_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) 			    const struct drm_display_mode *mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) void drm_bridge_chain_disable(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) void drm_bridge_chain_post_disable(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) void drm_bridge_chain_mode_set(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) 			       const struct drm_display_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) 			       const struct drm_display_mode *adjusted_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) void drm_bridge_chain_pre_enable(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) void drm_bridge_chain_enable(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) int drm_atomic_bridge_chain_check(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) 				  struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) 				  struct drm_connector_state *conn_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) 				     struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) 					  struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) 					struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) 				    struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) u32 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) 					struct drm_bridge_state *bridge_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) 					struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) 					struct drm_connector_state *conn_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) 					u32 output_fmt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) 					unsigned int *num_input_fmts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) enum drm_connector_status drm_bridge_detect(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) int drm_bridge_get_modes(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) 			 struct drm_connector *connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) struct edid *drm_bridge_get_edid(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) 				 struct drm_connector *connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) void drm_bridge_hpd_enable(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) 			   void (*cb)(void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) 				      enum drm_connector_status status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) 			   void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) void drm_bridge_hpd_disable(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) void drm_bridge_hpd_notify(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) 			   enum drm_connector_status status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) #ifdef CONFIG_DRM_PANEL_BRIDGE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) 					      u32 connector_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) void drm_panel_bridge_remove(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) 					     struct drm_panel *panel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) 						   struct drm_panel *panel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) 						   u32 connector_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) #endif