From patchwork Fri Jun 23 01:08:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 9805507 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 DACC860329 for ; Fri, 23 Jun 2017 01:09:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E23C12846A for ; Fri, 23 Jun 2017 01:09:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6D3528512; Fri, 23 Jun 2017 01:09:03 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham 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 880D02846A for ; Fri, 23 Jun 2017 01:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754105AbdFWBJA (ORCPT ); Thu, 22 Jun 2017 21:09:00 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35407 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbdFWBI6 (ORCPT ); Thu, 22 Jun 2017 21:08:58 -0400 Received: by mail-wr0-f194.google.com with SMTP id z45so8756114wrb.2; Thu, 22 Jun 2017 18:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hfrdDXT+E3rj7tYxjD6t63SDigIHIxWb2tlp2N8Ywak=; b=uqEbBFPBcfvFL1sWJuXSc1sDcak1QKukRHps1LOM406LoroCmiT1U70Wcp8iV9y789 16FAA+5pBy6UMuaWJ4dlU3giGmmNlNZ0/XO9aKkJzu/c+VEzSn8eyvnGuQKlOEdij29x ytV/JfhUzV1egAU9HglEy2+dOk6HiJ0B2ZhEqYzEK9MGVkMuIFn3kbUMz45iZT68rXPh +QWaEpeaGssq5F6eodP4dl4hczX73TONKoIuWERO1tgWMvQJT2zfv8Bc4WHQL0sO8qP4 ziXMJAePQHh/RRa2UIHUbD9HJ4WCpbhbxaxJlcRAZCDMv3wnyQ1Bzdx8iL4Wo0nQQ34B s6gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hfrdDXT+E3rj7tYxjD6t63SDigIHIxWb2tlp2N8Ywak=; b=dg1cJSEFICXb2nH3Haj+9xWYBBk71Kkhjq2dt1mrwFJh/f555QTaid1LUavfD0OJ6s cS+FHkwKdVkDRTcEAyoMTXjJi1p2BqUrKvHIhiTtwN7X1xJzd6fK6vA+FsYkhQePzBcb seQRjfP4/XlgvXuveRMSbHW3fiIPA47GwYEWs03k2SMnh6pOwomued7//n+ClNNMrhCL wYFi75eTiys1uU9ZjwP0aMa56LqpB8bbCcS5RPBwHXpJGcIKGEtiWJaUM1CclX8p3e7c Zcv7LToeitYDHsq7BjFcxQAhTCM4A+oULylLtBbB0jMub/zBgVK6B0CsMNC62DS1dXNU URGg== X-Gm-Message-State: AKS2vOw6xvaJ/kPjGikBR9srXry5aVnHo5YXkJXMXy6UE4D8TDuRyDcv O0wZrZPprY+4MquMUpo= X-Received: by 10.223.142.202 with SMTP id q68mr3870583wrb.13.1498180137133; Thu, 22 Jun 2017 18:08:57 -0700 (PDT) Received: from fainelli-desktop.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id 92sm4883893wrb.55.2017.06.22.18.08.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 18:08:56 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , "Rafael J. Wysocki" , Alexandre Belloni , "Rafael J. Wysocki" , Ulf Hansson , Daniel Lezcano , linux-pm , Thibaud Cornic , JB , Mason , Kevin Hilman , Pavel Machek , Linux ARM Subject: [RFC 2/2] soc: bcm: brcmstb: PM: Implement target_state callback Date: Thu, 22 Jun 2017 18:08:37 -0700 Message-Id: <20170623010837.11199-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170623010837.11199-1-f.fainelli@gmail.com> References: <20170622085102.mpk7vxodpgxtrlfd@piout.net> <20170623010837.11199-1-f.fainelli@gmail.com> 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 Provide a target_state callback implementation which just returns the suspend_state_t the system is about to enter. Broadcom STB drivers can utilize platform_suspend_target_state() to retrieve that and take appropriate actions (e.g: full vs. partial re-initialization). Signed-off-by: Florian Fainelli --- drivers/soc/bcm/brcmstb/pm/pm-arm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c index 4b7e6c297b23..7d4695734093 100644 --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c @@ -104,6 +104,7 @@ struct brcmstb_pm_control { u32 phy_b_standby_ctrl_offs; bool needs_ddr_pad; struct platform_device *pdev; + suspend_state_t pm_state; }; enum bsp_initiate_command { @@ -547,9 +548,23 @@ static int brcmstb_pm_valid(suspend_state_t state) } } +static int brcmstb_pm_begin(suspend_state_t state) +{ + ctrl.pm_state = state; + + return 0; +} + +static int brcmstb_target_state(void) +{ + return ctrl.pm_state; +} + static const struct platform_suspend_ops brcmstb_pm_ops = { + .begin = brcmstb_pm_begin, .enter = brcmstb_pm_enter, .valid = brcmstb_pm_valid, + .target_state = brcmstb_target_state, }; static const struct of_device_id aon_ctrl_dt_ids[] = {