Skip to content

Commit 9a2e915

Browse files
committed
panel: Make qcom,mdss-dsi-traffic-mode actually optional
On rm69032_320-cmd panel for asus-sparrow this property does not exist.
1 parent 4b44f18 commit 9a2e915

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

panel.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@ def __new__(cls, value: str, flags: List[str]) -> TrafficMode:
3838

3939
@staticmethod
4040
def parse(prop: libfdt.Property) -> Optional[TrafficMode]:
41-
if prop.is_str():
42-
return TrafficMode(prop.as_str())
41+
if prop:
42+
if prop.is_str():
43+
return TrafficMode(prop.as_str())
4344

44-
print(f"WARNING: qcom,mdss-dsi-traffic-mode is not a null terminated string:", prop)
45+
print(f"WARNING: qcom,mdss-dsi-traffic-mode is not a null terminated string:", prop)
4546

46-
# Some Samsung panels have the traffic mode as index for some reason
47-
if len(prop) == 4:
48-
i = prop.as_uint32()
49-
traffic_modes = list(TrafficMode.__members__.values())
50-
if i < len(traffic_modes):
51-
print(f"Interpreting qcom,mdss-dsi-traffic-mode as numeric index: {i} == {traffic_modes[i]}")
52-
return traffic_modes[i]
47+
# Some Samsung panels have the traffic mode as index for some reason
48+
if len(prop) == 4:
49+
i = prop.as_uint32()
50+
traffic_modes = list(TrafficMode.__members__.values())
51+
if i < len(traffic_modes):
52+
print(f"Interpreting qcom,mdss-dsi-traffic-mode as numeric index: {i} == {traffic_modes[i]}")
53+
return traffic_modes[i]
5354

5455
# Use the default in mdss_dsi_panel.c
5556
print("Falling back to MIPI_DSI_MODE_VIDEO_SYNC_PULSE")
@@ -228,7 +229,7 @@ def __init__(self, name: str, fdt: Fdt2, node: int) -> None:
228229
self.framerate = fdt.getprop(mode_node, 'qcom,mdss-dsi-panel-framerate').as_uint32()
229230
self.bpp = fdt.getprop(node, 'qcom,mdss-dsi-bpp').as_uint32()
230231
self.mode = Mode(fdt.getprop(node, 'qcom,mdss-dsi-panel-type').as_str())
231-
self.traffic_mode = TrafficMode.parse(fdt.getprop(node, 'qcom,mdss-dsi-traffic-mode'))
232+
self.traffic_mode = TrafficMode.parse(fdt.getprop_or_none(node, 'qcom,mdss-dsi-traffic-mode'))
232233

233234
backlight = fdt.getprop_or_none(node, 'qcom,mdss-dsi-bl-pmic-control-type')
234235
self.backlight = BacklightControl(backlight.as_str()) if backlight else None

0 commit comments

Comments
 (0)