From patchwork Tue Jun 14 21:54:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12881633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35840C43334 for ; Tue, 14 Jun 2022 21:54:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DF26112A52; Tue, 14 Jun 2022 21:54:42 +0000 (UTC) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB9AE1122CF for ; Tue, 14 Jun 2022 21:54:40 +0000 (UTC) Received: by mail-pj1-x1030.google.com with SMTP id gc3-20020a17090b310300b001e33092c737so266466pjb.3 for ; Tue, 14 Jun 2022 14:54: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=65Y41kdawwG1n+2uI4rvZLnKQNlAIFaOOfNmllqQLv8=; b=EdN0uGZ3OZRMm5vATmxr2x7Q5Cqn1/DD3mCxrzY/7OzjM2t7U4pHdEYKoigjkl//R6 6KHpMtFP09kwukqqwTCO+MB0yRbh6qqhSZDR3PUAKoMnDXxjd/G04PPSJ9tJa6HHQOHE Fps7YmaMWDzhf+p0hG/bCMP/LfAC/qOt3cNeo= 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=65Y41kdawwG1n+2uI4rvZLnKQNlAIFaOOfNmllqQLv8=; b=rclPhQSTIP4U5XcT/j6nhLqhR9CqX8v5lwzWoNSsD2Emj4IP/NEMcSKkxY5mRLVy3O G1yqOmxDNnE9Hh+w6cOXGu5/nwnGJZmF97OB98xvZjgiZciNvmbDSOYP9dFK/K/jvVxP xFTqyoNXnxDxD5uv2no5Xgmf47JD7r9HbBTXH+GM2Nb6CP8TolaciAV57uQehQZzL8ma PVelh440mGroBKWglPOVPfQDglym3R4/cQSyAXqEimr0sXGobQm05vmBAa/BPRuFZvTY yqRP5QSGs8CCjDWMOpsm/uzQU+eSQSjBkwtOOb2+lstXeMBFLfvTFXOHtAynnj03pf36 j1+Q== X-Gm-Message-State: AJIora9Q6SvLnn/wxwGJsKm2dajrlQKwLUIdcmtKNdW9DD/k/6mHRxg5 bZESRELdBUA7M/2+lMEJfaYPbfohiujk9Xrp X-Google-Smtp-Source: AGRyM1uthElZF57fyUFL/+OiAZrcfH8RH/6cIit8YmMun/0EwOG0PbFroYO/GhXjJ2LU/4JIZrnS/w== X-Received: by 2002:a17:902:ec84:b0:167:6f74:ba76 with SMTP id x4-20020a170902ec8400b001676f74ba76mr6121089plg.17.1655243680141; Tue, 14 Jun 2022 14:54:40 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f355:be2d:74b7:3c7c]) by smtp.gmail.com with ESMTPSA id y2-20020a17090264c200b0016641a646cbsm7668968pli.218.2022.06.14.14.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 14:54:39 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 1/4] drm/dp: Add wait_hpd_asserted() callback to struct drm_dp_aux Date: Tue, 14 Jun 2022 14:54:15 -0700 Message-Id: <20220614145327.v4.1.Icf57bb12233a47727013c6ab69eebf803e22ebc1@changeid> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220614215418.910948-1-dianders@chromium.org> References: <20220614215418.910948-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Douglas Anderson , Sankeerth Billakanti , Philip Chen , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Abhinav Kumar , Robert Foss , Stephen Boyd , Jani Nikula , Maxime Ripard , Hsin-Yi Wang , Dmitry Baryshkov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Sometimes it's useful for users of the DP AUX bus (like panels) to be able to poll HPD. Let's add a callback that allows DP AUX busses drivers to provide this. Suggested-by: Dmitry Baryshkov Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- Changes in v4: - Comments now explain that we may wait longer due to debouncing. - Rebased to handle the fact that the stuct moved files. Changes in v2: - Change is_hpd_asserted() to wait_hpd_asserted() include/drm/display/drm_dp_helper.h | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index c5f8f45511ed..db0fe9f8a612 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -389,6 +389,36 @@ struct drm_dp_aux { ssize_t (*transfer)(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg); + /** + * @wait_hpd_asserted: wait for HPD to be asserted + * + * This is mainly useful for eDP panels drivers to wait for an eDP + * panel to finish powering on. This is an optional function. + * + * This function will efficiently wait for the HPD signal to be + * asserted. The `wait_us` parameter that is passed in says that we + * know that the HPD signal is expected to be asserted within `wait_us` + * microseconds. This function could wait for longer than `wait_us` if + * the logic in the DP controller has a long debouncing time. The + * important thing is that if this function returns success that the + * DP controller is ready to send AUX transactions. + * + * This function returns 0 if HPD was asserted or -ETIMEDOUT if time + * expired and HPD wasn't asserted. This function should not print + * timeout errors to the log. + * + * The semantics of this function are designed to match the + * readx_poll_timeout() function. That means a `wait_us` of 0 means + * to wait forever. Like readx_poll_timeout(), this function may sleep. + * + * NOTE: this function specifically reports the state of the HPD pin + * that's associated with the DP AUX channel. This is different from + * the HPD concept in much of the rest of DRM which is more about + * physical presence of a display. For eDP, for instance, a display is + * assumed always present even if the HPD pin is deasserted. + */ + int (*wait_hpd_asserted)(struct drm_dp_aux *aux, unsigned long wait_us); + /** * @i2c_nack_count: Counts I2C NACKs, used for DP validation. */