Skip to content

Commit 3ff9588

Browse files
westeriLinus Walleij
authored andcommitted
pinctrl: baytrail: Add pull type, strength and open drain to debugfs output
In case of resolving power management or similar issues it might be useful to have these properties included in the debugfs output. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 605a7bc commit 3ff9588

1 file changed

Lines changed: 51 additions & 4 deletions

File tree

‎drivers/pinctrl/pinctrl-baytrail.c‎

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,20 @@
4343
#define BYT_INT_STAT_REG 0x800
4444

4545
/* BYT_CONF0_REG register bits */
46+
#define BYT_IODEN BIT(31)
4647
#define BYT_TRIG_NEG BIT(26)
4748
#define BYT_TRIG_POS BIT(25)
4849
#define BYT_TRIG_LVL BIT(24)
50+
#define BYT_PULL_STR_SHIFT 9
51+
#define BYT_PULL_STR_MASK (3 << BYT_PULL_STR_SHIFT)
52+
#define BYT_PULL_STR_2K (0 << BYT_PULL_STR_SHIFT)
53+
#define BYT_PULL_STR_10K (1 << BYT_PULL_STR_SHIFT)
54+
#define BYT_PULL_STR_20K (2 << BYT_PULL_STR_SHIFT)
55+
#define BYT_PULL_STR_40K (3 << BYT_PULL_STR_SHIFT)
56+
#define BYT_PULL_ASSIGN_SHIFT 7
57+
#define BYT_PULL_ASSIGN_MASK (3 << BYT_PULL_ASSIGN_SHIFT)
58+
#define BYT_PULL_ASSIGN_UP (1 << BYT_PULL_ASSIGN_SHIFT)
59+
#define BYT_PULL_ASSIGN_DOWN (2 << BYT_PULL_ASSIGN_SHIFT)
4960
#define BYT_PIN_MUX 0x07
5061

5162
/* BYT_VAL_REG register bits */
@@ -321,6 +332,8 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
321332
spin_lock_irqsave(&vg->lock, flags);
322333

323334
for (i = 0; i < vg->chip.ngpio; i++) {
335+
const char *pull_str = NULL;
336+
const char *pull = NULL;
324337
const char *label;
325338
offs = vg->range->pins[i] * 16;
326339
conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG);
@@ -330,18 +343,52 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
330343
if (!label)
331344
label = "Unrequested";
332345

346+
switch (conf0 & BYT_PULL_ASSIGN_MASK) {
347+
case BYT_PULL_ASSIGN_UP:
348+
pull = "up";
349+
break;
350+
case BYT_PULL_ASSIGN_DOWN:
351+
pull = "down";
352+
break;
353+
}
354+
355+
switch (conf0 & BYT_PULL_STR_MASK) {
356+
case BYT_PULL_STR_2K:
357+
pull_str = "2k";
358+
break;
359+
case BYT_PULL_STR_10K:
360+
pull_str = "10k";
361+
break;
362+
case BYT_PULL_STR_20K:
363+
pull_str = "20k";
364+
break;
365+
case BYT_PULL_STR_40K:
366+
pull_str = "40k";
367+
break;
368+
}
369+
333370
seq_printf(s,
334-
" gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n",
371+
" gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s",
335372
i,
336373
label,
337374
val & BYT_INPUT_EN ? " " : "in",
338375
val & BYT_OUTPUT_EN ? " " : "out",
339376
val & BYT_LEVEL ? "hi" : "lo",
340377
vg->range->pins[i], offs,
341378
conf0 & 0x7,
342-
conf0 & BYT_TRIG_NEG ? " fall" : "",
343-
conf0 & BYT_TRIG_POS ? " rise" : "",
344-
conf0 & BYT_TRIG_LVL ? " level" : "");
379+
conf0 & BYT_TRIG_NEG ? " fall" : " ",
380+
conf0 & BYT_TRIG_POS ? " rise" : " ",
381+
conf0 & BYT_TRIG_LVL ? " level" : " ");
382+
383+
if (pull && pull_str)
384+
seq_printf(s, " %-4s %-3s", pull, pull_str);
385+
else
386+
seq_puts(s, " ");
387+
388+
if (conf0 & BYT_IODEN)
389+
seq_puts(s, " open-drain");
390+
391+
seq_puts(s, "\n");
345392
}
346393
spin_unlock_irqrestore(&vg->lock, flags);
347394
}

0 commit comments

Comments
 (0)