Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2905141iog; Mon, 27 Jun 2022 05:29:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYCF9kVJb6G4ITva4QgCHytWn1fQIXXYfMeDwW4KRafjYGkaNzXtM6RHQ+Ry+9HhYjwo+T X-Received: by 2002:a63:5304:0:b0:3fb:92eb:8e90 with SMTP id h4-20020a635304000000b003fb92eb8e90mr12956909pgb.36.1656332968761; Mon, 27 Jun 2022 05:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656332968; cv=none; d=google.com; s=arc-20160816; b=PqI7/iuqGQhHqN3I9vmxfxez7hVHiPUjQeJUYf7RhPvR4txhMZs6KR3e38ysrpmQUF mwbcb/6M3+r1xSv8Cl9UszP1yyDCh+WG8gbASO2T2IeZNIg5ut27UAJD/XCMCI3cub1H 5yumibW10bRry6aMUjPrOBXPvP5StOuhHLGfdQDcflMFDtOCtJ+bP0St5cqxvHVs6Yor GlAcLC4CdyVTmNPARU2kcLE1g12YyGoLZ8ZchlYA3bygHOB8BIRY7nOczfYy38UX1rXm V8iDhBTu6FKEFWNtYlWpRFh4fu544bEyYG7240Vv7IUudl5MRfqKifmugVoubdoSJPtV 2yxg== 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=AGfZ2x8UzXScXfLJKUVJfg1m94LAgRT2U6k2hTSJ9Vc=; b=OWG478PraOs1rdqiEMqP8fgn0olFZGOcjBUyx7DRd+N5s+DHStIHVckVoTqs9uc07Y zgN5sosakLnBUeLYXrO6d0rJCs1Xigzl1qtQNjY8+ShfBfjrrN0S8fsYPHcyFpr1oF7a XlJGZ/XqKNesPs+aQakaM5Up1HtXp4zH5KEu3Y3NjSwy4M43Fa21rnlRU5W8PWlJVfix htgfm4ONqd1EDlpUEPYd7V7Z59pssFp91WF6S69CmB9C8tRbjdq6YuZHBBVW1FCfa6Ya Un1oV9HBx3WD4lI7iIuh0jEYC+nZ7fHx7fgENzhB6eGww6ExbR8nC1bPYHEkwYeX6Cdm T0dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1zJzIXbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk10-20020a17090b33ca00b001ed5b454a39si6532708pjb.139.2022.06.27.05.29.16; Mon, 27 Jun 2022 05:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1zJzIXbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235355AbiF0L2Z (ORCPT + 99 others); Mon, 27 Jun 2022 07:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235195AbiF0L1L (ORCPT ); Mon, 27 Jun 2022 07:27:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AB99FD9; Mon, 27 Jun 2022 04:27:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24688614C8; Mon, 27 Jun 2022 11:27:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EF92C385A9; Mon, 27 Jun 2022 11:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329220; bh=t6YNsAmuGSN6G8yIXFXw38LmA8/sEUriDb7d86ArpoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zJzIXbhC9Kf5CGpvpDr1D6LifgpIXQMbz1+aVA26fEUs2HXHVghDioxfBrz8Czae KPu3tEUvmqOsENd9bDMPMCAdx9+T2q6ACxkHpa9wuRQ+rciX0Sh2R3gRo+st2riEJV 9NW13uI3EBFo3gAZB26w3wZ0Pzh2mMyhQa7SSR4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuogee Hsieh , Rob Clark , Sasha Levin Subject: [PATCH 5.10 040/102] drm/msm/dp: promote irq_hpd handle to handle link training correctly Date: Mon, 27 Jun 2022 13:20:51 +0200 Message-Id: <20220627111934.660299951@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuogee Hsieh [ Upstream commit 26b8d66a399e625f3aa2c02ccbab1bff2e00040c ] Some dongles require link training done at irq_hpd request instead of plugin request. This patch promote irq_hpd handler to handle link training and setup hpd_state correctly. Signed-off-by: Kuogee Hsieh Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dp/dp_display.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index d504cf68283a..f1f777baa2c4 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -476,10 +476,9 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp) sink_request = dp->link->sink_request; if (sink_request & DS_PORT_STATUS_CHANGED) { - dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); if (dp_display_is_sink_count_zero(dp)) { DRM_DEBUG_DP("sink count is zero, nothing to do\n"); - return 0; + return -ENOTCONN; } return dp_display_process_hpd_high(dp); @@ -496,7 +495,9 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp) static int dp_display_usbpd_attention_cb(struct device *dev) { int rc = 0; + u32 sink_request; struct dp_display_private *dp; + struct dp_usbpd *hpd; if (!dev) { DRM_ERROR("invalid dev\n"); @@ -510,10 +511,26 @@ static int dp_display_usbpd_attention_cb(struct device *dev) return -ENODEV; } + hpd = dp->usbpd; + /* check for any test request issued by sink */ rc = dp_link_process_request(dp->link); - if (!rc) - dp_display_handle_irq_hpd(dp); + if (!rc) { + sink_request = dp->link->sink_request; + if (sink_request & DS_PORT_STATUS_CHANGED) { + /* same as unplugged */ + hpd->hpd_high = 0; + dp->hpd_state = ST_DISCONNECT_PENDING; + dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); + } + + rc = dp_display_handle_irq_hpd(dp); + + if (!rc && (sink_request & DS_PORT_STATUS_CHANGED)) { + hpd->hpd_high = 1; + dp->hpd_state = ST_CONNECT_PENDING; + } + } return rc; } -- 2.35.1