LeMaker Guitar:How to use debugfs

From BananaPro/Pi
Jump to: navigation, search

Other languages:
English • ‎中文(简体)‎

Description

Debugfs exists as a simple way for kernel developers to make information available to user space. Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all. Developers can put any information they want here. The debugfs filesystem is also intended to not serve as a stable ABI to user space; in theory, there are no stability constraints placed on files exported there. The real world is not always so simple, even though debugfs interfaces are best designed with the idea that they will need to be maintained forever.

Debugfs mounting

Debugfs is typically mounted with a command like:

mount -t debugfs none /sys/kernel/debug


Command debug node

View and set GPIO register

As to GPIOA_OUT_EN, the address of GPIOA_OUT_EN is 0xb01b0000. We can type the command as below to view the value of GPIOA_OUT_EN:

cd /sys/kernel/debug/owl/
echo 0xb01b0000 > reg

The return result will be: [0xb01b0000]: 0x00000000.
0x00000000 is the value of GPIOA_OUT_EN register.
(Note: Only the level of print is more than 4, the return message will be printed.)

We can type the command as below to enable GPIOA15:

cd /sys/kernel/debug/owl/
echo 0xb01b0000=0x00008000 > reg


View ATC260X(PMU) register

cd /sys/kernel/debug/regmap/0-0065
cat registers
#<Register ID: Values>
00: e0eb
01: 4017
02: 1a82
03: 4280
04: 0000
05: 0180
06: 0000
07: 0000
08: 0000
09: 0000
0a: 5680
0b: fc00
0c: a680
0d: fc00
0e: e680
0f: fc00
10: 4910
11: e9cf
12: 2cae
13: 334b
14: 85af
15: 6cae
16: 334b
17: 8acf
18: 254c
19: 338a
1a: 0000
1b: 0000
1c: 0000
…


View battery/charging information

cd /sys/kernel/debug
cat charger				
charger is off			#whether is charging
charge current = 0mA		#charge current
wall voltage = 4248 (mV)	#the input voltage of power adapter
vbus voltage = 0 (mV)		#the input voltage of USB 3.0 Micro-B
bat voltage = 17 (mV)		#the voltage of battery
bat current = 0(mA)		#the current of battery

View the power management

cd /sys/kernel/debug/regulator

We will see the related information of ldo, dcdc, switch and so on.

View GPIO information

cd /sys/kernel/debug/
cat gpio 
GPIOs 0-131, owl-gpio-chip:
 gpio-35  (ft5x06              ) out hi
 gpio-36  (?                   ) out hi
 gpio-37  (?                   ) out hi
 gpio-43  (phy_power_gpio      ) out hi
 gpio-44  (green:GPIOB12       ) out lo
 gpio-49  (?                   ) in  hi
 gpio-62  (wifi_en_gpios       ) out hi
 gpio-63  (blue:GPIOB31        ) out lo
 gpio-66  (card_detect_gpio    ) in  lo
 gpio-120 (pwdn-front-gpios    ) out hi
 gpio-121 (reset-gpios         ) out hi
 gpio-124 (pwdn-rear-gpios     ) out hi
 gpio-125 (actions,atm7059tc-us) out lo
 gpio-126 (wifi_bt_power_gpios ) out hi
 gpio-127 (phy_reset_gpio      ) out hi
 
GPIOs 241-247, platform/atc2603c-sgpio.0, atc2603c-sgpio-chip, can sleep:
 
GPIOs 248-255, platform/atc2603c-gpio.0, atc260x-gpio-chip, can sleep:


View PWM information

cd /sys/kernel/debug/
cat pwm
platform/b01b0050.pwm, 6 PWM devices
 pwm-0   (backlight           ): requested enabled
 pwm-1   (vdd-gpu-dcdc        ): requested enabled
 pwm-2   (vdd-core-dcdc       ): requested enabled
 pwm-3   (ext_dcdc_pwm_ctl    ): requested enabled
 pwm-4   ((null)              ):
 pwm-5   ((null)              ):


View mmc information

cd /sys/kernel/debug/mmcx
cat ios 
clock:          50000000 Hz
vdd:            15 (2.7 ~ 2.8 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    5 (sd uhs SDR50)
signal voltage: 0 (1.80 V)
mmcx represents mmc0, mmc1, mmc2…


View USB devices information

If you connect a USB device to LeMaker Guitar, you can type the command as below to view the USB device information.

cd /sys/kernel/debug/usb
cat devices 
 
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 3.10
S:  Manufacturer=Linux 3.10.37 aotg_hub_hcd
S:  Product=AOTG USB Host Controller Driver
S:  SerialNumber=aotg_hcd.1
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
 
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1976 ProdID=4082 Rev= 1.00
S:  Manufacturer=ChipsBnk
S:  Product=USB Reader
S:  SerialNumber=110074973765
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms


See Also

  1. https://www.kernel.org/doc/Documentation/filesystems/debugfs.txt