Received: by 10.192.165.148 with SMTP id m20csp593320imm; Wed, 25 Apr 2018 04:51:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AHw956YdMnfbXhgB8vIPX1di/2sqLhUa6ODImJKez8PmDf25bg6HB43Og01XmGviWiAga X-Received: by 2002:a17:902:362:: with SMTP id 89-v6mr29537012pld.270.1524657075902; Wed, 25 Apr 2018 04:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524657075; cv=none; d=google.com; s=arc-20160816; b=McqkQt3ccePIW9Yk/EHmt1CJrX2HnE+iCNj4CgCAFF/QlRpob4abvGcj0b4wwNGuOB BRfHNDIWBXPDnaDq4RPej/lPDcyCpUA4nit3P6+Qmx0SgwlTGaSCkMYQRJcB2TNxeoEy SSS06Lm2ZhC8aiW/4rFlzpoAbdpIILBPCGGNEPYUaz3g0QUF5BoE25FRvejq+ZrG1NXX Q2pF/gMEXedeDmdtS39iFMFoS4HKboRSgsCmloxE1GLv+Qas8A0M745VSjhcftah2/Nz XSIXyRO90ynUAStORrE7jmICBQex/tyk7u5cs3Z6NhxI+e/T3Zh6gSpsmQRsIfmckUJD UeVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=8FxfZXfdx/uw7/QRfafA2t8ulE0EuFHAB4P5P7Vt/UE=; b=QCJHVJjGZLX0+rFLUBwPmjsPUFVqqD4ySeCTwnI7LdvLVUrmY3ERGRlvfLUKGPv5Is CJSbFz0s5rQ0HZiOjni9x5iqYOsC626QR39gSMU/htPX7PVWF5vnIzpdPKo4Q0wHRT3M rXIqO1l/fdX71Z0mzZ/xJq7b0V31rIEWkA+4GjQ2cfqV3BaiYtV0kqwNgZkaGGjgmTi8 u1JphK6E5oxlHw3gyE8S9Ueg8h8hBfH25BZlXi4EAMJlcGBaTCnuWfKlwNiNXZi3PVvK BrvfAtyufBE8JbiFkdjKpemV6lNxEkPZkqu9qOBwT+VyoQHVHTUt9FM7wSibFYFy23ic FMKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=a4p3FAgh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si7794590pgw.657.2018.04.25.04.51.01; Wed, 25 Apr 2018 04:51:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=a4p3FAgh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbeDYLtj (ORCPT + 99 others); Wed, 25 Apr 2018 07:49:39 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:36921 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751487AbeDYLtg (ORCPT ); Wed, 25 Apr 2018 07:49:36 -0400 Received: by mail-it0-f68.google.com with SMTP id 71-v6so18983902ith.2 for ; Wed, 25 Apr 2018 04:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=8FxfZXfdx/uw7/QRfafA2t8ulE0EuFHAB4P5P7Vt/UE=; b=a4p3FAghWgKo6uqT2gjIcWpZZxl3XiBYjtfU43Je1ygGW/XHIz2lvcWly0qUn2Q/tz FpI6fiZcUwROkvoRudwoJBy+z53TQOkb+jsohBOp6vLhGP//LbNVAhYfavnU8/uGZwV/ wNXj7xVYEYZP39U0fdFZxPwZt68Ls7H9AvDyo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=8FxfZXfdx/uw7/QRfafA2t8ulE0EuFHAB4P5P7Vt/UE=; b=A4z/T8TiV8w4/+K+JzY6U5zh1HgBP9wOQF7+bqpt+tlyoJTfsqGfd0Waue7ISwWhP9 fcOBpEwg3QBEyR8SONdkhN9ZSbLSATdkr2ZKsWcrIGlgIII4g0ou6vNA9xqXptxo2Ar+ G91KvSW2W8nDWWwEL4WbIf9hzdUonFaYgfDFgo/zhJHwP7n4Bmt5sYIOX8XyICc/yN2/ DN01WrrCcmZnaAHRSjOy47PYRlN38fMLj4Y8EEYA1IU8caix0YD82rVkPjr+aiaWIyDt 2TyI8W1nD2ge60nVsUvq5EBJBPMfe8wyaea4JO9aKCq+JBIVa8gYaXhqhgt03RBivtMK D4PA== X-Gm-Message-State: ALQs6tC9I+fGsYAqq4374a3q/bGoicrhlTeJy6t3XBciuk5OIR6n5C9J CkFNVozwGM3BjBpJsZvBZDfq/HSeAcWB6QFjHkbZ9A== X-Received: by 2002:a24:b310:: with SMTP id e16-v6mr19583430itf.58.1524656975847; Wed, 25 Apr 2018 04:49:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:bf4f:0:0:0:0:0 with HTTP; Wed, 25 Apr 2018 04:49:35 -0700 (PDT) X-Originating-IP: [2a02:168:5635:0:39d2:f87e:2033:9f6] In-Reply-To: <20180425112604.GP14661@e110455-lin.cambridge.arm.com> References: <1524593567-5559-1-git-send-email-ayan.halder@arm.com> <1524593567-5559-6-git-send-email-ayan.halder@arm.com> <20180425071722.GN25142@phenom.ffwll.local> <20180425112604.GP14661@e110455-lin.cambridge.arm.com> From: Daniel Vetter Date: Wed, 25 Apr 2018 13:49:35 +0200 X-Google-Sender-Auth: hx09kToJVVKKk3Iz45I-C6E4S28 Message-ID: Subject: Re: [PATCH v3 5/5] drm/arm/malidp: Added the late system pm functions To: Liviu Dudau Cc: Ayan Kumar Halder , Brian Starkey , Dave Airlie , dri-devel , Linux Kernel Mailing List , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 25, 2018 at 1:26 PM, Liviu Dudau wrote: > On Wed, Apr 25, 2018 at 09:17:22AM +0200, Daniel Vetter wrote: >> On Tue, Apr 24, 2018 at 07:12:47PM +0100, Ayan Kumar Halder wrote: >> > malidp_pm_suspend_late checks if the runtime status is not suspended >> > and if so, invokes malidp_runtime_pm_suspend which disables the >> > display engine/core interrupts and the clocks. It sets the runtime sta= tus >> > as suspended. >> > >> > The difference between suspend() and suspend_late() is as follows:- >> > 1. suspend() makes the device quiescent. In our case, we invoke the DR= M >> > helper which disables the CRTC. This would have invoked runtime pm >> > suspend but the system suspend process disables runtime pm. >> > 2. suspend_late() It continues the suspend operations of the drm devic= e >> > which was started by suspend(). In our case, it performs the same func= tionality >> > as runtime_suspend(). >> > >> > The complimentary functions are resume() and resume_early(). In the ca= se of >> > resume_early(), we invoke malidp_runtime_pm_resume() which enables the= clocks >> > and the interrupts. It sets the runtime status as active. If the devic= e was >> > in runtime suspend mode before system suspend was called, pm_runtime_w= ork() >> > will put the device back in runtime suspended mode( after the complete= system >> > has been resumed). >> > >> > Signed-off-by: Ayan Kumar Halder >> > >> >> Afaiui we still haven't bottomed out on the discussion on v1. Did you ge= t >> hold of Rafael? > > No, there was no reply from him. Lets try again: > > Rafael, we are debating on what the proper approach is for handling the > suspend/resume callbacks for a DRM driver that is likely to not be > runtime suspended when the power-down happens (because we are driving > the display output). We are using in this patch the LATE_SYSTEM_SLEEP_PM_= OPS > in order to do the work that we also do during runtime suspend, which is > turning off the output and the clocks driving it. The reason for doing > that is because the PM core takes a runtime reference during system > suspend for all devices that are not already runtime suspended, so our > runtime_pm_suspend() hook is never called. > > Daniel's argument is that we should not be doing this from LATE hooks, > but from the normal suspend hooks, however kernel doc seems to suggest > otherwise. For more context: I thought the reason behind the recommendation to stuff the rpm callbacks into the late/early hooks was to solve cross-device ordering issues. That way everyone shuts down the device functionality in the normal hooks, but only powers them off in the late hook (to allow other drivers to keep using the clock/i2c master/whatever). But we now have device_link to solve that since a while, so I'm not sure the recommendation to stuff the rpm hooks into late/early callbacks is still correct. -Daniel > > Best regards, > Liviu > > > >> -Daniel >> >> > --- >> > Changes in v3:- >> > - Rebased on top of earlier v3 patches, >> > >> > Changes in v2:- >> > - Removed the change id and modified the commit message >> > --- >> > drivers/gpu/drm/arm/malidp_drv.c | 17 +++++++++++++++++ >> > 1 file changed, 17 insertions(+) >> > >> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/ma= lidp_drv.c >> > index 82221ea..c53b46a 100644 >> > --- a/drivers/gpu/drm/arm/malidp_drv.c >> > +++ b/drivers/gpu/drm/arm/malidp_drv.c >> > @@ -768,8 +768,25 @@ static int __maybe_unused malidp_pm_resume(struct= device *dev) >> > return 0; >> > } >> > >> > +static int __maybe_unused malidp_pm_suspend_late(struct device *dev) >> > +{ >> > + if (!pm_runtime_status_suspended(dev)) { >> > + malidp_runtime_pm_suspend(dev); >> > + pm_runtime_set_suspended(dev); >> > + } >> > + return 0; >> > +} >> > + >> > +static int __maybe_unused malidp_pm_resume_early(struct device *dev) >> > +{ >> > + malidp_runtime_pm_resume(dev); >> > + pm_runtime_set_active(dev); >> > + return 0; >> > +} >> > + >> > static const struct dev_pm_ops malidp_pm_ops =3D { >> > SET_SYSTEM_SLEEP_PM_OPS(malidp_pm_suspend, malidp_pm_resume) \ >> > + SET_LATE_SYSTEM_SLEEP_PM_OPS(malidp_pm_suspend_late, malidp_pm_res= ume_early) \ >> > SET_RUNTIME_PM_OPS(malidp_runtime_pm_suspend, malidp_runtime_pm_re= sume, NULL) >> > }; >> > >> > -- >> > 2.7.4 >> > >> > _______________________________________________ >> > dri-devel mailing list >> > dri-devel@lists.freedesktop.org >> > https://lists.freedesktop.org/mailman/listinfo/dri-devel >> >> -- >> Daniel Vetter >> Software Engineer, Intel Corporation >> http://blog.ffwll.ch > > -- > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > | I would like to | > | fix the world, | > | but they're not | > | giving me the | > \ source code! / > --------------- > =C2=AF\_(=E3=83=84)_/=C2=AF > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel --=20 Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch