@@ -62,8 +62,8 @@ def get_params(b: bytes) -> List[str]:
6262# MIPI DCS commands
6363@unique
6464class DCSCommand (Enum ):
65- NOP = 0x00 , 0 , 'mipi_dsi_dcs_nop '
66- SOFT_RESET = 0x01 , 0 , 'mipi_dsi_dcs_soft_reset '
65+ NOP = 0x00 , 0 , 'mipi_dsi_dcs_nop_multi '
66+ SOFT_RESET = 0x01 , 0 , 'mipi_dsi_dcs_soft_reset_multi '
6767 # GET_COMPRESSION_MODE = 0x03,
6868 # GET_DISPLAY_ID = 0x04,
6969 # GET_ERROR_COUNT_ON_DSI = 0x05,
@@ -77,40 +77,40 @@ class DCSCommand(Enum):
7777 # GET_DISPLAY_MODE = 0x0D,
7878 # GET_SIGNAL_MODE = 0x0E,
7979 # GET_DIAGNOSTIC_RESULT = 0x0F,
80- ENTER_SLEEP_MODE = 0x10 , 0 , 'mipi_dsi_dcs_enter_sleep_mode '
81- EXIT_SLEEP_MODE = 0x11 , 0 , 'mipi_dsi_dcs_exit_sleep_mode '
80+ ENTER_SLEEP_MODE = 0x10 , 0 , 'mipi_dsi_dcs_enter_sleep_mode_multi '
81+ EXIT_SLEEP_MODE = 0x11 , 0 , 'mipi_dsi_dcs_exit_sleep_mode_multi '
8282 ENTER_PARTIAL_MODE = 0x12 , 0 ,
8383 ENTER_NORMAL_MODE = 0x13 , 0 ,
8484 # GET_IMAGE_CHECKSUM_RGB = 0x14,
8585 # GET_IMAGE_CHECKSUM_CT = 0x15,
8686 EXIT_INVERT_MODE = 0x20 , 0 ,
8787 ENTER_INVERT_MODE = 0x21 , 0 ,
8888 SET_GAMMA_CURVE = 0x26 , 1 ,
89- SET_DISPLAY_OFF = 0x28 , 0 , 'mipi_dsi_dcs_set_display_off '
90- SET_DISPLAY_ON = 0x29 , 0 , 'mipi_dsi_dcs_set_display_on '
91- SET_COLUMN_ADDRESS = 0x2A , 4 , 'mipi_dsi_dcs_set_column_address ' , _get_params_int (2 , 'big' )
92- SET_PAGE_ADDRESS = 0x2B , 4 , 'mipi_dsi_dcs_set_page_address ' , _get_params_int (2 , 'big' )
89+ SET_DISPLAY_OFF = 0x28 , 0 , 'mipi_dsi_dcs_set_display_off_multi '
90+ SET_DISPLAY_ON = 0x29 , 0 , 'mipi_dsi_dcs_set_display_on_multi '
91+ SET_COLUMN_ADDRESS = 0x2A , 4 , 'mipi_dsi_dcs_set_column_address_multi ' , _get_params_int (2 , 'big' )
92+ SET_PAGE_ADDRESS = 0x2B , 4 , 'mipi_dsi_dcs_set_page_address_multi ' , _get_params_int (2 , 'big' )
9393 WRITE_MEMORY_START = 0x2C ,
9494 WRITE_LUT = 0x2D ,
9595 READ_MEMORY_START = 0x2E ,
9696 SET_PARTIAL_ROWS = 0x30 ,
9797 SET_PARTIAL_COLUMNS = 0x31 ,
9898 SET_SCROLL_AREA = 0x33 , 6 ,
99- SET_TEAR_OFF = 0x34 , 0 , 'mipi_dsi_dcs_set_tear_off '
100- SET_TEAR_ON = 0x35 , 1 , 'mipi_dsi_dcs_set_tear_on ' , TearMode .get_params
99+ SET_TEAR_OFF = 0x34 , 0 , 'mipi_dsi_dcs_set_tear_off_multi '
100+ SET_TEAR_ON = 0x35 , 1 , 'mipi_dsi_dcs_set_tear_on_multi ' , TearMode .get_params
101101 SET_ADDRESS_MODE = 0x36 , 1 ,
102102 SET_SCROLL_START = 0x37 , 2 ,
103103 EXIT_IDLE_MODE = 0x38 , 0 ,
104104 ENTER_IDLE_MODE = 0x39 , 0 ,
105- SET_PIXEL_FORMAT = 0x3A , 1 , 'mipi_dsi_dcs_set_pixel_format '
105+ SET_PIXEL_FORMAT = 0x3A , 1 , 'mipi_dsi_dcs_set_pixel_format_multi '
106106 WRITE_MEMORY_CONTINUE = 0x3C ,
107107 SET_3D_CONTROL = 0x3D ,
108108 READ_MEMORY_CONTINUE = 0x3E ,
109109 # GET_3D_CONTROL = 0x3F,
110110 SET_VSYNC_TIMING = 0x40
111- SET_TEAR_SCANLINE = 0x44 , 2 , 'mipi_dsi_dcs_set_tear_scanline ' , _get_params_int (2 , 'big' )
111+ SET_TEAR_SCANLINE = 0x44 , 2 , 'mipi_dsi_dcs_set_tear_scanline_multi ' , _get_params_int (2 , 'big' )
112112 GET_SCANLINE = 0x45 ,
113- SET_DISPLAY_BRIGHTNESS = 0x51 , (1 , 2 ), 'mipi_dsi_dcs_set_display_brightness ' , _get_params_int (2 , 'little' )
113+ SET_DISPLAY_BRIGHTNESS = 0x51 , (1 , 2 ), 'mipi_dsi_dcs_set_display_brightness_multi ' , _get_params_int (2 , 'little' )
114114 # GET_DISPLAY_BRIGHTNESS = 0x52,
115115 WRITE_CONTROL_DISPLAY = 0x53 , 1 ,
116116 # GET_CONTROL_DISPLAY = 0x54,
@@ -136,13 +136,9 @@ def __new__(cls, value: int, nargs: Union[int, Tuple[int]] = (), method: str = N
136136 def identifier (self ):
137137 return 'MIPI_DCS_' + self .name
138138
139- @property
140- def description (self ):
141- return self .name .lower ().replace ('_' , ' ' )
142-
143139 def get_params (self , b : bytes ):
144140 params = self ._get_params (b )
145- params .insert (0 , 'dsi ' )
141+ params .insert (0 , '&dsi_ctx ' )
146142 return params
147143
148144 @staticmethod
@@ -178,50 +174,45 @@ def find(payload: bytes, dumb: bool) -> Optional[DCSCommand]:
178174 DCSCommand .SET_DISPLAY_ON , DCSCommand .SET_DISPLAY_OFF ]
179175
180176
181- def _generate_checked_call (method : str , args : List [str ], description : str ) -> str :
182- return f'''\
183- { wrap .join (f' ret = { method } (' , ',' , ');' , args )}
184- if (ret < 0) {{
185- dev_err(dev, "Failed to { description } : %d\\ n", ret);
186- return ret;
187- }}\
188- '''
177+ def _generate_call (method : str , args : List [str ]) -> str :
178+ return wrap .join (f'\t { method } (' , ',' , ');' , args )
189179
190180
191181def _generate_generic_write (t : Transaction , payload : bytes , options : Options ) -> str :
192182 # TODO: Warn when downstream uses LONG_WRITE but mainline would use SHORT
193183 params = _get_params_hex (payload )
194- params .insert (0 , 'dsi ' )
195- return wrap .join ('\t mipi_dsi_generic_write_seq (' , ',' , ');' , params , force = 2 )
184+ params .insert (0 , '&dsi_ctx ' )
185+ return wrap .join ('\t mipi_dsi_generic_write_seq_multi (' , ',' , ');' , params , force = 2 )
196186
197187
198188def _generate_dcs_write (t : Transaction , payload : bytes , options : Options ) -> str :
199189 # TODO: Warn when downstream uses LONG_WRITE but mainline would use SHORT
200190
201191 dcs = DCSCommand .find (payload , options .dumb_dcs )
202192 if dcs and dcs .method :
203- return _generate_checked_call (dcs .method , dcs .get_params (payload [1 :]), dcs . description )
193+ return _generate_call (dcs .method , dcs .get_params (payload [1 :]))
204194
205195 params = _get_params_hex (payload )
206196 if dcs :
207197 params [0 ] = dcs .identifier
208- params .insert (0 , 'dsi ' )
198+ params .insert (0 , '&dsi_ctx ' )
209199
210- return wrap .join ('\t mipi_dsi_dcs_write_seq (' , ',' , ');' , params , force = 2 )
200+ return wrap .join ('\t mipi_dsi_dcs_write_seq_multi (' , ',' , ');' , params , force = 2 )
211201
212202
213203def _generate_peripheral (t : Transaction , payload : bytes , options : Options ) -> str :
214204 if t == Transaction .TURN_ON_PERIPHERAL :
215- return _generate_checked_call ( 'mipi_dsi_turn_on_peripheral ' , ['dsi' ], t . description )
205+ return _generate_call ( 'mipi_dsi_turn_on_peripheral_multi ' , ['&dsi_ctx' ] )
216206 elif t == Transaction .SHUTDOWN_PERIPHERAL :
217- return _generate_checked_call ( 'mipi_dsi_shutdown_peripheral ' , ['dsi' ], t . description )
207+ return _generate_call ( 'mipi_dsi_shutdown_peripheral_multi ' , ['&dsi_ctx' ] )
218208 else :
219209 raise ValueError (t )
220210
221211
222212def _generate_compression_mode (t : Transaction , payload : bytes , options : Options ) -> str :
223- return _generate_checked_call ('mipi_dsi_compression_mode' , ['dsi' , str (bool (payload [0 ])).lower ()],
224- 'set compression mode' )
213+ return _generate_call ('mipi_dsi_compression_mode_ext_multi' ,
214+ ['&dsi_ctx' , str (bool (payload [0 ])).lower (),
215+ 'MIPI_DSI_COMPRESSION_DSC' , '0' ]) # TODO: Do we need something != 0?
225216
226217
227218def _generate_ignore (t : Transaction , payload : bytes , options : Options ) -> str :
@@ -297,10 +288,6 @@ def __new__(cls, value: int, max_args: int = -1, generate=_generate_fallback) ->
297288 def identifier (self ):
298289 return 'MIPI_DSI_' + self .name
299290
300- @property
301- def description (self ):
302- return self .name .lower ().replace ('_' , ' ' )
303-
304291 @property
305292 def is_long (self ):
306293 # From mipi_dsi_packet_format_is_long()
0 commit comments