Skip to content

Commit f23fa5b

Browse files
committed
mipi: Add Transaction.is_long() from mipi_dsi_packet_format_is_long()
This can be used to check if a DSI packet should use the long format for the given transaction.
1 parent eaa6e9a commit f23fa5b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

mipi.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
# Copyright (C) 2006 Nokia Corporation
1111
# Author: Imre Deak <[email protected]>
1212
#
13+
# Some code adapted from:
14+
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_mipi_dsi.c
15+
#
16+
# Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
17+
# Andrzej Hajda <[email protected]>
18+
#
1319
from __future__ import annotations
1420

1521
from enum import IntEnum, unique, Enum
@@ -296,5 +302,27 @@ def identifier(self):
296302
def description(self):
297303
return self.name.lower().replace('_', ' ')
298304

305+
@property
306+
def is_long(self):
307+
# From mipi_dsi_packet_format_is_long()
308+
return self in [
309+
Transaction.NULL_PACKET,
310+
Transaction.BLANKING_PACKET,
311+
Transaction.GENERIC_LONG_WRITE,
312+
Transaction.DCS_LONG_WRITE,
313+
Transaction.PICTURE_PARAMETER_SET,
314+
Transaction.COMPRESSED_PIXEL_STREAM,
315+
Transaction.LOOSELY_PACKED_PIXEL_STREAM_YCBCR20,
316+
Transaction.PACKED_PIXEL_STREAM_YCBCR24,
317+
Transaction.PACKED_PIXEL_STREAM_YCBCR16,
318+
Transaction.PACKED_PIXEL_STREAM_30,
319+
Transaction.PACKED_PIXEL_STREAM_36,
320+
Transaction.PACKED_PIXEL_STREAM_YCBCR12,
321+
Transaction.PACKED_PIXEL_STREAM_16,
322+
Transaction.PACKED_PIXEL_STREAM_18,
323+
Transaction.PIXEL_STREAM_3BYTE_18,
324+
Transaction.PACKED_PIXEL_STREAM_24,
325+
]
326+
299327
def generate(self, payload: bytes, options: Options) -> str:
300328
return self._generate(self, payload, options)

0 commit comments

Comments
 (0)