Sysfs and Procfs Entries
This topic describes sysfs and procfs entries that can be useful for debugging.
Sysfs
Sysfs is a virtual file system that exports information about various kernel subsystems, hardware devices, and associated device drivers. The system passes information from the kernel space to the user space. Sysfs entries are either read-only (RO) or read-write (RW). For RW entries, sysfs can set values in the kernel space.
Sysfs entries are expressed as a path that begins with /sys. You can use the cat command to get the data associated with a sysfs entry. You can send the cat commands to the target with minicom. For example:
cat /sys/kernel/debug/gpio
For sysfs entries with RW access, you can use the following command syntax to change the value:
echo <value> > <sysfs_pathname>
Where <value> is the new value.
Procfs
Procfs is also a virtual file system that exports process information such as the current status of the process, or all open file descriptors to the user space. Procfs entries are expressed as a path that begins with /proc.
Boot Loader Data
You can customize the boot loader to pass data to a procfs folder that userspace interfaces can access.
To access boot loader data from the kernel
1. From your boot loader, call the QbInitBootData function to register the data.
For information on using this function and limitations on data size, see the API description in Foundation SDK 5.0 References. To access these references, click the API tab from Foundation SDK 5.0 Development Guide.
2. From your userspace interface, list the data in:
/proc/device-tree/chosen/nvidia,bootdata
The size of the above entry equals the number of bytes passed to QbInitBootData.
Chip Information and Unique ID
You can use procfs to get chip information, which shows the number of the CPU cores, and the CPU implementer.
To get chip information
• Enter:
cat /proc/cpuinfo
The following are examples of the information from this, depending on the NVIDIA® Tegra® version in your platform.
processor : 0
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 1
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x003
CPU revision : 0
MTS version : 36203586
processor : 2
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x003
CPU revision : 0
MTS version : 36203586
processor : 3
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 4
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 5
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
Where:
• Processor: X is the Linux CPU number (CPUX)
• CPU implementer: 0xXX is as follows:
• 0x41 is ARM Ltd. A57s
• 0x4e is ASCII “N” for NVIDIA
GPIO Settings
Consult the following GPIO settings for your platform.
Tegra GPIO settings can be obtained from:
/sys/kernel/debug/tegra_gpio
Each field represents the following in order:
• Controller Port:pin
• ENABLE_CONFIG
• DEBOUNCE_THRESHOLD
• INPUT_VALUE
• OUTPUT_CONTROL
• OUTPUT_VALUE
• INTERRUPT_CLEAR
Refer to the Tegra Reference Manual for descriptions of each of these fields.
For example, the following command:
cat /sys/kernel/debug/tegra_gpio
Produces the following output:
Port:Pin:ENB DBC IN OUT_CTRL OUT_VAL INT_CLR
A:0 0x3 0x0 0x0 0x0 0x0 0x0
A:1 0x0 0x0 0x0 0x1 0x0 0x0
A:2 0x0 0x0 0x0 0x1 0x0 0x0
A:3 0x0 0x0 0x0 0x1 0x0 0x0
A:4 0x0 0x0 0x0 0x1 0x0 0x0
A:5 0x3 0x0 0x0 0x0 0x1 0x0
A:6 0x1 0x0 0x1 0x1 0x0 0x0
B:0 0x0 0x0 0x0 0x1 0x0 0x0
B:1 0x0 0x0 0x0 0x1 0x0 0x0
B:2 0x0 0x0 0x0 0x1 0x0 0x0
B:3 0x0 0x0 0x0 0x1 0x0 0x0
B:4 0x3 0x0 0x0 0x0 0x0 0x0
B:5 0x3 0x0 0x0 0x0 0x0 0x0
B:6 0x3 0x0 0x0 0x0 0x0 0x0
E:0 0x0 0x0 0x0 0x1 0x0 0x0
E:1 0x0 0x0 0x0 0x1 0x0 0x0
E:2 0x0 0x0 0x0 0x1 0x0 0x0
E:3 0x0 0x0 0x0 0x1 0x0 0x0
E:4 0x0 0x0 0x0 0x1 0x0 0x0
E:5 0x0 0x0 0x0 0x1 0x0 0x0
E:6 0x0 0x0 0x0 0x1 0x0 0x0
E:7 0x0 0x0 0x0 0x1 0x0 0x0
F:0 0x0 0x0 0x0 0x1 0x0 0x0
F:1 0x0 0x0 0x0 0x1 0x0 0x0
F:2 0x0 0x0 0x0 0x1 0x0 0x0
F:3 0x0 0x0 0x0 0x1 0x0 0x0
F:4 0x0 0x0 0x0 0x1 0x0 0x0
F:5 0x0 0x0 0x0 0x1 0x0 0x0
G:0 0x0 0x0 0x0 0x1 0x0 0x0
G:1 0x0 0x0 0x0 0x1 0x0 0x0
G:2 0x0 0x0 0x0 0x1 0x0 0x0
G:3 0x0 0x0 0x0 0x1 0x0 0x0
G:4 0x0 0x0 0x0 0x1 0x0 0x0
G:5 0x0 0x0 0x0 0x1 0x0 0x0
H:0 0x0 0x0 0x0 0x1 0x0 0x0
H:1 0x0 0x0 0x0 0x1 0x0 0x0
H:2 0x0 0x0 0x0 0x1 0x0 0x0
H:3 0x0 0x0 0x0 0x1 0x0 0x0
EE:0 0x0 0x0 0x0 0x1 0x0 0x0
EE:1 0x0 0x0 0x0 0x1 0x0 0x0
EE:2 0x1 0x0 0x1 0x1 0x0 0x0
FF:0 0x1 0x0 0x1 0x1 0x0 0x0
FF:1 0x1 0x0 0x1 0x1 0x0 0x0
FF:2 0x45 0x0 0x1 0x1 0x0 0x0
FF:3 0x1 0x0 0x1 0x1 0x0 0x0
FF:4 0x1 0x0 0x1 0x1 0x0 0x0
The GPIO pin allocation, direction, and value of the GPIOs can be obtained from the standard kernel file at:
/sys/kernel/debug/gpio
The tegra name corresponding to each GPIO pin number, can be obtained from the file at:
<top>/drive-oss-src/t18x/drivers/pinctrl/pinctrl-tegra186.c
For example, the following command:
cat /sys/kernel/debug/gpio
Produces the following output information:
root@nvidia:~# cat /sys/kernel/debug/gpio
GPIOs 0-255, platform/2200000.gpio, tegra-gpio:
gpio-5 (pwdn-gpios ) out hi
gpio-12 (pwdn-gpios ) out lo
gpio-13 (pwdn-gpios ) out lo
gpio-68 (pwdn-gpios ) out lo
gpio-69 (pwdn-gpios ) out lo
gpio-70 (pwdn-gpios ) out lo
gpio-71 (pwdn-gpios ) out lo
gpio-77 (en-vdd-sdcard1 ) out hi
gpio-78 (en-vdd-sdcard3 ) out hi
gpio-92 (vdd-usb0-5v ) out lo
gpio-93 (vdd-usb2-5v ) in hi
gpio-100 (eqos_phy_reset ) out hi
gpio-101 (eqos_phy_intr ) in hi
gpio-121 (hdmi2.0_hpd ) in lo
gpio-123 (wp ) in lo
gpio-124 (wp ) in lo
gpio-125 (3440000.sdhci cd ) in lo
gpio-126 (3400000.sdhci cd ) in lo
gpio-148 (pwdn-gpios ) out lo
gpio-173 (pwdn-gpios ) out lo
gpio-193 (pwdn-gpios ) out lo
gpio-197 (pwdn-gpios ) out lo
GPIOs 904-911, platform/max20024-gpio.0, max20024-gpio, can sleep:
gpio-904 (external-connection:) in hi
GPIOs 912-1023, i2c/0-0061, tmpm32xi2c, can sleep:
gpio-919 (rst_gpio ) out hi
gpio-947 (vdd-mdm ) in lo
gpio-949 (vdd_wl_bt ) out hi
gpio-967 (vdd-sata-3v3 ) out hi
The value for each parameter in the header file, gpio-names.h, is set according to the following formula:
TEGRA_GPIO_P<bank><pin>=<value>
Where:
• <bank> is the bank name.
• <pin> is the pin number. This integer value can be from 0 to 7.
• <value> is the result of the following formula:
<bank_number> * 8 + <pin>
<bank_number> is the numeric representation of the bank name where A=0, B=1, C=2, D=3, …, Y=24, Z=25, AA=26, BB=27, CC=28, …
For example, the parameter TEGRA_GPIO_PN4 refers to the value of pin 4 or 04 in bank N. The value of this parameter is 108.
N=13
13 * 8 + 4 = 108
The parameter TEGRA_GPIO_PFF3 refers to the value of pin 5 or 05 in bank FF. The value of the parameter is 251.
FF=31
31 * 8 + 4 = 251
Clock Settings for Tegra Parker
On Tegra codename Parker, BPMP-firmware controls clocks. The CPU issues IPC calls to the BPMP to control clocks.
For more information, see the “Configuring Power on BPMP Firmware (Tegra Parker)” topic in the Foundation SDK 5.0 Development Guide.
The following table lists the clock names you can use in sysfs entries for getting or setting clock characteristics. These clock names must be preceded with /sys/kernel/debug/bpmp/debug/clk, as follows:
/sys/kernel/debug/bpmp/debug/clk/<clock_name>
For information on using sysfs entries, see Sysfs at the beginning of this topic.
For information about available Tegra clock sources and capabilities, see the “Clock and Reset Controller” section of the Tegra Technical Reference Manual (TRM) for your chip. This section of the TRM also describes clock sources muxes and provides descriptions of available clock sources for each component.
Clock Name | Description | Access |
clk_tree | Display information about the entire clock tree | Read only (RO) |
min_rate | Minimum clock rate of a module that is supported by the hardware. | RO |
max_rate | Maximum clock rate of a module that is supported by the hardware. | RO |
mrq_rate_locked | Displays the state of the mrq rate lock value for this clock. 0 = A rate request initiated through mrq is handled for this clock. 1 = A rate request initiated through mrq is ignored for this clock. | R/W |
parent | Displays the current parent of a clock. The clock framework sets the parent. Warning: Do not modify this setting. Modifying it could result in chip damage. | R/W |
possible_parents | Provides a list of the parents for the clock. | RO |
rate | Displays the current running clock rate (in Hz). For most clocks, the clock rate remains fixed at the POR value. For clocks where the rate can vary, the rate must be set from the respective driver. Warning: Do not modify this setting. Modifying it could result in chip damage. | R/W |
state | Displays the state of the clock. 0 means the clock is turned off. 1 means the clock is turned on. | R/W |
pto_counter | Displays the clock rate as measured in the hardware counter if it is available for this clock. | RO |
dvfs | Displays the dvfs table, if it is available for this clock. | RO |
The following topics contain examples on using the sysfs interface to get clock information:
To get clock tree information
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/clk_tree
To get state of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/state
To set state of a clock
• Enter:
echo <0|1> > /sys/kernel/debug/bpmp/debug/clk/<clock_name>/state
To get minimum rate of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/min_rate
To get maximum rate of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/max_rate
To get rate of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/rate
To set rate of a clock
• Enter:
echo <rate> > /sys/kernel/debug/bpmp/debug/clk/<clock_name>/rate
To get pto counter of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/pto_counter
To get possible parents of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/possible_parents
To get parent of a clock
• Enter:
cat /sys/kernel/debug/bpmp/debug/clk/<clock_name>/parent
To set parent of a clock
• Enter:
echo <parent_clock_name> > /sys/kernel/debug/bpmp/debug/clk/<clock_name>/parent
Increasing the HDMI Debounce Time
To increase the HDMI debounce time to 1500 ms so that Dell P2514Qb works with your HDMI output:
1. Open the following file.
linux/kernel-display/drivers/video/tegra/dc/hdmi2.0.h
2. Change the following symbol.
#define HDMI_HPD_DEBOUNCE_DELAY_MS (1500)
3. Rebuild tmp kernel.