Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp990489pxb; Tue, 14 Sep 2021 13:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqIUHgzjLWLBr6AZo3H7wSXNu8UXt0tc/0hDFtVK2Xv9kzOR3F657DDUsCKOMSLPxTmBN1 X-Received: by 2002:a05:6e02:1cad:: with SMTP id x13mr1612694ill.60.1631651157070; Tue, 14 Sep 2021 13:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631651157; cv=none; d=google.com; s=arc-20160816; b=V1Qy27CWP/0eRjY4Ax6oR9lvu7BuIpEmjZJuW1hh7OPmuQUFXNeRDeyttW38iya05W z4hw2kL04IkbIm6sSp6mAy2Fihsp5koL/frjHn/g1pBqht9hmWaM9cEw+fJ9pOzwCsv/ JKT1t2T7ACAWrrV6fCwhi5I6ouR6WrK4bXoMDl6MDu/zbyQDvnwS1GSlz6Di4bwPHn73 h+EOkUAStv2HyqLrqpBONHyBhW9x2dsBMy3jnIgM16gC5n1EzoIXpmQV8r6Uc1ua/gW2 R+JsYyfCTSq36nedjAVTiArGe6wEaVjW7bxjNM2DPa/0iEBoWMTvqpTkMKT+lT5ia5Nb NANQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vpEXnbBKR0bloKgXMxBkZufR69FGR0namo850/sSuY0=; b=MCFIsT+uDZBH3jzm+7KDywFy10OOzmG1hsX8RmEkhcM1vdI2a8PqslEQHLG1ut3wIg zYXDiTyX2JYi09JNGs1Lx4b3aaXvU5ZYqoBzPbEPNQwJqYRdPLTP5VOXDC6jdJfjbzTZ kW/q4+AqzoldKcULa2KA52pIDsl+O20MrwImwcP0MXVFAUTDXKNfv2eQYO/GYM1zeR5u bLmmk5OhUNhLa1Nv4f8P4Vrw/zmEH21TLZOKVba45dhM8Pmyr8DMnjmdvJ5EmhLBGK51 Dlo4FIYFttnohpQ9/l+uLvQ5BEYpPYCMnDfAi8YvjLNljUA5BM25gs62tt4LJp/mBV20 RuZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QD10I0+T; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si13168521jan.43.2021.09.14.13.25.42; Tue, 14 Sep 2021 13:25:57 -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=@chromium.org header.s=google header.b=QD10I0+T; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbhINUYu (ORCPT + 99 others); Tue, 14 Sep 2021 16:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234767AbhINUY2 (ORCPT ); Tue, 14 Sep 2021 16:24:28 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDFDC0613CF for ; Tue, 14 Sep 2021 13:22:40 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id w19-20020a17090aaf9300b00191e6d10a19so534940pjq.1 for ; Tue, 14 Sep 2021 13:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vpEXnbBKR0bloKgXMxBkZufR69FGR0namo850/sSuY0=; b=QD10I0+TVx4/lj2zfWzAgsFTRCOeUemwh5dNMsa7Dl3/o3jNo71bM29C3c1wQjJnog qNHCZT3p5Go/d2liL5u5rqpZiqfFAWm+tSypPxiw4MTgjDCWgYwSGRSX8WkDVu5c5hpg eBPZD62X+jCyS9fgUWHAmPz8GUjZK+sepSqD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vpEXnbBKR0bloKgXMxBkZufR69FGR0namo850/sSuY0=; b=e9xolAKKgrK+uzYtwAxOsEUuoSblnngOKzgBU9/SnbaEYGlfZ7GvALgpC/VPbcdh48 QGNiH/yVfaRXIp40tK7qtStbLRqNGRl1YBlTdZZTlBa/Keg/KguJdD8Up5If5L8L9hFm fNvwuQhlkVtSflWi00xrfYsvIK2DtpHbB/aJdlSWbwSrJFE9Ux5+h5k6iGgt3sevuTyf mTsEQNWmKKqOyb89HRV8GHuOA/ti5K+FLuFHVtGb271ZZpP1gAOT+autlWvrcuaVjbpG GuoWCTXLjYexSfZ90KDQ9w/NdcJoP0nroUifOKRArxgmhgoLT5HE64JqkgCAl7ksGube MW7Q== X-Gm-Message-State: AOAM532dredCaRPN3qaYrvN357XHWTQaHkN424sN93CxpIpkYZtpC82U xsPgnY76la99ontslzBoZoWZgA== X-Received: by 2002:a17:902:650b:b0:13a:123a:4ef9 with SMTP id b11-20020a170902650b00b0013a123a4ef9mr16501693plk.49.1631650960249; Tue, 14 Sep 2021 13:22:40 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f38f:9d0f:3eba:f8c4]) by smtp.gmail.com with ESMTPSA id 141sm12185393pgg.16.2021.09.14.13.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 13:22:39 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: devicetree@vger.kernel.org, Steev Klimaszewski , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, David Airlie , Maarten Lankhorst , Thomas Zimmermann , Linus W , Bjorn Andersson , Daniel Vetter , Maxime Ripard , Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v5 13/15] drm/panel-edp: Fix "prepare_to_enable" if panel doesn't handle HPD Date: Tue, 14 Sep 2021 13:22:00 -0700 Message-Id: <20210914132020.v5.13.Ia8288d36df4b12770af59ae3ff73ef7e08fb4e2e@changeid> X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog In-Reply-To: <20210914202202.1702601-1-dianders@chromium.org> References: <20210914202202.1702601-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While cleaning up the descriptions of the delay for eDP panels I realized that we'd have a bug if any panels need the "prepare_to_enable" but HPD handling isn't happening in the panel driver. Let's put in a stopgap to at least make us not violate timings. This is not perfectly optimal but trying to do better is hard. At the moment only 2 panels specify this delay and only 30 ms is at stake. These panels are also currently hooked up with "hpd-gpios" so effectively this "fix" is just a theoretical fix and won't actually do anything for any devices currently supported in mainline. Signed-off-by: Douglas Anderson Acked-by: Sam Ravnborg --- (no changes since v4) Changes in v4: - panel-simple-edp => panel-edp Changes in v3: - Fix "prepare_to_enable" patch new for v3. drivers/gpu/drm/panel/panel-edp.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 80a37a4e5750..a83ef9905ea7 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -508,12 +508,32 @@ static int panel_edp_prepare(struct drm_panel *panel) static int panel_edp_enable(struct drm_panel *panel) { struct panel_edp *p = to_panel_edp(panel); + unsigned int delay; if (p->enabled) return 0; - if (p->desc->delay.enable) - msleep(p->desc->delay.enable); + delay = p->desc->delay.enable; + + /* + * If there is a "prepare_to_enable" delay then that's supposed to be + * the delay from HPD going high until we can turn the backlight on. + * However, we can only count this if HPD is handled by the panel + * driver, not if it goes to a dedicated pin on the controller. + * If we aren't handling the HPD pin ourselves then the best we + * can do is assume that HPD went high immediately before we were + * called (and link training took zero time). + * + * NOTE: if we ever end up in this "if" statement then we're + * guaranteed that the panel_edp_wait() call below will do no delay. + * It already handles that case, though, so we don't need any special + * code for it. + */ + if (p->desc->delay.prepare_to_enable && !p->hpd_gpio && !p->no_hpd) + delay = max(delay, p->desc->delay.prepare_to_enable); + + if (delay) + msleep(delay); panel_edp_wait(p->prepared_time, p->desc->delay.prepare_to_enable); -- 2.33.0.309.g3052b89438-goog