pinctrl: Add an API to get the pinctrl pins if initialized

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 <hhhawa@amazon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Hanna Hawa 2022-12-28 16:48:12 +00:00 коммит произвёл Wolfram Sang
Родитель 5f451bef75
Коммит 13e80244ca
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,8 @@ struct device;
#ifdef CONFIG_PINCTRL #ifdef CONFIG_PINCTRL
#include <linux/device.h>
/* The device core acts as a consumer toward pinctrl */ /* The device core acts as a consumer toward pinctrl */
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
@ -44,6 +46,14 @@ struct dev_pin_info {
extern int pinctrl_bind_pins(struct device *dev); extern int pinctrl_bind_pins(struct device *dev);
extern int pinctrl_init_done(struct device *dev); extern int pinctrl_init_done(struct device *dev);
static inline struct pinctrl *dev_pinctrl(struct device *dev)
{
if (!dev->pins)
return NULL;
return dev->pins->p;
}
#else #else
/* Stubs if we're not using pinctrl */ /* Stubs if we're not using pinctrl */
@ -58,5 +68,10 @@ static inline int pinctrl_init_done(struct device *dev)
return 0; return 0;
} }
static inline struct pinctrl *dev_pinctrl(struct device *dev)
{
return NULL;
}
#endif /* CONFIG_PINCTRL */ #endif /* CONFIG_PINCTRL */
#endif /* PINCTRL_DEVINFO_H */ #endif /* PINCTRL_DEVINFO_H */