If there is a gpio range mapping for the pin, then print out the gpio number for the pin in the debugfs 'pins' file. Here is an example on the BeagleBone Black: $ cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins |head -20 registered pins: 142 pin 0 (PIN0) 44e10800 00000027 pinctrl-single GPIO-32 pin 1 (PIN1) 44e10804 00000027 pinctrl-single GPIO-33 pin 2 (PIN2) 44e10808 00000027 pinctrl-single GPIO-34 pin 3 (PIN3) 44e1080c 00000027 pinctrl-single GPIO-35 pin 4 (PIN4) 44e10810 00000027 pinctrl-single GPIO-36 pin 5 (PIN5) 44e10814 00000027 pinctrl-single GPIO-37 pin 6 (PIN6) 44e10818 00000027 pinctrl-single GPIO-38 pin 7 (PIN7) 44e1081c 00000027 pinctrl-single GPIO-39 pin 8 (PIN8) 44e10820 00000027 pinctrl-single GPIO-22 pin 9 (PIN9) 44e10824 00000030 pinctrl-single GPIO-23 pin 10 (PIN10) 44e10828 00000030 pinctrl-single GPIO-26 pin 11 (PIN11) 44e1082c 00000030 pinctrl-single GPIO-27 pin 12 (PIN12) 44e10830 00000030 pinctrl-single GPIO-44 pin 13 (PIN13) 44e10834 00000030 pinctrl-single GPIO-45 pin 14 (PIN14) 44e10838 00000030 pinctrl-single GPIO-46 pin 15 (PIN15) 44e1083c 00000030 pinctrl-single GPIO-47 pin 16 (PIN16) 44e10840 00000027 pinctrl-single GPIO-48 pin 17 (PIN17) 44e10844 00000027 pinctrl-single GPIO-49 pin 18 (PIN18) 44e10848 00000000 pinctrl-single GPIO-50 Signed-off-by: Drew Fustini <drew@xxxxxxxxxxxxxxx> --- drivers/pinctrl/pinctrl-single.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index f3a8a465d27e..473fe0f61792 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -275,6 +275,14 @@ static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev, unsigned val, mux_bytes; unsigned long offset; size_t pa; + struct pinctrl_gpio_range *range; + unsigned gpio_num = 0; + + list_for_each_entry(range, &pctldev->gpio_ranges, node) { + if ((pin >= range->pin_base) && + (pin < (range->pin_base + range->npins))) + gpio_num = range->base + (pin - range->pin_base); + } pcs = pinctrl_dev_get_drvdata(pctldev); @@ -283,7 +291,10 @@ static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev, val = pcs->read(pcs->base + offset); pa = pcs->res->start + offset; - seq_printf(s, "%zx %08x %s ", pa, val, DRIVER_NAME); + if (gpio_num > 0) + seq_printf(s, "%zx %08x %s GPIO-%u", pa, val, DRIVER_NAME, gpio_num); + else + seq_printf(s, "%zx %08x %s", pa, val, DRIVER_NAME); } static void pcs_dt_free_map(struct pinctrl_dev *pctldev, -- 2.25.1