From patchwork Sat Apr 9 02:36:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12807337 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 998F4C433EF for ; Sat, 9 Apr 2022 02:37:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F104210E240; Sat, 9 Apr 2022 02:37:17 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 147DE10E209 for ; Sat, 9 Apr 2022 02:37:15 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so6908006pja.0 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=wQzrS/hlLHSZWPZGx8kIup+Ztf/FwjegDEY/DiGGIuvJkm+rMSf0f1P+BxZm70rupL wGDOQOLxVK26ZwaTuPoA0piqGonr1RwP8JEuHoV1DlY605Z/M5qaSDdH2seLO943rQKV bV+FuL5+BYY4eKXTjpAh2/Z5xnuXT0xlq2l9jC8cfVWB63bH9m1UTJp/TWQtKJaJUgm5 jSEl7fC4K5k3uCMHxGNc7sLcsQsWrTS29aC1XbLfHFecMWvYKkLef2b3FIewQkJbsB0w 4Fq3s57wWPpzkgVrVOzI8hAqNBM6OW30z17FBXHFhWRykby7aln2+nyoKvqg+ipJjo0V ReLQ== X-Gm-Message-State: AOAM532esFUaDl4va+F0CEY/xNjZXb/SqOaSZmYIL2bsjIchPqWV9HgI F04sh7/plaZhpAYBWs+hguLhPKPlzcJ1YZK3gIpk6g== X-Google-Smtp-Source: ABdhPJxZ7Pqlo45QY22NAolHTEUTLzi46MpCGEQydMm3iAjUaV6osMVmGoBxIwb2Ikn3JQsXaigMug== 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 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 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 , Jonas Karlman , David Airlie , linux-kernel@vger.kernel.org, Neil Armstrong , Abhinav Kumar , Robert Foss , Stephen Boyd , Jernej Skrabec , Andrzej Hajda , Hsin-Yi Wang , Dmitry Baryshkov , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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);