From patchwork Mon Oct 16 13:55:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10008435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 213BE604D7 for ; Mon, 16 Oct 2017 13:55:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11DB428414 for ; Mon, 16 Oct 2017 13:55:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06B64285AF; Mon, 16 Oct 2017 13:55:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD09B2859F for ; Mon, 16 Oct 2017 13:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753032AbdJPNzm (ORCPT ); Mon, 16 Oct 2017 09:55:42 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:45734 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752981AbdJPNz2 (ORCPT ); Mon, 16 Oct 2017 09:55:28 -0400 Received: from ayla.of.borg ([84.195.106.246]) by andre.telenet-ops.be with bizsmtp id NDvP1w0075JzmfG01DvPCY; Mon, 16 Oct 2017 15:55:26 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1e45rW-0000bp-Vv; Mon, 16 Oct 2017 15:55:22 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1e45rW-0001KS-UN; Mon, 16 Oct 2017 15:55:22 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd , Simon Horman , Magnus Damm , "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson Cc: Sergei Shtylyov , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 01/10] clk: renesas: mstp: Keep wakeup sources active during system suspend Date: Mon, 16 Oct 2017 15:55:07 +0200 Message-Id: <1508162116-5043-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508162116-5043-1-git-send-email-geert+renesas@glider.be> References: <1508162116-5043-1-git-send-email-geert+renesas@glider.be> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a device is part of the CPG/MSTP Clock Domain and to be used as a wakeup source, it must be kept active during system suspend. Currently this is handled in device-specific drivers by explicitly increasing the use count of the module clock when the device is configured as a wakeup source. However, the proper way to prevent the device from being stopped is to inform this requirement to the genpd core. Hence provide an .active_wakeup() callback that always returns true. Note that this will only affect devices configured as wakeup sources. Signed-off-by: Geert Uytterhoeven --- drivers/clk/renesas/clk-mstp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 500a9e4e03c48957..912e4745d8011fe8 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c @@ -329,6 +329,11 @@ void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev) pm_clk_destroy(dev); } +static bool cpg_mstp_active_wakeup(struct device *dev) +{ + return true; +} + void __init cpg_mstp_add_clk_domain(struct device_node *np) { struct generic_pm_domain *pd; @@ -345,6 +350,7 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np) pd->name = np->name; pd->flags = GENPD_FLAG_PM_CLK; + pd->dev_ops.active_wakeup = cpg_mstp_active_wakeup; pd->attach_dev = cpg_mstp_attach_dev; pd->detach_dev = cpg_mstp_detach_dev; pm_genpd_init(pd, &pm_domain_always_on_gov, false);