Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fdt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def find_by_compatible(self, compatible):
break
yield offset

def find_by_path(self, path):
offset = check_err(
fdt_path_offset(self._fdt, path),
[FDT_ERR_NOTFOUND])
if offset == -FDT_ERR_NOTFOUND:
return None
yield offset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using yield for a single element is a bit odd, this should return simply the index


def subnodes(self, parent):
offset = self.first_subnode(parent, [FDT_ERR_NOTFOUND])
while offset != -FDT_ERR_NOTFOUND:
Expand Down
3 changes: 3 additions & 0 deletions panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ def find(fdt: Fdt2) -> Iterator[int]:
for sub in fdt.subnodes(mdp):
yield sub

for mdp in fdt.find_by_path("/soc"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then drop the loop here, it doesn't actually loop over anything.

But I'm a bit skeptical about treating all devices below /soc as panels. Is there anything interesting inside the node or so that we could match on?

for sub in fdt.subnodes(mdp):
yield sub
# Newer device trees do not necessarily have panels below MDP,
# search for qcom,dsi-display node instead
panel_phandles = set()
Expand Down