Gpio-keys: Failed to request GPIO 64, error -16

I have added

	gpio-keys {
		compatible = "gpio-keys";
		gpio-keys,name = "gpio-keys";

		keyR0 {
			label = "Key_R0";
			linux,code = <KEY_F5>;
			gpios = <&gpio TEGRA_GPIO(Y, 2) GPIO_ACTIVE_LOW>;
			debounce-interval = <30>;
		};

		keyL0 {
			label = "Key_L0";
			linux,code = <KEY_F1>;
			gpios = <&gpio TEGRA_GPIO(I, 0) GPIO_ACTIVE_LOW>;
			debounce-interval = <30>;
		};
	};

to the file tegra210-p3448-0000-p3449-0000-b00.dts. Key R0 works fine, but key L0 doesn’t work. My dmesg output contains:

$ dmesg|grep gpio-keys
[    1.373725] gpio-keys gpio-keys: Failed to request GPIO 64, error -16
[    1.373780] gpio-keys: probe of gpio-keys failed with error -16

I tried to modify the file tegra210-porg-gpio-p3448-0000-b00.dtsi:

/*This dtsi file was generated by Jetson_Nano_DeveloperKit_Users_Pinmux_Configuration.xlsm Revision: 1.02 */
/*
 * Copyright (c) 2019, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <dt-bindings/gpio/tegra-gpio.h>

/ {
	gpio: gpio@6000d000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_default>;

		gpio_default: default {
			gpio-input = <
				TEGRA_GPIO(A, 5)
				TEGRA_GPIO(X, 4)
				TEGRA_GPIO(X, 5)
				TEGRA_GPIO(X, 6)
				TEGRA_GPIO(Y, 1)
				TEGRA_GPIO(V, 1)
				TEGRA_GPIO(Z, 2)
				TEGRA_GPIO(H, 2)
				TEGRA_GPIO(H, 5)
				TEGRA_GPIO(H, 6)
				TEGRA_GPIO(I, 0)
				TEGRA_GPIO(I, 1)
				TEGRA_GPIO(CC, 4)
				>;
			gpio-output-low = <
				TEGRA_GPIO(S, 7)
				TEGRA_GPIO(T, 0)
				TEGRA_GPIO(Z, 3)
				TEGRA_GPIO(H, 0)
				TEGRA_GPIO(H, 3)
				TEGRA_GPIO(H, 4)
				TEGRA_GPIO(H, 7)
				/* TEGRA_GPIO(I, 0) */
				TEGRA_GPIO(I, 2)
				>;
			gpio-output-high = <
				TEGRA_GPIO(A, 6)
				TEGRA_GPIO(X, 3)
				TEGRA_GPIO(CC, 7)
				>;
		};
	};
};

and the file tegra210-porg-pinmux-p3448-0000-b00.dtsi with following:

			nfc_en_pi0 {
				nvidia,pins = "nfc_en_pi0";
				nvidia,function = "rsvd0";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

Rebuild the dtb-file and copied it to my Jetson Nano. But nothing changes. Still Failed to request GPIO 64, error -16 error.

I googled a lot and found this post:

The leds_pwm was using the GPIO06 pin. I disabled in the device tree and in menuconfig and now am able to use these GPIOs without a busy error.

But I can’t find any leds_pwm in my device tree and in the dmesg output:

$ dmesg | grep leds
$

How can I fix this error?

Hi charlz_klug,

Are you using the devkit or custom board for Jetson Nano?
What’s your Jetpack version in use?

Please disable pwm-leds node in your device tree.

	pwm-leds {
 		compatible = "pwm-leds";
 		status = "disabled";
 	};

Are you using the devkit or custom board for Jetson Nano?

I use custom board for Jetson Nano.

What’s your Jetpack version in use?

Don’t know exactly. I guess Jetson Linux 32.6.1.

I found that TEGRA_GPIO(I, 0) used for CAM_I2C_MUX in tegra210-porg-camera-rbpcv2-dual-imx219.dtsi (line 23):

#define CAM_I2C_MUX TEGRA_GPIO(I, 0) // NFC_EN GPIO

I have commented the line

#include "porg-platforms/tegra210-porg-camera-rbpcv2-dual-imx219.dtsi"

in the tegra210-p3448-0000-p3449-0000-b00.dts file and TEGRA_GPIO(I, 0) was freed!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.