Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp348664pxb; Wed, 27 Oct 2021 04:13:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVFpSaT+xplW0X6ysNgCbQqkU/qBWjzP51m4hbaO1OR7htGXJeWJSpsUOvOmTzZZ6lAqEC X-Received: by 2002:a17:907:6297:: with SMTP id nd23mr38830078ejc.62.1635333210065; Wed, 27 Oct 2021 04:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635333210; cv=none; d=google.com; s=arc-20160816; b=RREO4ZOlU80G4/JP0W9gj+aTZtS29/9Srd4CqTkYZGg9U2iW9xPZUhcZ4fm5P+WdGc t6JIiXTAJ9svcCY2Jx260G5QEv7wcl9iMGDtpuciifJvQ7shdwPJpz6BxBg86uHv6etT 31foZne1uQFPjtp9XmBZb0DNX0CW01JxA9/6S/OUoDII2EkGeVMcJL6uACkt3k/lYnEC 7yVpKKq+eQpktnX02OoIdsG3ZdmZWu9D8rqGIFkqIXorhphcgg1XiWuq9rELxwHQOgjP 3Gw2mHr1JNPe8lKt0RRbyzvR7W562EZ+A0pVY/qQFR87ZKNx4LBD3BOjXQYM3k5Q0MkB kwbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MededdR+juQ13yGNOGeK0uexSJWnvAp1kcIewWh2eLQ=; b=tRCKOh+u2YeZxVREkqkt8BYpUCK/HE41dD3jnXd8e3/d8g4B1nTcAZxitHFsv8CrzX PvEwhwqNTzWYRcONap81g7kfVqOCW4pscZ19hp6DJQKVPU4X9gYfI3ETp6W4vV5lkhSY IF7cINlxeLPQYblmm96zhdXjywXvhJKVhkFZKsHUfkiElEaAheU5xoHOEzPwaLe2dMVS np3klGGS9RMXv3tV5zZDyFA/FFwoELMl21T4SSslKy4iX8tPVGxGBIQbEKaYPkY068GK bIosFCIJd7svjyX8os83IVeDMsiBb6B2NZNb2bEmIu+1XBMTx67wXdAWBYVinj22yOod v4bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VjzyyTWv; 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 hd31si7116408ejc.365.2021.10.27.04.12.43; Wed, 27 Oct 2021 04:13:30 -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=VjzyyTWv; 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 S236470AbhJZVb2 (ORCPT + 99 others); Tue, 26 Oct 2021 17:31:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbhJZVbV (ORCPT ); Tue, 26 Oct 2021 17:31:21 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15429C061570 for ; Tue, 26 Oct 2021 14:28:57 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id e138so1066524ybc.3 for ; Tue, 26 Oct 2021 14:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MededdR+juQ13yGNOGeK0uexSJWnvAp1kcIewWh2eLQ=; b=VjzyyTWvDNaSRucg992Q9KO0s04B1dUPhTg8JsH7gGpG8/9JKgrpf5xFAv8yKZDXD4 virhKTaJqSw35lj17a32xWK+LeU9It9zqAx9KVbjhTJ33chCrk0Dl1KN31VrJaqALMYy jz3ly0NwfGZOhtjvX05ax/BPl3OIfZPOYK1eY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MededdR+juQ13yGNOGeK0uexSJWnvAp1kcIewWh2eLQ=; b=KwNlm7lI9glSOWUquukeRh56zjvhYWvPgbAEG5etA7GUZvaebKNKInR3JmWTK+CxBn 594YYq+rPZrIz7VOPJZXIby8izSn4Zwe8jFYfDJ7ymLK7Zlq3+yJVBYM2jt4vt7eRpbH 1xGZWHfRcOXzfqu+Xy8i16/VmRSUcghvcZXhWsSKh8DyhnmJjoJ0M9ENXWbi+7vX7b0v 62tNqQhyge/VAVmGB9A65m/3nXkDyMqW8VFngMYTR6oNjoZcm3oxLpZgBchh+AnBUqnP IjhurJ27WxyiPxPCMb2nFGfzCg2Jv0HvGrRWrSIMJWbNegTPVhk7S9xdaEYCBPJzfF0j 93wQ== X-Gm-Message-State: AOAM532jDGPG7vJGqOFq/GY8Pd5amw7YNILyNLCZuee22uF6/MHjee0+ RT4uBdyMLKILUcdXTSqchBtS7iGjOVX5qX9V/KfiOg== X-Received: by 2002:a25:ae1a:: with SMTP id a26mr4404931ybj.217.1635283736333; Tue, 26 Oct 2021 14:28:56 -0700 (PDT) MIME-Version: 1.0 References: <20211026121058.v3.1.I9d81c3b44f350707b5373d00524af77c4aae862b@changeid> In-Reply-To: From: Philip Chen Date: Tue, 26 Oct 2021 14:28:44 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] drm/bridge: parade-ps8640: Enable runtime power management To: Stephen Boyd Cc: LKML , dianders@chromium.org, Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Neil Armstrong , Robert Foss , dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On Tue, Oct 26, 2021 at 12:36 PM Stephen Boyd wrote: > > Quoting Philip Chen (2021-10-26 12:11:09) > > Fit ps8640 driver into runtime power management framework: > > > > First, break _poweron() to 3 parts: (1) turn on power and wait for > > ps8640's internal MCU to finish init (2) check panel HPD (which is > > proxied by GPIO9) (3) the other configs. As runtime_resume() can be > > called before panel is powered, we only add (1) to _resume() and leave > > (2)(3) to _pre_enable(). We also add (2) to _aux_transfer() as we want > > to ensure panel HPD is asserted before we start AUX CH transactions. > > > > Second, the original driver has a mysterious delay of 50 ms between (2) > > and (3). Since Parade's support can't explain what the delay is for, > > and we don't see removing the delay break any boards at hand, remove > > the delay to fit into this driver change. > > > > In addition, rename "powered" to "pre_enabled" and don't check for it > > in the pm_runtime calls. The pm_runtime calls are already refcounted > > so there's no reason to check there. The other user of "powered", > > _get_edid(), only cares if pre_enable() has already been called. > > > > Lastly, change some existing DRM_...() logging to dev_...() along the > > way, since DRM_...() seem to be deprecated in [1]. > > > > [1] https://patchwork.freedesktop.org/patch/454760/ > > > > Signed-off-by: Philip Chen > > Reviewed-by: Douglas Anderson > > --- > > > > Changes in v3: > > - Fix typo/wording in the commit message. > > - Add ps8640_aux_transfer_msg() for AUX operation. In > > ps8640_aux_transfer(), wrap around ps8640_aux_transfer_msg() > > with PM operations and HPD check. > > - Document why autosuspend_delay is set to 500ms. > > > > drivers/gpu/drm/bridge/parade-ps8640.c | 186 +++++++++++++++---------- > > 1 file changed, 115 insertions(+), 71 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c > > index 3aaa90913bf8..ac42a3473770 100644 > > --- a/drivers/gpu/drm/bridge/parade-ps8640.c > > +++ b/drivers/gpu/drm/bridge/parade-ps8640.c > > @@ -9,6 +9,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -100,7 +101,7 @@ struct ps8640 { > > struct regulator_bulk_data supplies[2]; > > struct gpio_desc *gpio_reset; > > struct gpio_desc *gpio_powerdown; > > - bool powered; > > + bool pre_enabled; > > }; > > > > static const struct regmap_config ps8640_regmap_config[] = { > > @@ -148,8 +149,29 @@ static inline struct ps8640 *aux_to_ps8640(struct drm_dp_aux *aux) > > return container_of(aux, struct ps8640, aux); > > } > > > > -static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, > > - struct drm_dp_aux_msg *msg) > > +static void ps8640_ensure_hpd(struct ps8640 *ps_bridge) > > static int ps8640_ensure_hpd? Oops, this change was mis-added to the patch on top of this one. I'll fix it in v4... > > > +{ > > + struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; > > + struct device *dev = &ps_bridge->page[PAGE2_TOP_CNTL]->dev; > > + int status; > > + int ret; > > + > > + /* > > + * Apparently something about the firmware in the chip signals that > > + * HPD goes high by reporting GPIO9 as high (even though HPD isn't > > + * actually connected to GPIO9). > > + */ > > + ret = regmap_read_poll_timeout(map, PAGE2_GPIO_H, status, > > + status & PS_GPIO9, 20 * 1000, 200 * 1000); > > + > > + if (ret < 0) > > + dev_warn(dev, "HPD didn't go high: %d\n", ret); > > + > > + return ret; > > +} > > + > > +static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux, > > + struct drm_dp_aux_msg *msg) > > { > > struct ps8640 *ps_bridge = aux_to_ps8640(aux); > > struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL]; > > Otherwise > > Reviewed-by: Stephen Boyd