From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F916C07E99 for ; Fri, 9 Jul 2021 17:17:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9F8B613C2 for ; Fri, 9 Jul 2021 17:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbhGIRT5 (ORCPT ); Fri, 9 Jul 2021 13:19:57 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:57753 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbhGIRT4 (ORCPT ); Fri, 9 Jul 2021 13:19:56 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1625851033; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=Xx1QWoGplZYDFvg3o09yp0wM5pDO8b7Sp2lAAG1myl8=; b=qKH3uj5Mw3wBGylG/fKQ9TrcE2hF9iUyr6hhfC1ag22jrZarD+qAe4ruf+ZMKHYnSgvyQtI4 hkq82ptgFB8zx9TPGlaATIWN1m4kCZEdfmt2ZxEGc0AOD4SOQbvgPDHyMyupV+6ogGjQ3Hwk YBSYrM08WxVzKcj1My6nicZSqf4= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 60e8848501dd9a9431a8c44f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 09 Jul 2021 17:16:53 GMT Sender: khsieh=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8D101C43460; Fri, 9 Jul 2021 17:16:53 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: khsieh) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7FA01C433F1; Fri, 9 Jul 2021 17:16:52 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 09 Jul 2021 10:16:52 -0700 From: khsieh@codeaurora.org To: Stephen Boyd Cc: dri-devel@lists.freedesktop.org, robdclark@gmail.com, sean@poorly.run, abhinavk@codeaurora.org, aravindh@codeaurora.org, airlied@linux.ie, daniel@ffwll.ch, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 7/7] drm/msm/dp: retrain link when loss of symbol lock detected In-Reply-To: References: <1625592020-22658-1-git-send-email-khsieh@codeaurora.org> <1625592020-22658-8-git-send-email-khsieh@codeaurora.org> Message-ID: X-Sender: khsieh@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-07-08 00:21, Stephen Boyd wrote: > Quoting Kuogee Hsieh (2021-07-06 10:20:20) >> Main link symbol locked is achieved at end of link training 2. Some >> dongle main link symbol may become unlocked again if host did not end >> link training soon enough after completion of link training 2. Host >> have to re train main link if loss of symbol lock detected before >> end link training so that the coming video stream can be transmitted >> to sink properly. >> >> Signed-off-by: Kuogee Hsieh > > I guess this is a fix for the original driver, so it should be tagged > with Fixes appropriately. Actually, this is fix on patch #6 : drm/msm/dp: do not end dp link training until video is ready Should i merge patch #6 and #7 together? Or can you suggest what should I do? > >> --- >> drivers/gpu/drm/msm/dp/dp_ctrl.c | 34 >> ++++++++++++++++++++++++++++++++++ >> 1 file changed, 34 insertions(+) >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c >> b/drivers/gpu/drm/msm/dp/dp_ctrl.c >> index 0cb01a9..e616ab2 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c >> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c >> @@ -1661,6 +1661,25 @@ static bool dp_ctrl_any_lane_cr_lose(struct >> dp_ctrl_private *ctrl, >> return false; >> } >> >> +static bool dp_ctrl_loss_symbol_lock(struct dp_ctrl_private *ctrl) >> +{ >> + u8 link_status[6]; > > Can we use link_status[DP_LINK_STATUS_SIZE] instead? > >> + u8 status; >> + int i; >> + int lane = ctrl->link->link_params.num_lanes; > > s/lane/num_lanes/ > > would make the code easier to read > >> + >> + dp_ctrl_read_link_status(ctrl, link_status); >> + >> + for (i = 0; i < lane; i++) { >> + status = link_status[i / 2]; >> + status >>= ((i % 2) * 4); >> + if (!(status & DP_LANE_SYMBOL_LOCKED)) >> + return true; >> + } >> + >> + return false; >> +} >> + >> int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) >> { >> int rc = 0; >> @@ -1777,6 +1796,17 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) >> return rc; >> } >> >> +static int dp_ctrl_link_retrain(struct dp_ctrl_private *ctrl) >> +{ >> + int ret = 0; > > Please drop init of ret. > >> + u8 cr_status[2]; >> + int training_step = DP_TRAINING_NONE; >> + >> + ret = dp_ctrl_setup_main_link(ctrl, cr_status, >> &training_step); > > as it is assigned here. > >> + >> + return ret; > > And indeed, it could be 'return dp_ctrl_setup_main_link()' instead. > >> +} >> + >> int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl) >> { >> int ret = 0; >> @@ -1802,6 +1832,10 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl) >> } >> } >> >> + /* if loss symbol lock happen, then retaining the link */ > > retain or retrain? The comment seems to be saying what the code says > "if > loss retrain", so the comment is not very useful. > >> + if (dp_ctrl_loss_symbol_lock(ctrl)) >> + dp_ctrl_link_retrain(ctrl); >> + >> /* stop txing train pattern to end link training */ >> dp_ctrl_clear_training_pattern(ctrl); >>