Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp378391pxb; Wed, 14 Apr 2021 18:25:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMgQoSx8Vmoe+YPtzjSz65W6xFRGmBkRqYtW06ZvqZZKcTMrpSfGXj4urSFcvqfHQ+H1zj X-Received: by 2002:a17:90a:c788:: with SMTP id gn8mr972398pjb.60.1618449921599; Wed, 14 Apr 2021 18:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618449921; cv=none; d=google.com; s=arc-20160816; b=AZG4zCsGOCq9bq+cpFiO41gQGFlAJbmqR90x+NzZsr1dFJSyy2v+3N8V2y40SlPVR+ norzibKit2lF53vXQyAroEHVS8ieXVVC2rtIXi93zshAMRJUfgaI/qI/P6JGXGJZI4rk EVoAOXVmLzGc3MAXO1sgd+At+0ytbg9IZW6KUbTiXerkkApwohvgv2lYOJxvIuz6YPoF lFPQOIrovbFEWbTXIgeoRfyk7zcwPxVAMUxw0oWaGcFV0j6HtPX2BVBzHXWuYiO30MYP j/N3ctJRH5XJP8bPUmUaw8aUy9yPadjdIRiFL+aA44dzkYhAQbl+9BcdIhFCM0Aw31lu OYXw== 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=or2E+Xrz/yrj3CbSRghlqeF1cBqT6BkZhveQdh84YTM=; b=Sgaql0Pe+JqXYWB7nLBsUv5eBySWnjU2PcCA2dnpKdRg+L80Ga53PnWVupQshh0M67 ZxTGGxxbcoabiqzi3etszfXcDLJoo+1bKtaenM9HPGUqZOD6KW2FxVAgarOs3tDBSYou FJKVgXwBauANMDH1OdH8q6WT6oEjidz5djl7Krcu+LQWF7/5Y21JH7WuR6bxbbvP6ydd 88uf0Ccda953KKEP6fF5boC8KYo9jBlV5tfDrE0j2DZwA+VDlTazWKxZ4Cmz8NvkmTiF +bsIRZoX7Vr9YD9o9Fp1yqcDA79quXj4QNWWqG65tzUv3fp6O51ccgMcU8cATLeBMTUO PuIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dr3mDQfI; 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 m185si1542815pgm.44.2021.04.14.18.25.09; Wed, 14 Apr 2021 18:25:21 -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=dr3mDQfI; 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 S229598AbhDOBXi (ORCPT + 99 others); Wed, 14 Apr 2021 21:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhDOBXh (ORCPT ); Wed, 14 Apr 2021 21:23:37 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A51C061574 for ; Wed, 14 Apr 2021 18:23:12 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id h15so1126863qvu.4 for ; Wed, 14 Apr 2021 18:23:12 -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=or2E+Xrz/yrj3CbSRghlqeF1cBqT6BkZhveQdh84YTM=; b=dr3mDQfITiSC1Xe8vhYBkB/3AZe6OSEASYIUILrz/7HZvYfnBmMT/gH8v92ltFTKIu AgdL3RA1GZEtAA8Hzgt98fThu/Qn1Q8wEKSPjgueKRNz+hJ/JHSgQ5LFlIvVEEAQEf/S aKevGJb+16n4efb/8Bk+p1IrucLytBbNXsIgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=or2E+Xrz/yrj3CbSRghlqeF1cBqT6BkZhveQdh84YTM=; b=KeNQtP3CX3X6Bdr9MMlm2IcvPqDwW1O+36Vb9CbD1sZejvPGTHSq0lxAWIdIM3nox2 hbjmsuCHIH3eCLTL75f3Ey5ca7kd008YBVhUqejdh2or2GlTcSkb6vI0NW0OgGKIi+jd 762u8Y67wEoCql5kIDAcAF1S+ImgkOac326JOQXqDJPLBMGKeHC6eQdxX4NDYRFK86hz fMODsPSuywrcS5PZFwLQ/jlUwBW+WHQnsZjycTStVUjG/UNaML8finboVe9orqJcnXrD twUPyJMRysAR1UMAvoGBEJncgP2QXvnerQOm9mHzJVrgVoLqf4YTPIiDv5lglR26afA0 Am0w== X-Gm-Message-State: AOAM530LfdElQJCk8dtZg/2nPhbN4eCgSmIjtLWPWTD5cnLk+6UIiiGE KPsLyb/Dgv62HiZQL+wMFrU7K3xi01zS4Q== X-Received: by 2002:a05:6214:1906:: with SMTP id er6mr909912qvb.38.1618449791187; Wed, 14 Apr 2021 18:23:11 -0700 (PDT) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com. [209.85.219.181]) by smtp.gmail.com with ESMTPSA id f12sm745711qti.63.2021.04.14.18.23.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Apr 2021 18:23:09 -0700 (PDT) Received: by mail-yb1-f181.google.com with SMTP id x76so14284217ybe.5 for ; Wed, 14 Apr 2021 18:23:09 -0700 (PDT) X-Received: by 2002:a25:d847:: with SMTP id p68mr1088600ybg.345.1618449788793; Wed, 14 Apr 2021 18:23:08 -0700 (PDT) MIME-Version: 1.0 References: <20210402222846.2461042-1-dianders@chromium.org> <20210402152701.v3.12.I9e8bd33b49c496745bfac58ea9ab418bd3b6f5ce@changeid> In-Reply-To: From: Doug Anderson Date: Wed, 14 Apr 2021 18:22:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 12/12] drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare To: Laurent Pinchart Cc: Andrzej Hajda , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Sam Ravnborg , Linus W , Bjorn Andersson , Rob Clark , Stephen Boyd , Steev Klimaszewski , Maarten Lankhorst , linux-arm-msm , Stanislav Lisovskiy , Daniel Vetter , David Airlie , Thierry Reding , dri-devel , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Apr 14, 2021 at 5:58 PM Laurent Pinchart wrote: > > Hi Doug, > > Thank you for the patch. > > On Fri, Apr 02, 2021 at 03:28:46PM -0700, Douglas Anderson wrote: > > Unpreparing and re-preparing a panel can be a really heavy > > operation. Panels datasheets often specify something on the order of > > 500ms as the delay you should insert after turning off the panel > > before turning it on again. In addition, turning on a panel can have > > delays on the order of 100ms - 200ms before the panel will assert HPD > > (AKA "panel ready"). The above means that we should avoid turning a > > panel off if we're going to turn it on again shortly. > > > > The above becomes a problem when we want to read the EDID of a > > panel. The way that ordering works is that userspace wants to read the > > EDID of the panel _before_ fully enabling it so that it can set the > > initial mode correctly. However, we can't read the EDID until we power > > it up. This leads to code that does this dance (like > > ps8640_bridge_get_edid()): > > > > 1. When userspace requests EDID / the panel modes (through an ioctl), > > we power on the panel just enough to read the EDID and then power > > it off. > > 2. Userspace then turns the panel on. > > > > There's likely not much time between step #1 and #2 and so we want to > > avoid powering the panel off and on again between those two steps. > > > > Let's use Runtime PM to help us. We'll move the existing prepare() and > > unprepare() to be runtime resume() and runtime suspend(). Now when we > > want to prepare() or unprepare() we just increment or decrement the > > refcount. We'll default to a 1 second autosuspend delay which seems > > sane given the typical delays we see for panels. > > > > A few notes: > > - It seems the existing unprepare() and prepare() are defined to be > > no-ops if called extra times. We'll preserve that behavior. > > The prepare and unprepare calls are supposed to be balanced, which > should allow us to drop this check. Do you have a reason to suspect that > it may not be the case ? No, it was just code inspection. The old code definitely made an effort to make enable of an already enabled panel a no-op and disable of an already disabled panel a no-op. This is even before my (somewhat) recent patch to make things timing based, though I did touch the code. Can I maybe suggest that getting rid of the extra check should be a separate patch after this one? Then if it breaks someone it's easy to just revert that one and we can still keep the runtime pm? > > - This is a slight change in the ABI of simple panel. If something was > > absolutely relying on the unprepare() to happen instantly that > > simply won't be the case anymore. I'm not aware of anyone relying on > > that behavior, but if there is someone then we'll need to figure out > > how to enable (or disable) this new delayed behavior selectively. > > - In order for this to work we now have a hard dependency on > > "PM". From memory this is a legit thing to assume these days and we > > don't have to find some fallback to keep working if someone wants to > > build their system without "PM". > > Sounds fine to me. > > The code looks good to me. Possibly with the prepared check removed, > > Reviewed-by: Laurent Pinchart Thanks!