DART-SD410 Debian GPIO 5.7.0
From Variscite Wiki
DART-SD410 - Using GPIO
User LED4 (D15) connected to GPIO2 of the PMIC. The LED4 is not in the apq8016-var-dt410.dtsi file under gpio-leds section.
This allows user access to this LED as a GPIO device.
To change the state of the LED via serial console type:
# cd /sys/class/gpio # echo 387 > export This line creates a new directory gpio387 The number 387 calculated as 1 + 386. 1 is the GPIO number, 386 is static offset for PMIC gpio. So changing any other PMIC GPIO will lead to 386 + GPIO number. # cd gpio387 # echo out > direction # echo 1 > value The led will turn on # echo 0 > value The led will turn off
To read the current state type:
# cat value The output will be 0
You can change active state to active low.
# echo 1 > active_low # echo 0 > value The led is active low, writing 0 will turn on the led. # echo 1 > value The led is active low, writing 1 will turn off the led.
The Boot Select switch (SW3) connected to CPU GPIO81 the gpio offset for CPU is 390. to read its value use:
# cd /sys/class/gpio # echo 471 > export # cd gpio471 # cat value If the switch is in OFF position the output is 0. If the switch is in ON position the output is 1.
To see all allocated GPIOs in the system type:
# cat /sys/kernel/debug/gpio The output will be: gpiochip2: GPIOs 382-385, parent: platform/200f000.spmi:pm8916@0:mpps@a000, 200f000.spmi:pm8916@0:mpps@a000: mpp1 : out analog vin-2 0 high mpp2 : out digital vin-0 0 low mpp3 : out digital vin-0 0 high mpp4 : out digital vin-0 0 low gpiochip1: GPIOs 386-389, parent: platform/200f000.spmi:pm8916@0:gpios@c000, 200f000.spmi:pm8916@0:gpios@c000: gpio1 : out low normal vin-0 pull-down 10uA push-pull high atest-0 dtest-0 gpio2 : out low normal vin-0 pull-down 10uA push-pull high atest-0 dtest-0 gpio3 : out high normal vin-0 pull-down 10uA push-pull high atest-0 dtest-0 gpio4 : out high normal vin-0 pull-down 10uA push-pull high atest-0 dtest-0 gpiochip0: GPIOs 390-511, parent: platform/1000000.pinctrl, 1000000.pinctrl: gpio0 : in high func2 16mA no pull gpio1 : in low func2 16mA no pull gpio2 : in high func2 16mA no pull gpio3 : in high func2 16mA no pull gpio4 : out low func2 16mA no pull gpio5 : out low func2 16mA no pull gpio6 : in high func3 16mA no pull gpio7 : in high func3 16mA no pull gpio8 : in low func1 12mA no pull gpio9 : in low func1 12mA no pull gpio10 : out high func0 16mA no pull gpio11 : in low func1 12mA no pull gpio12 : in high func0 2mA pull down gpio13 : in high func0 2mA pull down gpio14 : in high func2 16mA no pull gpio15 : in high func2 16mA no pull gpio16 : in low func1 12mA no pull gpio17 : in low func1 12mA no pull gpio18 : out high func0 16mA no pull gpio19 : in low func1 12mA no pull gpio20 : in low func0 2mA pull down gpio21 : out low func0 2mA pull down gpio22 : in high func2 16mA no pull gpio23 : in high func2 16mA no pull gpio24 : in low func0 2mA pull down gpio25 : in low func0 2mA pull down gpio26 : in low func1 16mA no pull gpio27 : in low func1 16mA no pull gpio28 : out low func0 16mA no pull gpio29 : in high func1 16mA no pull gpio30 : in high func1 16mA no pull gpio31 : in high func0 2mA pull down gpio32 : out high func0 16mA no pull gpio33 : out low func0 16mA no pull gpio34 : out low func0 16mA no pull gpio35 : out low func0 16mA no pull gpio36 : in low func0 2mA pull down gpio37 : in low func0 2mA pull down gpio38 : in high func0 2mA pull up gpio39 : in low func0 2mA pull down gpio40 : in low func1 6mA pull down gpio41 : in low func1 6mA pull down gpio42 : in low func1 6mA pull down gpio43 : in low func1 6mA pull down gpio44 : in low func1 6mA pull down gpio45 : in low func0 2mA pull down gpio46 : in low func0 2mA pull down gpio47 : in low func0 2mA pull down gpio48 : in low func0 2mA pull down gpio49 : in low func0 2mA pull down gpio50 : in low func0 2mA pull down gpio51 : in low func0 2mA pull down gpio52 : in low func0 2mA pull down gpio53 : in low func0 2mA pull down gpio54 : in low func0 2mA pull down gpio55 : in low func0 2mA pull down gpio56 : in low func0 2mA pull down gpio57 : in low func0 2mA pull down gpio58 : in low func0 2mA pull down gpio59 : in low func0 2mA pull down gpio60 : in low func0 2mA pull down gpio61 : in low func0 2mA pull down gpio62 : in low func0 2mA pull down gpio63 : in low func1 8mA pull down gpio64 : in low func1 8mA pull down gpio65 : in low func1 8mA pull down gpio66 : in low func1 8mA pull down gpio67 : in low func1 8mA pull down gpio68 : in low func1 8mA pull down gpio69 : in low func0 2mA pull down gpio70 : in low func0 2mA pull down gpio71 : in low func0 2mA pull down gpio72 : in low func0 2mA pull down gpio73 : in low func0 2mA pull down gpio74 : in low func0 2mA pull down gpio75 : in low func0 2mA pull down gpio76 : in low func0 2mA pull down gpio77 : in low func0 2mA pull down gpio78 : in low func0 2mA pull down gpio79 : in low func0 2mA pull down gpio80 : in low func0 2mA pull down gpio81 : in high func0 2mA pull down gpio82 : in low func0 2mA pull down gpio83 : in low func0 2mA pull down gpio84 : in low func0 2mA pull down gpio85 : in low func0 2mA pull down gpio86 : in high func0 2mA pull down gpio87 : in low func0 2mA pull down gpio88 : in low func0 2mA pull down gpio89 : in low func0 2mA pull down gpio90 : in low func0 2mA pull down gpio91 : in low func0 2mA pull down gpio92 : in low func0 2mA pull down gpio93 : in low func0 2mA pull down gpio94 : in low func0 2mA pull down gpio95 : in low func0 2mA pull down gpio96 : out high func0 2mA no pull gpio97 : in low func0 2mA pull down gpio98 : in low func0 2mA pull down gpio99 : in low func0 2mA pull down gpio100 : in low func0 2mA pull down gpio101 : in low func0 2mA pull down gpio102 : in low func0 2mA pull down gpio103 : in low func0 2mA pull down gpio104 : in low func1 2mA no pull gpio105 : in low func0 2mA pull down gpio106 : in low func0 2mA pull down gpio107 : in high func0 8mA pull up gpio108 : in low func0 2mA pull down gpio109 : in low func0 2mA pull down gpio110 : in low func0 2mA pull down gpio111 : in low func0 2mA pull down gpio112 : in low func1 8mA pull down gpio113 : in low func0 2mA pull down gpio114 : in low func0 2mA pull down gpio115 : in low func0 2mA pull down gpio116 : in low func1 8mA pull down gpio117 : in low func1 8mA pull down gpio118 : in low func1 8mA pull down gpio119 : in low func1 8mA pull down gpio120 : out low func0 2mA pull down gpio121 : in low func0 8mA pull up
From this table you can see that offsets are:
- CPU gpio is 390
- PMIC gpio is 386
- PMIC mpp is 382