diff options
-rw-r--r-- | drivers/gpio/gpio-wm8994.c | 79 |
1 files changed, 77 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index 96198f3fab73..92ea5350dfe9 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c | |||
@@ -117,6 +117,60 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
117 | 117 | ||
118 | 118 | ||
119 | #ifdef CONFIG_DEBUG_FS | 119 | #ifdef CONFIG_DEBUG_FS |
120 | static const char *wm8994_gpio_fn(u16 fn) | ||
121 | { | ||
122 | switch (fn) { | ||
123 | case WM8994_GP_FN_PIN_SPECIFIC: | ||
124 | return "pin-specific"; | ||
125 | case WM8994_GP_FN_GPIO: | ||
126 | return "GPIO"; | ||
127 | case WM8994_GP_FN_SDOUT: | ||
128 | return "SDOUT"; | ||
129 | case WM8994_GP_FN_IRQ: | ||
130 | return "IRQ"; | ||
131 | case WM8994_GP_FN_TEMPERATURE: | ||
132 | return "Temperature"; | ||
133 | case WM8994_GP_FN_MICBIAS1_DET: | ||
134 | return "MICBIAS1 detect"; | ||
135 | case WM8994_GP_FN_MICBIAS1_SHORT: | ||
136 | return "MICBIAS1 short"; | ||
137 | case WM8994_GP_FN_MICBIAS2_DET: | ||
138 | return "MICBIAS2 detect"; | ||
139 | case WM8994_GP_FN_MICBIAS2_SHORT: | ||
140 | return "MICBIAS2 short"; | ||
141 | case WM8994_GP_FN_FLL1_LOCK: | ||
142 | return "FLL1 lock"; | ||
143 | case WM8994_GP_FN_FLL2_LOCK: | ||
144 | return "FLL2 lock"; | ||
145 | case WM8994_GP_FN_SRC1_LOCK: | ||
146 | return "SRC1 lock"; | ||
147 | case WM8994_GP_FN_SRC2_LOCK: | ||
148 | return "SRC2 lock"; | ||
149 | case WM8994_GP_FN_DRC1_ACT: | ||
150 | return "DRC1 activity"; | ||
151 | case WM8994_GP_FN_DRC2_ACT: | ||
152 | return "DRC2 activity"; | ||
153 | case WM8994_GP_FN_DRC3_ACT: | ||
154 | return "DRC3 activity"; | ||
155 | case WM8994_GP_FN_WSEQ_STATUS: | ||
156 | return "Write sequencer"; | ||
157 | case WM8994_GP_FN_FIFO_ERROR: | ||
158 | return "FIFO error"; | ||
159 | case WM8994_GP_FN_OPCLK: | ||
160 | return "OPCLK"; | ||
161 | case WM8994_GP_FN_THW: | ||
162 | return "Thermal warning"; | ||
163 | case WM8994_GP_FN_DCS_DONE: | ||
164 | return "DC servo"; | ||
165 | case WM8994_GP_FN_FLL1_OUT: | ||
166 | return "FLL1 output"; | ||
167 | case WM8994_GP_FN_FLL2_OUT: | ||
168 | return "FLL1 output"; | ||
169 | default: | ||
170 | return "Unknown"; | ||
171 | } | ||
172 | } | ||
173 | |||
120 | static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | 174 | static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
121 | { | 175 | { |
122 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); | 176 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); |
@@ -148,8 +202,29 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
148 | continue; | 202 | continue; |
149 | } | 203 | } |
150 | 204 | ||
151 | /* No decode yet; note that GPIO2 is special */ | 205 | if (reg & WM8994_GPN_DIR) |
152 | seq_printf(s, "(%x)\n", reg); | 206 | seq_printf(s, "in "); |
207 | else | ||
208 | seq_printf(s, "out "); | ||
209 | |||
210 | if (reg & WM8994_GPN_PU) | ||
211 | seq_printf(s, "pull up "); | ||
212 | |||
213 | if (reg & WM8994_GPN_PD) | ||
214 | seq_printf(s, "pull down "); | ||
215 | |||
216 | if (reg & WM8994_GPN_POL) | ||
217 | seq_printf(s, "inverted "); | ||
218 | else | ||
219 | seq_printf(s, "noninverted "); | ||
220 | |||
221 | if (reg & WM8994_GPN_OP_CFG) | ||
222 | seq_printf(s, "open drain "); | ||
223 | else | ||
224 | seq_printf(s, "CMOS "); | ||
225 | |||
226 | seq_printf(s, "%s (%x)\n", | ||
227 | wm8994_gpio_fn(reg & WM8994_GPN_FN_MASK), reg); | ||
153 | } | 228 | } |
154 | } | 229 | } |
155 | #else | 230 | #else |