27
27
#include <linux/pinctrl/machine.h>
28
28
29
29
#ifdef CONFIG_GPIOLIB
30
+ #include "../gpio/gpiolib.h"
30
31
#include <asm-generic/gpio.h>
31
32
#endif
32
33
@@ -1601,6 +1602,9 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
1601
1602
struct pinctrl_dev * pctldev = s -> private ;
1602
1603
const struct pinctrl_ops * ops = pctldev -> desc -> pctlops ;
1603
1604
unsigned i , pin ;
1605
+ struct pinctrl_gpio_range * range ;
1606
+ unsigned int gpio_num ;
1607
+ struct gpio_chip * chip ;
1604
1608
1605
1609
seq_printf (s , "registered pins: %d\n" , pctldev -> desc -> npins );
1606
1610
@@ -1618,6 +1622,23 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
1618
1622
1619
1623
seq_printf (s , "pin %d (%s) " , pin , desc -> name );
1620
1624
1625
+ #ifdef CONFIG_GPIOLIB
1626
+ gpio_num = 0 ;
1627
+ list_for_each_entry (range , & pctldev -> gpio_ranges , node ) {
1628
+ if ((pin >= range -> pin_base ) &&
1629
+ (pin < (range -> pin_base + range -> npins ))) {
1630
+ gpio_num = range -> base + (pin - range -> pin_base );
1631
+ break ;
1632
+ }
1633
+ }
1634
+ chip = gpio_to_chip (gpio_num );
1635
+ if (chip && chip -> gpiodev && chip -> gpiodev -> base )
1636
+ seq_printf (s , "%u:%s " , gpio_num -
1637
+ chip -> gpiodev -> base , chip -> label );
1638
+ else
1639
+ seq_puts (s , "0:? " );
1640
+ #endif
1641
+
1621
1642
/* Driver-specific info per pin */
1622
1643
if (ops -> pin_dbg_show )
1623
1644
ops -> pin_dbg_show (pctldev , s , pin );
0 commit comments