Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1821396imm; Wed, 16 May 2018 03:40:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXqGf2WD/RocgF6qCD6zl4PhSfwuWXlZy9RX/Hz/e/oObeU2kZPzmBSJ4MtwGiT1H7Oe6K X-Received: by 2002:a62:404f:: with SMTP id n76-v6mr350323pfa.185.1526467253940; Wed, 16 May 2018 03:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526467253; cv=none; d=google.com; s=arc-20160816; b=lMRJaqiAB3qlof7yZLweJ2DyOkVgeTjRQPdISl2IiOh5v9t/FCwmQKuskEm/KE+3Sf xhOvosSKWU/Zgi2vpdOK8vcKcmDtt+sm6QK2qAVJCJ6C2UXTE0o3LqTeufenEcG0dKDV 496FvGC5VRfD7CoNW1ciQJm8tTK1LnSzV0A4NbVaoXsbTBlC2p9M5ofMGzS/Du+4Pjb9 xWs2CadLBSbwYO7fK+Wk31yygpvbInFuVUvYQsMT3gdiIUR3pakL+fhrZny8kaADH9w/ qpuzSc2b/Dtkacsp58j/ugDU/yOKii1N6bcwVuOJqScKwLcnzcNnftRyxDPbq8vwHL2z GgAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Stg4Nf4DNxzYuqfFTfAMC1ikXnhnecvP+F1sl2SOVhc=; b=pZvL+uE3R1pVW/x00+5KU2F4i5jL1GakLChRmNUcXaMNtJN7ZkknsLtmxr5unx3+YV Jt60fZb7HtEz+Ycc8BBAPK4WtQyUeWxQdgnpwxF/Zb/f/KAGLWir5Ndx8VScRx02Lwhe ZP9zlcxBEiNmmt1YDixl7u8+kQdRQ/MZ5ThzeaPjniib2+TLBpHW2oXg6Ga6uKCFb2en sTK3c9rVUQsg8/2HVrfQFy4Df+pdbBP+LOHjp3B/yDmWRipZQNJILlx/7mxipHHbiXHR e04xK1X2kdyNWsU9Ly6DC7Oa0rxPZh7ZObS718Wn2yFZKqEFaDehh64iMD+kSoVFXETc mbdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HMKS6rWQ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z73-v6si2473133pfj.197.2018.05.16.03.40.39; Wed, 16 May 2018 03:40:53 -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=@gmail.com header.s=20161025 header.b=HMKS6rWQ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752405AbeEPKi4 (ORCPT + 99 others); Wed, 16 May 2018 06:38:56 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:35115 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752015AbeEPKiz (ORCPT ); Wed, 16 May 2018 06:38:55 -0400 Received: by mail-ot0-f196.google.com with SMTP id h8-v6so315980otb.2; Wed, 16 May 2018 03:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Stg4Nf4DNxzYuqfFTfAMC1ikXnhnecvP+F1sl2SOVhc=; b=HMKS6rWQEMqdfFH5w4f4N6d1NEay6ZmUtOxI/e0Y8LRm7xIz2aBFrTAR0TTR0LxsLL pS9OjGKipG/n2q4iHYd8HIbAhLqYVOxpy/dtQSgUOzYmBdjYQ0vs9/KtMbamJiojZxM5 gWeIhuoxCtikMXgctC8zz3DXkvoWxbcQUKIfv1mRIQ8Cr9sLlu7NBXf23rkvjYk3rC2e +W6i+mjdHjD4eWI1mYZLnA5hBgjx1CvNb1fmG9t/MCWna3cFpdXGEZ0L43wC8Nek5aMX eRpacu5/vwPKspyFyqL74eQNJ7/Dvg5laFrgOgXtMCrK2O1f6xA0Zeh539QrX6hll7h3 t6Cg== 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; bh=Stg4Nf4DNxzYuqfFTfAMC1ikXnhnecvP+F1sl2SOVhc=; b=HVDhoEj1tC6YBo+Bd8aTLFzfakl/b8cIkYxT+OuDvWHFvulwVz78Nn4Mv7d99JOHGX q2LDGSsvmVO0b8bHuJt+DCQL0+fVnGbmUDgVVkeHGAJY0+jQjdRSw7seZza/20hbwldN ArGybJuBI397fAmK7nmfZLEuq6JHiIhBj305U9KJqDu15PNkQo2ZhLOYcRFsyd01FO5b +JjeKwv+YOLoplixbqgRyHzSkmh4txJ5s1+hNBPUwpAsYHjqxxMCekMw15PxY+tKPl6b iDIrThknrmLBATH6E0yOCEZuq14IYoTP1hg8bWrqVBAvj2kAjNkZJ2RSw3cqRA0Kgn0f C9jg== X-Gm-Message-State: ALKqPwcy/jAQ5LyYuZJ5Kjv8pTDrzJElOo+xmFr5bgjwUud+3OvdRfob eoSSFSrEFUsTr0+qmLrkm+KUHbhYjg/Rm3fbI/g= X-Received: by 2002:a9d:5917:: with SMTP id t23-v6mr234554oth.217.1526467134425; Wed, 16 May 2018 03:38:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Wed, 16 May 2018 03:38:54 -0700 (PDT) In-Reply-To: <1526400259-7573-6-git-send-email-ayan.halder@arm.com> References: <1526400259-7573-1-git-send-email-ayan.halder@arm.com> <1526400259-7573-6-git-send-email-ayan.halder@arm.com> From: "Rafael J. Wysocki" Date: Wed, 16 May 2018 12:38:54 +0200 X-Google-Sender-Auth: 6WvFpTBQ6IbAiB549rT5doxsOzc Message-ID: Subject: Re: [PATCH v3 5/5] drm/arm/malidp: Added the late system pm functions To: Ayan Kumar Halder Cc: liviu.dudau@arm.com, Brian Starkey , malidp@foss.arm.com, David Airlie , dri-devel , Linux PM , Linux Kernel Mailing List , nd@arm.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15, 2018 at 6:04 PM, 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 status > as suspended. > > The difference between suspend() and suspend_late() is as follows:- > 1. suspend() makes the device quiescent. In our case, we invoke the DRM > 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 device > which was started by suspend(). In our case, it performs the same functionality > as runtime_suspend(). > > The complimentary functions are resume() and resume_early(). In the case 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 device was > in runtime suspend mode before system suspend was called, pm_runtime_work() > will put the device back in runtime suspended mode( after the complete system > has been resumed). > > Signed-off-by: Ayan Kumar Halder > > --- > 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/malidp_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 = { > SET_SYSTEM_SLEEP_PM_OPS(malidp_pm_suspend, malidp_pm_resume) \ > + SET_LATE_SYSTEM_SLEEP_PM_OPS(malidp_pm_suspend_late, malidp_pm_resume_early) \ > SET_RUNTIME_PM_OPS(malidp_runtime_pm_suspend, malidp_runtime_pm_resume, NULL) > }; > > -- AFAICS, this should work, so please feel free to add Reviewed-by: Rafael J. Wysocki to it if that helps.