[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221221205116.73941-3-hhhawa@amazon.com>
Date: Wed, 21 Dec 2022 20:51:16 +0000
From: Hanna Hawa <hhhawa@...zon.com>
To: <wsa@...nel.org>, <linus.walleij@...aro.org>,
<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-gpio@...r.kernel.org>
CC: <dwmw@...zon.co.uk>, <benh@...zon.com>, <ronenk@...zon.com>,
<talel@...zon.com>, <jonnyc@...zon.com>, <hanochu@...zon.com>,
<farbere@...zon.com>, <itamark@...zon.com>, <hhhawa@...zon.com>
Subject: [PATCH v4 2/2] i2c: Set i2c pinctrl recovery info from it's device pinctrl
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 <hhhawa@...zon.com>
---
drivers/i2c/i2c-core-base.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 7539b0740351..8c5f76c43dc8 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -34,6 +34,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/devinfo.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeirq.h>
@@ -282,7 +283,10 @@ static void i2c_gpio_init_pinctrl_recovery(struct i2c_adapter *adap)
{
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
struct device *dev = &adap->dev;
- struct pinctrl *p = bri->pinctrl;
+ struct pinctrl *p;
+
+ bri->pinctrl = bri->pinctrl ?: dev_pinctrl(dev->parent);
+ p = bri->pinctrl;
/*
* we can't change states without pinctrl, so remove the states if
--
2.38.1
Powered by blists - more mailing lists