Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483742pxj; Mon, 10 May 2021 04:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVRLfU4fZXGMRAOe0/bupvZnne4JtdDG/R6YnByYiwSzEgbPcRNhqgRudRJUEJIWZz/xaH X-Received: by 2002:a92:c74c:: with SMTP id y12mr21146001ilp.107.1620645110612; Mon, 10 May 2021 04:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645110; cv=none; d=google.com; s=arc-20160816; b=aXtSdXKZnreRjfUVv7FucpxTAQO7edvotb8s1oDzGqAsUAnOlGXtq0/t/jlQbeFt59 s3366MXkYQDGYVpOTR3qjh1VE3DMXIXZ1JqeQWs3RHdEcQPd1auEWacEEIxVofTS27a6 pxcUSG6OzVHANqQMLbNSvsROpio6FneUkpQcXgKUNlZvCqIVioNetFDKMCYLdDwXckhN 1oQ9PtrqZpsQkoHKp7xpL1uOoQgnZTWlx/YRrhG/9NFXVJ27OEjLHRkoIJUDBguKMJ1o Wnek8FTPLNc7EBoUo3k7iecVwjLu8WjRd5etmVeUEuS/bk9H7zm9rEqwM1yRl2XATbAC UwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ojAu+nHdw/qXlWioThY8KGB9O/Vbq13eO5Wz/NNPYSw=; b=ekyesHZmdFIIr+fVLLWD0QmV6bGroDRTYAvgjx7Ex4knkFiHjqFlPtUz1jMm/nP33q NAoBpIm7GuhN/C+BBJbM5ylAD7Mgk9rYNYXnarzl2180lsZiTQ1sNK4DxoX/xTfpgEyH mGnhuboljBN7kJY1yryeo+cUw+4OlwQxwEblySLvTBQsNeMJacnVDGVDnIBoY/5G7SL9 oJ/9vXFirtrLii3Z1554DSUjqstesBW7Y7rDTKrq0yF9BgzgCtKfVBsPXWs+uT76XKck EF8LdS8R2nKYNsCMnmry0oSlvJkB3i8GMFU08bXpsg0eC0XhfIPfNjGd9B3ZIu5SjJJq 43RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxUWnovD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si18712996iot.35.2021.05.10.04.11.38; Mon, 10 May 2021 04:11:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxUWnovD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236768AbhEJLKX (ORCPT + 99 others); Mon, 10 May 2021 07:10:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:42076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233456AbhEJKuE (ORCPT ); Mon, 10 May 2021 06:50:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2891C619D0; Mon, 10 May 2021 10:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643132; bh=szF3c9ShV5dLhia4AnTX0NjVXZj9kw1lman0nuAV8/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xxUWnovD//94YYK3+h1D0uIW4UD9OGsEQRkmrnGZnsiHYLaWX8akiOJGQvp4shKHX xs6371lBK2OrfarnIFCC1VHZMWDMtSoyLDjzEJfQf5T3iEM5VW1ZaAZ/qLUmVX0f2g GnR20CkYnq3d0dgXCiT3ntFuq7DAHxK6uxv9GYv8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Fangzhi Zuo , Nicholas Kazlauskas , Solomon Chiu , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 190/299] drm/amd/display: Fix debugfs link_settings entry Date: Mon, 10 May 2021 12:19:47 +0200 Message-Id: <20210510102011.222083052@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fangzhi Zuo [ Upstream commit c006a1c00de29e8cdcde1d0254ac23433ed3fee9 ] 1. Catch invalid link_rate and link_count settings 2. Call dc interface to overwrite preferred link settings, and wait until next stream update to apply the new settings. Tested-by: Daniel Wheeler Signed-off-by: Fangzhi Zuo Reviewed-by: Nicholas Kazlauskas Acked-by: Solomon Chiu Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 8cd646eef096..e02a55fc1382 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -150,7 +150,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size, * * --- to get dp configuration * - * cat link_settings + * cat /sys/kernel/debug/dri/0/DP-x/link_settings * * It will list current, verified, reported, preferred dp configuration. * current -- for current video mode @@ -163,7 +163,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size, * echo > link_settings * * for example, to force to 2 lane, 2.7GHz, - * echo 4 0xa > link_settings + * echo 4 0xa > /sys/kernel/debug/dri/0/DP-x/link_settings * * spread_spectrum could not be changed dynamically. * @@ -171,7 +171,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size, * done. please check link settings after force operation to see if HW get * programming. * - * cat link_settings + * cat /sys/kernel/debug/dri/0/DP-x/link_settings * * check current and preferred settings. * @@ -255,7 +255,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, int max_param_num = 2; uint8_t param_nums = 0; long param[2]; - bool valid_input = false; + bool valid_input = true; if (size == 0) return -EINVAL; @@ -282,9 +282,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, case LANE_COUNT_ONE: case LANE_COUNT_TWO: case LANE_COUNT_FOUR: - valid_input = true; break; default: + valid_input = false; break; } @@ -294,9 +294,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, case LINK_RATE_RBR2: case LINK_RATE_HIGH2: case LINK_RATE_HIGH3: - valid_input = true; break; default: + valid_input = false; break; } @@ -310,10 +310,11 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, * spread spectrum will not be changed */ prefer_link_settings.link_spread = link->cur_link_settings.link_spread; + prefer_link_settings.use_link_rate_set = false; prefer_link_settings.lane_count = param[0]; prefer_link_settings.link_rate = param[1]; - dc_link_set_preferred_link_settings(dc, &prefer_link_settings, link); + dc_link_set_preferred_training_settings(dc, &prefer_link_settings, NULL, link, true); kfree(wr_buf); return size; -- 2.30.2