Lines Matching defs:wm8350
3 * wm8350-core.c -- Device access for Wolfson WM8350
14 #include <linux/mfd/wm8350/core.h>
15 #include <linux/mfd/wm8350/gpio.h>
16 #include <linux/mfd/wm8350/pmic.h>
18 static int gpio_set_dir(struct wm8350 *wm8350, int gpio, int dir)
22 wm8350_reg_unlock(wm8350);
24 ret = wm8350_clear_bits(wm8350,
28 ret = wm8350_set_bits(wm8350,
31 wm8350_reg_lock(wm8350);
35 static int wm8350_gpio_set_debounce(struct wm8350 *wm8350, int gpio, int db)
38 return wm8350_set_bits(wm8350, WM8350_GPIO_DEBOUNCE,
41 return wm8350_clear_bits(wm8350,
45 static int gpio_set_func(struct wm8350 *wm8350, int gpio, int func)
49 wm8350_reg_unlock(wm8350);
52 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_1)
54 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_1,
58 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_1)
60 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_1,
64 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_1)
66 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_1,
70 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_1)
72 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_1,
76 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_2)
78 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_2,
82 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_2)
84 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_2,
88 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_2)
90 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_2,
94 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_2)
96 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_2,
100 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_3)
102 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_3,
106 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_3)
108 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_3,
112 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_3)
114 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_3,
118 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_3)
120 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_3,
124 reg = wm8350_reg_read(wm8350, WM8350_GPIO_FUNCTION_SELECT_4)
126 wm8350_reg_write(wm8350, WM8350_GPIO_FUNCTION_SELECT_4,
130 wm8350_reg_lock(wm8350);
134 wm8350_reg_lock(wm8350);
138 static int gpio_set_pull_up(struct wm8350 *wm8350, int gpio, int up)
141 return wm8350_set_bits(wm8350,
145 return wm8350_clear_bits(wm8350,
150 static int gpio_set_pull_down(struct wm8350 *wm8350, int gpio, int down)
153 return wm8350_set_bits(wm8350,
157 return wm8350_clear_bits(wm8350,
162 static int gpio_set_polarity(struct wm8350 *wm8350, int gpio, int pol)
165 return wm8350_set_bits(wm8350,
169 return wm8350_clear_bits(wm8350,
174 static int gpio_set_invert(struct wm8350 *wm8350, int gpio, int invert)
177 return wm8350_set_bits(wm8350, WM8350_GPIO_INT_MODE, 1 << gpio);
179 return wm8350_clear_bits(wm8350,
183 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
188 if (gpio_set_pull_up(wm8350, gpio, 0))
190 if (gpio_set_pull_down(wm8350, gpio, 0))
193 if (gpio_set_pull_down(wm8350, gpio, 0))
195 if (gpio_set_pull_up(wm8350, gpio, 1))
198 if (gpio_set_pull_up(wm8350, gpio, 0))
200 if (gpio_set_pull_down(wm8350, gpio, 1))
204 if (gpio_set_invert(wm8350, gpio, invert))
206 if (gpio_set_polarity(wm8350, gpio, pol))
208 if (wm8350_gpio_set_debounce(wm8350, gpio, debounce))
210 if (gpio_set_dir(wm8350, gpio, dir))
212 return gpio_set_func(wm8350, gpio, func);