On some platforms, the sda/scl pins are muxed with gpio functions, so...
they could be used for recovery. Select the gpio/default pin function
when prepare/unprepare recovery.
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
---
since v1:
- use IS_ERR_OR_NULL
drivers/i2c/busses/i2c-designware-core.h | 3 +++
drivers/i2c/busses/i2c-designware-master.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
+ pinctrl = devm_pinctrl_get(dev->dev);
+ if (PTR_ERR(pinctrl) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ if (!IS_ERR_OR_NULL(pinctrl)) {
+ dev->pinctrl = pinctrl;
+ s = pinctrl_lookup_state(pinctrl, PINCTRL_STATE_DEFAULT);
+ if (!IS_ERR_OR_NULL(s))
+ dev->pins_default = s;
+ s = pinctrl_lookup_state(pinctrl, "gpio");
+ if (!IS_ERR_OR_NULL(s))
+ dev->pins_gpio = s;
+ }
+