From nobody Tue Sep 16 21:17:06 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673DBC4167B for ; Wed, 28 Dec 2022 16:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233748AbiL1QyO (ORCPT ); Wed, 28 Dec 2022 11:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235060AbiL1QxZ (ORCPT ); Wed, 28 Dec 2022 11:53:25 -0500 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2E71D30B; Wed, 28 Dec 2022 08:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1672246123; x=1703782123; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ypztWKO0acnZ9KxjcJXXqWb0zwFVPuYw8z6bkanpP7I=; b=X2avdODidm1GauxVEdrETEnAyBkNYgUVCsIq5vb37YTi23OZeOET9jN2 ad47jh4ley/NTa2LhqkZLduqsna9X3R6JCnJO1TznHbyVIN/ywI8o0/Wa CfTGsvZS02uzETzQ7ntTGM5MON/dtCkiX+9GgPkNtabTOeWx6ITmL9KCW I=; X-IronPort-AV: E=Sophos;i="5.96,281,1665446400"; d="scan'208";a="294965043" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-cadc3fbd.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 16:48:37 +0000 Received: from EX13D46EUA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-m6i4x-cadc3fbd.us-west-2.amazon.com (Postfix) with ESMTPS id 5D439A0B2D; Wed, 28 Dec 2022 16:48:35 +0000 (UTC) Received: from EX19D019EUA002.ant.amazon.com (10.252.50.84) by EX13D46EUA001.ant.amazon.com (10.43.165.109) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 28 Dec 2022 16:48:34 +0000 Received: from dev-dsk-hhhawa-1b-84e0d7ff.eu-west-1.amazon.com (10.43.162.56) by EX19D019EUA002.ant.amazon.com (10.252.50.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.20; Wed, 28 Dec 2022 16:48:30 +0000 From: Hanna Hawa To: , , , , , CC: , , , , , , , , Subject: [PATCH v5 1/2] pinctrl: Add an API to get the pinctrl pins if initialized Date: Wed, 28 Dec 2022 16:48:12 +0000 Message-ID: <20221228164813.67964-2-hhhawa@amazon.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221228164813.67964-1-hhhawa@amazon.com> References: <20221228164813.67964-1-hhhawa@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.43.162.56] X-ClientProxiedBy: EX13D45UWA001.ant.amazon.com (10.43.160.91) To EX19D019EUA002.ant.amazon.com (10.252.50.84) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add an API to get the pinctrl pins if it was initialized before driver probed. This API will be used in I2C core to get the device pinctrl information for recovery state change. Signed-off-by: Hanna Hawa Reviewed-by: Andy Shevchenko Reported-by: kernel test robot Reviewed-by: Linus Walleij --- include/linux/pinctrl/devinfo.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinf= o.h index a48ff69acddd..670588bfc7ab 100644 --- a/include/linux/pinctrl/devinfo.h +++ b/include/linux/pinctrl/devinfo.h @@ -16,6 +16,8 @@ =20 #ifdef CONFIG_PINCTRL =20 +#include + /* The device core acts as a consumer toward pinctrl */ #include =20 @@ -40,6 +42,14 @@ struct dev_pin_info { extern int pinctrl_bind_pins(struct device *dev); extern int pinctrl_init_done(struct device *dev); =20 +static inline struct pinctrl *dev_pinctrl(struct device *dev) +{ + if (!dev->pins) + return NULL; + + return dev->pins->p; +} + #else =20 struct device; @@ -56,5 +66,10 @@ static inline int pinctrl_init_done(struct device *dev) return 0; } =20 +static inline struct pinctrl *dev_pinctrl(struct device *dev) +{ + return NULL; +} + #endif /* CONFIG_PINCTRL */ #endif /* PINCTRL_DEVINFO_H */ --=20 2.38.1 From nobody Tue Sep 16 21:17:06 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 913ECC46467 for ; Wed, 28 Dec 2022 16:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiL1QyK (ORCPT ); Wed, 28 Dec 2022 11:54:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235127AbiL1Qxa (ORCPT ); Wed, 28 Dec 2022 11:53:30 -0500 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 100281D322; Wed, 28 Dec 2022 08:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1672246125; x=1703782125; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1A5zlnRR2f2ZTu4fR9CQ3Z2F8xD3bcpX34JwmydLuRw=; b=hRo+ktv32bU5i4CiAAkrW190QrCGbcAEgFvf1M99Sl1fTEgWFy67EL9R OhFoTP9Zz5I0d7WnGdnA/aOSKL9/vqe/DFuMsZimNkKTfR2I9vC1Kzebw tfRL+TGKNDkhcNYDbxiXdln44uWUe/X77U6Szp3GmPnEuIm9YyXW43fjO Q=; X-IronPort-AV: E=Sophos;i="5.96,281,1665446400"; d="scan'208";a="281514154" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 16:48:43 +0000 Received: from EX13D45EUA003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com (Postfix) with ESMTPS id CAEBAC30CB; Wed, 28 Dec 2022 16:48:41 +0000 (UTC) Received: from EX19D019EUA002.ant.amazon.com (10.252.50.84) by EX13D45EUA003.ant.amazon.com (10.43.165.71) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 28 Dec 2022 16:48:39 +0000 Received: from dev-dsk-hhhawa-1b-84e0d7ff.eu-west-1.amazon.com (10.43.162.56) by EX19D019EUA002.ant.amazon.com (10.252.50.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.20; Wed, 28 Dec 2022 16:48:34 +0000 From: Hanna Hawa To: , , , , , CC: , , , , , , , , Subject: [PATCH v5 2/2] i2c: Set i2c pinctrl recovery info from it's device pinctrl Date: Wed, 28 Dec 2022 16:48:13 +0000 Message-ID: <20221228164813.67964-3-hhhawa@amazon.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221228164813.67964-1-hhhawa@amazon.com> References: <20221228164813.67964-1-hhhawa@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.43.162.56] X-ClientProxiedBy: EX13D45UWA001.ant.amazon.com (10.43.160.91) To EX19D019EUA002.ant.amazon.com (10.252.50.84) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently the i2c subsystem rely on the controller device tree to initialize the pinctrl recovery information, part of the drivers does not set this field (rinfo->pinctrl), for example i2c DesignWare driver. The pins information is saved part of the device structure before probe and it's done on pinctrl_bind_pins(). Make the i2c init recovery to get the device pins if it's not initialized by the driver from the device pins. Signed-off-by: Hanna Hawa Reviewed-by: Andy Shevchenko Reported-by: kernel test robot --- drivers/i2c/i2c-core-base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 7539b0740351..fb5644457452 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -282,7 +283,9 @@ static void i2c_gpio_init_pinctrl_recovery(struct i2c_a= dapter *adap) { struct i2c_bus_recovery_info *bri =3D adap->bus_recovery_info; struct device *dev =3D &adap->dev; - struct pinctrl *p =3D bri->pinctrl; + struct pinctrl *p =3D bri->pinctrl ?: dev_pinctrl(dev->parent); + + bri->pinctrl =3D p; =20 /* * we can't change states without pinctrl, so remove the states if --=20 2.38.1