Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp783152imm; Tue, 15 May 2018 09:06:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpyGlUG5gTodgIAtO6EGVlmMX+hW1Q2Np6Q9FmAD0f/nfNsqW6kBICMS+hnIm3BtQFfIJ+J X-Received: by 2002:a63:2d83:: with SMTP id t125-v6mr12625193pgt.336.1526400414381; Tue, 15 May 2018 09:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526400414; cv=none; d=google.com; s=arc-20160816; b=UU7fHDgnOo5OxbyJ64LARnTADsbUXGHJYJfjOC2jZD8Fqpvfd26y4vVmxYMJmIC/C8 rknhN6hB+jtPFbUmEBGXnTV2od5b7o300zAqcyhXfJ7aptWbY+NFXyMAMqpAvTI1FPR+ gqf4al7qP/Cc2zgaV82tgvOVxx0wR1sM8kToWZVjFXVpQ6880iRBg6z8NS23LQeqSxM/ XbdM5cRisUjCITRTWGyuG5EdTYujhYgaQFbyqFJssq2bs39hWZsg4Txpgdou+80J80iJ qBBuxEVrNJwk4wBGFnmZKBvYoF2BBOTQNccf+3rt38FWW1O582BCrRuaXX4neyllACjj U0Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:nodisclaimer:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LsyVVtSKc4MDQkSbK9GcI7h4y2vmknpb4J3ELyV8KBA=; b=HF/+kYsWiNlVFRaENPpK/bcFnXiy7MBdPwJY5hTWYZnHxq83JQfyoktu+TsFW8koKF /Yd6ZXa/ZHA8b0uc1X9ACQdflMU7jEJEmfqgKihM2a2bbmiCaoFKS9/tpMO+Aq4hMrOq lkeqBP9O8DgrAUvF5b4JWZoAXUUBEkgj/Scfn0mzOANKWn3o/RO5BQKhb99pRik+hE2G Zp9CGhmKeWxp2KfLUYd98FXEziZ4ZirE1xPzQG4vmWmH3fzRzjGRJujDbvelUxLu8r2s Zy+bFNhB2M7QMyQ/S4pcZDpZCT/6YarXiNAM7rpeMKlQb73TWcWOiZbQRzL0IcQaswqH ffvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=bvdEPpAw; 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 n20-v6si308361pff.370.2018.05.15.09.06.35; Tue, 15 May 2018 09:06:54 -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=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=bvdEPpAw; 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 S1753832AbeEOQEu (ORCPT + 99 others); Tue, 15 May 2018 12:04:50 -0400 Received: from mail-he1eur01on0054.outbound.protection.outlook.com ([104.47.0.54]:19657 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752537AbeEOQEp (ORCPT ); Tue, 15 May 2018 12:04:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LsyVVtSKc4MDQkSbK9GcI7h4y2vmknpb4J3ELyV8KBA=; b=bvdEPpAw+z284rgZDHqQ40MvbUeVC+SFr3p7+1J3uiOuoS3ECp8Mn3dz0mBIw6QRHhKc11Bmy/0ma/CB4I+9MkiDs0QinO3axz+3TG/IuqcOCVCKdYeM4utVR1ewi4/OjqIooMdxicHsUDnbkpwRPk5aN1auwhk0RuCRMPa7bhg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ayan.Halder@arm.com; Received: from e113505-lin.cambridge.arm.com (217.140.96.140) by AM6PR08MB3029.eurprd08.prod.outlook.com (2603:10a6:209:45::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Tue, 15 May 2018 16:04:35 +0000 From: Ayan Kumar Halder To: ayan.halder@arm.com, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: nd@arm.com Subject: [PATCH v3 5/5] drm/arm/malidp: Added the late system pm functions Date: Tue, 15 May 2018 17:04:19 +0100 Message-Id: <1526400259-7573-6-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526400259-7573-1-git-send-email-ayan.halder@arm.com> References: <1526400259-7573-1-git-send-email-ayan.halder@arm.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: LNXP265CA0095.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::35) To AM6PR08MB3029.eurprd08.prod.outlook.com (2603:10a6:209:45::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020);SRVR:AM6PR08MB3029; X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3029;3:c7yo7zaB/Px4yFyesz5sRuMpycNyRvR7a/0cSHb+uwRA622S3i8cFYevYp/G5GSYEW+Cm3ljdnFL1fJ+ExugThzl10q9ntc3ce9dNCeHY+wGRoKcS46U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;4:WbKqoiwEz8UYL5OeJcC0sjifsN/NpkV3Nt1SMV/zBR8Najob4H6O81hGhZQ7PSnEXxVbkpk2kWCBjci9XU7/SeRH6i8uJ67dYhTkCYhDLmfb6Nu3h7uhhL3m0IutUYoFlNgj1Je1UR/ic8TsH4ZwhxtSHvoTWru9nYEHc1n5499L/ePHb02iYI17cpoBWrGijBZHe515wO7PdggyaY8NRPr3qyYpxRfdVnIiwvPcMYi7C8Aw/mn+WhN9HQxoFLKTEv47aEXEfHEwO1d29o8h1qVueLMFnBmBoeNm0d5l07I3Mux+wh0+MOhDDbVh/8bD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:AM6PR08MB3029;BCL:0;PCL:0;RULEID:;SRVR:AM6PR08MB3029; X-Forefront-PRVS: 0673F5BE31 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39380400002)(376002)(39860400002)(396003)(346002)(366004)(199004)(189003)(3846002)(16526019)(68736007)(53936002)(5660300001)(8936002)(2906002)(50226002)(59450400001)(86362001)(76176011)(52116002)(26005)(7696005)(51416003)(6116002)(386003)(446003)(2616005)(316002)(476003)(16586007)(81156014)(106356001)(105586002)(97736004)(81166006)(6666003)(11346002)(956004)(486006)(478600001)(50466002)(6486002)(305945005)(48376002)(4326008)(7736002)(25786009)(47776003)(66066001)(36756003)(72206003)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB3029;H:e113505-lin.cambridge.arm.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM6PR08MB3029;23:7+tBYMrSEE5KLSgs61zrGaeGPqE3pOPYn39+TAndX?= =?us-ascii?Q?pkvaNUcuSxLgVgLufd9ocaknedzz8QguyLzF0O6fX5iogZ8grLaiSGo83dzY?= =?us-ascii?Q?xgJQxeVW5WFZW78qhNg+aSB0mkgSF86yk6RRzymu9yWbs5mn/trKIRAPDHB2?= =?us-ascii?Q?7nQradfaHLXd1azRBAQ9porJI/YRQbiKAZQVshAeWgcuCnK/zpa0hkoFawgK?= =?us-ascii?Q?h/P2mB9DoEX9GyloJiViTmm08svvUDnpUvnpd9eM9RPlOpGmYax5szUpqUv/?= =?us-ascii?Q?otuq2KIOpaR3hBtLkfG+wivAFxnS2S4tD0iOO62CXAaLE7q4z5k4eQr0iWO/?= =?us-ascii?Q?w7djvOPsA/+0uryGpGcAIidPJ6QOkdpyj+kpUDH8gXTSGhTiyx4WlwC/S+SS?= =?us-ascii?Q?2L0zmP0MsaHBB7+sTTm1KPZOlxeLOhoFeiZBy3EZKflXQbzL8xr7Yo7J3B7t?= =?us-ascii?Q?/gHtc2WFbYmwQJY08Ti7FWPJ/K1bi/rx7EWStujLrj+1v1FNvyrLovVwRbll?= =?us-ascii?Q?o3WdnrJZXYhGU1abEZTRLflb3kdLVYUQ9ImcTe/tZXTGVSKzEHz+fvJieLN1?= =?us-ascii?Q?sxMrWYTCn9Zo3kKyYgYQOOtZqH7rTbTuqLLyOrTYhekrd678ZqXVEMEGp97Q?= =?us-ascii?Q?AZ01D5XAtakhb84qs0ssQb8hHObngEOQbaOYM0LK3MJGf7sVeZt6Iv2Lh1st?= =?us-ascii?Q?FTNcuXrUNll4KR9LZUqP7dcggK6rnSMz/QLJnFQPzOW9xMwXYp54MqZcAqqW?= =?us-ascii?Q?+47QEmWLo1lrPWGJTs6YnYUOZvRF+5rvDWmtpKdhtbFt/q9U9syN4i9sgVKe?= =?us-ascii?Q?RQjfh0ieorlpWJBvG653QcNGL6vrAUFezPp5q+Hel/viY0mcUGHRVHw1nwef?= =?us-ascii?Q?oDa7p2kruuDjQapQaDw54qjS1DBdp5hx22BFOkAFdZs9iOhISjZCv0+DFxeF?= =?us-ascii?Q?5u6kXFWUqhEHRHmye+g7bsGNvttgHY/zSwK+4DrcrKII/XvTpTvRC0suv7HA?= =?us-ascii?Q?ULtzjVTkMqYz1yA58kic/BCOvOzkBM0S6su4+CsyRvdYLokKeRtLmycITggy?= =?us-ascii?Q?PCutqBqhxYsdhImUImpoIEmlt9prJxZqC+gsWddQrnC4bxTmZ6SfwlOiXBIY?= =?us-ascii?Q?hRK2hKH+7fBpMzYD1jnK1hH4Gb5EwRxbm+b3xNPRmLnWfLFUrkWTg=3D=3D?= X-Microsoft-Antispam-Message-Info: bmseAF1MIod7j0GRoHsNtFiUO3OKI0K8CqOGUgFJHDmNZDKgOBRUBpskefx6Y5iVA5bkG3OHT+itQ3jwhCzxgqO73B97m/dpjiBkJ3k17ZIlEPxKIX8+qd/j9wLxXTypv2vw21nZVYJVnphaF+RQwT6vh6+k49eXSU5RTIu4A64E9sXCjx322v7KlydI8Cvw X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3029;6:9BCPdeD8g+gjqSgBk+1+uF/T/BN6uL+D1AkAvz/RL46uImA9NzhcNxbIwz2FAmOizbvhs3SRo8okxgs2o73ArAYgrUbQfy82KGvi6KlavdnXBWjGYKeThQEoSnupB6TxYLGCSx9pHvafF6bRpp6MYEJEVeOAR5Ayle6pZkAj3GKwhCJ1A9EQn/oCPqxEVEWzO0OFP+CRtnAKoo6mpbw43i3fZBdOp9tO4SU9vEOzL9xhK43ssh+1ygv3M68T8/WBWZFK6lepeQQcI2sMG1Yc2PpmBkqpThBFrxUMfcyXXR02HnSqlEgY2X+5i1tF1kgcd8n0zOWXd5WZVaKydqzuBWq+BY4sH+GYDIyPmb28OHALZfk895SQFazFBE9DunDpZOx9a75F4yia9fIR+oZLoLy6nTfLhEl35+m2ohhH55qmul9SReMf2WyRvf+wSgYTHynPUfb4+cD0XXo91Nie7w==;5:Yw9V6UpekHpxlPjexgmbxGriyab2k3feKzlulb9yarQZYE0gAD0wKPweNQH/gQI7JSpGt8kkw42zK9dL1pzT0n6Z4BppoK71vLAcRAyRIS8zASD+DIDAc4ceEBNXuy4WK9yNrQq8mXPe9MfWItvPIFjtaDaBXSmX/knQKAjLutA=;24:Y2amHtJyz2T2uJCVy5JWIHlOXuJVk31ujDnNEg4+UsYvSsX4cbVBPKLPDgy/279KjRfQcJK5YcYHPTH3Oq9Fzx29WYrG+YVoLY3nAYbg84k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3029;7:BI0O2+R6oy9RDo80B1/VBeh7awIy8xKkJCszIr9wVaGb03Fi+K3Bq3nM++eGFlvv1nHVQPbG4IByJmtWlwyU7rIsXt6xMyzfQqBu+A98CnyzdC0EsQkGXxsZvVIPKr1lSWaP8hvjmZNorclGvQm5pWrknBkZkLQjvqGCbO3JWc+E40u0its+C3SHV2Y8B9tVoqbuWJJtMNrrO3g1WvbAzXz75Y6FSHLkgFJRy8n6wdvIF00wY2iLyjz7QPQ/WQhV X-MS-Office365-Filtering-Correlation-Id: d136530e-7189-4b73-0e98-08d5ba7d8dec X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2018 16:04:35.5497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d136530e-7189-4b73-0e98-08d5ba7d8dec X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3029 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) }; -- 2.7.4