DART-SD410 Debian GPIO

From Variscite Wiki
Revision as of 10:17, 18 April 2016 by Leonid (talk | contribs) (Created page with "= Using GPIO = User LED4 (D15) connected to GPIO2 of the PMIC. The LED4 is not defined in the apq8016-var-dt410.dtsi file under gpio-leds section.</br> This allow user acces t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using GPIO

User LED4 (D15) connected to GPIO2 of the PMIC. The LED4 is not defined in the apq8016-var-dt410.dtsi file under gpio-leds section.
This allow user acces to this LED as GPIO device. To change the state of the LED via serial console type:

# cd /sys/class/gpio
# echo 445 > export
This line creates a new directory gpio445
The number 445 calculated as 1 + 444. 1 is the GPIO number, 444 is static offset for PMIC gpio.
So changing any other PMIC GPIO will lead to 444 + GPIO number.
# cd gpio445
# 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 0. to read its value use:

# cd /sys/class/gpio
# echo 81 > export
# cd gpio81
# 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:
GPIOs 0-121, platform/1000000.pinctrl, 1000000.pinctrl:
 gpio0   : in  2 16mA no pull
 gpio1   : in  2 16mA no pull
 gpio2   : in  2 16mA no pull
 gpio3   : in  2 16mA no pull
 gpio4   : out 2 16mA no pull
 gpio5   : out 2 16mA no pull
 gpio6   : in  0 2mA pull down
 gpio7   : in  0 2mA pull down
 gpio8   : in  0 2mA pull down
 gpio9   : in  0 2mA pull down
 gpio10  : in  0 2mA pull down
 gpio11  : in  0 2mA pull down
 gpio12  : out 0 2mA pull down
 gpio13  : in  0 2mA pull down
 gpio14  : in  2 16mA no pull
 gpio15  : in  2 16mA no pull
 gpio16  : in  0 2mA pull down
 gpio17  : in  0 2mA pull down
 gpio18  : in  0 2mA pull down
 gpio19  : in  0 2mA pull down
 gpio20  : in  0 2mA pull down
 gpio21  : out 0 16mA pull down
 gpio22  : in  2 16mA no pull
 gpio23  : in  2 16mA no pull
 gpio24  : in  0 2mA pull down
 gpio25  : in  0 2mA pull down
 gpio26  : in  0 2mA pull down
 gpio27  : in  0 2mA pull down
 gpio28  : in  0 2mA pull down
 gpio29  : in  0 2mA pull down
 gpio30  : in  0 2mA pull down
 gpio31  : in  0 2mA no pull
 gpio32  : out 0 2mA no pull
 gpio33  : in  0 2mA pull down
 gpio34  : in  0 2mA pull down
 gpio35  : in  0 2mA pull down
 gpio36  : in  0 2mA pull down
 gpio37  : in  0 2mA pull down
 gpio38  : in  0 2mA pull up
 gpio39  : in  0 2mA pull down
 gpio40  : in  1 6mA pull down
 gpio41  : in  1 6mA pull down
 gpio42  : in  1 6mA pull down
 gpio43  : in  1 6mA pull down
 gpio44  : in  1 6mA pull down
 gpio45  : in  0 2mA pull down
 gpio46  : in  0 2mA pull down
 gpio47  : in  0 2mA pull down
 gpio48  : in  0 2mA pull down
 gpio49  : in  0 2mA pull down
 gpio50  : in  0 2mA pull down
 gpio51  : in  0 2mA pull down
 gpio52  : in  0 2mA pull down
 gpio53  : in  0 2mA pull down
 gpio54  : in  0 2mA pull down
 gpio55  : in  0 2mA pull down
 gpio56  : in  0 2mA pull down
 gpio57  : in  0 2mA pull down
 gpio58  : in  0 2mA pull down
 gpio59  : in  0 2mA pull down
 gpio60  : in  0 2mA pull down
 gpio61  : in  0 2mA pull down
 gpio62  : in  0 2mA pull down
 gpio63  : in  1 8mA pull down
 gpio64  : in  1 8mA pull down
 gpio65  : in  1 8mA pull down
 gpio66  : in  1 8mA pull down
 gpio67  : in  1 8mA pull down
 gpio68  : in  1 8mA pull down
 gpio69  : in  0 2mA pull down
 gpio70  : in  0 2mA pull down
 gpio71  : in  0 2mA pull down
 gpio72  : in  0 2mA pull down
 gpio73  : in  0 2mA pull down
 gpio74  : in  0 2mA pull down
 gpio75  : in  0 2mA pull down
 gpio76  : in  0 2mA pull down
 gpio77  : in  0 2mA pull down
 gpio78  : in  0 2mA pull down
 gpio79  : in  0 2mA pull down
 gpio80  : in  0 2mA pull down
 gpio81  : in  0 2mA pull down
 gpio82  : in  0 2mA pull down
 gpio83  : in  0 2mA pull down
 gpio84  : in  0 2mA pull down
 gpio85  : in  0 2mA pull down
 gpio86  : in  0 2mA pull down
 gpio87  : in  0 2mA pull down
 gpio88  : in  0 2mA pull down
 gpio89  : in  0 2mA pull down
 gpio90  : in  0 2mA pull down
 gpio91  : in  0 2mA pull down
 gpio92  : in  0 2mA pull down
 gpio93  : in  0 2mA pull down
 gpio94  : in  0 2mA pull down
 gpio95  : in  0 2mA pull down
 gpio96  : in  0 2mA pull down
 gpio97  : in  0 2mA pull down
 gpio98  : in  0 2mA pull down
 gpio99  : in  0 2mA pull down
 gpio100 : in  0 2mA pull down
 gpio101 : in  0 2mA pull down
 gpio102 : in  0 2mA pull down
 gpio103 : in  0 2mA pull down
 gpio104 : in  0 2mA pull down
 gpio105 : in  0 2mA pull down
 gpio106 : in  0 2mA pull down
 gpio107 : in  0 8mA pull up
 gpio108 : in  0 2mA pull down
 gpio109 : in  0 2mA pull down
 gpio110 : in  0 2mA pull down
 gpio111 : in  0 2mA pull down
 gpio112 : in  1 8mA pull down
 gpio113 : in  0 2mA pull down
 gpio114 : in  0 2mA pull down
 gpio115 : in  0 2mA pull down
 gpio116 : in  1 8mA pull down
 gpio117 : in  1 8mA pull down
 gpio118 : in  1 8mA pull down
 gpio119 : in  1 8mA pull down
 gpio120 : out 0 16mA pull down
 gpio121 : in  0 8mA pull up

GPIOs 440-443, platform/200f000.spmi:pm8916@0:mpps@a000, 200f000.spmi:pm8916@0:mpps@a000:
 mpp1 : out  analog  vin-2 0 0.6kOhm  gh
 mpp2 : out  digital vin-0 0 0.6kOhm  high
 mpp3 : out  digital vin-0 0 0.6kOhm  high
 mpp4 : out  digital vin-3 0 0.6kOhm  low
GPIOs 444-447, platform/200f000.spmi:pm8916@0:gpios@c000, 200f000.spmi:pm8916@0:gpios@c000:
 gpio1 : out  normal  vin-0 pull-down 10uA              push-pull  low  high
 gpio2 : out  normal  vin-0 pull-down 10uA              push-pull  low  high
 gpio3 : out  normal  vin-0 pull-down 10uA              push-pull  high high
 gpio4 : out  normal  vin-0 pull-down 10uA              push-pull  low  high

GPIOs 448-479, platform/soc:wcnss-smp2p, master-kernel:

GPIOs 480-511, platform/soc:q6-smp2p, master-kernel:
 gpio-480 (                    |qcom,stop           ) out ?

From this table you can see that offsets are:

  • CPU gpio is 0
  • PMIC gpio is 444
  • PMIC mpp is 440