/*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/ctype.h>26#include <linux/list.h>27#include <linux/mutex.h>2829#include <drm/drm_atomic.h>30#include <drm/drm_encoder.h>31#include <drm/drm_mode_object.h>32#include <drm/drm_modes.h>3334struct cec_msg;35struct device_node;3637struct drm_bridge;38struct drm_bridge_timings;39struct drm_connector;40struct drm_display_info;41struct drm_minor;42struct drm_panel;43struct edid;44struct hdmi_codec_daifmt;45struct hdmi_codec_params;46struct i2c_adapter;4748/**49* enum drm_bridge_attach_flags - Flags for &drm_bridge_funcs.attach50*/51enum drm_bridge_attach_flags {52/**53* @DRM_BRIDGE_ATTACH_NO_CONNECTOR: When this flag is set the bridge54* shall not create a drm_connector.55*/56DRM_BRIDGE_ATTACH_NO_CONNECTOR = BIT(0),57};5859/**60* struct drm_bridge_funcs - drm_bridge control functions61*/62struct drm_bridge_funcs {63/**64* @attach:65*66* This callback is invoked whenever our bridge is being attached to a67* &drm_encoder. The flags argument tunes the behaviour of the attach68* operation (see DRM_BRIDGE_ATTACH_*).69*70* The @attach callback is optional.71*72* RETURNS:73*74* Zero on success, error code on failure.75*/76int (*attach)(struct drm_bridge *bridge, struct drm_encoder *encoder,77enum drm_bridge_attach_flags flags);7879/**80* @destroy:81*82* This callback is invoked when the bridge is about to be83* deallocated.84*85* The @destroy callback is optional.86*/87void (*destroy)(struct drm_bridge *bridge);8889/**90* @detach:91*92* This callback is invoked whenever our bridge is being detached from a93* &drm_encoder.94*95* The @detach callback is optional.96*/97void (*detach)(struct drm_bridge *bridge);9899/**100* @mode_valid:101*102* This callback is used to check if a specific mode is valid in this103* bridge. This should be implemented if the bridge has some sort of104* restriction in the modes it can display. For example, a given bridge105* may be responsible to set a clock value. If the clock can not106* produce all the values for the available modes then this callback107* can be used to restrict the number of modes to only the ones that108* can be displayed.109*110* This hook is used by the probe helpers to filter the mode list in111* drm_helper_probe_single_connector_modes(), and it is used by the112* atomic helpers to validate modes supplied by userspace in113* drm_atomic_helper_check_modeset().114*115* The @mode_valid callback is optional.116*117* NOTE:118*119* Since this function is both called from the check phase of an atomic120* commit, and the mode validation in the probe paths it is not allowed121* to look at anything else but the passed-in mode, and validate it122* against configuration-invariant hardware constraints. Any further123* limits which depend upon the configuration can only be checked in124* @mode_fixup.125*126* RETURNS:127*128* drm_mode_status Enum129*/130enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge,131const struct drm_display_info *info,132const struct drm_display_mode *mode);133134/**135* @mode_fixup:136*137* This callback is used to validate and adjust a mode. The parameter138* mode is the display mode that should be fed to the next element in139* the display chain, either the final &drm_connector or the next140* &drm_bridge. The parameter adjusted_mode is the input mode the bridge141* requires. It can be modified by this callback and does not need to142* match mode. See also &drm_crtc_state.adjusted_mode for more details.143*144* This is the only hook that allows a bridge to reject a modeset. If145* this function passes all other callbacks must succeed for this146* configuration.147*148* The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup()149* is not called when &drm_bridge_funcs.atomic_check() is implemented,150* so only one of them should be provided.151*152* NOTE:153*154* This function is called in the check phase of atomic modesets, which155* can be aborted for any reason (including on userspace's request to156* just check whether a configuration would be possible). Drivers MUST157* NOT touch any persistent state (hardware or software) or data158* structures except the passed in @state parameter.159*160* Also beware that userspace can request its own custom modes, neither161* core nor helpers filter modes to the list of probe modes reported by162* the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure163* that modes are filtered consistently put any bridge constraints and164* limits checks into @mode_valid.165*166* RETURNS:167*168* True if an acceptable configuration is possible, false if the modeset169* operation should be rejected.170*/171bool (*mode_fixup)(struct drm_bridge *bridge,172const struct drm_display_mode *mode,173struct drm_display_mode *adjusted_mode);174/**175* @disable:176*177* The @disable callback should disable the bridge.178*179* The bridge can assume that the display pipe (i.e. clocks and timing180* signals) feeding it is still running when this callback is called.181*182*183* If the preceding element is a &drm_bridge, then this is called before184* that bridge is disabled via one of:185*186* - &drm_bridge_funcs.disable187* - &drm_bridge_funcs.atomic_disable188*189* If the preceding element of the bridge is a display controller, then190* this callback is called before the encoder is disabled via one of:191*192* - &drm_encoder_helper_funcs.atomic_disable193* - &drm_encoder_helper_funcs.prepare194* - &drm_encoder_helper_funcs.disable195* - &drm_encoder_helper_funcs.dpms196*197* and the CRTC is disabled via one of:198*199* - &drm_crtc_helper_funcs.prepare200* - &drm_crtc_helper_funcs.atomic_disable201* - &drm_crtc_helper_funcs.disable202* - &drm_crtc_helper_funcs.dpms.203*204* The @disable callback is optional.205*206* NOTE:207*208* This is deprecated, do not use!209* New drivers shall use &drm_bridge_funcs.atomic_disable.210*/211void (*disable)(struct drm_bridge *bridge);212213/**214* @post_disable:215*216* The bridge must assume that the display pipe (i.e. clocks and timing217* signals) feeding this bridge is no longer running when the218* @post_disable is called.219*220* This callback should perform all the actions required by the hardware221* after it has stopped receiving signals from the preceding element.222*223* If the preceding element is a &drm_bridge, then this is called after224* that bridge is post-disabled (unless marked otherwise by the225* @pre_enable_prev_first flag) via one of:226*227* - &drm_bridge_funcs.post_disable228* - &drm_bridge_funcs.atomic_post_disable229*230* If the preceding element of the bridge is a display controller, then231* this callback is called after the encoder is disabled via one of:232*233* - &drm_encoder_helper_funcs.atomic_disable234* - &drm_encoder_helper_funcs.prepare235* - &drm_encoder_helper_funcs.disable236* - &drm_encoder_helper_funcs.dpms237*238* and the CRTC is disabled via one of:239*240* - &drm_crtc_helper_funcs.prepare241* - &drm_crtc_helper_funcs.atomic_disable242* - &drm_crtc_helper_funcs.disable243* - &drm_crtc_helper_funcs.dpms244*245* The @post_disable callback is optional.246*247* NOTE:248*249* This is deprecated, do not use!250* New drivers shall use &drm_bridge_funcs.atomic_post_disable.251*/252void (*post_disable)(struct drm_bridge *bridge);253254/**255* @mode_set:256*257* This callback should set the given mode on the bridge. It is called258* after the @mode_set callback for the preceding element in the display259* pipeline has been called already. If the bridge is the first element260* then this would be &drm_encoder_helper_funcs.mode_set. The display261* pipe (i.e. clocks and timing signals) is off when this function is262* called.263*264* The adjusted_mode parameter is the mode output by the CRTC for the265* first bridge in the chain. It can be different from the mode266* parameter that contains the desired mode for the connector at the end267* of the bridges chain, for instance when the first bridge in the chain268* performs scaling. The adjusted mode is mostly useful for the first269* bridge in the chain and is likely irrelevant for the other bridges.270*271* For atomic drivers the adjusted_mode is the mode stored in272* &drm_crtc_state.adjusted_mode.273*274* NOTE:275*276* This is deprecated, do not use!277* New drivers shall set their mode in the278* &drm_bridge_funcs.atomic_enable operation.279*/280void (*mode_set)(struct drm_bridge *bridge,281const struct drm_display_mode *mode,282const struct drm_display_mode *adjusted_mode);283/**284* @pre_enable:285*286* The display pipe (i.e. clocks and timing signals) feeding this bridge287* will not yet be running when the @pre_enable is called.288*289* This callback should perform all the necessary actions to prepare the290* bridge to accept signals from the preceding element.291*292* If the preceding element is a &drm_bridge, then this is called before293* that bridge is pre-enabled (unless marked otherwise by294* @pre_enable_prev_first flag) via one of:295*296* - &drm_bridge_funcs.pre_enable297* - &drm_bridge_funcs.atomic_pre_enable298*299* If the preceding element of the bridge is a display controller, then300* this callback is called before the CRTC is enabled via one of:301*302* - &drm_crtc_helper_funcs.atomic_enable303* - &drm_crtc_helper_funcs.commit304*305* and the encoder is enabled via one of:306*307* - &drm_encoder_helper_funcs.atomic_enable308* - &drm_encoder_helper_funcs.enable309* - &drm_encoder_helper_funcs.commit310*311* The @pre_enable callback is optional.312*313* NOTE:314*315* This is deprecated, do not use!316* New drivers shall use &drm_bridge_funcs.atomic_pre_enable.317*/318void (*pre_enable)(struct drm_bridge *bridge);319320/**321* @enable:322*323* The @enable callback should enable the bridge.324*325* The bridge can assume that the display pipe (i.e. clocks and timing326* signals) feeding it is running when this callback is called. This327* callback must enable the display link feeding the next bridge in the328* chain if there is one.329*330* If the preceding element is a &drm_bridge, then this is called after331* that bridge is enabled via one of:332*333* - &drm_bridge_funcs.enable334* - &drm_bridge_funcs.atomic_enable335*336* If the preceding element of the bridge is a display controller, then337* this callback is called after the CRTC is enabled via one of:338*339* - &drm_crtc_helper_funcs.atomic_enable340* - &drm_crtc_helper_funcs.commit341*342* and the encoder is enabled via one of:343*344* - &drm_encoder_helper_funcs.atomic_enable345* - &drm_encoder_helper_funcs.enable346* - drm_encoder_helper_funcs.commit347*348* The @enable callback is optional.349*350* NOTE:351*352* This is deprecated, do not use!353* New drivers shall use &drm_bridge_funcs.atomic_enable.354*/355void (*enable)(struct drm_bridge *bridge);356357/**358* @atomic_pre_enable:359*360* The display pipe (i.e. clocks and timing signals) feeding this bridge361* will not yet be running when the @atomic_pre_enable is called.362*363* This callback should perform all the necessary actions to prepare the364* bridge to accept signals from the preceding element.365*366* If the preceding element is a &drm_bridge, then this is called before367* that bridge is pre-enabled (unless marked otherwise by368* @pre_enable_prev_first flag) via one of:369*370* - &drm_bridge_funcs.pre_enable371* - &drm_bridge_funcs.atomic_pre_enable372*373* If the preceding element of the bridge is a display controller, then374* this callback is called before the CRTC is enabled via one of:375*376* - &drm_crtc_helper_funcs.atomic_enable377* - &drm_crtc_helper_funcs.commit378*379* and the encoder is enabled via one of:380*381* - &drm_encoder_helper_funcs.atomic_enable382* - &drm_encoder_helper_funcs.enable383* - &drm_encoder_helper_funcs.commit384*385* The @atomic_pre_enable callback is optional.386*/387void (*atomic_pre_enable)(struct drm_bridge *bridge,388struct drm_atomic_state *state);389390/**391* @atomic_enable:392*393* The @atomic_enable callback should enable the bridge.394*395* The bridge can assume that the display pipe (i.e. clocks and timing396* signals) feeding it is running when this callback is called. This397* callback must enable the display link feeding the next bridge in the398* chain if there is one.399*400* If the preceding element is a &drm_bridge, then this is called after401* that bridge is enabled via one of:402*403* - &drm_bridge_funcs.enable404* - &drm_bridge_funcs.atomic_enable405*406* If the preceding element of the bridge is a display controller, then407* this callback is called after the CRTC is enabled via one of:408*409* - &drm_crtc_helper_funcs.atomic_enable410* - &drm_crtc_helper_funcs.commit411*412* and the encoder is enabled via one of:413*414* - &drm_encoder_helper_funcs.atomic_enable415* - &drm_encoder_helper_funcs.enable416* - drm_encoder_helper_funcs.commit417*418* The @atomic_enable callback is optional.419*/420void (*atomic_enable)(struct drm_bridge *bridge,421struct drm_atomic_state *state);422/**423* @atomic_disable:424*425* The @atomic_disable callback should disable the bridge.426*427* The bridge can assume that the display pipe (i.e. clocks and timing428* signals) feeding it is still running when this callback is called.429*430* If the preceding element is a &drm_bridge, then this is called before431* that bridge is disabled via one of:432*433* - &drm_bridge_funcs.disable434* - &drm_bridge_funcs.atomic_disable435*436* If the preceding element of the bridge is a display controller, then437* this callback is called before the encoder is disabled via one of:438*439* - &drm_encoder_helper_funcs.atomic_disable440* - &drm_encoder_helper_funcs.prepare441* - &drm_encoder_helper_funcs.disable442* - &drm_encoder_helper_funcs.dpms443*444* and the CRTC is disabled via one of:445*446* - &drm_crtc_helper_funcs.prepare447* - &drm_crtc_helper_funcs.atomic_disable448* - &drm_crtc_helper_funcs.disable449* - &drm_crtc_helper_funcs.dpms.450*451* The @atomic_disable callback is optional.452*/453void (*atomic_disable)(struct drm_bridge *bridge,454struct drm_atomic_state *state);455456/**457* @atomic_post_disable:458*459* The bridge must assume that the display pipe (i.e. clocks and timing460* signals) feeding this bridge is no longer running when the461* @atomic_post_disable is called.462*463* This callback should perform all the actions required by the hardware464* after it has stopped receiving signals from the preceding element.465*466* If the preceding element is a &drm_bridge, then this is called after467* that bridge is post-disabled (unless marked otherwise by the468* @pre_enable_prev_first flag) via one of:469*470* - &drm_bridge_funcs.post_disable471* - &drm_bridge_funcs.atomic_post_disable472*473* If the preceding element of the bridge is a display controller, then474* this callback is called after the encoder is disabled via one of:475*476* - &drm_encoder_helper_funcs.atomic_disable477* - &drm_encoder_helper_funcs.prepare478* - &drm_encoder_helper_funcs.disable479* - &drm_encoder_helper_funcs.dpms480*481* and the CRTC is disabled via one of:482*483* - &drm_crtc_helper_funcs.prepare484* - &drm_crtc_helper_funcs.atomic_disable485* - &drm_crtc_helper_funcs.disable486* - &drm_crtc_helper_funcs.dpms487*488* The @atomic_post_disable callback is optional.489*/490void (*atomic_post_disable)(struct drm_bridge *bridge,491struct drm_atomic_state *state);492493/**494* @atomic_duplicate_state:495*496* Duplicate the current bridge state object (which is guaranteed to be497* non-NULL).498*499* The atomic_duplicate_state hook is mandatory if the bridge500* implements any of the atomic hooks, and should be left unassigned501* otherwise. For bridges that don't subclass &drm_bridge_state, the502* drm_atomic_helper_bridge_duplicate_state() helper function shall be503* used to implement this hook.504*505* RETURNS:506* A valid drm_bridge_state object or NULL if the allocation fails.507*/508struct drm_bridge_state *(*atomic_duplicate_state)(struct drm_bridge *bridge);509510/**511* @atomic_destroy_state:512*513* Destroy a bridge state object previously allocated by514* &drm_bridge_funcs.atomic_duplicate_state().515*516* The atomic_destroy_state hook is mandatory if the bridge implements517* any of the atomic hooks, and should be left unassigned otherwise.518* For bridges that don't subclass &drm_bridge_state, the519* drm_atomic_helper_bridge_destroy_state() helper function shall be520* used to implement this hook.521*/522void (*atomic_destroy_state)(struct drm_bridge *bridge,523struct drm_bridge_state *state);524525/**526* @atomic_get_output_bus_fmts:527*528* Return the supported bus formats on the output end of a bridge.529* The returned array must be allocated with kmalloc() and will be530* freed by the caller. If the allocation fails, NULL should be531* returned. num_output_fmts must be set to the returned array size.532* Formats listed in the returned array should be listed in decreasing533* preference order (the core will try all formats until it finds one534* that works).535*536* This method is only called on the last element of the bridge chain537* as part of the bus format negotiation process that happens in538* &drm_atomic_bridge_chain_select_bus_fmts().539* This method is optional. When not implemented, the core will540* fall back to &drm_connector.display_info.bus_formats[0] if541* &drm_connector.display_info.num_bus_formats > 0,542* or to MEDIA_BUS_FMT_FIXED otherwise.543*/544u32 *(*atomic_get_output_bus_fmts)(struct drm_bridge *bridge,545struct drm_bridge_state *bridge_state,546struct drm_crtc_state *crtc_state,547struct drm_connector_state *conn_state,548unsigned int *num_output_fmts);549550/**551* @atomic_get_input_bus_fmts:552*553* Return the supported bus formats on the input end of a bridge for554* a specific output bus format.555*556* The returned array must be allocated with kmalloc() and will be557* freed by the caller. If the allocation fails, NULL should be558* returned. num_input_fmts must be set to the returned array size.559* Formats listed in the returned array should be listed in decreasing560* preference order (the core will try all formats until it finds one561* that works). When the format is not supported NULL should be562* returned and num_input_fmts should be set to 0.563*564* This method is called on all elements of the bridge chain as part of565* the bus format negotiation process that happens in566* drm_atomic_bridge_chain_select_bus_fmts().567* This method is optional. When not implemented, the core will bypass568* bus format negotiation on this element of the bridge without569* failing, and the previous element in the chain will be passed570* MEDIA_BUS_FMT_FIXED as its output bus format.571*572* Bridge drivers that need to support being linked to bridges that are573* not supporting bus format negotiation should handle the574* output_fmt == MEDIA_BUS_FMT_FIXED case appropriately, by selecting a575* sensible default value or extracting this information from somewhere576* else (FW property, &drm_display_mode, &drm_display_info, ...)577*578* Note: Even if input format selection on the first bridge has no579* impact on the negotiation process (bus format negotiation stops once580* we reach the first element of the chain), drivers are expected to581* return accurate input formats as the input format may be used to582* configure the CRTC output appropriately.583*/584u32 *(*atomic_get_input_bus_fmts)(struct drm_bridge *bridge,585struct drm_bridge_state *bridge_state,586struct drm_crtc_state *crtc_state,587struct drm_connector_state *conn_state,588u32 output_fmt,589unsigned int *num_input_fmts);590591/**592* @atomic_check:593*594* This method is responsible for checking bridge state correctness.595* It can also check the state of the surrounding components in chain596* to make sure the whole pipeline can work properly.597*598* &drm_bridge_funcs.atomic_check() hooks are called in reverse599* order (from the last to the first bridge).600*601* This method is optional. &drm_bridge_funcs.mode_fixup() is not602* called when &drm_bridge_funcs.atomic_check() is implemented, so only603* one of them should be provided.604*605* If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or606* &drm_bridge_state.output_bus_cfg.flags it should happen in607* this function. By default the &drm_bridge_state.output_bus_cfg.flags608* field is set to the next bridge609* &drm_bridge_state.input_bus_cfg.flags value or610* &drm_connector.display_info.bus_flags if the bridge is the last611* element in the chain.612*613* RETURNS:614* zero if the check passed, a negative error code otherwise.615*/616int (*atomic_check)(struct drm_bridge *bridge,617struct drm_bridge_state *bridge_state,618struct drm_crtc_state *crtc_state,619struct drm_connector_state *conn_state);620621/**622* @atomic_reset:623*624* Reset the bridge to a predefined state (or retrieve its current625* state) and return a &drm_bridge_state object matching this state.626* This function is called at attach time.627*628* The atomic_reset hook is mandatory if the bridge implements any of629* the atomic hooks, and should be left unassigned otherwise. For630* bridges that don't subclass &drm_bridge_state, the631* drm_atomic_helper_bridge_reset() helper function shall be used to632* implement this hook.633*634* Note that the atomic_reset() semantics is not exactly matching the635* reset() semantics found on other components (connector, plane, ...).636*637* 1. The reset operation happens when the bridge is attached, not when638* drm_mode_config_reset() is called639* 2. It's meant to be used exclusively on bridges that have been640* converted to the ATOMIC API641*642* RETURNS:643* A valid drm_bridge_state object in case of success, an ERR_PTR()644* giving the reason of the failure otherwise.645*/646struct drm_bridge_state *(*atomic_reset)(struct drm_bridge *bridge);647648/**649* @detect:650*651* Check if anything is attached to the bridge output.652*653* This callback is optional, if not implemented the bridge will be654* considered as always having a component attached to its output.655* Bridges that implement this callback shall set the656* DRM_BRIDGE_OP_DETECT flag in their &drm_bridge->ops.657*658* RETURNS:659*660* drm_connector_status indicating the bridge output status.661*/662enum drm_connector_status (*detect)(struct drm_bridge *bridge,663struct drm_connector *connector);664665/**666* @get_modes:667*668* Fill all modes currently valid for the sink into the &drm_connector669* with drm_mode_probed_add().670*671* The @get_modes callback is mostly intended to support non-probeable672* displays such as many fixed panels. Bridges that support reading673* EDID shall leave @get_modes unimplemented and implement the674* &drm_bridge_funcs->edid_read callback instead.675*676* This callback is optional. Bridges that implement it shall set the677* DRM_BRIDGE_OP_MODES flag in their &drm_bridge->ops.678*679* The connector parameter shall be used for the sole purpose of680* filling modes, and shall not be stored internally by bridge drivers681* for future usage.682*683* RETURNS:684*685* The number of modes added by calling drm_mode_probed_add().686*/687int (*get_modes)(struct drm_bridge *bridge,688struct drm_connector *connector);689690/**691* @edid_read:692*693* Read the EDID data of the connected display.694*695* The @edid_read callback is the preferred way of reporting mode696* information for a display connected to the bridge output. Bridges697* that support reading EDID shall implement this callback and leave698* the @get_modes callback unimplemented.699*700* The caller of this operation shall first verify the output701* connection status and refrain from reading EDID from a disconnected702* output.703*704* This callback is optional. Bridges that implement it shall set the705* DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops.706*707* The connector parameter shall be used for the sole purpose of EDID708* retrieval, and shall not be stored internally by bridge drivers for709* future usage.710*711* RETURNS:712*713* An edid structure newly allocated with drm_edid_alloc() or returned714* from drm_edid_read() family of functions on success, or NULL715* otherwise. The caller is responsible for freeing the returned edid716* structure with drm_edid_free().717*/718const struct drm_edid *(*edid_read)(struct drm_bridge *bridge,719struct drm_connector *connector);720721/**722* @hpd_notify:723*724* Notify the bridge of hot plug detection.725*726* This callback is optional, it may be implemented by bridges that727* need to be notified of display connection or disconnection for728* internal reasons. One use case is to reset the internal state of CEC729* controllers for HDMI bridges.730*/731void (*hpd_notify)(struct drm_bridge *bridge,732enum drm_connector_status status);733734/**735* @hpd_enable:736*737* Enable hot plug detection. From now on the bridge shall call738* drm_bridge_hpd_notify() each time a change is detected in the output739* connection status, until hot plug detection gets disabled with740* @hpd_disable.741*742* This callback is optional and shall only be implemented by bridges743* that support hot-plug notification without polling. Bridges that744* implement it shall also implement the @hpd_disable callback and set745* the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.746*/747void (*hpd_enable)(struct drm_bridge *bridge);748749/**750* @hpd_disable:751*752* Disable hot plug detection. Once this function returns the bridge753* shall not call drm_bridge_hpd_notify() when a change in the output754* connection status occurs.755*756* This callback is optional and shall only be implemented by bridges757* that support hot-plug notification without polling. Bridges that758* implement it shall also implement the @hpd_enable callback and set759* the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops.760*/761void (*hpd_disable)(struct drm_bridge *bridge);762763/**764* @hdmi_tmds_char_rate_valid:765*766* Check whether a particular TMDS character rate is supported by the767* driver.768*769* This callback is optional and should only be implemented by the770* bridges that take part in the HDMI connector implementation. Bridges771* that implement it shall set the DRM_BRIDGE_OP_HDMI flag in their772* &drm_bridge->ops.773*774* Returns:775*776* Either &drm_mode_status.MODE_OK or one of the failure reasons777* in &enum drm_mode_status.778*/779enum drm_mode_status780(*hdmi_tmds_char_rate_valid)(const struct drm_bridge *bridge,781const struct drm_display_mode *mode,782unsigned long long tmds_rate);783784/**785* @hdmi_clear_infoframe:786*787* This callback clears the infoframes in the hardware during commit.788* It will be called multiple times, once for every disabled infoframe789* type.790*791* This callback is optional but it must be implemented by bridges that792* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.793*/794int (*hdmi_clear_infoframe)(struct drm_bridge *bridge,795enum hdmi_infoframe_type type);796/**797* @hdmi_write_infoframe:798*799* Program the infoframe into the hardware. It will be called multiple800* times, once for every updated infoframe type.801*802* This callback is optional but it must be implemented by bridges that803* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.804*/805int (*hdmi_write_infoframe)(struct drm_bridge *bridge,806enum hdmi_infoframe_type type,807const u8 *buffer, size_t len);808809/**810* @hdmi_audio_startup:811*812* Called when ASoC starts an audio stream setup.813*814* This callback is optional, it can be implemented by bridges that815* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.816*817* Returns:818* 0 on success, a negative error code otherwise819*/820int (*hdmi_audio_startup)(struct drm_bridge *bridge,821struct drm_connector *connector);822823/**824* @hdmi_audio_prepare:825* Configures HDMI-encoder for audio stream. Can be called multiple826* times for each setup.827*828* This callback is optional but it must be implemented by bridges that829* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.830*831* Returns:832* 0 on success, a negative error code otherwise833*/834int (*hdmi_audio_prepare)(struct drm_bridge *bridge,835struct drm_connector *connector,836struct hdmi_codec_daifmt *fmt,837struct hdmi_codec_params *hparms);838839/**840* @hdmi_audio_shutdown:841*842* Shut down the audio stream.843*844* This callback is optional but it must be implemented by bridges that845* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.846*847* Returns:848* 0 on success, a negative error code otherwise849*/850void (*hdmi_audio_shutdown)(struct drm_bridge *bridge,851struct drm_connector *connector);852853/**854* @hdmi_audio_mute_stream:855*856* Mute/unmute HDMI audio stream.857*858* This callback is optional, it can be implemented by bridges that859* set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.860*861* Returns:862* 0 on success, a negative error code otherwise863*/864int (*hdmi_audio_mute_stream)(struct drm_bridge *bridge,865struct drm_connector *connector,866bool enable, int direction);867868/**869* @hdmi_cec_init:870*871* Initialize CEC part of the bridge.872*873* This callback is optional, it can be implemented by bridges that874* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their875* &drm_bridge->ops.876*877* Returns:878* 0 on success, a negative error code otherwise879*/880int (*hdmi_cec_init)(struct drm_bridge *bridge,881struct drm_connector *connector);882883/**884* @hdmi_cec_enable:885*886* Enable or disable the CEC adapter inside the bridge.887*888* This callback is optional, it can be implemented by bridges that889* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their890* &drm_bridge->ops.891*892* Returns:893* 0 on success, a negative error code otherwise894*/895int (*hdmi_cec_enable)(struct drm_bridge *bridge, bool enable);896897/**898* @hdmi_cec_log_addr:899*900* Set the logical address of the CEC adapter inside the bridge.901*902* This callback is optional, it can be implemented by bridges that903* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their904* &drm_bridge->ops.905*906* Returns:907* 0 on success, a negative error code otherwise908*/909int (*hdmi_cec_log_addr)(struct drm_bridge *bridge, u8 logical_addr);910911/**912* @hdmi_cec_transmit:913*914* Transmit the message using the CEC adapter inside the bridge.915*916* This callback is optional, it can be implemented by bridges that917* set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their918* &drm_bridge->ops.919*920* Returns:921* 0 on success, a negative error code otherwise922*/923int (*hdmi_cec_transmit)(struct drm_bridge *bridge, u8 attempts,924u32 signal_free_time, struct cec_msg *msg);925926/**927* @dp_audio_startup:928*929* Called when ASoC starts a DisplayPort audio stream setup.930*931* This callback is optional, it can be implemented by bridges that932* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.933*934* Returns:935* 0 on success, a negative error code otherwise936*/937int (*dp_audio_startup)(struct drm_bridge *bridge,938struct drm_connector *connector);939940/**941* @dp_audio_prepare:942* Configures DisplayPort audio stream. Can be called multiple943* times for each setup.944*945* This callback is optional but it must be implemented by bridges that946* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.947*948* Returns:949* 0 on success, a negative error code otherwise950*/951int (*dp_audio_prepare)(struct drm_bridge *bridge,952struct drm_connector *connector,953struct hdmi_codec_daifmt *fmt,954struct hdmi_codec_params *hparms);955956/**957* @dp_audio_shutdown:958*959* Shut down the DisplayPort audio stream.960*961* This callback is optional but it must be implemented by bridges that962* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.963*964* Returns:965* 0 on success, a negative error code otherwise966*/967void (*dp_audio_shutdown)(struct drm_bridge *bridge,968struct drm_connector *connector);969970/**971* @dp_audio_mute_stream:972*973* Mute/unmute DisplayPort audio stream.974*975* This callback is optional, it can be implemented by bridges that976* set the @DRM_BRIDGE_OP_DP_AUDIO flag in their &drm_bridge->ops.977*978* Returns:979* 0 on success, a negative error code otherwise980*/981int (*dp_audio_mute_stream)(struct drm_bridge *bridge,982struct drm_connector *connector,983bool enable, int direction);984985/**986* @debugfs_init:987*988* Allows bridges to create bridge-specific debugfs files.989*/990void (*debugfs_init)(struct drm_bridge *bridge, struct dentry *root);991};992993/**994* struct drm_bridge_timings - timing information for the bridge995*/996struct drm_bridge_timings {997/**998* @input_bus_flags:999*1000* Tells what additional settings for the pixel data on the bus1001* this bridge requires (like pixel signal polarity). See also1002* &drm_display_info->bus_flags.1003*/1004u32 input_bus_flags;1005/**1006* @setup_time_ps:1007*1008* Defines the time in picoseconds the input data lines must be1009* stable before the clock edge.1010*/1011u32 setup_time_ps;1012/**1013* @hold_time_ps:1014*1015* Defines the time in picoseconds taken for the bridge to sample the1016* input signal after the clock edge.1017*/1018u32 hold_time_ps;1019/**1020* @dual_link:1021*1022* True if the bus operates in dual-link mode. The exact meaning is1023* dependent on the bus type. For LVDS buses, this indicates that even-1024* and odd-numbered pixels are received on separate links.1025*/1026bool dual_link;1027};10281029/**1030* enum drm_bridge_ops - Bitmask of operations supported by the bridge1031*/1032enum drm_bridge_ops {1033/**1034* @DRM_BRIDGE_OP_DETECT: The bridge can detect displays connected to1035* its output. Bridges that set this flag shall implement the1036* &drm_bridge_funcs->detect callback.1037*/1038DRM_BRIDGE_OP_DETECT = BIT(0),1039/**1040* @DRM_BRIDGE_OP_EDID: The bridge can retrieve the EDID of the display1041* connected to its output. Bridges that set this flag shall implement1042* the &drm_bridge_funcs->edid_read callback.1043*/1044DRM_BRIDGE_OP_EDID = BIT(1),1045/**1046* @DRM_BRIDGE_OP_HPD: The bridge can detect hot-plug and hot-unplug1047* without requiring polling. Bridges that set this flag shall1048* implement the &drm_bridge_funcs->hpd_enable and1049* &drm_bridge_funcs->hpd_disable callbacks if they support enabling1050* and disabling hot-plug detection dynamically.1051*/1052DRM_BRIDGE_OP_HPD = BIT(2),1053/**1054* @DRM_BRIDGE_OP_MODES: The bridge can retrieve the modes supported1055* by the display at its output. This does not include reading EDID1056* which is separately covered by @DRM_BRIDGE_OP_EDID. Bridges that set1057* this flag shall implement the &drm_bridge_funcs->get_modes callback.1058*/1059DRM_BRIDGE_OP_MODES = BIT(3),1060/**1061* @DRM_BRIDGE_OP_HDMI: The bridge provides HDMI connector operations,1062* including infoframes support. Bridges that set this flag must1063* implement the &drm_bridge_funcs->write_infoframe callback.1064*1065* Note: currently there can be at most one bridge in a chain that sets1066* this bit. This is to simplify corresponding glue code in connector1067* drivers.1068*/1069DRM_BRIDGE_OP_HDMI = BIT(4),1070/**1071* @DRM_BRIDGE_OP_HDMI_AUDIO: The bridge provides HDMI audio operations.1072* Bridges that set this flag must implement the1073* &drm_bridge_funcs->hdmi_audio_prepare and1074* &drm_bridge_funcs->hdmi_audio_shutdown callbacks.1075*1076* Note: currently there can be at most one bridge in a chain that sets1077* this bit. This is to simplify corresponding glue code in connector1078* drivers. Also it is not possible to have a bridge in the chain that1079* sets @DRM_BRIDGE_OP_DP_AUDIO if there is a bridge that sets this1080* flag.1081*/1082DRM_BRIDGE_OP_HDMI_AUDIO = BIT(5),1083/**1084* @DRM_BRIDGE_OP_DP_AUDIO: The bridge provides DisplayPort audio operations.1085* Bridges that set this flag must implement the1086* &drm_bridge_funcs->dp_audio_prepare and1087* &drm_bridge_funcs->dp_audio_shutdown callbacks.1088*1089* Note: currently there can be at most one bridge in a chain that sets1090* this bit. This is to simplify corresponding glue code in connector1091* drivers. Also it is not possible to have a bridge in the chain that1092* sets @DRM_BRIDGE_OP_HDMI_AUDIO if there is a bridge that sets this1093* flag.1094*/1095DRM_BRIDGE_OP_DP_AUDIO = BIT(6),1096/**1097* @DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER: The bridge requires CEC notifier1098* to be present.1099*/1100DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER = BIT(7),1101/**1102* @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER: The bridge requires CEC adapter1103* to be present.1104*/1105DRM_BRIDGE_OP_HDMI_CEC_ADAPTER = BIT(8),1106};11071108/**1109* struct drm_bridge - central DRM bridge control structure1110*/1111struct drm_bridge {1112/** @base: inherit from &drm_private_object */1113struct drm_private_obj base;1114/** @dev: DRM device this bridge belongs to */1115struct drm_device *dev;1116/** @encoder: encoder to which this bridge is connected */1117struct drm_encoder *encoder;1118/** @chain_node: used to form a bridge chain */1119struct list_head chain_node;1120/** @of_node: device node pointer to the bridge */1121struct device_node *of_node;1122/** @list: to keep track of all added bridges */1123struct list_head list;1124/**1125* @timings:1126*1127* the timing specification for the bridge, if any (may be NULL)1128*/1129const struct drm_bridge_timings *timings;1130/** @funcs: control functions */1131const struct drm_bridge_funcs *funcs;11321133/**1134* @container: Pointer to the private driver struct embedding this1135* @struct drm_bridge.1136*/1137void *container;11381139/**1140* @refcount: reference count of users referencing this bridge.1141*/1142struct kref refcount;11431144/** @driver_private: pointer to the bridge driver's internal context */1145void *driver_private;1146/** @ops: bitmask of operations supported by the bridge */1147enum drm_bridge_ops ops;1148/**1149* @type: Type of the connection at the bridge output1150* (DRM_MODE_CONNECTOR_*). For bridges at the end of this chain this1151* identifies the type of connected display.1152*/1153int type;1154/**1155* @interlace_allowed: Indicate that the bridge can handle interlaced1156* modes.1157*/1158bool interlace_allowed;1159/**1160* @ycbcr_420_allowed: Indicate that the bridge can handle YCbCr 4201161* output.1162*/1163bool ycbcr_420_allowed;1164/**1165* @pre_enable_prev_first: The bridge requires that the prev1166* bridge @pre_enable function is called before its @pre_enable,1167* and conversely for post_disable. This is most frequently a1168* requirement for DSI devices which need the host to be initialised1169* before the peripheral.1170*/1171bool pre_enable_prev_first;1172/**1173* @ddc: Associated I2C adapter for DDC access, if any.1174*/1175struct i2c_adapter *ddc;11761177/**1178* @vendor: Vendor of the product to be used for the SPD InfoFrame1179* generation. This is required if @DRM_BRIDGE_OP_HDMI is set.1180*/1181const char *vendor;11821183/**1184* @product: Name of the product to be used for the SPD InfoFrame1185* generation. This is required if @DRM_BRIDGE_OP_HDMI is set.1186*/1187const char *product;11881189/**1190* @supported_formats: Bitmask of @hdmi_colorspace listing supported1191* output formats. This is only relevant if @DRM_BRIDGE_OP_HDMI is set.1192*/1193unsigned int supported_formats;11941195/**1196* @max_bpc: Maximum bits per char the HDMI bridge supports. Allowed1197* values are 8, 10 and 12. This is only relevant if1198* @DRM_BRIDGE_OP_HDMI is set.1199*/1200unsigned int max_bpc;12011202/**1203* @hdmi_cec_dev: device to be used as a containing device for CEC1204* functions.1205*/1206struct device *hdmi_cec_dev;12071208/**1209* @hdmi_audio_dev: device to be used as a parent for the HDMI Codec if1210* either of @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO is set.1211*/1212struct device *hdmi_audio_dev;12131214/**1215* @hdmi_audio_max_i2s_playback_channels: maximum number of playback1216* I2S channels for the @DRM_BRIDGE_OP_HDMI_AUDIO or1217* @DRM_BRIDGE_OP_DP_AUDIO.1218*/1219int hdmi_audio_max_i2s_playback_channels;12201221/**1222* @hdmi_audio_i2s_formats: supported I2S formats, optional. The1223* default is to allow all formats supported by the corresponding I2S1224* bus driver. This is only used for bridges setting1225* @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO.1226*/1227u64 hdmi_audio_i2s_formats;12281229/**1230* @hdmi_audio_spdif_playback: set if this bridge has S/PDIF playback1231* port for @DRM_BRIDGE_OP_HDMI_AUDIO or @DRM_BRIDGE_OP_DP_AUDIO.1232*/1233unsigned int hdmi_audio_spdif_playback : 1;12341235/**1236* @hdmi_audio_dai_port: sound DAI port for either of1237* @DRM_BRIDGE_OP_HDMI_AUDIO and @DRM_BRIDGE_OP_DP_AUDIO, -1 if it is1238* not used.1239*/1240int hdmi_audio_dai_port;12411242/**1243* @hdmi_cec_adapter_name: the name of the adapter to register1244*/1245const char *hdmi_cec_adapter_name;12461247/**1248* @hdmi_cec_available_las: number of logical addresses, CEC_MAX_LOG_ADDRS if unset1249*/1250u8 hdmi_cec_available_las;12511252/** private: */1253/**1254* @hpd_mutex: Protects the @hpd_cb and @hpd_data fields.1255*/1256struct mutex hpd_mutex;1257/**1258* @hpd_cb: Hot plug detection callback, registered with1259* drm_bridge_hpd_enable().1260*/1261void (*hpd_cb)(void *data, enum drm_connector_status status);1262/**1263* @hpd_data: Private data passed to the Hot plug detection callback1264* @hpd_cb.1265*/1266void *hpd_data;1267};12681269static inline struct drm_bridge *1270drm_priv_to_bridge(struct drm_private_obj *priv)1271{1272return container_of(priv, struct drm_bridge, base);1273}12741275struct drm_bridge *drm_bridge_get(struct drm_bridge *bridge);1276void drm_bridge_put(struct drm_bridge *bridge);12771278void *__devm_drm_bridge_alloc(struct device *dev, size_t size, size_t offset,1279const struct drm_bridge_funcs *funcs);12801281/**1282* devm_drm_bridge_alloc - Allocate and initialize a bridge1283* @dev: struct device of the bridge device1284* @type: the type of the struct which contains struct &drm_bridge1285* @member: the name of the &drm_bridge within @type1286* @funcs: callbacks for this bridge1287*1288* The reference count of the returned bridge is initialized to 1. This1289* reference will be automatically dropped via devm (by calling1290* drm_bridge_put()) when @dev is removed.1291*1292* Returns:1293* Pointer to new bridge, or ERR_PTR on failure.1294*/1295#define devm_drm_bridge_alloc(dev, type, member, funcs) \1296((type *)__devm_drm_bridge_alloc(dev, sizeof(type), \1297offsetof(type, member), funcs))12981299void drm_bridge_add(struct drm_bridge *bridge);1300int devm_drm_bridge_add(struct device *dev, struct drm_bridge *bridge);1301void drm_bridge_remove(struct drm_bridge *bridge);1302int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,1303struct drm_bridge *previous,1304enum drm_bridge_attach_flags flags);13051306#ifdef CONFIG_OF1307struct drm_bridge *of_drm_find_bridge(struct device_node *np);1308#else1309static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)1310{1311return NULL;1312}1313#endif13141315/**1316* drm_bridge_get_current_state() - Get the current bridge state1317* @bridge: bridge object1318*1319* This function must be called with the modeset lock held.1320*1321* RETURNS:1322*1323* The current bridge state, or NULL if there is none.1324*/1325static inline struct drm_bridge_state *1326drm_bridge_get_current_state(struct drm_bridge *bridge)1327{1328if (!bridge)1329return NULL;13301331/*1332* Only atomic bridges will have bridge->base initialized by1333* drm_atomic_private_obj_init(), so we need to make sure we're1334* working with one before we try to use the lock.1335*/1336if (!bridge->funcs || !bridge->funcs->atomic_reset)1337return NULL;13381339drm_modeset_lock_assert_held(&bridge->base.lock);13401341if (!bridge->base.state)1342return NULL;13431344return drm_priv_to_bridge_state(bridge->base.state);1345}13461347/**1348* drm_bridge_get_next_bridge() - Get the next bridge in the chain1349* @bridge: bridge object1350*1351* RETURNS:1352* the next bridge in the chain after @bridge, or NULL if @bridge is the last.1353*/1354static inline struct drm_bridge *1355drm_bridge_get_next_bridge(struct drm_bridge *bridge)1356{1357if (list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain))1358return NULL;13591360return list_next_entry(bridge, chain_node);1361}13621363/**1364* drm_bridge_get_prev_bridge() - Get the previous bridge in the chain1365* @bridge: bridge object1366*1367* RETURNS:1368* the previous bridge in the chain, or NULL if @bridge is the first.1369*/1370static inline struct drm_bridge *1371drm_bridge_get_prev_bridge(struct drm_bridge *bridge)1372{1373if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))1374return NULL;13751376return list_prev_entry(bridge, chain_node);1377}13781379/**1380* drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain1381* @encoder: encoder object1382*1383* RETURNS:1384* the first bridge in the chain, or NULL if @encoder has no bridge attached1385* to it.1386*/1387static inline struct drm_bridge *1388drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)1389{1390return list_first_entry_or_null(&encoder->bridge_chain,1391struct drm_bridge, chain_node);1392}13931394/**1395* drm_for_each_bridge_in_chain() - Iterate over all bridges present in a chain1396* @encoder: the encoder to iterate bridges on1397* @bridge: a bridge pointer updated to point to the current bridge at each1398* iteration1399*1400* Iterate over all bridges present in the bridge chain attached to @encoder.1401*/1402#define drm_for_each_bridge_in_chain(encoder, bridge) \1403list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)14041405enum drm_mode_status1406drm_bridge_chain_mode_valid(struct drm_bridge *bridge,1407const struct drm_display_info *info,1408const struct drm_display_mode *mode);1409void drm_bridge_chain_mode_set(struct drm_bridge *bridge,1410const struct drm_display_mode *mode,1411const struct drm_display_mode *adjusted_mode);14121413int drm_atomic_bridge_chain_check(struct drm_bridge *bridge,1414struct drm_crtc_state *crtc_state,1415struct drm_connector_state *conn_state);1416void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,1417struct drm_atomic_state *state);1418void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,1419struct drm_atomic_state *state);1420void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,1421struct drm_atomic_state *state);1422void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,1423struct drm_atomic_state *state);14241425u32 *1426drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge,1427struct drm_bridge_state *bridge_state,1428struct drm_crtc_state *crtc_state,1429struct drm_connector_state *conn_state,1430u32 output_fmt,1431unsigned int *num_input_fmts);14321433enum drm_connector_status1434drm_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connector);1435int drm_bridge_get_modes(struct drm_bridge *bridge,1436struct drm_connector *connector);1437const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge,1438struct drm_connector *connector);1439void drm_bridge_hpd_enable(struct drm_bridge *bridge,1440void (*cb)(void *data,1441enum drm_connector_status status),1442void *data);1443void drm_bridge_hpd_disable(struct drm_bridge *bridge);1444void drm_bridge_hpd_notify(struct drm_bridge *bridge,1445enum drm_connector_status status);14461447#ifdef CONFIG_DRM_PANEL_BRIDGE1448bool drm_bridge_is_panel(const struct drm_bridge *bridge);1449struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel);1450struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel,1451u32 connector_type);1452void drm_panel_bridge_remove(struct drm_bridge *bridge);1453int drm_panel_bridge_set_orientation(struct drm_connector *connector,1454struct drm_bridge *bridge);1455struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,1456struct drm_panel *panel);1457struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,1458struct drm_panel *panel,1459u32 connector_type);1460struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm,1461struct drm_panel *panel);1462struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);1463#else1464static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge)1465{1466return false;1467}14681469static inline int drm_panel_bridge_set_orientation(struct drm_connector *connector,1470struct drm_bridge *bridge)1471{1472return -EINVAL;1473}1474#endif14751476#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE)1477struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node,1478u32 port, u32 endpoint);1479struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node,1480u32 port, u32 endpoint);1481#else1482static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev,1483struct device_node *node,1484u32 port,1485u32 endpoint)1486{1487return ERR_PTR(-ENODEV);1488}14891490static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,1491struct device_node *node,1492u32 port,1493u32 endpoint)1494{1495return ERR_PTR(-ENODEV);1496}1497#endif14981499void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge);15001501void drm_bridge_debugfs_params(struct dentry *root);1502void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder);15031504#endif150515061507