LEDs Pinmux Question

Hello,

A bit ago I was trying to get a touchscreen working with a CM3 module and ran into some problems. I wanted to try to take a crack at solving the problem and I had a few questions.

When I try to load the goodix.dtb touch driver I get the following error:

Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: pin gpio9 already requested by leds; cannot claim for 3f204000.spi
Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: pin-9 (3f204000.spi) status -22
Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: could not request pin 9 (gpio9) from group gpio9 on device pinctrl-bcm28
Oct 18 23:09:47 localhost kernel: spi-bcm2835 3f204000.spi: Error applying setting, reverse things back
Oct 18 23:09:47 localhost kernel: spi-bcm2835: probe of 3f204000.spi failed with error -22
Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: pin gpio0 already requested by leds; cannot claim for 3f205000.i2c
Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: pin-0 (3f205000.i2c) status -22
Oct 18 23:09:47 localhost kernel: pinctrl-bcm2835 3f200000.gpio: could not request pin 0 (gpio0) from group gpio0 on device pinctrl-bcm28
Oct 18 23:09:47 localhost kernel: i2c-bcm2835 3f205000.i2c: Error applying setting, reverse things back

It looks like the issue is that the driver needs a few pins that are already in use. How do I go about freeing these pins so that the touch driver can use them? Below you can see that half of the GPIO are bound to leds for some reason. I’m using the default ubuntu core CM3 image.

z4@localhost:~$ sudo cat /sys/kernel/debug/pinctrl/3f200000.gpio/pinmux-pins
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (gpio0): leds (GPIO UNCLAIMED) function alt2 group gpio0
pin 1 (gpio1): leds (GPIO UNCLAIMED) function alt2 group gpio1
pin 2 (gpio2): leds (GPIO UNCLAIMED) function alt2 group gpio2
pin 3 (gpio3): leds (GPIO UNCLAIMED) function alt2 group gpio3
pin 4 (gpio4): leds (GPIO UNCLAIMED) function alt2 group gpio4
pin 5 (gpio5): leds (GPIO UNCLAIMED) function alt2 group gpio5
pin 6 (gpio6): leds (GPIO UNCLAIMED) function alt2 group gpio6
pin 7 (gpio7): leds (GPIO UNCLAIMED) function alt2 group gpio7
pin 8 (gpio8): leds (GPIO UNCLAIMED) function alt2 group gpio8
pin 9 (gpio9): leds (GPIO UNCLAIMED) function alt2 group gpio9
pin 10 (gpio10): leds (GPIO UNCLAIMED) function alt2 group gpio10
pin 11 (gpio11): leds (GPIO UNCLAIMED) function alt2 group gpio11
pin 12 (gpio12): leds (GPIO UNCLAIMED) function alt2 group gpio12
pin 13 (gpio13): leds (GPIO UNCLAIMED) function alt2 group gpio13
pin 14 (gpio14): leds (GPIO UNCLAIMED) function alt2 group gpio14
pin 15 (gpio15): leds (GPIO UNCLAIMED) function alt2 group gpio15
pin 16 (gpio16): leds (GPIO UNCLAIMED) function alt2 group gpio16
pin 17 (gpio17): leds (GPIO UNCLAIMED) function alt2 group gpio17
pin 18 (gpio18): leds (GPIO UNCLAIMED) function alt2 group gpio18
pin 19 (gpio19): leds (GPIO UNCLAIMED) function alt2 group gpio19
pin 20 (gpio20): leds (GPIO UNCLAIMED) function alt2 group gpio20
pin 21 (gpio21): leds (GPIO UNCLAIMED) function alt2 group gpio21
pin 22 (gpio22): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 23 (gpio23): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 24 (gpio24): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 25 (gpio25): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 26 (gpio26): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 27 (gpio27): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 28 (gpio28): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 29 (gpio29): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 30 (gpio30): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 31 (gpio31): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 32 (gpio32): 3f215040.serial (GPIO UNCLAIMED) function alt5 group gpio32
pin 33 (gpio33): 3f215040.serial (GPIO UNCLAIMED) function alt5 group gpio33
pin 34 (gpio34): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 35 (gpio35): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 36 (gpio36): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 37 (gpio37): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 38 (gpio38): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 39 (gpio39): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 40 (gpio40): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 41 (gpio41): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 42 (gpio42): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 43 (gpio43): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 44 (gpio44): 3f804000.i2c (GPIO UNCLAIMED) function alt2 group gpio44
pin 45 (gpio45): 3f804000.i2c (GPIO UNCLAIMED) function alt2 group gpio45
pin 46 (gpio46): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 47 (gpio47): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 48 (gpio48): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio48
pin 49 (gpio49): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio49
pin 50 (gpio50): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio50
pin 51 (gpio51): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio51
pin 52 (gpio52): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio52
pin 53 (gpio53): 3f202000.mmc (GPIO UNCLAIMED) function alt0 group gpio53

Okay so the problem was that I had DPI enabled for the screen, which uses the first 21 GPIO pins. As a result I needed to disable SPI and I2C0 because they use some of those GPIO pins. I still can’t seem to get the goodix touch driver to load – working on that now.

looks like you can move around the gpio’s in use by defining the right params as option to the goodix entry: