lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210251126.OHP8vg0l-lkp@intel.com>
Date:   Tue, 25 Oct 2022 11:18:13 +0800
From:   kernel test robot <lkp@...el.com>
To:     Lewis Huang <Lewis.Huang@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Alex Deucher <alexander.deucher@....com>,
        Wenjing Liu <Wenjing.Liu@....com>
Subject: [agd5f:drm-next 77/81]
 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:5044:24: warning:
 implicit conversion from 'enum <anonymous>' to 'enum dc_status'

tree:   https://gitlab.freedesktop.org/agd5f/linux.git drm-next
head:   34d84636e5e09521d031863a01f9b9fb22ffa875
commit: b473bd5fc333ab02479444dd4a51be5f5e324d97 [77/81] drm/amd/display: refine wake up aux in retrieve link caps
config: sparc-allyesconfig
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add agd5f https://gitlab.freedesktop.org/agd5f/linux.git
        git fetch --no-tags agd5f drm-next
        git checkout b473bd5fc333ab02479444dd4a51be5f5e324d97
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c: In function 'dp_retrieve_lttpr_cap':
>> drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:5044:24: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_status' [-Wenum-conversion]
    5044 |                 return false;
         |                        ^~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c: At top level:
>> drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:5230:16: warning: no previous prototype for 'wake_up_aux_channel' [-Wmissing-prototypes]
    5230 | enum dc_status wake_up_aux_channel(struct dc_link *link)
         |                ^~~~~~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/resource.h:28,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:31:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~


vim +5044 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c

96577cf82a1331 Hersen Wu        2020-01-14  5033  
b473bd5fc333ab Lewis Huang      2022-10-20  5034  enum dc_status dp_retrieve_lttpr_cap(struct dc_link *link)
77361ed89a8b03 Jimmy Kizito     2022-03-24  5035  {
77361ed89a8b03 Jimmy Kizito     2022-03-24  5036  	uint8_t lttpr_dpcd_data[8];
77361ed89a8b03 Jimmy Kizito     2022-03-24  5037  	enum dc_status status = DC_ERROR_UNEXPECTED;
77361ed89a8b03 Jimmy Kizito     2022-03-24  5038  	bool is_lttpr_present = false;
77361ed89a8b03 Jimmy Kizito     2022-03-24  5039  
e844cc250f33d2 Michael Strauss  2022-07-25  5040  	/* Logic to determine LTTPR support*/
e844cc250f33d2 Michael Strauss  2022-07-25  5041  	bool vbios_lttpr_interop = link->dc->caps.vbios_lttpr_aware;
0bbd1c7de319ca George Shen      2022-01-31  5042  
e844cc250f33d2 Michael Strauss  2022-07-25  5043  	if (!vbios_lttpr_interop || !link->dc->caps.extended_aux_timeout_support)
e844cc250f33d2 Michael Strauss  2022-07-25 @5044  		return false;
0bbd1c7de319ca George Shen      2022-01-31  5045  
c797ede0ec89f1 Wenjing Liu      2020-06-01  5046  	/* By reading LTTPR capability, RX assumes that we will enable
7809fc00e20e6e Wesley Chalmers  2021-03-17  5047  	 * LTTPR extended aux timeout if LTTPR is present.
c797ede0ec89f1 Wenjing Liu      2020-06-01  5048  	 */
e844cc250f33d2 Michael Strauss  2022-07-25  5049  	status = core_link_read_dpcd(link,
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5050  			DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV,
4d1d699f479dc8 Michael Strauss  2022-05-06  5051  			lttpr_dpcd_data,
4d1d699f479dc8 Michael Strauss  2022-05-06  5052  			sizeof(lttpr_dpcd_data));
3b90318d44f87a Michael Strauss  2022-04-22  5053  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5054  	link->dpcd_caps.lttpr_caps.revision.raw =
4d1d699f479dc8 Michael Strauss  2022-05-06  5055  			lttpr_dpcd_data[DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5056  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
8e5100a575433c abdoulaye berthe 2019-07-19  5057  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5058  	link->dpcd_caps.lttpr_caps.max_link_rate =
4d1d699f479dc8 Michael Strauss  2022-05-06  5059  			lttpr_dpcd_data[DP_MAX_LINK_RATE_PHY_REPEATER -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5060  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
8e5100a575433c abdoulaye berthe 2019-07-19  5061  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5062  	link->dpcd_caps.lttpr_caps.phy_repeater_cnt =
4d1d699f479dc8 Michael Strauss  2022-05-06  5063  			lttpr_dpcd_data[DP_PHY_REPEATER_CNT -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5064  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
8e5100a575433c abdoulaye berthe 2019-07-19  5065  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5066  	link->dpcd_caps.lttpr_caps.max_lane_count =
4d1d699f479dc8 Michael Strauss  2022-05-06  5067  			lttpr_dpcd_data[DP_MAX_LANE_COUNT_PHY_REPEATER -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5068  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
8e5100a575433c abdoulaye berthe 2019-07-19  5069  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5070  	link->dpcd_caps.lttpr_caps.mode =
4d1d699f479dc8 Michael Strauss  2022-05-06  5071  			lttpr_dpcd_data[DP_PHY_REPEATER_MODE -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5072  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
8e5100a575433c abdoulaye berthe 2019-07-19  5073  
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5074  	link->dpcd_caps.lttpr_caps.max_ext_timeout =
4d1d699f479dc8 Michael Strauss  2022-05-06  5075  			lttpr_dpcd_data[DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT -
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5076  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
f01ee019586220 Fangzhi Zuo      2021-08-03  5077  	link->dpcd_caps.lttpr_caps.main_link_channel_coding.raw =
4d1d699f479dc8 Michael Strauss  2022-05-06  5078  			lttpr_dpcd_data[DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER -
f01ee019586220 Fangzhi Zuo      2021-08-03  5079  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
f01ee019586220 Fangzhi Zuo      2021-08-03  5080  
f01ee019586220 Fangzhi Zuo      2021-08-03  5081  	link->dpcd_caps.lttpr_caps.supported_128b_132b_rates.raw =
4d1d699f479dc8 Michael Strauss  2022-05-06  5082  			lttpr_dpcd_data[DP_PHY_REPEATER_128B132B_RATES -
f01ee019586220 Fangzhi Zuo      2021-08-03  5083  							DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
f01ee019586220 Fangzhi Zuo      2021-08-03  5084  
47c2790ad69d1f Michael Strauss  2022-08-31  5085  	/* If this chip cap is set, at least one retimer must exist in the chain
e844cc250f33d2 Michael Strauss  2022-07-25  5086  	 * Override count to 1 if we receive a known bad count (0 or an invalid value)
e844cc250f33d2 Michael Strauss  2022-07-25  5087  	 */
47c2790ad69d1f Michael Strauss  2022-08-31  5088  	if (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN &&
47c2790ad69d1f Michael Strauss  2022-08-31  5089  			(dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) == 0)) {
47c2790ad69d1f Michael Strauss  2022-08-31  5090  		ASSERT(0);
47c2790ad69d1f Michael Strauss  2022-08-31  5091  		link->dpcd_caps.lttpr_caps.phy_repeater_cnt = 0x80;
345d6493476615 Leo Chen         2022-09-16  5092  		DC_LOG_DC("lttpr_caps forced phy_repeater_cnt = %d\n", link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
47c2790ad69d1f Michael Strauss  2022-08-31  5093  	}
47c2790ad69d1f Michael Strauss  2022-08-31  5094  
ede4f6dac99e4b Jimmy Kizito     2021-04-05  5095  	/* Attempt to train in LTTPR transparent mode if repeater count exceeds 8. */
e844cc250f33d2 Michael Strauss  2022-07-25  5096  	is_lttpr_present = dp_is_lttpr_present(link);
e844cc250f33d2 Michael Strauss  2022-07-25  5097  
e844cc250f33d2 Michael Strauss  2022-07-25  5098  	if (is_lttpr_present)
e844cc250f33d2 Michael Strauss  2022-07-25  5099  		CONN_DATA_DETECT(link, lttpr_dpcd_data, sizeof(lttpr_dpcd_data), "LTTPR Caps: ");
e844cc250f33d2 Michael Strauss  2022-07-25  5100  
345d6493476615 Leo Chen         2022-09-16  5101  	DC_LOG_DC("is_lttpr_present = %d\n", is_lttpr_present);
b473bd5fc333ab Lewis Huang      2022-10-20  5102  	return status;
e844cc250f33d2 Michael Strauss  2022-07-25  5103  }
e844cc250f33d2 Michael Strauss  2022-07-25  5104  
e844cc250f33d2 Michael Strauss  2022-07-25  5105  bool dp_is_lttpr_present(struct dc_link *link)
e844cc250f33d2 Michael Strauss  2022-07-25  5106  {
e844cc250f33d2 Michael Strauss  2022-07-25  5107  	return (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) != 0 &&
e844cc250f33d2 Michael Strauss  2022-07-25  5108  			link->dpcd_caps.lttpr_caps.max_lane_count > 0 &&
61aa7a6f760e78 abdoulaye berthe 2019-10-10  5109  			link->dpcd_caps.lttpr_caps.max_lane_count <= 4 &&
c797ede0ec89f1 Wenjing Liu      2020-06-01  5110  			link->dpcd_caps.lttpr_caps.revision.raw >= 0x14);
4d1d699f479dc8 Michael Strauss  2022-05-06  5111  }
e844cc250f33d2 Michael Strauss  2022-07-25  5112  
e844cc250f33d2 Michael Strauss  2022-07-25  5113  enum lttpr_mode dp_decide_lttpr_mode(struct dc_link *link, struct dc_link_settings *link_setting)
e844cc250f33d2 Michael Strauss  2022-07-25  5114  {
e844cc250f33d2 Michael Strauss  2022-07-25  5115  	enum dp_link_encoding encoding = dp_get_link_encoding_format(link_setting);
e844cc250f33d2 Michael Strauss  2022-07-25  5116  
e844cc250f33d2 Michael Strauss  2022-07-25  5117  	if (encoding == DP_8b_10b_ENCODING)
e844cc250f33d2 Michael Strauss  2022-07-25  5118  		return dp_decide_8b_10b_lttpr_mode(link);
e844cc250f33d2 Michael Strauss  2022-07-25  5119  	else if (encoding == DP_128b_132b_ENCODING)
e844cc250f33d2 Michael Strauss  2022-07-25  5120  		return dp_decide_128b_132b_lttpr_mode(link);
e844cc250f33d2 Michael Strauss  2022-07-25  5121  
e844cc250f33d2 Michael Strauss  2022-07-25  5122  	ASSERT(0);
e844cc250f33d2 Michael Strauss  2022-07-25  5123  	return LTTPR_MODE_NON_LTTPR;
e844cc250f33d2 Michael Strauss  2022-07-25  5124  }
e844cc250f33d2 Michael Strauss  2022-07-25  5125  
e844cc250f33d2 Michael Strauss  2022-07-25  5126  void dp_get_lttpr_mode_override(struct dc_link *link, enum lttpr_mode *override)
e844cc250f33d2 Michael Strauss  2022-07-25  5127  {
e844cc250f33d2 Michael Strauss  2022-07-25  5128  	if (!dp_is_lttpr_present(link))
e844cc250f33d2 Michael Strauss  2022-07-25  5129  		return;
e844cc250f33d2 Michael Strauss  2022-07-25  5130  
e844cc250f33d2 Michael Strauss  2022-07-25  5131  	if (link->dc->debug.lttpr_mode_override == LTTPR_MODE_TRANSPARENT) {
e844cc250f33d2 Michael Strauss  2022-07-25  5132  		*override = LTTPR_MODE_TRANSPARENT;
e844cc250f33d2 Michael Strauss  2022-07-25  5133  	} else if (link->dc->debug.lttpr_mode_override == LTTPR_MODE_NON_TRANSPARENT) {
e844cc250f33d2 Michael Strauss  2022-07-25  5134  		*override = LTTPR_MODE_NON_TRANSPARENT;
e844cc250f33d2 Michael Strauss  2022-07-25  5135  	} else if (link->dc->debug.lttpr_mode_override == LTTPR_MODE_NON_LTTPR) {
e844cc250f33d2 Michael Strauss  2022-07-25  5136  		*override = LTTPR_MODE_NON_LTTPR;
e844cc250f33d2 Michael Strauss  2022-07-25  5137  	}
345d6493476615 Leo Chen         2022-09-16  5138  	DC_LOG_DC("lttpr_mode_override chose LTTPR_MODE = %d\n", (uint8_t)(*override));
e844cc250f33d2 Michael Strauss  2022-07-25  5139  }
e844cc250f33d2 Michael Strauss  2022-07-25  5140  
e844cc250f33d2 Michael Strauss  2022-07-25  5141  enum lttpr_mode dp_decide_8b_10b_lttpr_mode(struct dc_link *link)
e844cc250f33d2 Michael Strauss  2022-07-25  5142  {
e844cc250f33d2 Michael Strauss  2022-07-25  5143  	bool is_lttpr_present = dp_is_lttpr_present(link);
e844cc250f33d2 Michael Strauss  2022-07-25  5144  	bool vbios_lttpr_force_non_transparent = link->dc->caps.vbios_lttpr_enable;
e844cc250f33d2 Michael Strauss  2022-07-25  5145  	bool vbios_lttpr_aware = link->dc->caps.vbios_lttpr_aware;
e844cc250f33d2 Michael Strauss  2022-07-25  5146  
e844cc250f33d2 Michael Strauss  2022-07-25  5147  	if (!is_lttpr_present)
e844cc250f33d2 Michael Strauss  2022-07-25  5148  		return LTTPR_MODE_NON_LTTPR;
e844cc250f33d2 Michael Strauss  2022-07-25  5149  
e844cc250f33d2 Michael Strauss  2022-07-25  5150  	if (vbios_lttpr_aware) {
345d6493476615 Leo Chen         2022-09-16  5151  		if (vbios_lttpr_force_non_transparent) {
345d6493476615 Leo Chen         2022-09-16  5152  			DC_LOG_DC("chose LTTPR_MODE_NON_TRANSPARENT due to VBIOS DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE set to 1.\n");
e844cc250f33d2 Michael Strauss  2022-07-25  5153  			return LTTPR_MODE_NON_TRANSPARENT;
345d6493476615 Leo Chen         2022-09-16  5154  		} else {
345d6493476615 Leo Chen         2022-09-16  5155  			DC_LOG_DC("chose LTTPR_MODE_NON_TRANSPARENT by default due to VBIOS not set DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE set to 1.\n");
e844cc250f33d2 Michael Strauss  2022-07-25  5156  			return LTTPR_MODE_TRANSPARENT;
e844cc250f33d2 Michael Strauss  2022-07-25  5157  		}
345d6493476615 Leo Chen         2022-09-16  5158  	}
e844cc250f33d2 Michael Strauss  2022-07-25  5159  
e844cc250f33d2 Michael Strauss  2022-07-25  5160  	if (link->dc->config.allow_lttpr_non_transparent_mode.bits.DP1_4A &&
345d6493476615 Leo Chen         2022-09-16  5161  			link->dc->caps.extended_aux_timeout_support) {
345d6493476615 Leo Chen         2022-09-16  5162  		DC_LOG_DC("chose LTTPR_MODE_NON_TRANSPARENT by default and dc->config.allow_lttpr_non_transparent_mode.bits.DP1_4A set to 1.\n");
e844cc250f33d2 Michael Strauss  2022-07-25  5163  		return LTTPR_MODE_NON_TRANSPARENT;
345d6493476615 Leo Chen         2022-09-16  5164  	}
e844cc250f33d2 Michael Strauss  2022-07-25  5165  
345d6493476615 Leo Chen         2022-09-16  5166  	DC_LOG_DC("chose LTTPR_MODE_NON_LTTPR.\n");
e844cc250f33d2 Michael Strauss  2022-07-25  5167  	return LTTPR_MODE_NON_LTTPR;
e844cc250f33d2 Michael Strauss  2022-07-25  5168  }
e844cc250f33d2 Michael Strauss  2022-07-25  5169  
e844cc250f33d2 Michael Strauss  2022-07-25  5170  enum lttpr_mode dp_decide_128b_132b_lttpr_mode(struct dc_link *link)
e844cc250f33d2 Michael Strauss  2022-07-25  5171  {
345d6493476615 Leo Chen         2022-09-16  5172  	enum lttpr_mode mode = LTTPR_MODE_NON_LTTPR;
345d6493476615 Leo Chen         2022-09-16  5173  
345d6493476615 Leo Chen         2022-09-16  5174  	if (dp_is_lttpr_present(link))
345d6493476615 Leo Chen         2022-09-16  5175  		mode = LTTPR_MODE_NON_TRANSPARENT;
345d6493476615 Leo Chen         2022-09-16  5176  
345d6493476615 Leo Chen         2022-09-16  5177  	DC_LOG_DC("128b_132b chose LTTPR_MODE %d.\n", mode);
345d6493476615 Leo Chen         2022-09-16  5178  	return mode;
ee9b1992f1fdf3 Wesley Chalmers  2021-05-14  5179  }
ee9b1992f1fdf3 Wesley Chalmers  2021-05-14  5180  
c595fb05e392a5 Wenjing Liu      2022-02-08  5181  static bool get_usbc_cable_id(struct dc_link *link, union dp_cable_id *cable_id)
c595fb05e392a5 Wenjing Liu      2022-02-08  5182  {
c595fb05e392a5 Wenjing Liu      2022-02-08  5183  	union dmub_rb_cmd cmd;
c595fb05e392a5 Wenjing Liu      2022-02-08  5184  
c595fb05e392a5 Wenjing Liu      2022-02-08  5185  	if (!link->ctx->dmub_srv ||
c595fb05e392a5 Wenjing Liu      2022-02-08  5186  			link->ep_type != DISPLAY_ENDPOINT_PHY ||
c595fb05e392a5 Wenjing Liu      2022-02-08  5187  			link->link_enc->features.flags.bits.DP_IS_USB_C == 0)
c595fb05e392a5 Wenjing Liu      2022-02-08  5188  		return false;
c595fb05e392a5 Wenjing Liu      2022-02-08  5189  
c595fb05e392a5 Wenjing Liu      2022-02-08  5190  	memset(&cmd, 0, sizeof(cmd));
c595fb05e392a5 Wenjing Liu      2022-02-08  5191  	cmd.cable_id.header.type = DMUB_CMD_GET_USBC_CABLE_ID;
c595fb05e392a5 Wenjing Liu      2022-02-08  5192  	cmd.cable_id.header.payload_bytes = sizeof(cmd.cable_id.data);
c595fb05e392a5 Wenjing Liu      2022-02-08  5193  	cmd.cable_id.data.input.phy_inst = resource_transmitter_to_phy_idx(
c595fb05e392a5 Wenjing Liu      2022-02-08  5194  			link->dc, link->link_enc->transmitter);
c595fb05e392a5 Wenjing Liu      2022-02-08  5195  	if (dc_dmub_srv_cmd_with_reply_data(link->ctx->dmub_srv, &cmd) &&
345d6493476615 Leo Chen         2022-09-16  5196  			cmd.cable_id.header.ret_status == 1) {
c595fb05e392a5 Wenjing Liu      2022-02-08  5197  		cable_id->raw = cmd.cable_id.data.output_raw;
345d6493476615 Leo Chen         2022-09-16  5198  		DC_LOG_DC("usbc_cable_id = %d.\n", cable_id->raw);
345d6493476615 Leo Chen         2022-09-16  5199  	}
c595fb05e392a5 Wenjing Liu      2022-02-08  5200  	return cmd.cable_id.header.ret_status == 1;
c595fb05e392a5 Wenjing Liu      2022-02-08  5201  }
c595fb05e392a5 Wenjing Liu      2022-02-08  5202  
c595fb05e392a5 Wenjing Liu      2022-02-08  5203  static union dp_cable_id intersect_cable_id(
c595fb05e392a5 Wenjing Liu      2022-02-08  5204  		union dp_cable_id *a, union dp_cable_id *b)
4a3ad932b2c538 Shen, George     2022-01-23  5205  {
c595fb05e392a5 Wenjing Liu      2022-02-08  5206  	union dp_cable_id out;
c595fb05e392a5 Wenjing Liu      2022-02-08  5207  
c595fb05e392a5 Wenjing Liu      2022-02-08  5208  	out.bits.UHBR10_20_CAPABILITY = MIN(a->bits.UHBR10_20_CAPABILITY,
c595fb05e392a5 Wenjing Liu      2022-02-08  5209  			b->bits.UHBR10_20_CAPABILITY);
c595fb05e392a5 Wenjing Liu      2022-02-08  5210  	out.bits.UHBR13_5_CAPABILITY = MIN(a->bits.UHBR13_5_CAPABILITY,
c595fb05e392a5 Wenjing Liu      2022-02-08  5211  			b->bits.UHBR13_5_CAPABILITY);
c595fb05e392a5 Wenjing Liu      2022-02-08  5212  	out.bits.CABLE_TYPE = MAX(a->bits.CABLE_TYPE, b->bits.CABLE_TYPE);
c595fb05e392a5 Wenjing Liu      2022-02-08  5213  
c595fb05e392a5 Wenjing Liu      2022-02-08  5214  	return out;
c595fb05e392a5 Wenjing Liu      2022-02-08  5215  }
c595fb05e392a5 Wenjing Liu      2022-02-08  5216  
c595fb05e392a5 Wenjing Liu      2022-02-08  5217  static void retrieve_cable_id(struct dc_link *link)
c595fb05e392a5 Wenjing Liu      2022-02-08  5218  {
c595fb05e392a5 Wenjing Liu      2022-02-08  5219  	union dp_cable_id usbc_cable_id;
c595fb05e392a5 Wenjing Liu      2022-02-08  5220  
c595fb05e392a5 Wenjing Liu      2022-02-08  5221  	link->dpcd_caps.cable_id.raw = 0;
c595fb05e392a5 Wenjing Liu      2022-02-08  5222  	core_link_read_dpcd(link, DP_CABLE_ATTRIBUTES_UPDATED_BY_DPRX,
c595fb05e392a5 Wenjing Liu      2022-02-08  5223  			&link->dpcd_caps.cable_id.raw, sizeof(uint8_t));
c595fb05e392a5 Wenjing Liu      2022-02-08  5224  
c595fb05e392a5 Wenjing Liu      2022-02-08  5225  	if (get_usbc_cable_id(link, &usbc_cable_id))
c595fb05e392a5 Wenjing Liu      2022-02-08  5226  		link->dpcd_caps.cable_id = intersect_cable_id(
c595fb05e392a5 Wenjing Liu      2022-02-08  5227  				&link->dpcd_caps.cable_id, &usbc_cable_id);
4a3ad932b2c538 Shen, George     2022-01-23  5228  }
4a3ad932b2c538 Shen, George     2022-01-23  5229  
b473bd5fc333ab Lewis Huang      2022-10-20 @5230  enum dc_status wake_up_aux_channel(struct dc_link *link)
2944dbedc7e167 Jimmy Kizito     2022-03-09  5231  {
2944dbedc7e167 Jimmy Kizito     2022-03-09  5232  	enum dc_status status = DC_ERROR_UNEXPECTED;
b473bd5fc333ab Lewis Huang      2022-10-20  5233  	uint32_t aux_channel_retry_cnt = 0;
b473bd5fc333ab Lewis Huang      2022-10-20  5234  	uint8_t dpcd_power_state = '\0';
2944dbedc7e167 Jimmy Kizito     2022-03-09  5235  
b473bd5fc333ab Lewis Huang      2022-10-20  5236  	while (status != DC_OK && aux_channel_retry_cnt < 10) {
b473bd5fc333ab Lewis Huang      2022-10-20  5237  		status = core_link_read_dpcd(link, DP_SET_POWER,
b473bd5fc333ab Lewis Huang      2022-10-20  5238  				&dpcd_power_state, sizeof(dpcd_power_state));
77361ed89a8b03 Jimmy Kizito     2022-03-24  5239  
b473bd5fc333ab Lewis Huang      2022-10-20  5240  		/* Delay 1 ms if AUX CH is in power down state. Based on spec
b473bd5fc333ab Lewis Huang      2022-10-20  5241  		 * section 2.3.1.2, if AUX CH may be powered down due to
b473bd5fc333ab Lewis Huang      2022-10-20  5242  		 * write to DPCD 600h = 2. Sink AUX CH is monitoring differential
b473bd5fc333ab Lewis Huang      2022-10-20  5243  		 * signal and may need up to 1 ms before being able to reply.
77361ed89a8b03 Jimmy Kizito     2022-03-24  5244  		 */
b473bd5fc333ab Lewis Huang      2022-10-20  5245  		if (status != DC_OK || dpcd_power_state == DP_SET_POWER_D3) {
b473bd5fc333ab Lewis Huang      2022-10-20  5246  			udelay(1000);
b473bd5fc333ab Lewis Huang      2022-10-20  5247  			aux_channel_retry_cnt++;
b473bd5fc333ab Lewis Huang      2022-10-20  5248  		}
b473bd5fc333ab Lewis Huang      2022-10-20  5249  	}
2944dbedc7e167 Jimmy Kizito     2022-03-09  5250  
2944dbedc7e167 Jimmy Kizito     2022-03-09  5251  	if (status != DC_OK) {
b473bd5fc333ab Lewis Huang      2022-10-20  5252  		dpcd_power_state = DP_SET_POWER_D0;
2944dbedc7e167 Jimmy Kizito     2022-03-09  5253  		status = core_link_write_dpcd(
2944dbedc7e167 Jimmy Kizito     2022-03-09  5254  				link,
2944dbedc7e167 Jimmy Kizito     2022-03-09  5255  				DP_SET_POWER,
b473bd5fc333ab Lewis Huang      2022-10-20  5256  				&dpcd_power_state,
b473bd5fc333ab Lewis Huang      2022-10-20  5257  				sizeof(dpcd_power_state));
2944dbedc7e167 Jimmy Kizito     2022-03-09  5258  
b473bd5fc333ab Lewis Huang      2022-10-20  5259  		dpcd_power_state = DP_SET_POWER_D3;
2944dbedc7e167 Jimmy Kizito     2022-03-09  5260  		status = core_link_write_dpcd(
2944dbedc7e167 Jimmy Kizito     2022-03-09  5261  				link,
2944dbedc7e167 Jimmy Kizito     2022-03-09  5262  				DP_SET_POWER,
b473bd5fc333ab Lewis Huang      2022-10-20  5263  				&dpcd_power_state,
b473bd5fc333ab Lewis Huang      2022-10-20  5264  				sizeof(dpcd_power_state));
b473bd5fc333ab Lewis Huang      2022-10-20  5265  		return DC_ERROR_UNEXPECTED;
2944dbedc7e167 Jimmy Kizito     2022-03-09  5266  	}
2944dbedc7e167 Jimmy Kizito     2022-03-09  5267  
b473bd5fc333ab Lewis Huang      2022-10-20  5268  	return DC_OK;
2944dbedc7e167 Jimmy Kizito     2022-03-09  5269  }
2944dbedc7e167 Jimmy Kizito     2022-03-09  5270  

:::::: The code at line 5044 was first introduced by commit
:::::: e844cc250f33d207077d0af9337484d6c94048f0 drm/amd/display: Refactor LTTPR mode selection

:::::: TO: Michael Strauss <michael.strauss@....com>
:::::: CC: Alex Deucher <alexander.deucher@....com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (322188 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ