]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/microcontroller/amlogic/meson_g12_common/pin.py
a6a9be1c6ed5ed3543cd1929153a3d31a273402c
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / amlogic / meson_g12_common / pin.py
1 from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin
2 import gpiod
3
4 # G12A, G12B, and SM1
5 # Ref:
6 # Linux kernel 4.9.y (hardkernel)
7 #     linux/include/dt-bindings/gpio/meson-g12a-gpio.h
8 # Linux kernel 5.4.y (mainline)
9 #     linux/include/dt-bindings/gpio/meson-g12a-gpio.h
10
11 chip0 = gpiod.Chip("0")
12 chip1 = gpiod.Chip("1")
13
14 if chip0.num_lines() < 20:
15     aobus = 0
16     periphs = 1
17     periphs_offset = chip1.num_lines() - 85
18 else:
19     aobus = 1
20     periphs = 0
21     periphs_offset = chip0.num_lines() - 85
22
23 chip0.close()
24 chip1.close()
25
26 GPIOAO_0 = GPIO496 = Pin((aobus, 0))
27 GPIOAO_1 = GPIO497 = Pin((aobus, 1))
28 GPIOAO_2 = GPIO498 = Pin((aobus, 2))
29 GPIOAO_3 = GPIO499 = Pin((aobus, 3))
30 GPIOAO_4 = GPIO500 = Pin((aobus, 4))
31 GPIOAO_5 = GPIO501 = Pin((aobus, 5))
32 GPIOAO_6 = GPIO502 = Pin((aobus, 6))
33 GPIOAO_7 = GPIO503 = Pin((aobus, 7))
34 GPIOAO_8 = GPIO504 = Pin((aobus, 8))
35 GPIOAO_9 = GPIO505 = Pin((aobus, 9))
36 GPIOAO_10 = GPIO506 = Pin((aobus, 10))
37 GPIOAO_11 = GPIO507 = Pin((aobus, 11))
38 GPIOE_0 = GPIO508 = Pin((aobus, 12))
39 GPIOE_1 = GPIO509 = Pin((aobus, 13))
40 GPIOE_2 = GPIO510 = Pin((aobus, 14))
41 GPIO_TEST_N = GPIO511 = Pin((aobus, 15))
42
43 GPIOH_0 = GPIO427 = Pin((periphs, 16 + periphs_offset))
44 GPIOH_1 = GPIO428 = Pin((periphs, 17 + periphs_offset))
45 GPIOH_2 = GPIO429 = Pin((periphs, 18 + periphs_offset))
46 GPIOH_3 = GPIO430 = Pin((periphs, 19 + periphs_offset))
47 GPIOH_4 = GPIO431 = Pin((periphs, 20 + periphs_offset))
48 GPIOH_5 = GPIO432 = Pin((periphs, 21 + periphs_offset))
49 GPIOH_6 = GPIO433 = Pin((periphs, 22 + periphs_offset))
50 GPIOH_7 = GPIO434 = Pin((periphs, 23 + periphs_offset))
51 GPIOH_8 = GPIO435 = Pin((periphs, 24 + periphs_offset))
52
53 GPIOA_0 = GPIO460 = Pin((periphs, 49 + periphs_offset))
54 GPIOA_1 = GPIO461 = Pin((periphs, 50 + periphs_offset))
55 GPIOA_2 = GPIO462 = Pin((periphs, 51 + periphs_offset))
56 GPIOA_3 = GPIO463 = Pin((periphs, 52 + periphs_offset))
57 GPIOA_4 = GPIO464 = Pin((periphs, 53 + periphs_offset))
58 GPIOA_5 = GPIO465 = Pin((periphs, 54 + periphs_offset))
59 GPIOA_6 = GPIO466 = Pin((periphs, 55 + periphs_offset))
60 GPIOA_7 = GPIO467 = Pin((periphs, 56 + periphs_offset))
61 GPIOA_8 = GPIO468 = Pin((periphs, 57 + periphs_offset))
62 GPIOA_9 = GPIO469 = Pin((periphs, 58 + periphs_offset))
63 GPIOA_10 = GPIO470 = Pin((periphs, 59 + periphs_offset))
64 GPIOA_11 = GPIO471 = Pin((periphs, 60 + periphs_offset))
65 GPIOA_12 = GPIO472 = Pin((periphs, 61 + periphs_offset))
66 GPIOA_13 = GPIO473 = Pin((periphs, 62 + periphs_offset))
67 GPIOA_14 = GPIO474 = Pin((periphs, 63 + periphs_offset))
68 GPIOA_15 = GPIO475 = Pin((periphs, 64 + periphs_offset))
69
70 GPIOX_0 = GPIO476 = Pin((periphs, 65 + periphs_offset))
71 GPIOX_1 = GPIO477 = Pin((periphs, 66 + periphs_offset))
72 GPIOX_2 = GPIO478 = Pin((periphs, 67 + periphs_offset))
73 GPIOX_3 = GPIO479 = Pin((periphs, 68 + periphs_offset))
74 GPIOX_4 = GPIO480 = Pin((periphs, 69 + periphs_offset))
75 GPIOX_5 = GPIO481 = Pin((periphs, 70 + periphs_offset))
76 GPIOX_6 = GPIO482 = Pin((periphs, 71 + periphs_offset))
77 GPIOX_7 = GPIO483 = Pin((periphs, 72 + periphs_offset))
78 GPIOX_8 = GPIO484 = Pin((periphs, 73 + periphs_offset))
79 GPIOX_9 = GPIO485 = Pin((periphs, 74 + periphs_offset))
80 GPIOX_10 = GPIO486 = Pin((periphs, 75 + periphs_offset))
81 GPIOX_11 = GPIO487 = Pin((periphs, 76 + periphs_offset))
82 GPIOX_12 = GPIO488 = Pin((periphs, 77 + periphs_offset))
83 GPIOX_13 = GPIO489 = Pin((periphs, 78 + periphs_offset))
84 GPIOX_14 = GPIO490 = Pin((periphs, 79 + periphs_offset))
85 GPIOX_15 = GPIO491 = Pin((periphs, 80 + periphs_offset))
86 GPIOX_16 = GPIO492 = Pin((periphs, 81 + periphs_offset))
87 GPIOX_17 = GPIO493 = Pin((periphs, 82 + periphs_offset))
88 GPIOX_18 = GPIO494 = Pin((periphs, 83 + periphs_offset))
89 GPIOX_19 = GPIO495 = Pin((periphs, 84 + periphs_offset))