Commit 13e80244 authored by Hanna Hawa's avatar Hanna Hawa Committed by Wolfram Sang

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: default avatarHanna Hawa <hhhawa@amazon.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 5f451bef
......@@ -18,6 +18,8 @@ struct device;
#ifdef CONFIG_PINCTRL
#include <linux/device.h>
/* The device core acts as a consumer toward pinctrl */
#include <linux/pinctrl/consumer.h>
......@@ -44,6 +46,14 @@ struct dev_pin_info {
extern int pinctrl_bind_pins(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
/* Stubs if we're not using pinctrl */
......@@ -58,5 +68,10 @@ static inline int pinctrl_init_done(struct device *dev)
return 0;
}
static inline struct pinctrl *dev_pinctrl(struct device *dev)
{
return NULL;
}
#endif /* CONFIG_PINCTRL */
#endif /* PINCTRL_DEVINFO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment