Message ID | 20221117133655.1.I51639dc112bbbe27259df6bdad56dbabd655d91a@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp617304wrr; Thu, 17 Nov 2022 12:56:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf57qBV+bAn4wJ68QLpVMgUk0nNQqAVB4K7gjl7RYMxYnxgLcz2enKDRF+PVTw7yZ64clUa0 X-Received: by 2002:aa7:cc08:0:b0:461:8a43:e93 with SMTP id q8-20020aa7cc08000000b004618a430e93mr3492014edt.275.1668718575041; Thu, 17 Nov 2022 12:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668718575; cv=none; d=google.com; s=arc-20160816; b=Ky+K8EMt0YepRYQP04UpOLcELkleqixLBjY/m7G8RuIc/RS3iqder/6q4Y9CuPQT6o ZSeR8tvmfVhCQqmPuoM3RmI0JebAIOQ3AMwJ+WmRXe7Y2zgcZAr9WglK1O/fe0fRljRo aVansdbRAHcN20D9XfOvJ4rRYdrOTSpg4o6fGas/YN/PxcQ8eBgZ7niLK9H3SmdOnKeq K8/olIHLouQ3g20w27QlkRperg9HA5479eZiW90+VXYUjzcEEzbLS7YdOo/Loj+hg2VS fqk44naGbnbd/wbAOEdwuhUf6mk4hJ2o0C86NYH9jc8A4/fvg0plRU3MFzAotEFrBSww bbWg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=cZEHbyUygY8mL/VudOEJPrn+JnbHs5KjIjH28m2m7pA=; b=xnpZ/SAjLo1bvmWJjyCL18h3tomTK1E5fbRpuwJFhShVf81JiC1Oy863djdFAWVEBl 4ALvBjeGCKyB/lVz7ubvv9kaj9PshriK+x1m11jQSj10JSs0b12hXThFqSHmA6ZxyPJp G53nXb0ZH4ZlYIIM3fWxEttNp1arLFoTTLsd1gxBMmA7Aq6DlDy2hlRWZfM8/t3XIGQE T2xtn1VLysMvATx8V65xxpd17jNQZ8VxFDQ+nBoDqjWAdy2W98lob72eEw0ftw6dRx/r C8wfYdffbePRiZzspWu2yFLeFC+rMJofFv9B95q3T7PHmVPELTIJkIOAShVkiJ1WlMc8 srug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="UER82uY/"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a05640251cd00b00462e5d768b3si1877761edd.612.2022.11.17.12.55.22; Thu, 17 Nov 2022 12:56:15 -0800 (PST) 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="UER82uY/"; 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 S235006AbiKQUjI (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Thu, 17 Nov 2022 15:39:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiKQUjG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 17 Nov 2022 15:39:06 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140302737 for <linux-kernel@vger.kernel.org>; Thu, 17 Nov 2022 12:39:06 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id p184so2312336iof.11 for <linux-kernel@vger.kernel.org>; Thu, 17 Nov 2022 12:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cZEHbyUygY8mL/VudOEJPrn+JnbHs5KjIjH28m2m7pA=; b=UER82uY/1H5jglIAPvq1HsO4gdv4BFQBRhaokleoscz7Q4tld2LY9bERy0ACZV8fhB IxIqhMTIkOn6F4rz+ndD8NGvcSuANM7pvoitxcDZcPvzhzsADp3S64VuG+X0BO9X0ker Ux1ahNLGD7fRkaIH2Ib+C1+uCkYKYrs9mWlXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cZEHbyUygY8mL/VudOEJPrn+JnbHs5KjIjH28m2m7pA=; b=x/r5L4HPPqHQKN8dQbeCrwEBDMrn8DGLc5oKC+Ya5Fnn6ni+ttxI4QvYO/FTl944hX Ab2Xcn5P/BhKUz7hpypDkfzmWgEU1oo9EoFmFqS3pATY33qCekifpB9cK1VNSxdm8aA+ pNl1ChY3i+TzJIyShmSNN4orajAardOunHaM167LT5kSlxXPQqsMkA/ziujGIeTRVGvE hkVQrGD+Lj5pi0zvPvkPqE8VQ7k/VRW8zZWkhnDFCd4UvuJl4TIgP9uow1p83m0JCRy6 ThXMYH7Ms8a/0+Z1mnysmN7X3vZOLJGWSeuHKmZogFWo9p8e9v70kZpDasg3d23TofxW 6haw== X-Gm-Message-State: ANoB5pl6F4cCFR1jy6fMogsClFa5UDoPutHR9DaMztmhd3Uwdl2IxhOX f8uAA1YNT2wY1Fcv2Z36eDiC9Q== X-Received: by 2002:a05:6638:440b:b0:374:fbbe:2da6 with SMTP id bp11-20020a056638440b00b00374fbbe2da6mr1806005jab.163.1668717545484; Thu, 17 Nov 2022 12:39:05 -0800 (PST) Received: from midworld.bld.corp.google.com ([2620:15c:183:200:b285:6808:3f3e:f538]) by smtp.gmail.com with ESMTPSA id d191-20020a0262c8000000b00363da904602sm570192jac.13.2022.11.17.12.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 12:39:04 -0800 (PST) From: Drew Davenport <ddavenport@chromium.org> To: dri-devel@lists.freedesktop.org Cc: dianders@chromium.org, Drew Davenport <ddavenport@chromium.org>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>, Sam Ravnborg <sam@ravnborg.org>, Thierry Reding <thierry.reding@gmail.com>, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] drm/panel-edp: Use ktime_get_boottime for delays Date: Thu, 17 Nov 2022 13:38:44 -0700 Message-Id: <20221117133655.1.I51639dc112bbbe27259df6bdad56dbabd655d91a@changeid> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog 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,TVD_PH_BODY_ACCOUNTS_PRE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749778248535372453?= X-GMAIL-MSGID: =?utf-8?q?1749778248535372453?= |
Series | [1/5] drm/panel-edp: Use ktime_get_boottime for delays | |
Commit Message
Drew Davenport
Nov. 17, 2022, 8:38 p.m. UTC
ktime_get is based on CLOCK_MONOTONIC which stops on suspend. On
suspend, the time that the panel was powerd off is recorded with
ktime_get, and on resume this time is compared to the current ktime_get
time to determine if the driver should wait for the panel to power down
completely before re-enabling it.
Because we're using ktime_get, this delay doesn't account for the time
that the device is suspended, during which the power down delay may have
already elapsed.
Change to use ktime_get_boottime throughout, which uses CLOCK_BOOTTIME
which does not stop when suspended. This ensures that the resume path
will not be delayed if the power off delay has already been met while
the device is suspended.
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
---
drivers/gpu/drm/panel/panel-edp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
Hi, On Thu, Nov 17, 2022 at 12:39 PM Drew Davenport <ddavenport@chromium.org> wrote: > > ktime_get is based on CLOCK_MONOTONIC which stops on suspend. On > suspend, the time that the panel was powerd off is recorded with > ktime_get, and on resume this time is compared to the current ktime_get > time to determine if the driver should wait for the panel to power down > completely before re-enabling it. > > Because we're using ktime_get, this delay doesn't account for the time > that the device is suspended, during which the power down delay may have > already elapsed. > > Change to use ktime_get_boottime throughout, which uses CLOCK_BOOTTIME > which does not stop when suspended. This ensures that the resume path > will not be delayed if the power off delay has already been met while > the device is suspended. > > Signed-off-by: Drew Davenport <ddavenport@chromium.org> > > --- > > drivers/gpu/drm/panel/panel-edp.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Douglas Anderson <dianders@chromium.org>
Hi, On Thu, Nov 17, 2022 at 1:14 PM Doug Anderson <dianders@chromium.org> wrote: > > Hi, > > On Thu, Nov 17, 2022 at 12:39 PM Drew Davenport <ddavenport@chromium.org> wrote: > > > > ktime_get is based on CLOCK_MONOTONIC which stops on suspend. On > > suspend, the time that the panel was powerd off is recorded with > > ktime_get, and on resume this time is compared to the current ktime_get > > time to determine if the driver should wait for the panel to power down > > completely before re-enabling it. > > > > Because we're using ktime_get, this delay doesn't account for the time > > that the device is suspended, during which the power down delay may have > > already elapsed. > > > > Change to use ktime_get_boottime throughout, which uses CLOCK_BOOTTIME > > which does not stop when suspended. This ensures that the resume path > > will not be delayed if the power off delay has already been met while > > the device is suspended. > > > > Signed-off-by: Drew Davenport <ddavenport@chromium.org> > > > > --- > > > > drivers/gpu/drm/panel/panel-edp.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > Reviewed-by: Douglas Anderson <dianders@chromium.org> Pushed to drm-misc-next: fa8e91b12697 drm/panel-edp: Use ktime_get_boottime for delays
diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 5cb8dc2ebe184..a0a7ab35e08c9 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -351,7 +351,7 @@ static void panel_edp_wait(ktime_t start_ktime, unsigned int min_ms) return; min_ktime = ktime_add(start_ktime, ms_to_ktime(min_ms)); - now_ktime = ktime_get(); + now_ktime = ktime_get_boottime(); if (ktime_before(now_ktime, min_ktime)) msleep(ktime_to_ms(ktime_sub(min_ktime, now_ktime)) + 1); @@ -378,7 +378,7 @@ static int panel_edp_suspend(struct device *dev) gpiod_set_value_cansleep(p->enable_gpio, 0); regulator_disable(p->supply); - p->unprepared_time = ktime_get(); + p->unprepared_time = ktime_get_boottime(); return 0; } @@ -464,14 +464,14 @@ static int panel_edp_prepare_once(struct panel_edp *p) } } - p->prepared_time = ktime_get(); + p->prepared_time = ktime_get_boottime(); return 0; error: gpiod_set_value_cansleep(p->enable_gpio, 0); regulator_disable(p->supply); - p->unprepared_time = ktime_get(); + p->unprepared_time = ktime_get_boottime(); return err; }