Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp1203684pxw; Sat, 9 Apr 2022 15:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQrP5nIAVQkn25BPe8HJJnwYiDvZrcgFJ//+DM+SAXSQ2JB82GOvf7DhLxn428OWcul7MP X-Received: by 2002:a17:907:7f0f:b0:6e4:c15e:7751 with SMTP id qf15-20020a1709077f0f00b006e4c15e7751mr24411681ejc.266.1649542796925; Sat, 09 Apr 2022 15:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649542796; cv=none; d=google.com; s=arc-20160816; b=tpT7fUYC8dxPXPY4dMTZcBZkeeriJjEoJEfVfL3rCM3R6Nr7a1zah1/eN2u+fkUgh4 rA7n5kocl6+7bLJ/dmXkWl9rkaYPSlkAaUqgvx4XDjQaMuXKaxor9tFvVkDGKp1U8J42 iGOXIxNkwFDLw84W4GC0WYiqKT4WZmSmhgtNklgtgGLdlEOCt/HSaujrk/Bb3yuU8jE6 r6qt5hrQV2owyvCvEu+ZBJHeAsD8YuVKkv1F/QqMEkNaCeGlFJ9q23cq6Z/J/PGdNq47 kw9AkdJcEm+YRu3VzTQ4UDPtqZqZAqm8HHgTVL5k/c9sK9pIcS8LRUDZtOGABn+0WjSx vFRg== 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=GRUl59HS+3kIJaHkhNRsC+uDBDA3ykeO3cGjaLdlqT4=; b=r0+wSfDnUzyfo0G/v8Fs30oa0BnggtY7NP0RLWVecuG0ZSluPjPsOiMDZPC+8x53sJ x6+sgl60MubNlcP8TmjrScB6t8QtVDNA0VKZfZQIQ/Uv6K/TIEK5CDricQ4HMmZFGvRz P2YNfy09eG9l5mfkNB5WiBAW1rc/ygR4NLfra/UdhWhhmS5jaOdRf7bcKbCUUC9zP0vC AKC+vUtYr8w4Fi3K3aRtSCTghwCjU0vcpj3xD6PKkal9O+mnveFmgyxQ/2jP/Xne68J5 WsG0t8A7QA9mWhNiOoPRFGqCVL5sLQKZLXo1gRwefUR2fG+Al32lofgt89oRfmZyh1Vy A2sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CauMoP36; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a50f1d5000000b0041d2fcc319asi3686089edl.80.2022.04.09.15.19.04; Sat, 09 Apr 2022 15:19:56 -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=@chromium.org header.s=google header.b=CauMoP36; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240651AbiDICjl (ORCPT + 99 others); Fri, 8 Apr 2022 22:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbiDICjU (ORCPT ); Fri, 8 Apr 2022 22:39:20 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE05C4E0E for ; Fri, 8 Apr 2022 19:37:15 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id md4so1977849pjb.4 for ; Fri, 08 Apr 2022 19:37:15 -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=GRUl59HS+3kIJaHkhNRsC+uDBDA3ykeO3cGjaLdlqT4=; b=CauMoP36hw/My6kTj0xHbH3I/vgeGoE5r6qOsDM1oBALiaD5VgEqwKzw3bc5b1e6xv xsBdzDpI5v56V2lc31/4fXcJ5iSKsi5n/sZDErwdJ+Dlgnkua6nKFC+riYU8jXpNfuI6 njExO59mFknKxVM1+EcREmTxf9rf5f6RtRVJM= 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=GRUl59HS+3kIJaHkhNRsC+uDBDA3ykeO3cGjaLdlqT4=; b=aE+/VBqdKXMtEcv2K9K278ES8m55uccLyNkMwEeuc4kYg6kIZNcVKsHHcQncwQm5IA wqCBgLMwgmS4UG8GWBPPQ3Y4PXCnqPfQcjYoCoynmRfxkO02VHXrLToiIq18L3iBl/ke //7LAkWqUWwdDNdfkSSexcMcEYkVV8ibjw1JOk9u36cRz8dEzMr7+BTkLf30dFK9RojJ /EnMSoNwH9+bzLdMTjOHt0xBeCgPXGqRoFSR/MKoL0ALlEIHFv9qAdv3jAxKtLfUsRVJ f9UCn/FU8Ehtkx4rS01WaUNHeV72X0UrOYdrvRv65IdbaS3L7NxTgGyFdUGHOgWkgibo B9mQ== X-Gm-Message-State: AOAM533u3RBnOt9eVxoTjY3taB1L7nButShKCeFBDozdqFGvWoblEAvs WZz8DkE57qENPsla/o6WUpZl+g== X-Received: by 2002:a17:903:1206:b0:151:7d67:2924 with SMTP id l6-20020a170903120600b001517d672924mr21812991plh.45.1649471834502; Fri, 08 Apr 2022 19:37:14 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:17db:64e:48d4:a4e]) by smtp.gmail.com with ESMTPSA id 188-20020a6215c5000000b0050597294893sm759999pfv.124.2022.04.08.19.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 19:37:14 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Robert Foss , Hsin-Yi Wang , Dmitry Baryshkov , Abhinav Kumar , Sankeerth Billakanti , Philip Chen , Stephen Boyd , Douglas Anderson , Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Neil Armstrong , linux-kernel@vger.kernel.org Subject: [RFC PATCH 6/6] drm/bridge: parade-ps8640: Provide is_hpd_asserted() in struct drm_dp_aux Date: Fri, 8 Apr 2022 19:36:28 -0700 Message-Id: <20220408193536.RFC.6.Ie827321ce263be52fdb8c1276f6f8cc00d78029f@changeid> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog In-Reply-To: <20220409023628.2104952-1-dianders@chromium.org> References: <20220409023628.2104952-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 This implements the callback added by the patch ("drm/dp: Add is_hpd_asserted() callback to struct drm_dp_aux"). With this change and all the two "DP AUX Endpoint" drivers changed to use is_hpd_asserted(), we no longer need to have an long delay in the AUX transfer function. It's up to the panel code to make sure that the panel is powered now. If someone tried to call the aux transfer function without making sure the panel is powered we'll just get a normal transfer failure. We'll still keep the "ensure" for HPD in the pre_enable() function. Though it's probably not actually needed there, this driver is used in the old mode (pre-DP AUX Endpoints) and it may be important for those cases. If nothing else, it shouldn't cause any big problems. Signed-off-by: Douglas Anderson --- drivers/gpu/drm/bridge/parade-ps8640.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 96e883985608..13c3cb5d34f3 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -190,6 +190,22 @@ static int ps8640_ensure_hpd(struct ps8640 *ps_bridge) return ret; } +static bool ps8640_is_hpd_asserted(struct drm_dp_aux *aux) +{ + struct ps8640 *ps_bridge = aux_to_ps8640(aux); + struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; + struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; + unsigned int status = 0; + + pm_runtime_get_sync(dev); + regmap_read(map, PAGE2_GPIO_H, &status); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + + /* GPIO9 signals HPD. See ps8640_ensure_hpd() */ + return status & PS_GPIO9; +} + static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) { @@ -324,9 +340,7 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, int ret; pm_runtime_get_sync(dev); - ret = ps8640_ensure_hpd(ps_bridge); - if (!ret) - ret = ps8640_aux_transfer_msg(aux, msg); + ret = ps8640_aux_transfer_msg(aux, msg); pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); @@ -679,6 +693,7 @@ static int ps8640_probe(struct i2c_client *client) ps_bridge->aux.name = "parade-ps8640-aux"; ps_bridge->aux.dev = dev; ps_bridge->aux.transfer = ps8640_aux_transfer; + ps_bridge->aux.is_hpd_asserted = ps8640_is_hpd_asserted; drm_dp_aux_init(&ps_bridge->aux); pm_runtime_enable(dev); -- 2.35.1.1178.g4f1659d476-goog