From patchwork Wed May 22 15:29:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin GAIGNARD X-Patchwork-Id: 10956121 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 AA1E116C1 for ; Wed, 22 May 2019 15:29:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99E1728866 for ; Wed, 22 May 2019 15:29:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E1F128C0C; Wed, 22 May 2019 15:29:55 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 298AB28866 for ; Wed, 22 May 2019 15:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xi+acNYy1PSQICgYiM/1drBefw8khya6bGQvtm4DkMk=; b=cJe8sH4/KkRWcq 55x91SfTzND6s7hfCO2GE3rFA+pZfoUtkPqARnq4xZ/dl0UkxLr2wB3F/3jLsRaJxqUy4QkJ5eTQ9 h7kFC4UME7SqAhTauOzPtS1AtpK+sAbjP9a4gXHVqtKtDHE80a+IgdswxRzFBj7G7F18+Wt/apcY8 z1EmI/ZsDf4QnaTFeRIwEbrSJRKSYRBUr5yH3KNnJrOc4NR2enZmxg1nMsVJ9TTfun9L4ouUvkZek zoZbiveE7RH444pQds/skg3LIk18QEaq8W2fhAEvzGzHH36ffW13Ts0fwjT6dxoBduma3Ll20J1yi qGtB2XnLLJSP3WZUVFVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTTBZ-0003Ve-Nl; Wed, 22 May 2019 15:29:45 +0000 Received: from mx07-00178001.pphosted.com ([62.209.51.94]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTTBQ-0003Np-TV for linux-arm-kernel@lists.infradead.org; Wed, 22 May 2019 15:29:38 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4MFQqg9026162; Wed, 22 May 2019 17:29:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=JrVfzO8I0FUdBcA3/JLpbsGbKJMCTTSle83Drqd40I0=; b=jSsr6s7jVaQbMt8kPO4pRmSUhH/+HT6oOwLe/dK8+tiiVoABSwi84tfdkDxRodCa/Imi Pfvf2epLhjBGK2VXZ30vNPpFux7ljEFUk7VdwmbHAPHGEKNm5ePQuDhhK5foqa0BTQDl 0wmF8YO3QfllpXpTtlEvhaYn/WoTjUIPeYdgfNcwmDoi+JuRjPBT0xX80omOT8dT6T3R 1kham35TZYpJACb7syn/erZH799wOpLhl6wi6DEwWy6rV5A3/a3mVMEOEJA7kQrnY9Zj xWymIlL6UZCdXiufj7KytYk0TvEaekYjMaTSkc9AvQ0UHvEHUEJuns78NIBddNt4vUcS jg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2sj7tu979k-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 22 May 2019 17:29:31 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3AF0A3F; Wed, 22 May 2019 15:29:30 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 019DB2CD7; Wed, 22 May 2019 15:29:29 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 May 2019 17:29:30 +0200 Received: from localhost (10.201.20.122) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 May 2019 17:29:29 +0200 From: Benjamin Gaignard To: , , Subject: [PATCH 1/2] pinctrl: Allow to create link between controller and consumer Date: Wed, 22 May 2019 17:29:24 +0200 Message-ID: <20190522152925.12419-2-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190522152925.12419-1-benjamin.gaignard@st.com> References: <20190522152925.12419-1-benjamin.gaignard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.122] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-22_08:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190522_082937_240208_FA787F78 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Gaignard , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, benjamin.gaignard@linaro.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Pin controller may want to create a link between itself and its clients to be sure of suspend/resume call ordering. Introduce create_link field in pinctrl_desc structure to let pinctrl core knows that controller expect to create a link. Signed-off-by: Benjamin Gaignard --- drivers/pinctrl/core.c | 11 +++++++++++ include/linux/pinctrl/pinctrl.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index c6ff4d5fa482..40b647f3dc7d 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1216,6 +1216,15 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, } EXPORT_SYMBOL_GPL(pinctrl_lookup_state); +static void pinctrl_link_add(struct pinctrl_dev *pctldev, + struct device *consumer) +{ + if (pctldev->desc->create_link) + device_link_add(consumer, pctldev->dev, + DL_FLAG_PM_RUNTIME | + DL_FLAG_AUTOREMOVE_CONSUMER); +} + /** * pinctrl_commit_state() - select/activate/program a pinctrl state to HW * @p: the pinctrl handle for the device that requests configuration @@ -1261,6 +1270,8 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) if (ret < 0) { goto unapply_new_state; } + + pinctrl_link_add(setting->pctldev, p->dev); } p->state = state; diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 8f5dbb84547a..11a42ccf4b0a 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h @@ -125,6 +125,7 @@ struct pinctrl_ops { * the hardware description * @custom_conf_items: Information how to print @params in debugfs, must be * the same size as the @custom_params, i.e. @num_custom_params + * @create_link: If true create a link between pinctrl and it consumer */ struct pinctrl_desc { const char *name; @@ -139,6 +140,7 @@ struct pinctrl_desc { const struct pinconf_generic_params *custom_params; const struct pin_config_item *custom_conf_items; #endif + bool create_link; }; /* External interface to pin controller */ From patchwork Wed May 22 15:29:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin GAIGNARD X-Patchwork-Id: 10956123 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 7F39913AD for ; Wed, 22 May 2019 15:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D10728849 for ; Wed, 22 May 2019 15:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6168228B6B; Wed, 22 May 2019 15:30:13 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09EEC204C1 for ; Wed, 22 May 2019 15:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cPFh7S0EwaHI1kaJwg05d9EHbAr+R05TiAAr5BR3CDQ=; b=gFBmROQ4NuIqQ2 SRj+6AKez8jTGfAI3OD7Qt7PyKRF1UJ043w+K1y8+xT70QDafDJTMDYJm9LgKOreddC/8wlVZbZ6D ds6WBAW0/ucK8dBSQ0SlD15A7E28u1AavkDjB+wxEjOBhNevhirnPU4ZfKwLw6777cwx4ERDqwhnp X+p1iBtbj2n9sNz5D4RLAuSfwOkyPdWaycq2oL3RHUNMAXaUJDwvv152p2iredR5x0yaGQfd3Iqj3 SKqOirzYrQVvPTpljtRNdBb6s56nEaeNMXuv4yHvBgJ0HtVF0UmFS6tXt7rCegR7dgouQmn8uafFZ cDIYj8G2zgcfViztUbUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTTBv-0004EM-Ri; Wed, 22 May 2019 15:30:07 +0000 Received: from mx07-00178001.pphosted.com ([62.209.51.94]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTTBT-0003Nq-2K for linux-arm-kernel@lists.infradead.org; Wed, 22 May 2019 15:29:40 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4MFSLdn021231; Wed, 22 May 2019 17:29:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=B6DKjDnb7O5BR/R4BaH3RkAeSYESY1eQiVlZXH9oE8A=; b=Nsbzx5vOjEJkV6yl0J71Fvx548IwqVYr5OK+tf/R+yDwNL/jXPYF5cCRqDr/O99pgeYH 0ozfyPcQkt6fT8zAvU1kfbBuNu90pOOEkOzQjh/KFw/OAAuwwg/Bry9j3ZzkAxvjmzTB S9cYHgLoffD6ew/N+GxezB5ZBZasKT/JVJpusP2/sWvqP93/T7zHcOgu4y6mYBlTeHEq 0hr71YovpDRlVqBWpd6wZSqmxK/hmmIgDcx6Z4YXDXZXONzyegRzNWS2r8q8e4L5TR7T 2Dpj+FLeOrndDydEazYRjwezPqxckX1Hssp03CO49DxgnkEfH4BkR1wPXqG9aX+Gnswu Kw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2sj7h11b1j-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 22 May 2019 17:29:32 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3A46941; Wed, 22 May 2019 15:29:31 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EAEE42CD8; Wed, 22 May 2019 15:29:30 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 May 2019 17:29:30 +0200 Received: from localhost (10.201.20.122) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 May 2019 17:29:30 +0200 From: Benjamin Gaignard To: , , Subject: [PATCH 2/2] pinctrl: stmfx: enable links creations Date: Wed, 22 May 2019 17:29:25 +0200 Message-ID: <20190522152925.12419-3-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190522152925.12419-1-benjamin.gaignard@st.com> References: <20190522152925.12419-1-benjamin.gaignard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.122] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-22_08:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190522_082939_402491_6BE37BDB X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Gaignard , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, benjamin.gaignard@linaro.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Set create_link to inform pinctrl core that stmfx wants to create link with its consumers. Signed-off-by: Benjamin Gaignard --- drivers/pinctrl/pinctrl-stmfx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index eba872ce4a7c..55a9f145b4d9 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -622,6 +622,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) pctl->pctl_desc.pins = stmfx_pins; pctl->pctl_desc.npins = ARRAY_SIZE(stmfx_pins); pctl->pctl_desc.owner = THIS_MODULE; + pctl->pctl_desc.create_link = true; ret = devm_pinctrl_register_and_init(pctl->dev, &pctl->pctl_desc, pctl, &pctl->pctl_dev);