aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pinctrl
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-01-23 07:34:34 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-01-26 09:27:37 -0500
commit2956b5d94a76b596fa5057c2b3ca915cb27d7652 (patch)
tree3a1dbce1201ef4923a4124f63eb209026e8fba7e /include/linux/pinctrl
parent15381bc7c7f52d56f87c56dd7c948ad78704b852 (diff)
pinctrl / gpio: Introduce .set_config() callback for GPIO chips
Currently we already have two pin configuration related callbacks available for GPIO chips .set_single_ended() and .set_debounce(). In future we expect to have even more, which does not scale well if we need to add yet another callback to the GPIO chip structure for each possible configuration parameter. Better solution is to reuse what we already have available in the generic pinconf. To support this, we introduce a new .set_config() callback for GPIO chips. The callback takes a single packed pin configuration value as parameter. This can then be extended easily beyond what is currently supported by just adding new types to the generic pinconf enum. If the GPIO driver is backed up by a pinctrl driver the GPIO driver can just assign gpiochip_generic_config() (introduced in this patch) to .set_config and that will take care configuration requests are directed to the pinctrl driver. We then convert the existing drivers over .set_config() and finally remove the .set_single_ended() and .set_debounce() callbacks. Suggested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/pinctrl')
-rw-r--r--include/linux/pinctrl/pinconf-generic.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 9a09107c890e..7620eb127cff 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -12,12 +12,6 @@
12#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H 12#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H
13#define __LINUX_PINCTRL_PINCONF_GENERIC_H 13#define __LINUX_PINCTRL_PINCONF_GENERIC_H
14 14
15/*
16 * You shouldn't even be able to compile with these enums etc unless you're
17 * using generic pin config. That is why this is defined out.
18 */
19#ifdef CONFIG_GENERIC_PINCONF
20
21/** 15/**
22 * enum pin_config_param - possible pin configuration parameters 16 * enum pin_config_param - possible pin configuration parameters
23 * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it 17 * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it
@@ -118,18 +112,6 @@ enum pin_config_param {
118 PIN_CONFIG_MAX = 0xFF, 112 PIN_CONFIG_MAX = 0xFF,
119}; 113};
120 114
121#ifdef CONFIG_DEBUG_FS
122#define PCONFDUMP(a, b, c, d) { .param = a, .display = b, .format = c, \
123 .has_arg = d }
124
125struct pin_config_item {
126 const enum pin_config_param param;
127 const char * const display;
128 const char * const format;
129 bool has_arg;
130};
131#endif /* CONFIG_DEBUG_FS */
132
133/* 115/*
134 * Helpful configuration macro to be used in tables etc. 116 * Helpful configuration macro to be used in tables etc.
135 */ 117 */
@@ -158,6 +140,21 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param
158 return PIN_CONF_PACKED(param, argument); 140 return PIN_CONF_PACKED(param, argument);
159} 141}
160 142
143#ifdef CONFIG_GENERIC_PINCONF
144
145#ifdef CONFIG_DEBUG_FS
146#define PCONFDUMP(a, b, c, d) { \
147 .param = a, .display = b, .format = c, .has_arg = d \
148 }
149
150struct pin_config_item {
151 const enum pin_config_param param;
152 const char * const display;
153 const char * const format;
154 bool has_arg;
155};
156#endif /* CONFIG_DEBUG_FS */
157
161#ifdef CONFIG_OF 158#ifdef CONFIG_OF
162 159
163#include <linux/device.h> 160#include <linux/device.h>