From patchwork Fri Nov 16 18:58:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10686885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E8A713BF for ; Fri, 16 Nov 2018 18:59:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EDE42D855 for ; Fri, 16 Nov 2018 18:59:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 825D82D85A; Fri, 16 Nov 2018 18:59:06 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 23E002D855 for ; Fri, 16 Nov 2018 18:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726034AbeKQFMj (ORCPT ); Sat, 17 Nov 2018 00:12:39 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35295 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKQFMi (ORCPT ); Sat, 17 Nov 2018 00:12:38 -0500 Received: by mail-pf1-f193.google.com with SMTP id v9-v6so11820854pff.2 for ; Fri, 16 Nov 2018 10:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=O/I1k539tqwRKsWEthqNKRxgRw6UGeJxi9txfRXZzPs=; b=KLZWzsJhlfTV/XtDJEEamvmNiM8nLyXeEta/AJD2tDgdv+WurGGNVZuvZe18Jho4KC v6Q3QOBZhO8bzJGTqkFzQ0NYhuB7nNqPDjDwcLg2rCP90f8FzF6V4hqz2BgpFijfuvlU oN4NsVm4d9FqcOK72WlLquPVnxjX2t5/VYnGg= 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; bh=O/I1k539tqwRKsWEthqNKRxgRw6UGeJxi9txfRXZzPs=; b=J36nGu1uMYEkoAdNGndB06chGwWNHP9ewWF0wlywCakk0ljPI2zOKC/oHd3TWL2GXM dKY+o8oH69UOhPMZqbaMy9vaLBbZKPHO6P0DX9QRQoyQjAwhpAu9ckC3iNjak1qbFoqR Xnbh3WFwFwLeld/3g6t48r4eF2MIKqX8aOfac+0aTWiJPppRkBpOIAwNgbNvzFpv7w2F ypTzEdS4DR4Z5hZLNyWjbbZJNgZk4a/QfNPfEAByos4lEJJrwYNYBC+6uA1i3AP2ue2j cvpeSBaFBF0y2aC1sfrGeLdFmhsYkVPUDD2IJlyRaKJXgIpNvznSOfqAF8cdTPGl1JR0 78dQ== X-Gm-Message-State: AGRZ1gIvonDM8aUztdZV2R9umWpWe856skWNw/CqAofnd6Ad1ieuuuef M8oKdjjWEiJttM9yRGIZDrQlGQ== X-Google-Smtp-Source: AJdET5c5jsenlqjOYFDIn7rMKqqrkp8pjbYQ5O05azogL1kYAUz70A/3ueQ5e7DYLQP49vZMyEREOA== X-Received: by 2002:a63:2f07:: with SMTP id v7mr10351558pgv.368.1542394743165; Fri, 16 Nov 2018 10:59:03 -0800 (PST) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:e418:c825:76cf:5f64]) by smtp.gmail.com with ESMTPSA id n13-v6sm44514473pfk.19.2018.11.16.10.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Nov 2018 10:59:02 -0800 (PST) From: Evan Green To: Linus Walleij , Bjorn Andersson Cc: Stephen Boyd , Evan Green , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2] pinctrl: msm: Add sleep pinctrl state transitions Date: Fri, 16 Nov 2018 10:58:53 -0800 Message-Id: <20181116185853.128207-1-evgreen@chromium.org> X-Mailer: git-send-email 2.16.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add PM suspend callbacks to the msm core driver that select the sleep and default pinctrl states. Then wire those callbacks up in the sdm845 driver, for those boards that may have GPIO hogs that need to change state during suspend. Signed-off-by: Evan Green Reviewed-by: Stephen Boyd Reviewed-by: Bjorn Andersson --- Changes in v2: - Moved dev_pm_ops structure to pinctrl-msm [Bjorn] drivers/pinctrl/qcom/pinctrl-msm.c | 19 +++++++++++++++++++ drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ drivers/pinctrl/qcom/pinctrl-sdm845.c | 1 + 3 files changed, 22 insertions(+) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 7c7d083e2c0dc..87cbebe217fd2 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -1072,6 +1072,25 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) } } +static int msm_pinctrl_suspend(struct device *dev) +{ + struct msm_pinctrl *pctrl = dev_get_drvdata(dev); + + return pinctrl_force_sleep(pctrl->pctrl); +} + +static int msm_pinctrl_resume(struct device *dev) +{ + struct msm_pinctrl *pctrl = dev_get_drvdata(dev); + + return pinctrl_force_default(pctrl->pctrl); +} + +SIMPLE_DEV_PM_OPS(msm_pinctrl_dev_pm_ops, msm_pinctrl_suspend, + msm_pinctrl_resume); + +EXPORT_SYMBOL(msm_pinctrl_dev_pm_ops); + int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data) { diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h index 29172fdf5882c..c12048e54a6f0 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -123,6 +123,8 @@ struct msm_pinctrl_soc_data { unsigned int ntiles; }; +extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops; + int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data); int msm_pinctrl_remove(struct platform_device *pdev); diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c index 2ab7a88857579..c97f20fca5fd3 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -1300,6 +1300,7 @@ static const struct of_device_id sdm845_pinctrl_of_match[] = { static struct platform_driver sdm845_pinctrl_driver = { .driver = { .name = "sdm845-pinctrl", + .pm = &msm_pinctrl_dev_pm_ops, .of_match_table = sdm845_pinctrl_of_match, }, .probe = sdm845_pinctrl_probe,