Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright © 2016 Intel Corporation
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 
0023 #ifndef DRM_DP_DUAL_MODE_HELPER_H
0024 #define DRM_DP_DUAL_MODE_HELPER_H
0025 
0026 #include <linux/types.h>
0027 
0028 /*
0029  * Optional for type 1 DVI adaptors
0030  * Mandatory for type 1 HDMI and type 2 adaptors
0031  */
0032 #define DP_DUAL_MODE_HDMI_ID 0x00 /* 00-0f */
0033 #define  DP_DUAL_MODE_HDMI_ID_LEN 16
0034 /*
0035  * Optional for type 1 adaptors
0036  * Mandatory for type 2 adaptors
0037  */
0038 #define DP_DUAL_MODE_ADAPTOR_ID 0x10
0039 #define  DP_DUAL_MODE_REV_MASK 0x07
0040 #define  DP_DUAL_MODE_REV_TYPE2 0x00
0041 #define  DP_DUAL_MODE_TYPE_MASK 0xf0
0042 #define  DP_DUAL_MODE_TYPE_TYPE2 0xa0
0043 /* This field is marked reserved in dual mode spec, used in LSPCON */
0044 #define  DP_DUAL_MODE_TYPE_HAS_DPCD 0x08
0045 #define DP_DUAL_MODE_IEEE_OUI 0x11 /* 11-13*/
0046 #define  DP_DUAL_IEEE_OUI_LEN 3
0047 #define DP_DUAL_DEVICE_ID 0x14 /* 14-19 */
0048 #define  DP_DUAL_DEVICE_ID_LEN 6
0049 #define DP_DUAL_MODE_HARDWARE_REV 0x1a
0050 #define DP_DUAL_MODE_FIRMWARE_MAJOR_REV 0x1b
0051 #define DP_DUAL_MODE_FIRMWARE_MINOR_REV 0x1c
0052 #define DP_DUAL_MODE_MAX_TMDS_CLOCK 0x1d
0053 #define DP_DUAL_MODE_I2C_SPEED_CAP 0x1e
0054 #define DP_DUAL_MODE_TMDS_OEN 0x20
0055 #define  DP_DUAL_MODE_TMDS_DISABLE 0x01
0056 #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
0057 #define  DP_DUAL_MODE_CEC_ENABLE 0x01
0058 #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22
0059 
0060 /* LSPCON specific registers, defined by MCA */
0061 #define DP_DUAL_MODE_LSPCON_MODE_CHANGE     0x40
0062 #define DP_DUAL_MODE_LSPCON_CURRENT_MODE        0x41
0063 #define  DP_DUAL_MODE_LSPCON_MODE_PCON          0x1
0064 
0065 struct drm_device;
0066 struct i2c_adapter;
0067 
0068 ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
0069                   u8 offset, void *buffer, size_t size);
0070 ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
0071                    u8 offset, const void *buffer, size_t size);
0072 
0073 /**
0074  * enum drm_lspcon_mode
0075  * @DRM_LSPCON_MODE_INVALID: No LSPCON.
0076  * @DRM_LSPCON_MODE_LS: Level shifter mode of LSPCON
0077  *  which drives DP++ to HDMI 1.4 conversion.
0078  * @DRM_LSPCON_MODE_PCON: Protocol converter mode of LSPCON
0079  *  which drives DP++ to HDMI 2.0 active conversion.
0080  */
0081 enum drm_lspcon_mode {
0082     DRM_LSPCON_MODE_INVALID,
0083     DRM_LSPCON_MODE_LS,
0084     DRM_LSPCON_MODE_PCON,
0085 };
0086 
0087 /**
0088  * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
0089  * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
0090  * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
0091  * @DRM_DP_DUAL_MODE_TYPE1_DVI: Type 1 DVI adaptor
0092  * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
0093  * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
0094  * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
0095  * @DRM_DP_DUAL_MODE_LSPCON: Level shifter / protocol converter
0096  */
0097 enum drm_dp_dual_mode_type {
0098     DRM_DP_DUAL_MODE_NONE,
0099     DRM_DP_DUAL_MODE_UNKNOWN,
0100     DRM_DP_DUAL_MODE_TYPE1_DVI,
0101     DRM_DP_DUAL_MODE_TYPE1_HDMI,
0102     DRM_DP_DUAL_MODE_TYPE2_DVI,
0103     DRM_DP_DUAL_MODE_TYPE2_HDMI,
0104     DRM_DP_DUAL_MODE_LSPCON,
0105 };
0106 
0107 enum drm_dp_dual_mode_type
0108 drm_dp_dual_mode_detect(const struct drm_device *dev, struct i2c_adapter *adapter);
0109 int drm_dp_dual_mode_max_tmds_clock(const struct drm_device *dev, enum drm_dp_dual_mode_type type,
0110                     struct i2c_adapter *adapter);
0111 int drm_dp_dual_mode_get_tmds_output(const struct drm_device *dev, enum drm_dp_dual_mode_type type,
0112                      struct i2c_adapter *adapter, bool *enabled);
0113 int drm_dp_dual_mode_set_tmds_output(const struct drm_device *dev, enum drm_dp_dual_mode_type type,
0114                      struct i2c_adapter *adapter, bool enable);
0115 const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
0116 
0117 int drm_lspcon_get_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
0118             enum drm_lspcon_mode *current_mode);
0119 int drm_lspcon_set_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
0120             enum drm_lspcon_mode reqd_mode);
0121 #endif