Skip to content

Commit 7e3169b

Browse files
authored
Merge pull request #384 from Dangku/main
support renesas rzv2h/rzv2n, bananapi ai2h/ai2n board
2 parents 7b80288 + acf0d47 commit 7e3169b

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def id(self) -> Optional[str]:
168168
board_id = self._clockwork_pi_id()
169169
elif chip_id == chips.K1:
170170
board_id = self._armbian_id() or self._spacemit_variants_id()
171+
elif chip_id == chips.RZV2N:
172+
board_id = self._armbian_id() or self._renesas_variants_id()
173+
elif chip_id == chips.RZV2H:
174+
board_id = self._armbian_id() or self._renesas_variants_id()
171175
elif chip_id == chips.RK3308:
172176
board_id = self._rock_pi_id()
173177
elif chip_id == chips.RK3399:
@@ -454,6 +458,10 @@ def _armbian_id(self) -> Optional[str]:
454458
board = boards.BANANA_PI_F3
455459
elif board_value == "bananapif5":
456460
board = boards.BANANA_PI_F5
461+
elif board_value == "bananapiai2n":
462+
board = boards.BANANA_PI_AI2N
463+
elif board_value == "bananapiai2h":
464+
board = boards.BANANA_PI_AI2H
457465
elif board_value == "orangepizeroplus2-h5":
458466
board = boards.ORANGE_PI_ZERO_PLUS_2H5
459467
elif board_value == "orangepizeroplus":
@@ -847,6 +855,22 @@ def _spacemit_variants_id(self) -> Optional[str]:
847855

848856
return board
849857

858+
def _renesas_variants_id(self) -> Optional[str]:
859+
"""Try to detect the id of renesas based board. (bananapi)"""
860+
board_value = self.detector.get_device_model()
861+
board = None
862+
if not board_value:
863+
return board
864+
board_value = board_value.lower()
865+
866+
if any(x in board_value for x in ("banana pi", "bananapi")):
867+
if "bpi-ai2n" in board_value:
868+
board = boards.BANANA_PI_AI2N
869+
if "bpi-ai2h" in board_value:
870+
board = boards.BANANA_PI_AI2H
871+
872+
return board
873+
850874
def _repka_variants_id(self) -> Optional[str]:
851875
board_value = self.detector.get_device_model()
852876
board = None

adafruit_platformdetect/chip.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ def _linux_id(self) -> Optional[str]:
315315
if self.detector.check_dt_compatible_value("spacemit,k1-x"):
316316
return chips.K1
317317

318+
if self.detector.check_dt_compatible_value("renesas,r9a09g056"):
319+
return chips.RZV2N
320+
321+
if self.detector.check_dt_compatible_value("renesas,r9a09g057"):
322+
return chips.RZV2H
323+
318324
if self.detector.check_dt_compatible_value("mediatek,mt8167"):
319325
return chips.MT8167
320326

adafruit_platformdetect/constants/boards.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
BANANA_PI_M5 = "BANANA_PI_M5"
8585
BANANA_PI_F3 = "BANANA_PI_F3"
8686
BANANA_PI_F5 = "BANANA_PI_F5"
87+
BANANA_PI_AI2N = "BANANA_PI_AI2N"
88+
BANANA_PI_AI2H = "BANANA_PI_AI2H"
8789

8890
# LeMaker boards
8991
LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO"
@@ -330,6 +332,8 @@
330332
BANANA_PI_M5,
331333
BANANA_PI_F3,
332334
BANANA_PI_F5,
335+
BANANA_PI_AI2N,
336+
BANANA_PI_AI2H,
333337
)
334338

335339
# LeMaker

adafruit_platformdetect/constants/chips.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
ATOM_J4105 = "ATOM_J4105"
8484
TH1520 = "TH1520"
8585
K1 = "K1"
86+
RZV2N = "RZV2N"
87+
RZV2H = "RZV2H"
8688
SUNRISE_X3 = "SUNRISE_X3"
8789

8890
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"}

0 commit comments

Comments
 (0)