summaryrefslogtreecommitdiff
path: root/include/linux/pinctrl
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-10-03 09:12:13 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-11-04 10:23:18 +0100
commitec963d04ca8651cc3738bc8e013b3ab7fdb95e3d (patch)
treec8692b1c3361790d51f654687b2a3ad7738ac06e /include/linux/pinctrl
parent9596ebf87c4f3f439d658af4d7cc2a302bea3750 (diff)
pinctrl: provide new GPIO-to-pinctrl glue helpers
Currently the pinctrl GPIO helpers all take a number from the global GPIO numberspace - of which we're trying to get rid of as argument. These helpers are almost universally called from GPIOLIB driver callbacks which take a pointer to the backing gpio_chip and the controller-relative offset as arguments. Let's provide improved variants of these functions that match the GPIOLIB signatures as the first step in removing the older flavor. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/pinctrl')
-rw-r--r--include/linux/pinctrl/consumer.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 22eef0a513ce..c95c13983376 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -17,6 +17,7 @@
#include <linux/pinctrl/pinctrl-state.h>
struct device;
+struct gpio_chip;
/* This struct is private to the core and should be regarded as a cookie */
struct pinctrl;
@@ -26,11 +27,20 @@ struct pinctrl_state;
/* External interface to pin control */
bool pinctrl_gpio_can_use_line(unsigned gpio);
+bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset);
int pinctrl_gpio_request(unsigned gpio);
+int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset);
void pinctrl_gpio_free(unsigned gpio);
+void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset);
int pinctrl_gpio_direction_input(unsigned gpio);
+int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
+ unsigned int offset);
int pinctrl_gpio_direction_output(unsigned gpio);
+int pinctrl_gpio_direction_output_new(struct gpio_chip *gc,
+ unsigned int offset);
int pinctrl_gpio_set_config(unsigned gpio, unsigned long config);
+int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+ unsigned long config);
struct pinctrl * __must_check pinctrl_get(struct device *dev);
void pinctrl_put(struct pinctrl *p);
@@ -68,30 +78,66 @@ static inline bool pinctrl_gpio_can_use_line(unsigned gpio)
return true;
}
+static inline bool
+pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
+{
+ return true;
+}
+
static inline int pinctrl_gpio_request(unsigned gpio)
{
return 0;
}
+static inline int
+pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
+{
+ return 0;
+}
+
static inline void pinctrl_gpio_free(unsigned gpio)
{
}
+static inline void
+pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
+{
+}
+
static inline int pinctrl_gpio_direction_input(unsigned gpio)
{
return 0;
}
+static inline int
+pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
+{
+ return 0;
+}
+
static inline int pinctrl_gpio_direction_output(unsigned gpio)
{
return 0;
}
+static inline int
+pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
+{
+ return 0;
+}
+
static inline int pinctrl_gpio_set_config(unsigned gpio, unsigned long config)
{
return 0;
}
+static inline int
+pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+ unsigned long config)
+{
+ return 0;
+}
+
static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
{
return NULL;