@@ -99,6 +99,20 @@ bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned int pin)
return !(ops->strict && !!desc->gpio_owner);
}
+bool pin_requested(struct pinctrl_dev *pctldev, int pin)
+{
+ struct pin_desc *desc;
+
+ desc = pin_desc_get(pctldev, pin);
+ if (!desc)
+ return false;
+
+ if (!desc->gpio_owner && !desc->mux_owner)
+ return false;
+
+ return true;
+}
+
/**
* pin_request() - request a single pin to be muxed in, typically for GPIO
* @pctldev: the associated pin controller device
@@ -42,6 +42,7 @@ int pinmux_map_to_setting(const struct pinctrl_map *map,
void pinmux_free_setting(const struct pinctrl_setting *setting);
int pinmux_enable_setting(const struct pinctrl_setting *setting);
void pinmux_disable_setting(const struct pinctrl_setting *setting);
+bool pin_requested(struct pinctrl_dev *pctldev, int pin);
#else
@@ -100,6 +101,11 @@ static inline void pinmux_disable_setting(const struct pinctrl_setting *setting)
{
}
+static inline bool __maybe_unused pin_requested(struct pinctrl_dev *pctldev, int pin)
+{
+ return false;
+}
+
#endif
#if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)