I’d like to configure two pins as GPIO LEDs, these are physical pins 79 and 81, also called D2 and L6 and GPIO30 and GPIO90. I have spent quite some time getting Linux 4.1 to run on this thing and most peripherals work, but I can’t figure out what I’m doing wrong with the GPIO.
The pins are tied to one LED each. I want to control these with the gpio sysfs API. From the pinmux documentation, I have interpreted these pins to be “dtc” and “dtd”, which are tied to the “vi” pin function node in tegra20-colibri-512.dtsi.
Now, I can
echo 30 > /sys/class/gpio/export
cd gpio30
echo out > direction
echo 1 > value
which should mean that the pin is FREE for gpio use, right? But while cat value outputs ‘1’, the LED doesn’t change state (and indeed the actual cpu pin isn’t flipped either).
So what could be causing this? I’ve also tried modding the device tree, like:
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_leds>;
usb {
/* note: dtd */
label = "led-usb";
gpios = <&gpio TEGRA_GPIO(L, 2) GPIO_ACTIVE_HIGH>;
};
vehicle {
/* note: dtc */
label= "led-vehicle";
gpios = <&gpio TEGRA_GPIO(D, 6) GPIO_ACTIVE_HIGH>;
};
};
pinctrl_gpio_leds: gpioleds {
nvidia,pins = "dtc", "dtd";
nvidia,pull = <TEGRA_PIN_PULL_UP>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
};
which had the same problem (the pins and their expected values show up in /sys/kernel/debug/gpio, but the physical pin doesn’t change state).