From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sharma, Shashank" Subject: Re: [PATCH v4 1/4] drm: Add helper for DP++ adaptors Date: Wed, 04 May 2016 11:56:29 +0530 Message-ID: <57299615.7080006@intel.com> References: <1462287356-5893-1-git-send-email-ville.syrjala@linux.intel.com> <1462298189-14255-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1462298189-14255-1-git-send-email-ville.syrjala@linux.intel.com> Sender: stable-owner@vger.kernel.org To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org Cc: stable@vger.kernel.org, Tore Anderson , Paulo Zanoni , Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org Thanks for addressing my review comments. Reviewed-by: Shashank Sharma Regards Shashank On 5/3/2016 11:26 PM, ville.syrjala@linux.intel.com wrote: > From: Ville Syrj=C3=A4l=C3=A4 > > Add a helper which aids in the identification of DP dual mode > (aka. DP++) adaptors. There are several types of adaptors > specified: type 1 DVI, type 1 HDMI, type 2 DVI, type 2 HDMI > > Type 1 adaptors have a max TMDS clock limit of 165MHz, type 2 adaptor= s > may go as high as 300MHz and they provide a register informing the > source device what the actual limit is. Supposedly also type 1 adapto= rs > may optionally implement this register. This TMDS clock limit is the > main reason why we need to identify these adaptors. > > Type 1 adaptors provide access to their internal registers and the si= nk > DDC bus through I2C. Type 2 adaptors provide this access both via I2C > and I2C-over-AUX. A type 2 source device may choose to implement eith= er > of these methods. If a source device implements the I2C-over-AUX > method, then the driver will obviously need specific support for such > adaptors since the port is driven like an HDMI port, but DDC > communication happes over the AUX channel. > > This helper should be enough to identify the adaptor type (some > type 1 DVI adaptors may be a slight exception) and the maximum TMDS > clock limit. Another feature that may be available is control over > the TMDS output buffers on the adaptor, possibly allowing for some > power saving when the TMDS link is down. > > Other user controllable features that may be available in the adaptor= s > are downstream i2c bus speed control when using i2c-over-aux, and > some control over the CEC pin. I chose not to provide any helper > functions for those since I have no use for them in i915 at this time= =2E > The rest of the registers in the adaptor are mostly just information, > eg. IEEE OUI, hardware and firmware revision, etc. > > v2: Pass adaptor type to helper functions to ease driver implementati= on > Fix a bunch of typoes (Paulo) > Add DRM_DP_DUAL_MODE_UNKNOWN for the case where we don't (yet) k= now > the type (Paulo) > Reject 0x00 and 0xff DP_DUAL_MODE_MAX_TMDS_CLOCK values (Paulo) > Adjust drm_dp_dual_mode_detect() type2 vs. type1 detection to > ease future LSPCON enabling > Remove the unused DP_DUAL_MODE_LAST_RESERVED define > v3: Fix kernel doc function argument descriptions (Jani) > s/NONE/UNKNOWN/ in drm_dp_dual_mode_detect() docs > Add kernel doc for enum drm_dp_dual_mode_type > Actually build the docs > Fix more typoes > v4: Adjust code indentation of type2 adaptor detection (Shashank) > Add debug messages for failurs cases (Shashank) > > Cc: stable@vger.kernel.org > Cc: Tore Anderson > Cc: Paulo Zanoni > Cc: Shashank Sharma > Cc: Daniel Vetter > Cc: Shashank Sharma > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > Documentation/DocBook/gpu.tmpl | 6 + > drivers/gpu/drm/Makefile | 2 +- > drivers/gpu/drm/drm_dp_dual_mode_helper.c | 365 +++++++++++++++++++= +++++++++++ > include/drm/drm_dp_dual_mode_helper.h | 92 ++++++++ > 4 files changed, 464 insertions(+), 1 deletion(-) > create mode 100644 drivers/gpu/drm/drm_dp_dual_mode_helper.c > create mode 100644 include/drm/drm_dp_dual_mode_helper.h > > diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/g= pu.tmpl > index 1464fb2f3c46..c248124357df 100644 > --- a/Documentation/DocBook/gpu.tmpl > +++ b/Documentation/DocBook/gpu.tmpl > @@ -1623,6 +1623,12 @@ void intel_crt_init(struct drm_device *dev) > !Edrivers/gpu/drm/drm_dp_helper.c > > > + Display Port Dual Mode Adaptor Helper Functions Referen= ce > +!Pdrivers/gpu/drm/drm_dp_dual_mode_helper.c dp dual mode helpers > +!Iinclude/drm/drm_dp_dual_mode_helper.h > +!Edrivers/gpu/drm/drm_dp_dual_mode_helper.c > + > + > Display Port MST Helper Functions Reference > !Pdrivers/gpu/drm/drm_dp_mst_topology.c dp mst helper > !Iinclude/drm/drm_dp_mst_helper.h > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 1a26b4eb1ce0..29f2ee9b9534 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -23,7 +23,7 @@ drm-$(CONFIG_AGP) +=3D drm_agpsupport.o > > drm_kms_helper-y :=3D drm_crtc_helper.o drm_dp_helper.o drm_probe_h= elper.o \ > drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ > - drm_kms_helper_common.o > + drm_kms_helper_common.o drm_dp_dual_mode_helper.o > > drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) +=3D drm_edid_load.= o > drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fb_helper.o > diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/= drm/drm_dp_dual_mode_helper.c > new file mode 100644 > index 000000000000..6842178474ba > --- /dev/null > +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c > @@ -0,0 +1,365 @@ > +/* > + * Copyright =C2=A9 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtai= ning a > + * copy of this software and associated documentation files (the "So= ftware"), > + * to deal in the Software without restriction, including without li= mitation > + * the rights to use, copy, modify, merge, publish, distribute, subl= icense, > + * and/or sell copies of the Software, and to permit persons to whom= the > + * Software is furnished to do so, subject to the following conditio= ns: > + * > + * The above copyright notice and this permission notice shall be in= cluded in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, E= XPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTA= BILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVEN= T SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAM= AGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERW= ISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE US= E OR > + * OTHER DEALINGS IN THE SOFTWARE. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + * DOC: dp dual mode helpers > + * > + * Helper functions to deal with DP dual mode (aka. DP++) adaptors. > + * > + * Type 1: > + * Adaptor registers (if any) and the sink DDC bus may be accessed v= ia I2C. > + * > + * Type 2: > + * Adaptor registers and sink DDC bus can be accessed either via I2C= or > + * I2C-over-AUX. Source devices may choose to implement either of th= ese > + * access methods. > + */ > + > +#define DP_DUAL_MODE_SLAVE_ADDRESS 0x40 > + > +/** > + * drm_dp_dual_mode_read - Read from the DP dual mode adaptor regist= er(s) > + * @adapter: I2C adapter for the DDC bus > + * @offset: register offset > + * @buffer: buffer for return data > + * @size: sizo of the buffer > + * > + * Reads @size bytes from the DP dual mode adaptor registers > + * starting at @offset. > + * > + * Returns: > + * 0 on success, negative error code on failure > + */ > +ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, > + u8 offset, void *buffer, size_t size) > +{ > + struct i2c_msg msgs[] =3D { > + { > + .addr =3D DP_DUAL_MODE_SLAVE_ADDRESS, > + .flags =3D 0, > + .len =3D 1, > + .buf =3D &offset, > + }, > + { > + .addr =3D DP_DUAL_MODE_SLAVE_ADDRESS, > + .flags =3D I2C_M_RD, > + .len =3D size, > + .buf =3D buffer, > + }, > + }; > + int ret; > + > + ret =3D i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); > + if (ret < 0) > + return ret; > + if (ret !=3D ARRAY_SIZE(msgs)) > + return -EPROTO; > + > + return 0; > +} > + > +/** > + * drm_dp_dual_mode_write - Write to the DP dual mode adaptor regist= er(s) > + * @adapter: I2C adapter for the DDC bus > + * @offset: register offset > + * @buffer: buffer for write data > + * @size: sizo of the buffer > + * > + * Writes @size bytes to the DP dual mode adaptor registers > + * starting at @offset. > + * > + * Returns: > + * 0 on success, negative error code on failure > + */ > +ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, > + u8 offset, const void *buffer, size_t size) > +{ > + struct i2c_msg msg =3D { > + .addr =3D DP_DUAL_MODE_SLAVE_ADDRESS, > + .flags =3D 0, > + .len =3D 1 + size, > + .buf =3D NULL, > + }; > + void *data; > + int ret; > + > + data =3D kmalloc(msg.len, GFP_TEMPORARY); > + if (!data) > + return -ENOMEM; > + > + msg.buf =3D data; > + > + memcpy(data, &offset, 1); > + memcpy(data + 1, buffer, size); > + > + ret =3D i2c_transfer(adapter, &msg, 1); > + > + kfree(data); > + > + if (ret < 0) > + return ret; > + if (ret !=3D 1) > + return -EPROTO; > + > + return 0; > +} > +EXPORT_SYMBOL(drm_dp_dual_mode_write); > + > +static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_= LEN]) > +{ > + static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =3D > + "DP-HDMI ADAPTOR\x04"; > + > + return memcmp(hdmi_id, dp_dual_mode_hdmi_id, > + sizeof(dp_dual_mode_hdmi_id)) =3D=3D 0; > +} > + > +static bool is_type2_adaptor(uint8_t adaptor_id) > +{ > + return adaptor_id =3D=3D (DP_DUAL_MODE_TYPE_TYPE2 | > + DP_DUAL_MODE_REV_TYPE2); > +} > + > +/** > + * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor > + * @adapter: I2C adapter for the DDC bus > + * > + * Attempt to identify the type of the DP dual mode adaptor used. > + * > + * Note that when the answer is @DRM_DP_DUAL_MODE_UNKNOWN it's not > + * certain whether we're dealing with a native HDMI port or > + * a type 1 DVI dual mode adaptor. The driver will have to use > + * some other hardware/driver specific mechanism to make that > + * distinction. > + * > + * Returns: > + * The type of the DP dual mode adaptor used > + */ > +enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapte= r *adapter) > +{ > + char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =3D {}; > + uint8_t adaptor_id =3D 0x00; > + ssize_t ret; > + > + /* > + * Let's see if the adaptor is there the by reading the > + * HDMI ID registers. > + * > + * Note that type 1 DVI adaptors are not required to implemnt > + * any registers, and that presents a problem for detection. > + * If the i2c transfer is nacked, we may or may not be dealing > + * with a type 1 DVI adaptor. Some other mechanism of detecting > + * the presence of the adaptor is required. One way would be > + * to check the state of the CONFIG1 pin, Another method would > + * simply require the driver to know whether the port is a DP++ > + * port or a native HDMI port. Both of these methods are entirely > + * hardware/driver specific so we can't deal with them here. > + */ > + ret =3D drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_HDMI_ID, > + hdmi_id, sizeof(hdmi_id)); > + if (ret) > + return DRM_DP_DUAL_MODE_UNKNOWN; > + > + /* > + * Sigh. Some (maybe all?) type 1 adaptors are broken and ack > + * the offset but ignore it, and instead they just always return > + * data from the start of the HDMI ID buffer. So for a broken > + * type 1 HDMI adaptor a single byte read will always give us > + * 0x44, and for a type 1 DVI adaptor it should give 0x00 > + * (assuming it implements any registers). Fortunately neither > + * of those values will match the type 2 signature of the > + * DP_DUAL_MODE_ADAPTOR_ID register so we can proceed with > + * the type 2 adaptor detection safely even in the presence > + * of broken type 1 adaptors. > + */ > + ret =3D drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID, > + &adaptor_id, sizeof(adaptor_id)); > + if (ret =3D=3D 0) { > + if (is_type2_adaptor(adaptor_id)) { > + if (is_hdmi_adaptor(hdmi_id)) > + return DRM_DP_DUAL_MODE_TYPE2_HDMI; > + else > + return DRM_DP_DUAL_MODE_TYPE2_DVI; > + } > + } > + > + if (is_hdmi_adaptor(hdmi_id)) > + return DRM_DP_DUAL_MODE_TYPE1_HDMI; > + else > + return DRM_DP_DUAL_MODE_TYPE1_DVI; > +} > +EXPORT_SYMBOL(drm_dp_dual_mode_detect); > + > +/** > + * drm_dp_dual_mode_max_tmds_clock - Max TMDS clock for DP dual mode= adaptor > + * @type: DP dual mode adaptor type > + * @adapter: I2C adapter for the DDC bus > + * > + * Determine the max TMDS clock the adaptor supports based on the > + * type of the dual mode adaptor and the DP_DUAL_MODE_MAX_TMDS_CLOCK > + * register (on type2 adaptors). As some type 1 adaptors have > + * problems with registers (see comments in drm_dp_dual_mode_detect(= )) > + * we don't read the register on those, instead we simply assume > + * a 165 MHz limit based on the specification. > + * > + * Returns: > + * Maximum supported TMDS clock rate for the DP dual mode adaptor in= kHz. > + */ > +int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, > + struct i2c_adapter *adapter) > +{ > + uint8_t max_tmds_clock; > + ssize_t ret; > + > + /* native HDMI so no limit */ > + if (type =3D=3D DRM_DP_DUAL_MODE_NONE) > + return 0; > + > + /* > + * Type 1 adaptors are limited to 165MHz > + * Type 2 adaptors can tells us their limit > + */ > + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) > + return 165000; > + > + ret =3D drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_MAX_TMDS_CLOCK, > + &max_tmds_clock, sizeof(max_tmds_clock)); > + if (ret || max_tmds_clock =3D=3D 0x00 || max_tmds_clock =3D=3D 0xff= ) { > + DRM_DEBUG_KMS("Failed to query max TMDS clock\n"); > + return 165000; > + } > + > + return max_tmds_clock * 5000 / 2; > +} > +EXPORT_SYMBOL(drm_dp_dual_mode_max_tmds_clock); > + > +/** > + * drm_dp_dual_mode_get_tmds_output - Get the state of the TMDS outp= ut buffers in the DP dual mode adaptor > + * @type: DP dual mode adaptor type > + * @adapter: I2C adapter for the DDC bus > + * @enabled: current state of the TMDS output buffers > + * > + * Get the state of the TMDS output buffers in the adaptor. For > + * type2 adaptors this is queried from the DP_DUAL_MODE_TMDS_OEN > + * register. As some type 1 adaptors have problems with registers > + * (see comments in drm_dp_dual_mode_detect()) we don't read the > + * register on those, instead we simply assume that the buffers > + * are always enabled. > + * > + * Returns: > + * 0 on success, negative error code on failure > + */ > +int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type= , > + struct i2c_adapter *adapter, > + bool *enabled) > +{ > + uint8_t tmds_oen; > + ssize_t ret; > + > + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) { > + *enabled =3D true; > + return 0; > + } > + > + ret =3D drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_TMDS_OEN, > + &tmds_oen, sizeof(tmds_oen)); > + if (ret) { > + DRM_DEBUG_KMS("Failed to query state of TMDS output buffers\n"); > + return ret; > + } > + > + *enabled =3D !(tmds_oen & DP_DUAL_MODE_TMDS_DISABLE); > + > + return 0; > +} > +EXPORT_SYMBOL(drm_dp_dual_mode_get_tmds_output); > + > +/** > + * drm_dp_dual_mode_set_tmds_output - Enable/disable TMDS output buf= fers in the DP dual mode adaptor > + * @type: DP dual mode adaptor type > + * @adapter: I2C adapter for the DDC bus > + * @enable: enable (as opposed to disable) the TMDS output buffers > + * > + * Set the state of the TMDS output buffers in the adaptor. For > + * type2 this is set via the DP_DUAL_MODE_TMDS_OEN register. As > + * some type 1 adaptors have problems with registers (see comments > + * in drm_dp_dual_mode_detect()) we avoid touching the register, > + * making this function a no-op on type 1 adaptors. > + * > + * Returns: > + * 0 on success, negative error code on failure > + */ > +int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type= , > + struct i2c_adapter *adapter, bool enable) > +{ > + uint8_t tmds_oen =3D enable ? 0 : DP_DUAL_MODE_TMDS_DISABLE; > + ssize_t ret; > + > + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) > + return 0; > + > + ret =3D drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_TMDS_OEN, > + &tmds_oen, sizeof(tmds_oen)); > + if (ret) { > + DRM_DEBUG_KMS("Failed to %s TMDS output buffers\n", > + enable ? "enable" : "disable"); > + return ret; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_dp_dual_mode_set_tmds_output); > + > +/** > + * drm_dp_get_dual_mode_type_name - Get the name of the DP dual mode= adaptor type as a string > + * @type: DP dual mode adaptor type > + * > + * Returns: > + * String representation of the DP dual mode adaptor type > + */ > +const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_typ= e type) > +{ > + switch (type) { > + case DRM_DP_DUAL_MODE_NONE: > + return "none"; > + case DRM_DP_DUAL_MODE_TYPE1_DVI: > + return "type 1 DVI"; > + case DRM_DP_DUAL_MODE_TYPE1_HDMI: > + return "type 1 HDMI"; > + case DRM_DP_DUAL_MODE_TYPE2_DVI: > + return "type 2 DVI"; > + case DRM_DP_DUAL_MODE_TYPE2_HDMI: > + return "type 2 HDMI"; > + default: > + WARN_ON(type !=3D DRM_DP_DUAL_MODE_UNKNOWN); > + return "unknown"; > + } > +} > +EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name); > diff --git a/include/drm/drm_dp_dual_mode_helper.h b/include/drm/drm_= dp_dual_mode_helper.h > new file mode 100644 > index 000000000000..e8a9dfd0e055 > --- /dev/null > +++ b/include/drm/drm_dp_dual_mode_helper.h > @@ -0,0 +1,92 @@ > +/* > + * Copyright =C2=A9 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtai= ning a > + * copy of this software and associated documentation files (the "So= ftware"), > + * to deal in the Software without restriction, including without li= mitation > + * the rights to use, copy, modify, merge, publish, distribute, subl= icense, > + * and/or sell copies of the Software, and to permit persons to whom= the > + * Software is furnished to do so, subject to the following conditio= ns: > + * > + * The above copyright notice and this permission notice shall be in= cluded in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, E= XPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTA= BILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVEN= T SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAM= AGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERW= ISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE US= E OR > + * OTHER DEALINGS IN THE SOFTWARE. > + */ > + > +#ifndef DRM_DP_DUAL_MODE_HELPER_H > +#define DRM_DP_DUAL_MODE_HELPER_H > + > +#include > + > +/* > + * Optional for type 1 DVI adaptors > + * Mandatory for type 1 HDMI and type 2 adaptors > + */ > +#define DP_DUAL_MODE_HDMI_ID 0x00 /* 00-0f */ > +#define DP_DUAL_MODE_HDMI_ID_LEN 16 > +/* > + * Optional for type 1 adaptors > + * Mandatory for type 2 adaptors > + */ > +#define DP_DUAL_MODE_ADAPTOR_ID 0x10 > +#define DP_DUAL_MODE_REV_MASK 0x07 > +#define DP_DUAL_MODE_REV_TYPE2 0x00 > +#define DP_DUAL_MODE_TYPE_MASK 0xf0 > +#define DP_DUAL_MODE_TYPE_TYPE2 0xa0 > +#define DP_DUAL_MODE_IEEE_OUI 0x11 /* 11-13*/ > +#define DP_DUAL_IEEE_OUI_LEN 3 > +#define DP_DUAL_DEVICE_ID 0x14 /* 14-19 */ > +#define DP_DUAL_DEVICE_ID_LEN 6 > +#define DP_DUAL_MODE_HARDWARE_REV 0x1a > +#define DP_DUAL_MODE_FIRMWARE_MAJOR_REV 0x1b > +#define DP_DUAL_MODE_FIRMWARE_MINOR_REV 0x1c > +#define DP_DUAL_MODE_MAX_TMDS_CLOCK 0x1d > +#define DP_DUAL_MODE_I2C_SPEED_CAP 0x1e > +#define DP_DUAL_MODE_TMDS_OEN 0x20 > +#define DP_DUAL_MODE_TMDS_DISABLE 0x01 > +#define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21 > +#define DP_DUAL_MODE_CEC_ENABLE 0x01 > +#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22 > + > +struct i2c_adapter; > + > +ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, > + u8 offset, void *buffer, size_t size); > +ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, > + u8 offset, const void *buffer, size_t size); > + > +/** > + * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor > + * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor > + * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI ada= ptor > + * @DRM_DP_DUAL_MODE_TYPE1_DVI: Type 1 DVI adaptor > + * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor > + * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor > + * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor > + */ > +enum drm_dp_dual_mode_type { > + DRM_DP_DUAL_MODE_NONE, > + DRM_DP_DUAL_MODE_UNKNOWN, > + DRM_DP_DUAL_MODE_TYPE1_DVI, > + DRM_DP_DUAL_MODE_TYPE1_HDMI, > + DRM_DP_DUAL_MODE_TYPE2_DVI, > + DRM_DP_DUAL_MODE_TYPE2_HDMI, > +}; > + > +enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapte= r *adapter); > +int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, > + struct i2c_adapter *adapter); > +int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type= , > + struct i2c_adapter *adapter, bool *enabled); > +int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type= , > + struct i2c_adapter *adapter, bool enable); > +const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_typ= e type); > + > +#endif >