Lines Matching +full:gpio +full:- +full:dir

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm8350-core.c -- Device access for Wolfson WM8350
15 #include <linux/mfd/wm8350/gpio.h>
18 static int gpio_set_dir(struct wm8350 *wm8350, int gpio, int dir) in gpio_set_dir() argument
23 if (dir == WM8350_GPIO_DIR_OUT) in gpio_set_dir()
26 1 << gpio); in gpio_set_dir()
30 1 << gpio); in gpio_set_dir()
35 static int wm8350_gpio_set_debounce(struct wm8350 *wm8350, int gpio, int db) in wm8350_gpio_set_debounce() argument
39 1 << gpio); in wm8350_gpio_set_debounce()
42 WM8350_GPIO_DEBOUNCE, 1 << gpio); in wm8350_gpio_set_debounce()
45 static int gpio_set_func(struct wm8350 *wm8350, int gpio, int func) in gpio_set_func() argument
50 switch (gpio) { in gpio_set_func()
131 return -EINVAL; in gpio_set_func()
138 static int gpio_set_pull_up(struct wm8350 *wm8350, int gpio, int up) in gpio_set_pull_up() argument
143 1 << gpio); in gpio_set_pull_up()
147 1 << gpio); in gpio_set_pull_up()
150 static int gpio_set_pull_down(struct wm8350 *wm8350, int gpio, int down) in gpio_set_pull_down() argument
155 1 << gpio); in gpio_set_pull_down()
159 1 << gpio); in gpio_set_pull_down()
162 static int gpio_set_polarity(struct wm8350 *wm8350, int gpio, int pol) in gpio_set_polarity() argument
167 1 << gpio); in gpio_set_polarity()
171 1 << gpio); in gpio_set_polarity()
174 static int gpio_set_invert(struct wm8350 *wm8350, int gpio, int invert) in gpio_set_invert() argument
177 return wm8350_set_bits(wm8350, WM8350_GPIO_INT_MODE, 1 << gpio); in gpio_set_invert()
180 WM8350_GPIO_INT_MODE, 1 << gpio); in gpio_set_invert()
183 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func, in wm8350_gpio_config() argument
188 if (gpio_set_pull_up(wm8350, gpio, 0)) in wm8350_gpio_config()
190 if (gpio_set_pull_down(wm8350, gpio, 0)) in wm8350_gpio_config()
193 if (gpio_set_pull_down(wm8350, gpio, 0)) in wm8350_gpio_config()
195 if (gpio_set_pull_up(wm8350, gpio, 1)) in wm8350_gpio_config()
198 if (gpio_set_pull_up(wm8350, gpio, 0)) in wm8350_gpio_config()
200 if (gpio_set_pull_down(wm8350, gpio, 1)) in wm8350_gpio_config()
204 if (gpio_set_invert(wm8350, gpio, invert)) in wm8350_gpio_config()
206 if (gpio_set_polarity(wm8350, gpio, pol)) in wm8350_gpio_config()
208 if (wm8350_gpio_set_debounce(wm8350, gpio, debounce)) in wm8350_gpio_config()
210 if (gpio_set_dir(wm8350, gpio, dir)) in wm8350_gpio_config()
212 return gpio_set_func(wm8350, gpio, func); in wm8350_gpio_config()
215 return -EIO; in wm8350_gpio_config()