/*1* Copyright (c) 2016 Intel Corporation2*3* Permission to use, copy, modify, distribute, and sell this software and its4* documentation for any purpose is hereby granted without fee, provided that5* the above copyright notice appear in all copies and that both that copyright6* notice and this permission notice appear in supporting documentation, and7* that the name of the copyright holders not be used in advertising or8* publicity pertaining to distribution of the software without specific,9* written prior permission. The copyright holders make no representations10* about the suitability of this software for any purpose. It is provided "as11* is" without express or implied warranty.12*13* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,14* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO15* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR16* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,17* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER18* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE19* OF THIS SOFTWARE.20*/2122#ifndef __DRM_BRIDGE_H__23#define __DRM_BRIDGE_H__2425#include <linux/cleanup.h>26#include <linux/ctype.h>27#include <linux/list.h>28#include <linux/mutex.h>2930#include <drm/drm_atomic.h>31#include <drm/drm_encoder.h>32#include <drm/drm_mode_object.h>33#include <drm/drm_modes.h>3435struct cec_msg;36struct device_node;3738struct drm_bridge;39struct drm_bridge_timings;40struct drm_connector;41struct drm_display_info;42struct drm_minor;43struct drm_panel;44struct edid;45struct hdmi_codec_daifmt;46struct hdmi_codec_params;47struct i2c_adapter;4849/**50* enum drm_bridge_attach_flags - Flags for &drm_bridge_funcs.attach51*/52enum drm_bridge_attach_flags {53/**54* @DRM_BRIDGE_ATTACH_NO_CONNECTOR: When this flag is set the bridge55* shall not create a drm_connector.56*/57DRM_BRIDGE_ATTACH_NO_CONNECTOR = BIT(0),58};5960/**61* struct drm_bridge_funcs - drm_bridge control functions62*/63struct drm_bridge_funcs {64/**65* @attach:66*67* This callback is invoked whenever our bridge is being attached to a68* &drm_encoder. The flags argument tunes the behaviour of the attach69* operation (see DRM_BRIDGE_ATTACH_*).70*71* The @attach callback is optional.72*73* RETURNS:74*75* Zero on success, error code on failure.76*/77int (*attach)(struct drm_bridge *bridge, struct drm_encoder *encoder,78enum drm_bridge_attach_flags flags);7980/**81* @destroy:82*83* This callback is invoked when the bridge is about to be84* deallocated.85*86* The @destroy callback is optional.87*/88void (*destroy)(struct drm_bridge *bridge);8990/**91* @detach:92*93* This callback is invoked whenever our bridge is being detached from a94* &drm_encoder.95*96* The @detach callback is optional.97*/98void (*detach)(struct drm_bridge *bridge);99100/**101* @mode_valid:102*103* This callback is used to check if a specific mode is valid in this104* bridge. This should be implemented if the bridge has some sort of105* restriction in the modes it can display. For example, a given bridge106* may be responsible to set a clock value. If the clock can not107* produce all the values for the available modes then this callback108* can be used to restrict the number of modes to only the ones that109* can be displayed.110*111* This hook is used by the probe helpers to filter the mode list in112* drm_helper_probe_single_connector_modes(), and it is used by the113* atomic helpers to validate modes supplied by userspace in114* drm_atomic_helper_check_modeset().115*116* The @mode_valid callback is optional.117*118* NOTE:119*120* Since this function is both called from the check phase of an atomic121* commit, and the mode validation in the probe paths it is not allowed122* to look at anything else but the passed-in mode, and validate it123* against configuration-invariant hardware constraints. Any further124* limits which depend upon the configuration can only be checked in125* @mode_fixup.126*127* RETURNS:128*129* drm_mode_status Enum130*/131enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge,132const struct drm_display_info *info,133const struct drm_display_mode *mode);134135/**136* @mode_fixup:137*138* This callback is used to validate and adjust a mode. The parameter139* mode is the display mode that should be fed to the next element in140* the display chain, either the final &drm_connector or the next141* &drm_bridge. The parameter adjusted_mode is the input mode the bridge142* requires. It can be modified by this callback and does not need to143* match mode. See also &drm_crtc_state.adjusted_mode for more details.144*145* This is the only hook that allows a bridge to reject a modeset. If146* this function passes all other callbacks must succeed for this147* configuration.148*149* The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup()150* is not called when &drm_bridge_funcs.atomic_check() is implemented,151* so only one of them should be provided.152*153* NOTE:154*155* This function is called in the check phase of atomic modesets, which156* can be aborted for any reason (including on userspace's request to157* just check whether a configuration would be possible). Drivers MUST158* NOT touch any persistent state (hardware or software) or data159* structures except the passed in @state parameter.160*161* Also beware that userspace can request its own custom modes, neither162* core nor helpers filter modes to the list of probe modes reported by163* the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure164* that modes are filtered consistently put any bridge constraints and165* limits checks into @mode_valid.166*167* RETURNS:168*169* True if an acceptable configuration is possible, false if the modeset170* operation should be rejected.171*/172bool (*mode_fixup)(struct drm_bridge *bridge,173const struct drm_display_mode *mode,174struct drm_display_mode *adjusted_mode);175/**176* @disable:177*178* This callback should disable the bridge. It is called right before179* the preceding element in the display pipe is disabled. If the180* preceding element is a bridge this means it's called before that181* bridge's @disable vfunc. If the preceding element is a &drm_encoder182* it's called right before the &drm_encoder_helper_funcs.disable,183* &drm_encoder_helper_funcs.prepare or &drm_encoder_helper_funcs.dpms184* hook.185*186* The bridge can assume that the display pipe (i.e. clocks and timing187* signals) feeding it is still running when this callback is called.188*189* The @disable callback is optional.190*191* NOTE:192*193* This is deprecated, do not use!194* New drivers shall use &drm_bridge_funcs.atomic_disable.195*/196void (*disable)(struct drm_bridge *bridge);197198/**199* @post_disable:200*201* This callback should disable the bridge. It is called right after the202* preceding element in the display pipe is disabled. If the preceding203* element is a bridge this means it's called after that bridge's204* @post_disable function. If the preceding element is a &drm_encoder205* it's called right after the encoder's206* &drm_encoder_helper_funcs.disable, &drm_encoder_helper_funcs.prepare207* or &drm_encoder_helper_funcs.dpms hook.208*209* The bridge must assume that the display pipe (i.e. clocks and timing210* signals) feeding it is no longer running when this callback is211* called.212*213* The @post_disable callback is optional.214*215* NOTE:216*217* This is deprecated, do not use!218* New drivers shall use &drm_bridge_funcs.atomic_post_disable.219*/220void (*post_disable)(struct drm_bridge *bridge);221222/**223* @mode_set:224*225* This callback should set the given mode on the bridge. It is called226* after the @mode_set callback for the preceding element in the display227* pipeline has been called already. If the bridge is the first element228* then this would be &drm_encoder_helper_funcs.mode_set. The display229* pipe (i.e. clocks and timing signals) is off when this function is230* called.231*232* The adjusted_mode parameter is the mode output by the CRTC for the233* first bridge in the chain. It can be different from the mode234* parameter that contains the desired mode for the connector at the end235* of the bridges chain, for instance when the first bridge in the chain236* performs scaling. The adjusted mode is mostly useful for the first237* bridge in the chain and is likely irrelevant for the other bridges.238*239* For atomic drivers the adjusted_mode is the mode stored in240* &drm_crtc_state.adjusted_mode.241*242* NOTE:243*244* This is deprecated, do not use!245* New drivers shall set their mode in the246* &drm_bridge_funcs.atomic_enable operation.247*/248void (*mode_set)(struct drm_bridge *bridge,249const struct drm_display_mode *mode,250const struct drm_display_mode *adjusted_mode);251/**252* @pre_enable:253*254* This callback should enable the bridge. It is called right before255* the preceding element in the display pipe is enabled. If the256* preceding element is a bridge this means it's called before that257* bridge's @pre_enable function. If the preceding element is a258* &drm_encoder it's called right before the encoder's259* &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or260* &drm_encoder_helper_funcs.dpms hook.261*262* The display pipe (i.e. clocks and timing signals) feeding this bridge263* will not yet be running when this callback is called. The bridge must264* not enable the display link feeding the next bridge in the chain (if265* there is one) when this callback is called.266*267* The @pre_enable callback is optional.268*269* NOTE:270*271* This is deprecated, do not use!272* New drivers shall use &drm_bridge_funcs.atomic_pre_enable.273*/274void (*pre_enable)(struct drm_bridge *bridge);275276/**277* @enable:278*279* This callback should enable the bridge. It is called right after280* the preceding element in the display pipe is enabled. If the281* preceding element is a bridge this means it's called after that282* bridge's @enable function. If the preceding element is a283* &drm_encoder it's called right after the encoder's284* &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or285* &drm_encoder_helper_funcs.dpms hook.286*287* The bridge can assume that the display pipe (i.e. clocks and timing288* signals) feeding it is running when this callback is called. This289* callback must enable the display link feeding the next bridge in the290* chain if there is one.291*292* The @enable callback is optional.293*294* NOTE:295*296* This is deprecated, do not use!297* New drivers shall use &drm_bridge_funcs.atomic_enable.298*/299void (*enable)(struct drm_bridge *bridge);300301/**302* @atomic_pre_enable:303*304* This callback should enable the bridge. It is called right before305* the preceding element in the display pipe is enabled. If the306* preceding element is a bridge this means it's called before that307* bridge's @atomic_pre_enable or @pre_enable function. If the preceding308* element is a &drm_encoder it's called right before the encoder's309* &drm_encoder_helper_funcs.atomic_enable hook.310*311* The display pipe (i.e. clocks and timing signals) feeding this bridge312* will not yet be running when this callback is called. The bridge must313* not enable the display link feeding the next bridge in the chain (if314* there is one) when this callback is called.315*316* The @atomic_pre_enable callback is optional.317*/318void (*atomic_pre_enable)(struct drm_bridge *bridge,319struct drm_atomic_state *state);320321/**322* @atomic_enable:323*324* This callback should enable the bridge. It is called right after325* the preceding element in the display pipe is enabled. If the326* preceding element is a bridge this means it's called after that327* bridge's @atomic_enable or @enable function. If the preceding element328* is a &drm_encoder it's called right after the encoder's329* &drm_encoder_helper_funcs.atomic_enable hook.330*331* The bridge can assume that the display pipe (i.e. clocks and timing332* signals) feeding it is running when this callback is called. This333* callback must enable the display link feeding the next bridge in the334* chain if there is one.335*336* The @atomic_enable callback is optional.337*/338void (*atomic_enable)(struct drm_bridge *bridge,339struct drm_atomic_state *state);340/**341* @atomic_disable:342*343* This callback should disable the bridge. It is called right before344* the preceding element in the display pipe is disabled. If the345* preceding element is a bridge this means it's called before that346* bridge's @atomic_disable or @disable vfunc. If the preceding element347* is a &drm_encoder it's called right before the348* &drm_encoder_helper_funcs.atomic_disable hook.349*350* The bridge can assume that the display pipe (i.e. clocks and timing351* signals) feeding it is still running when this callback is called.352*353* The @atomic_disable callback is optional.354*/355void (*atomic_disable)(struct drm_bridge *bridge,356struct drm_atomic_state *state);357358/**359* @atomic_post_disable:360*361* This callback should disable the bridge. It is called right after the362* preceding element in the display pipe is disabled. If the preceding363* element is a bridge this means it's called after that bridge's364* @atomic_post_disable or @post_disable function. If the preceding365* element is a &drm_encoder it's called right after the encoder's366* &drm_encoder_helper_funcs.atomic_disable hook.367*368* The bridge must assume that the display pipe (i.e. clocks and timing369* signals) feeding it is no longer running when this callback is370* called.371*372* The @atomic_post_disable callback is optional.373*/374void (*atomic_post_disable)(struct drm_bridge *bridge,375struct drm_atomic_state *state);376377/**378* @atomic_duplicate_state:379*380* Duplicate the current bridge state object (which is guaranteed to be381* non-NULL).382*383* The atomic_duplicate_state hook is mandatory if the bridge384* implements any of the atomic hooks, and should be left unassigned385* otherwise. For bridges that don't subclass &drm_bridge_state, the386* drm_atomic_helper_bridge_duplicate_state() helper function shall be387* used to implement this hook.388*389* RETURNS:390* A valid drm_bridge_state object or NULL if the allocation fails.391*/392struct drm_bridge_state *(*atomic_duplicate_state)(struct drm_bridge *bridge);393394/**395* @atomic_destroy_state:396*397* Destroy a bridge state object previously allocated by398* &drm_bridge_funcs.atomic_duplicate_state().399*400* The atomic_destroy_state hook is mandatory if the bridge implements401* any of the atomic hooks, and should be left unassigned otherwise.402* For bridges that don't subclass &drm_bridge_state, the403* drm_atomic_helper_bridge_destroy_state() helper function shall be404* used to implement this hook.405*/406void (*atomic_destroy_state)(struct drm_bridge *bridge,407struct drm_bridge_state *state);408409/**410* @atomic_get_output_bus_fmts:411*412* Return the supported bus formats on the output end of a bridge.413* The returned array must be allocated with kmalloc() and will be414* freed by the caller. If the allocation fails, NULL should be415* returned. num_output_fmts must be set to the returned array size.416* Formats listed in the returned array should be listed in decreasing417* preference order (the core will try all formats until it finds one418* that works).419*420* This method is only called on the last element of the bridge chain421* as part of the bus format negotiation process that happens in422* &drm_atomic_bridge_chain_select_bus_fmts().423* This method is optional. When not implemented, the core will424* fall back to &drm_connector.display_info.bus_formats[0] if425* &drm_connector.display_info.num_bus_formats > 0,426* or to MEDIA_BUS_FMT_FIXED otherwise.427*/428u32 *(*atomic_get_output_bus_fmts)(struct drm_bridge *bridge,429struct drm_bridge_state *bridge_state,430struct drm_crtc_state *crtc_state,431struct drm_connector_state *conn_state,432unsigned int *num_output_fmts);433434/**435* @atomic_get_input_bus_fmts:436*437* Return the supported bus formats on the input end of a bridge for438* a specific output bus format.439*440* The returned array must be allocated with kmalloc() and will be441* freed by the caller. If the allocation fails, NULL should be442* returned. num_input_fmts must be set to the returned array size.443* Formats listed in the returned array should be listed in decreasing444* preference order (the core will try all formats until it finds one445* that works). When the format is not supported NULL should be446* returned and num_input_fmts should be set to 0.447*448* This method is called on all elements of the bridge chain as part of449* the bus format negotiation process that happens in450* drm_atomic_bridge_chain_select_bus_fmts().451* This method is optional. When not implemented, the core will bypass452* bus format negotiation on this element of the bridge without453* failing, and the previous element in the chain will be passed454* MEDIA_BUS_FMT_FIXED as its output bus format.455*456* Bridge drivers that need to support being linked to bridges that are457* not supporting bus format negotiation should handle the458* output_fmt == MEDIA_BUS_FMT_FIXED case appropriately, by selecting a459* sensible default value or extracting this information from somewhere460* else (FW property, &drm_display_mode, &drm_display_info, ...)461*462* Note: Even if input format selection on the first bridge has no463* impact on the negotiation process (bus format negotiation stops once464* we reach the first element of the chain), drivers are expected to465* return accurate input formats as the input format may be used to466* configure the CRTC output appropriately.467*/468u32 *(*atomic_get_input_bus_fmts)(struct drm_bridge *bridge,469struct drm_bridge_state *bridge_state,470struct drm_crtc_state *crtc_state,471struct drm_connector_state *conn_state,472u32 output_fmt,473unsigned int *num_input_fmts);474475/**476* @atomic_check:477*478* This method is responsible for checking bridge state correctness.479* It can also check the state of the surrounding components in chain480* to make sure the whole pipeline can work properly.481*482* &drm_bridge_funcs.atomic_check() hooks are called in reverse483* order (from the last to the first bridge).484*485* This method is optional. &drm_bridge_funcs.mode_fixup() is not486* called when &drm_bridge_funcs.atomic_check() is implemented, so only487* one of them should be provided.488*489* If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or490* &drm_bridge_state.output_bus_cfg.flags it should happen in491* this function. By default the &drm_bridge_state.output_bus_cfg.flags492* field is set to the next bridge493* &drm_bridge_state.input_bus_cfg.flags value or494* &drm_connector.display_info.bus_flags if the bridge is the last495* element in the chain.496*497* RETURNS:498* zero if the check passed, a negative error code otherwise.499*/500int (*atomic_check)(struct drm_bridge *bridge,501struct drm_bridge_state *bridge_state,502struct drm_crtc_state *crtc_state,503struct drm_connector_state *conn_state);504505/**506* @atomic_reset:507*508* Reset the bridge to a predefined state (or retrieve its current509* state) and return a &drm_bridge_state object matching this state.510* This function is called at attach time.511*512* The atomic_reset hook is mandatory if the bridge implements any of513* the atomic hooks, and should be left unassigned otherwise. For514* bridges that don't subclass &drm_bridge_state, the515* drm_atomic_helper_bridge_reset() helper function shall be used to516* implement this hook.517*518* Note that the atomic_reset() semantics is not exactly matching the519* reset() semantics found on other components (connector, plane, ...).520*521* 1. The reset operation happens when the bridge is attached, not when522* drm_mode_config_reset() is called523* 2. It's meant to be used exclusively on bridges that have been524* converted to the ATOMIC API525*526* RETURNS:527* A valid drm_bridge_state object in case of success, an ERR_PTR()528* giving the reason of the failure otherwise.529*/530struct drm_bridge_state *(*atomic_reset)(struct drm_bridge *bridge);531532/**533* @detect:534*535* Check if anything is attached to the bridge output.536*537* This callback is optional, if not implemented the bridge will be538* considered as always having a component attached to its output.539* Bridges that implement this callback shall set the540* DRM_BRIDGE_OP_DETECT flag in their &drm_bridge->ops.541*542* RETURNS:543*544* drm_connector_status indicating the bridge output status.545*/546enum drm_connector_status (*detect)(struct drm_bridge *bridge,547struct drm_connector *connector);548549/**550* @get_modes:551*552* Fill all modes currently valid for the sink into the &drm_connector553* with drm_mode_probed_add().554*555* The @get_modes callback is mostly intended to support non-probeable556* displays such as many fixed panels. Bridges that support reading557* EDID shall leave @get_modes unimplemented and implement the558* &drm_bridge_funcs->edid_read callback instead.559*560* This callback is optional. Bridges that implement it shall set the561* DRM_BRIDGE_OP_MODES flag in their &drm_bridge->ops.562*563* The connector parameter shall be used for the sole purpose of564* filling modes, and shall not be stored internally by bridge drivers565* for future usage.566*567* RETURNS:568*569* The number of modes added by calling drm_mode_probed_add().570*/571int (*get_modes)(struct drm_bridge *bridge,572struct drm_connector *connector);573574/**575* @edid_read:576*577* Read the EDID data of the connected display.578*579* The @edid_read callback is the preferred way of reporting mode580* information for a display connected to the bridge output. Bridges581* that support reading EDID shall implement this callback and leave582* the @get_modes callback unimplemented.583*584* The caller of this operation shall first verify the output585* connection status and refrain from reading EDID from a disconnected586* output.587*588* This callback is optional. Bridges that implement it shall set the589* DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops.590*591* The connector parameter shall be used for the sole purpose of EDID592* retrieval, and shall not be stored internally by bridge drivers for593* future usage.594*595* RETURNS:596*597* An edid structure newly allocated with drm_edid_alloc() or returned598* from drm_edid_read() family of functions on success, or NULL599* otherwise. The caller is responsible for freeing the returned edid600* structure with drm_edid_free().601*/602const struct drm_edid *(*edid_read)(struct drm_bridge *bridge,603struct drm_connector *connector);604605/**606* @hpd_notify:607*608* Notify the bridge of hot plug detection.609*610* This callback is optional, it may be implemented by bridges that611* need to be notified of display connection or disconnection for612* internal reasons. One use case is to reset the internal state of CEC613* controllers for HDMI bridges.614*/615void (*hpd_notify)(struct drm_bridge *bridge,616enum drm_connector_status status);617618/**619* @hpd_enable:620*621* Enable hot plug detection. From now on the bridge shall call622* drm_bridge_hpd_notify() each time a change is detected in the output623* connection status, until hot plug detection gets disabled with624* @hpd_disable.625*626* This callback is optional and shall only be implemented by bridges627* that support hot-plug notification without polling. Bridges that628* implement it shall also implement the @hpd_disable callback and set629* the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.630*/631void (*hpd_enable)(struct drm_bridge *bridge);632633/**634* @hpd_disable:635*636* Disable hot plug detection. Once this function returns the bridge637* shall not call drm_bridge_hpd_notify() when a change in the output638* connection status occurs.639*640* This callback is optional and shall only be implemented by bridges641* that support hot-plug notification without polling. Bridges that642* implement it shall also implement the @hpd_enable callback and set643* the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.644*/645void (*hpd_disable)(struct drm_bridge *bridge);646647/**648* @hdmi_tmds_char_rate_valid:649*650* Check whether a particular TMDS character rate is supported by the651* driver.652*653* This callback is optional and should only be implemented by the654* bridges that take part in the HDMI connector implementation. Bridges655* that implement it shall set the DRM_BRIDGE_OP_HDMI flag in their656* &drm_bridge->ops.657*658* Returns:659*660* Either &drm_mode_status.MODE_OK or one of the failure reasons661* in &enum drm_mode_status.662*/663enum drm_mode_status664(*hdmi_tmds_char_rate_valid)(const struct drm_bridge *bridge,665const struct drm_display_mode *mode,666unsigned long long tmds_rate);667668/**669* @hdmi_clear_infoframe:670*671* This callback clears the infoframes in the hardware during commit.672* It will be called multiple times, once for every disabled infoframe673* type.674*675* This callback is optional but it must be implemented by bridges that676* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.677*/678int (*hdmi_clear_infoframe)(struct drm_bridge *bridge,679enum hdmi_infoframe_type type);680/**681* @hdmi_write_infoframe:682*683* Program the infoframe into the hardware. It will be called multiple684* times, once for every updated infoframe type.685*686* This callback is optional but it must be implemented by bridges that687* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.688*/689int (*hdmi_write_infoframe)(struct drm_bridge *bridge,690enum hdmi_infoframe_type type,691const u8 *buffer, size_t len);692693/**694* @hdmi_audio_startup:695*696* Called when ASoC starts an audio stream setup.697*698* This callback is optional, it can be implemented by bridges that699* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.700*701* Returns:702* 0 on success, a negative error code otherwise703*/704int (*hdmi_audio_startup)(struct drm_bridge *bridge,705struct drm_connector *connector);706707/**708* @hdmi_audio_prepare:709* Configures HDMI-encoder for audio stream. Can be called multiple710* times for each setup.711*712* This callback is optional but it must be implemented by bridges that713* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.714*715* Returns:716* 0 on success, a negative error code otherwise717*/718int (*hdmi_audio_prepare)(struct drm_bridge *bridge,719struct drm_connector *connector,720struct hdmi_codec_daifmt *fmt,721struct hdmi_codec_params *hparms);722723/**724* @hdmi_audio_shutdown:725*726* Shut down the audio stream.727*728* This callback is optional but it must be implemented by bridges that729* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.730*731* Returns:732* 0 on success, a negative error code otherwise733*/734void (*hdmi_audio_shutdown)(struct drm_bridge *bridge,735struct drm_connector *connector);736737/**738* @hdmi_audio_mute_stream:739*740* Mute/unmute HDMI audio stream.741*742* This callback is optional, it can be implemented by bridges that743* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.744*745* Returns:746* 0 on success, a negative error code otherwise747*/748int (*hdmi_audio_mute_stream)(struct drm_bridge *bridge,749struct drm_connector *connector,750bool enable, int direction);751752/**753* @hdmi_cec_init:754*755* Initialize CEC part of the bridge.756*757* This callback is optional, it can be implemented by bridges that758* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their759* &drm_bridge->ops.760*761* Returns:762* 0 on success, a negative error code otherwise763*/764int (*hdmi_cec_init)(struct drm_bridge *bridge,765struct drm_connector *connector);766767/**768* @hdmi_cec_enable:769*770* Enable or disable the CEC adapter inside the bridge.771*772* This callback is optional, it can be implemented by bridges that773* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their774* &drm_bridge->ops.775*776* Returns:777* 0 on success, a negative error code otherwise778*/779int (*hdmi_cec_enable)(struct drm_bridge *bridge, bool enable);780781/**782* @hdmi_cec_log_addr:783*784* Set the logical address of the CEC adapter inside the bridge.785*786* This callback is optional, it can be implemented by bridges that787* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their788* &drm_bridge->ops.789*790* Returns:791* 0 on success, a negative error code otherwise792*/793int (*hdmi_cec_log_addr)(struct drm_bridge *bridge, u8 logical_addr);794795/**796* @hdmi_cec_transmit:797*798* Transmit the message using the CEC adapter inside the bridge.799*800* This callback is optional, it can be implemented by bridges that801* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their802* &drm_bridge->ops.803*804* Returns:805* 0 on success, a negative error code otherwise806*/807int (*hdmi_cec_transmit)(struct drm_bridge *bridge, u8 attempts,808u32 signal_free_time, struct cec_msg *msg);809810/**811* @dp_audio_startup:812*813* Called when ASoC starts a DisplayPort audio stream setup.814*815* This callback is optional, it can be implemented by bridges that816* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.817*818* Returns:819* 0 on success, a negative error code otherwise820*/821int (*dp_audio_startup)(struct drm_bridge *bridge,822struct drm_connector *connector);823824/**825* @dp_audio_prepare:826* Configures DisplayPort audio stream. Can be called multiple827* times for each setup.828*829* This callback is optional but it must be implemented by bridges that830* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.831*832* Returns:833* 0 on success, a negative error code otherwise834*/835int (*dp_audio_prepare)(struct drm_bridge *bridge,836struct drm_connector *connector,837struct hdmi_codec_daifmt *fmt,838struct hdmi_codec_params *hparms);839840/**841* @dp_audio_shutdown:842*843* Shut down the DisplayPort audio stream.844*845* This callback is optional but it must be implemented by bridges that846* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.847*848* Returns:849* 0 on success, a negative error code otherwise850*/851void (*dp_audio_shutdown)(struct drm_bridge *bridge,852struct drm_connector *connector);853854/**855* @dp_audio_mute_stream:856*857* Mute/unmute DisplayPort audio stream.858*859* This callback is optional, it can be implemented by bridges that860* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.861*862* Returns:863* 0 on success, a negative error code otherwise864*/865int (*dp_audio_mute_stream)(struct drm_bridge *bridge,866struct drm_connector *connector,867bool enable, int direction);868869/**870* @debugfs_init:871*872* Allows bridges to create bridge-specific debugfs files.873*/874void (*debugfs_init)(struct drm_bridge *bridge, struct dentry *root);875};876877/**878* struct drm_bridge_timings - timing information for the bridge879*/880struct drm_bridge_timings {881/**882* @input_bus_flags:883*884* Tells what additional settings for the pixel data on the bus885* this bridge requires (like pixel signal polarity). See also886* &drm_display_info->bus_flags.887*/888u32 input_bus_flags;889/**890* @setup_time_ps:891*892* Defines the time in picoseconds the input data lines must be893* stable before the clock edge.894*/895u32 setup_time_ps;896/**897* @hold_time_ps:898*899* Defines the time in picoseconds taken for the bridge to sample the900* input signal after the clock edge.901*/902u32 hold_time_ps;903/**904* @dual_link:905*906* True if the bus operates in dual-link mode. The exact meaning is907* dependent on the bus type. For LVDS buses, this indicates that even-908* and odd-numbered pixels are received on separate links.909*/910bool dual_link;911};912913/**914* enum drm_bridge_ops - Bitmask of operations supported by the bridge915*/916enum drm_bridge_ops {917/**918* @DRM_BRIDGE_OP_DETECT: The bridge can detect displays connected to919* its output. Bridges that set this flag shall implement the920* &drm_bridge_funcs->detect callback.921*/922DRM_BRIDGE_OP_DETECT = BIT(0),923/**924* @DRM_BRIDGE_OP_EDID: The bridge can retrieve the EDID of the display925* connected to its output. Bridges that set this flag shall implement926* the &drm_bridge_funcs->edid_read callback.927*/928DRM_BRIDGE_OP_EDID = BIT(1),929/**930* @DRM_BRIDGE_OP_HPD: The bridge can detect hot-plug and hot-unplug931* without requiring polling. Bridges that set this flag shall932* implement the &drm_bridge_funcs->hpd_enable and933* &drm_bridge_funcs->hpd_disable callbacks if they support enabling934* and disabling hot-plug detection dynamically.935*/936DRM_BRIDGE_OP_HPD = BIT(2),937/**938* @DRM_BRIDGE_OP_MODES: The bridge can retrieve the modes supported939* by the display at its output. This does not include reading EDID940* which is separately covered by @DRM_BRIDGE_OP_EDID. Bridges that set941* this flag shall implement the &drm_bridge_funcs->get_modes callback.942*/943DRM_BRIDGE_OP_MODES = BIT(3),944/**945* @DRM_BRIDGE_OP_HDMI: The bridge provides HDMI connector operations,946* including infoframes support. Bridges that set this flag must947* implement the &drm_bridge_funcs->write_infoframe callback.948*949* Note: currently there can be at most one bridge in a chain that sets950* this bit. This is to simplify corresponding glue code in connector951* drivers.952*/953DRM_BRIDGE_OP_HDMI = BIT(4),954/**955* @DRM_BRIDGE_OP_HDMI_AUDIO: The bridge provides HDMI audio operations.956* Bridges that set this flag must implement the957* &drm_bridge_funcs->hdmi_audio_prepare and958* &drm_bridge_funcs->hdmi_audio_shutdown callbacks.959*960* Note: currently there can be at most one bridge in a chain that sets961* this bit. This is to simplify corresponding glue code in connector962* drivers. Also it is not possible to have a bridge in the chain that963* sets @DRM_BRIDGE_OP_DP_AUDIO if there is a bridge that sets this964* flag.965*/966DRM_BRIDGE_OP_HDMI_AUDIO = BIT(5),967/**968* @DRM_BRIDGE_OP_DP_AUDIO: The bridge provides DisplayPort audio operations.969* Bridges that set this flag must implement the970* &drm_bridge_funcs->dp_audio_prepare and971* &drm_bridge_funcs->dp_audio_shutdown callbacks.972*973* Note: currently there can be at most one bridge in a chain that sets974* this bit. This is to simplify corresponding glue code in connector975* drivers. Also it is not possible to have a bridge in the chain that976* sets @DRM_BRIDGE_OP_HDMI_AUDIO if there is a bridge that sets this977* flag.978*/979DRM_BRIDGE_OP_DP_AUDIO = BIT(6),980/**981* @DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER: The bridge requires CEC notifier982* to be present.983*/984DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER = BIT(7),985/**986* @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER: The bridge requires CEC adapter987* to be present.988*/989DRM_BRIDGE_OP_HDMI_CEC_ADAPTER = BIT(8),990};991992/**993* struct drm_bridge - central DRM bridge control structure994*/995struct drm_bridge {996/** @base: inherit from &drm_private_object */997struct drm_private_obj base;998/** @dev: DRM device this bridge belongs to */999struct drm_device *dev;1000/** @encoder: encoder to which this bridge is connected */1001struct drm_encoder *encoder;1002/** @chain_node: used to form a bridge chain */1003struct list_head chain_node;1004/** @of_node: device node pointer to the bridge */1005struct device_node *of_node;1006/** @list: to keep track of all added bridges */1007struct list_head list;1008/**1009* @timings:1010*1011* the timing specification for the bridge, if any (may be NULL)1012*/1013const struct drm_bridge_timings *timings;1014/** @funcs: control functions */1015const struct drm_bridge_funcs *funcs;10161017/**1018* @container: Pointer to the private driver struct embedding this1019* @struct drm_bridge.1020*/1021void *container;10221023/**1024* @refcount: reference count of users referencing this bridge.1025*/1026struct kref refcount;10271028/** @driver_private: pointer to the bridge driver's internal context */1029void *driver_private;1030/** @ops: bitmask of operations supported by the bridge */1031enum drm_bridge_ops ops;1032/**1033* @type: Type of the connection at the bridge output1034* (DRM_MODE_CONNECTOR_*). For bridges at the end of this chain this1035* identifies the type of connected display.1036*/1037int type;1038/**1039* @interlace_allowed: Indicate that the bridge can handle interlaced1040* modes.1041*/1042bool interlace_allowed;1043/**1044* @ycbcr_420_allowed: Indicate that the bridge can handle YCbCr 4201045* output.1046*/1047bool ycbcr_420_allowed;1048/**1049* @pre_enable_prev_first: The bridge requires that the prev1050* bridge @pre_enable function is called before its @pre_enable,1051* and conversely for post_disable. This is most frequently a1052* requirement for DSI devices which need the host to be initialised1053* before the peripheral.1054*/1055bool pre_enable_prev_first;1056/**1057* @support_hdcp: Indicate that the bridge supports HDCP.1058*/1059bool support_hdcp;1060/**1061* @ddc: Associated I2C adapter for DDC access, if any.1062*/1063struct i2c_adapter *ddc;10641065/**1066* @vendor: Vendor of the product to be used for the SPD InfoFrame1067* generation. This is required if @DRM_BRIDGE_OP_HDMI is set.1068*/1069const char *vendor;10701071/**1072* @product: Name of the product to be used for the SPD InfoFrame1073* generation. This is required if @DRM_BRIDGE_OP_HDMI is set.1074*/1075const char *product;10761077/**1078* @supported_formats: Bitmask of @hdmi_colorspace listing supported1079* output formats. This is only relevant if @DRM_BRIDGE_OP_HDMI is set.1080*/1081unsigned int supported_formats;10821083/**1084* @max_bpc: Maximum bits per char the HDMI bridge supports. Allowed1085* values are 8, 10 and 12. This is only relevant if1086* @DRM_BRIDGE_OP_HDMI is set.1087*/1088unsigned int max_bpc;10891090/**1091* @hdmi_cec_dev: device to be used as a containing device for CEC1092* functions.1093*/1094struct device *hdmi_cec_dev;10951096/**1097* @hdmi_audio_dev: device to be used as a parent for the HDMI Codec if1098* either of @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO is set.1099*/1100struct device *hdmi_audio_dev;11011102/**1103* @hdmi_audio_max_i2s_playback_channels: maximum number of playback1104* I2S channels for the @DRM_BRIDGE_OP_HDMI_AUDIO or1105* @DRM_BRIDGE_OP_DP_AUDIO.1106*/1107int hdmi_audio_max_i2s_playback_channels;11081109/**1110* @hdmi_audio_i2s_formats: supported I2S formats, optional. The1111* default is to allow all formats supported by the corresponding I2S1112* bus driver. This is only used for bridges setting1113* @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO.1114*/1115u64 hdmi_audio_i2s_formats;11161117/**1118* @hdmi_audio_spdif_playback: set if this bridge has S/PDIF playback1119* port for @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO.1120*/1121unsigned int hdmi_audio_spdif_playback : 1;11221123/**1124* @hdmi_audio_dai_port: sound DAI port for either of1125* @DRM_BRIDGE_OP_HDMI_AUDIO and @DRM_BRIDGE_OP_DP_AUDIO, -1 if it is1126* not used.1127*/1128int hdmi_audio_dai_port;11291130/**1131* @hdmi_cec_adapter_name: the name of the adapter to register1132*/1133const char *hdmi_cec_adapter_name;11341135/**1136* @hdmi_cec_available_las: number of logical addresses, CEC_MAX_LOG_ADDRS if unset1137*/1138u8 hdmi_cec_available_las;11391140/** private: */1141/**1142* @hpd_mutex: Protects the @hpd_cb and @hpd_data fields.1143*/1144struct mutex hpd_mutex;1145/**1146* @hpd_cb: Hot plug detection callback, registered with1147* drm_bridge_hpd_enable().1148*/1149void (*hpd_cb)(void *data, enum drm_connector_status status);1150/**1151* @hpd_data: Private data passed to the Hot plug detection callback1152* @hpd_cb.1153*/1154void *hpd_data;1155};11561157static inline struct drm_bridge *1158drm_priv_to_bridge(struct drm_private_obj *priv)1159{1160return container_of(priv, struct drm_bridge, base);1161}11621163struct drm_bridge *drm_bridge_get(struct drm_bridge *bridge);1164void drm_bridge_put(struct drm_bridge *bridge);11651166/* Cleanup action for use with __free() */1167DEFINE_FREE(drm_bridge_put, struct drm_bridge *, if (_T) drm_bridge_put(_T))11681169void *__devm_drm_bridge_alloc(struct device *dev, size_t size, size_t offset,1170const struct drm_bridge_funcs *funcs);11711172/**1173* devm_drm_bridge_alloc - Allocate and initialize a bridge1174* @dev: struct device of the bridge device1175* @type: the type of the struct which contains struct &drm_bridge1176* @member: the name of the &drm_bridge within @type1177* @funcs: callbacks for this bridge1178*1179* The reference count of the returned bridge is initialized to 1. This1180* reference will be automatically dropped via devm (by calling1181* drm_bridge_put()) when @dev is removed.1182*1183* Returns:1184* Pointer to new bridge, or ERR_PTR on failure.1185*/1186#define devm_drm_bridge_alloc(dev, type, member, funcs) \1187((type *)__devm_drm_bridge_alloc(dev, sizeof(type), \1188offsetof(type, member), funcs))11891190void drm_bridge_add(struct drm_bridge *bridge);1191int devm_drm_bridge_add(struct device *dev, struct drm_bridge *bridge);1192void drm_bridge_remove(struct drm_bridge *bridge);1193int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,1194struct drm_bridge *previous,1195enum drm_bridge_attach_flags flags);11961197#ifdef CONFIG_OF1198struct drm_bridge *of_drm_find_bridge(struct device_node *np);1199#else1200static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)1201{1202return NULL;1203}1204#endif12051206static inline bool drm_bridge_is_last(struct drm_bridge *bridge)1207{1208return list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain);1209}12101211/**1212* drm_bridge_get_current_state() - Get the current bridge state1213* @bridge: bridge object1214*1215* This function must be called with the modeset lock held.1216*1217* RETURNS:1218*1219* The current bridge state, or NULL if there is none.1220*/1221static inline struct drm_bridge_state *1222drm_bridge_get_current_state(struct drm_bridge *bridge)1223{1224if (!bridge)1225return NULL;12261227/*1228* Only atomic bridges will have bridge->base initialized by1229* drm_atomic_private_obj_init(), so we need to make sure we're1230* working with one before we try to use the lock.1231*/1232if (!bridge->funcs || !bridge->funcs->atomic_reset)1233return NULL;12341235drm_modeset_lock_assert_held(&bridge->base.lock);12361237if (!bridge->base.state)1238return NULL;12391240return drm_priv_to_bridge_state(bridge->base.state);1241}12421243/**1244* drm_bridge_get_next_bridge() - Get the next bridge in the chain1245* @bridge: bridge object1246*1247* The caller is responsible of having a reference to @bridge via1248* drm_bridge_get() or equivalent. This function leaves the refcount of1249* @bridge unmodified.1250*1251* The refcount of the returned bridge is incremented. Use drm_bridge_put()1252* when done with it.1253*1254* RETURNS:1255* the next bridge in the chain after @bridge, or NULL if @bridge is the last.1256*/1257static inline struct drm_bridge *1258drm_bridge_get_next_bridge(struct drm_bridge *bridge)1259{1260if (list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain))1261return NULL;12621263return drm_bridge_get(list_next_entry(bridge, chain_node));1264}12651266/**1267* drm_bridge_get_prev_bridge() - Get the previous bridge in the chain1268* @bridge: bridge object1269*1270* The caller is responsible of having a reference to @bridge via1271* drm_bridge_get() or equivalent. This function leaves the refcount of1272* @bridge unmodified.1273*1274* The refcount of the returned bridge is incremented. Use drm_bridge_put()1275* when done with it.1276*1277* RETURNS:1278* the previous bridge in the chain, or NULL if @bridge is the first.1279*/1280static inline struct drm_bridge *1281drm_bridge_get_prev_bridge(struct drm_bridge *bridge)1282{1283if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))1284return NULL;12851286return drm_bridge_get(list_prev_entry(bridge, chain_node));1287}12881289/**1290* drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain1291* @encoder: encoder object1292*1293* The refcount of the returned bridge is incremented. Use drm_bridge_put()1294* when done with it.1295*1296* RETURNS:1297* the first bridge in the chain, or NULL if @encoder has no bridge attached1298* to it.1299*/1300static inline struct drm_bridge *1301drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)1302{1303return drm_bridge_get(list_first_entry_or_null(&encoder->bridge_chain,1304struct drm_bridge, chain_node));1305}13061307/**1308* drm_bridge_chain_get_last_bridge() - Get the last bridge in the chain1309* @encoder: encoder object1310*1311* The refcount of the returned bridge is incremented. Use drm_bridge_put()1312* when done with it.1313*1314* RETURNS:1315* the last bridge in the chain, or NULL if @encoder has no bridge attached1316* to it.1317*/1318static inline struct drm_bridge *1319drm_bridge_chain_get_last_bridge(struct drm_encoder *encoder)1320{1321return drm_bridge_get(list_last_entry_or_null(&encoder->bridge_chain,1322struct drm_bridge, chain_node));1323}13241325/**1326* drm_bridge_get_next_bridge_and_put - Get the next bridge in the chain1327* and put the previous1328* @bridge: bridge object1329*1330* Same as drm_bridge_get_next_bridge() but additionally puts the @bridge.1331*1332* RETURNS:1333* the next bridge in the chain after @bridge, or NULL if @bridge is the last.1334*/1335static inline struct drm_bridge *1336drm_bridge_get_next_bridge_and_put(struct drm_bridge *bridge)1337{1338struct drm_bridge *next = drm_bridge_get_next_bridge(bridge);13391340drm_bridge_put(bridge);13411342return next;1343}13441345/**1346* drm_for_each_bridge_in_chain_scoped - iterate over all bridges attached1347* to an encoder1348* @encoder: the encoder to iterate bridges on1349* @bridge: a bridge pointer updated to point to the current bridge at each1350* iteration1351*1352* Iterate over all bridges present in the bridge chain attached to @encoder.1353*1354* Automatically gets/puts the bridge reference while iterating, and puts1355* the reference even if returning or breaking in the middle of the loop.1356*/1357#define drm_for_each_bridge_in_chain_scoped(encoder, bridge) \1358for (struct drm_bridge *bridge __free(drm_bridge_put) = \1359drm_bridge_chain_get_first_bridge(encoder); \1360bridge; \1361bridge = drm_bridge_get_next_bridge_and_put(bridge))13621363/**1364* drm_for_each_bridge_in_chain_from - iterate over all bridges starting1365* from the given bridge1366* @first_bridge: the bridge to start from1367* @bridge: a bridge pointer updated to point to the current bridge at each1368* iteration1369*1370* Iterate over all bridges in the encoder chain starting from1371* @first_bridge, included.1372*1373* Automatically gets/puts the bridge reference while iterating, and puts1374* the reference even if returning or breaking in the middle of the loop.1375*/1376#define drm_for_each_bridge_in_chain_from(first_bridge, bridge) \1377for (struct drm_bridge *bridge __free(drm_bridge_put) = \1378drm_bridge_get(first_bridge); \1379bridge; \1380bridge = drm_bridge_get_next_bridge_and_put(bridge))13811382enum drm_mode_status1383drm_bridge_chain_mode_valid(struct drm_bridge *bridge,1384const struct drm_display_info *info,1385const struct drm_display_mode *mode);1386void drm_bridge_chain_mode_set(struct drm_bridge *bridge,1387const struct drm_display_mode *mode,1388const struct drm_display_mode *adjusted_mode);13891390int drm_atomic_bridge_chain_check(struct drm_bridge *bridge,1391struct drm_crtc_state *crtc_state,1392struct drm_connector_state *conn_state);1393void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,1394struct drm_atomic_state *state);1395void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,1396struct drm_atomic_state *state);1397void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,1398struct drm_atomic_state *state);1399void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,1400struct drm_atomic_state *state);14011402u32 *1403drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge,1404struct drm_bridge_state *bridge_state,1405struct drm_crtc_state *crtc_state,1406struct drm_connector_state *conn_state,1407u32 output_fmt,1408unsigned int *num_input_fmts);14091410enum drm_connector_status1411drm_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connector);1412int drm_bridge_get_modes(struct drm_bridge *bridge,1413struct drm_connector *connector);1414const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge,1415struct drm_connector *connector);1416void drm_bridge_hpd_enable(struct drm_bridge *bridge,1417void (*cb)(void *data,1418enum drm_connector_status status),1419void *data);1420void drm_bridge_hpd_disable(struct drm_bridge *bridge);1421void drm_bridge_hpd_notify(struct drm_bridge *bridge,1422enum drm_connector_status status);14231424#ifdef CONFIG_DRM_PANEL_BRIDGE1425bool drm_bridge_is_panel(const struct drm_bridge *bridge);1426struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel);1427struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel,1428u32 connector_type);1429void drm_panel_bridge_remove(struct drm_bridge *bridge);1430int drm_panel_bridge_set_orientation(struct drm_connector *connector,1431struct drm_bridge *bridge);1432struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,1433struct drm_panel *panel);1434struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,1435struct drm_panel *panel,1436u32 connector_type);1437struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm,1438struct drm_panel *panel);1439struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);1440#else1441static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge)1442{1443return false;1444}14451446static inline int drm_panel_bridge_set_orientation(struct drm_connector *connector,1447struct drm_bridge *bridge)1448{1449return -EINVAL;1450}1451#endif14521453#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE)1454struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node,1455u32 port, u32 endpoint);1456struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node,1457u32 port, u32 endpoint);1458#else1459static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev,1460struct device_node *node,1461u32 port,1462u32 endpoint)1463{1464return ERR_PTR(-ENODEV);1465}14661467static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,1468struct device_node *node,1469u32 port,1470u32 endpoint)1471{1472return ERR_PTR(-ENODEV);1473}1474#endif14751476void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge);14771478void drm_bridge_debugfs_params(struct dentry *root);1479void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder);14801481#endif148214831484