From patchwork Fri Nov 9 22:28:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10676657 X-Patchwork-Delegate: agross@codeaurora.org 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 EAD0E109C for ; Fri, 9 Nov 2018 22:29:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3E722EF11 for ; Fri, 9 Nov 2018 22:29:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7C872EF29; Fri, 9 Nov 2018 22:29:05 +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 B53412EF11 for ; Fri, 9 Nov 2018 22:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbeKJILk (ORCPT ); Sat, 10 Nov 2018 03:11:40 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36320 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbeKJILj (ORCPT ); Sat, 10 Nov 2018 03:11:39 -0500 Received: by mail-pg1-f193.google.com with SMTP id z17-v6so1437876pgv.3 for ; Fri, 09 Nov 2018 14:29: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=deR2DBQY1z1RlhRjU/vwUxZxbWnUFD1ztEzC9UHYdaw=; b=mHQKhLB0jweDp3nEPUKUWvftJymlgE+58bcdhthWb+RnQKggsADsN9XOhKRZK00nF5 6v1QBlHR2PCj8s7ZReZADrXk2JMW1UqqRUqcU0m4bCZfziHAam6gY+qQ4EWTESp5AT7O 1Ab+q3y35nPd422/nPzC229AiCYbDj/kBUI1A= 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=deR2DBQY1z1RlhRjU/vwUxZxbWnUFD1ztEzC9UHYdaw=; b=WB97SeGkX9ln2aDWwCtoVVDvNqfPW0cOAvX6h+0trG/wg7YGVigEcN//EsH3e/1plH 7hlFXwNNFTdRwfnqVh24YxzQMNTgbgnZeF4hXqcovAEFnLED1kBrKb5ODqwoNjfEhfqJ FB20zbhl7sTu8p6CsmRjDdrsM5IfN1ramIeYVr9Y1a9FW3XrVgYVtU81JDNJQ4+EL8U5 aVnL+M4mVJxSIOgoREmFyO2GT0wcjE8CO4vfOfHYaUHvNKTvlxm7OtGqIzIFXpFYBxA/ N2I3EFvMItqlWh09+ONQ/uW9Az9RBsD6HbVPcBq8MTG0d0YYlcM5DuEtxRpVkS+czjKE 8zGA== X-Gm-Message-State: AGRZ1gJPYE6oXXXbr9IWK2igPfguj61OTp1WgjG9+5GIgzvLxPxAWXlQ 8qyAj7GTZXb4QEBHlVeut32kHvBhLjs= X-Google-Smtp-Source: AJdET5cBuQY5XuyXvhktTS2gRRmtrMKU/a8lxZeyhXHR3G8CKN60ZBaMD3OzpLgH8wHp5HXOVlqBxw== X-Received: by 2002:a65:5a8e:: with SMTP id c14mr9014921pgt.137.1541802543043; Fri, 09 Nov 2018 14:29: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 o7-v6sm11581274pfb.23.2018.11.09.14.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Nov 2018 14:29: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] pinctrl: msm: Add sleep pinctrl state transitions Date: Fri, 9 Nov 2018 14:28:35 -0800 Message-Id: <20181109222835.60607-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 --- drivers/pinctrl/qcom/pinctrl-msm.c | 16 ++++++++++++++++ drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ drivers/pinctrl/qcom/pinctrl-sdm845.c | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 7c7d083e2c0dc..d505d0a50f0a5 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -1072,6 +1072,22 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) } } +int msm_pinctrl_suspend(struct device *dev) +{ + struct msm_pinctrl *pctrl = dev_get_drvdata(dev); + + return pinctrl_force_sleep(pctrl->pctrl); +} +EXPORT_SYMBOL(msm_pinctrl_suspend); + +int msm_pinctrl_resume(struct device *dev) +{ + struct msm_pinctrl *pctrl = dev_get_drvdata(dev); + + return pinctrl_force_default(pctrl->pctrl); +} +EXPORT_SYMBOL(msm_pinctrl_resume); + 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..e163ca600ecd3 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; }; +int msm_pinctrl_suspend(struct device *dev); +int msm_pinctrl_resume(struct device *dev); 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..a3ac9cbeabad1 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -1287,6 +1287,9 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { .ngpios = 150, }; +static SIMPLE_DEV_PM_OPS(sdm845_pinctrl_dev_pm_ops, msm_pinctrl_suspend, + msm_pinctrl_resume); + static int sdm845_pinctrl_probe(struct platform_device *pdev) { return msm_pinctrl_probe(pdev, &sdm845_pinctrl); @@ -1300,6 +1303,7 @@ static const struct of_device_id sdm845_pinctrl_of_match[] = { static struct platform_driver sdm845_pinctrl_driver = { .driver = { .name = "sdm845-pinctrl", + .pm = &sdm845_pinctrl_dev_pm_ops, .of_match_table = sdm845_pinctrl_of_match, }, .probe = sdm845_pinctrl_probe,