@@ -1433,33 +1433,24 @@ static inline struct ili9881c *panel_to_ili9881c(struct drm_panel *panel)
14331433 * So before any attempt at sending a command or data, we have to be
14341434 * sure if we're in the right page or not.
14351435 */
1436- static int ili9881c_switch_page (struct ili9881c * ctx , u8 page )
1436+ static void ili9881c_switch_page (struct mipi_dsi_multi_context * mctx , u8 page )
14371437{
14381438 u8 buf [4 ] = { 0xff , 0x98 , 0x81 , page };
1439- int ret ;
1440-
1441- ret = mipi_dsi_dcs_write_buffer (ctx -> dsi , buf , sizeof (buf ));
1442- if (ret < 0 )
1443- return ret ;
14441439
1445- return 0 ;
1440+ mipi_dsi_dcs_write_buffer_multi ( mctx , buf , sizeof ( buf )) ;
14461441}
14471442
1448- static int ili9881c_send_cmd_data (struct ili9881c * ctx , u8 cmd , u8 data )
1443+ static void ili9881c_send_cmd_data (struct mipi_dsi_multi_context * mctx , u8 cmd , u8 data )
14491444{
14501445 u8 buf [2 ] = { cmd , data };
1451- int ret ;
14521446
1453- ret = mipi_dsi_dcs_write_buffer (ctx -> dsi , buf , sizeof (buf ));
1454- if (ret < 0 )
1455- return ret ;
1456-
1457- return 0 ;
1447+ mipi_dsi_dcs_write_buffer_multi (mctx , buf , sizeof (buf ));
14581448}
14591449
14601450static int ili9881c_prepare (struct drm_panel * panel )
14611451{
14621452 struct ili9881c * ctx = panel_to_ili9881c (panel );
1453+ struct mipi_dsi_multi_context mctx = { .dsi = ctx -> dsi };
14631454 unsigned int i ;
14641455 int ret ;
14651456
@@ -1480,54 +1471,39 @@ static int ili9881c_prepare(struct drm_panel *panel)
14801471 const struct ili9881c_instr * instr = & ctx -> desc -> init [i ];
14811472
14821473 if (instr -> op == ILI9881C_SWITCH_PAGE )
1483- ret = ili9881c_switch_page (ctx , instr -> arg .page );
1474+ ili9881c_switch_page (& mctx , instr -> arg .page );
14841475 else if (instr -> op == ILI9881C_COMMAND )
1485- ret = ili9881c_send_cmd_data (ctx , instr -> arg .cmd .cmd ,
1486- instr -> arg .cmd .data );
1487-
1488- if (ret )
1489- goto disable_power ;
1490- }
1491-
1492- ret = ili9881c_switch_page (ctx , 0 );
1493- if (ret )
1494- return ret ;
1495-
1496- if (ctx -> address_mode ) {
1497- ret = mipi_dsi_dcs_write (ctx -> dsi , MIPI_DCS_SET_ADDRESS_MODE ,
1498- & ctx -> address_mode ,
1499- sizeof (ctx -> address_mode ));
1500- if (ret < 0 )
1501- goto disable_power ;
1476+ ili9881c_send_cmd_data (& mctx , instr -> arg .cmd .cmd ,
1477+ instr -> arg .cmd .data );
15021478 }
15031479
1504- ret = mipi_dsi_dcs_set_tear_on (ctx -> dsi , MIPI_DSI_DCS_TEAR_MODE_VBLANK );
1505- if (ret )
1506- goto disable_power ;
1507-
1508- ret = mipi_dsi_dcs_exit_sleep_mode (ctx -> dsi );
1509- if (ret )
1510- goto disable_power ;
1480+ ili9881c_switch_page (& mctx , 0 );
15111481
1512- msleep (120 );
1482+ if (ctx -> address_mode )
1483+ ili9881c_send_cmd_data (& mctx , MIPI_DCS_SET_ADDRESS_MODE ,
1484+ ctx -> address_mode );
15131485
1514- ret = mipi_dsi_dcs_set_display_on (ctx -> dsi );
1515- if (ret )
1486+ mipi_dsi_dcs_set_tear_on_multi (& mctx , MIPI_DSI_DCS_TEAR_MODE_VBLANK );
1487+ mipi_dsi_dcs_exit_sleep_mode_multi (& mctx );
1488+ mipi_dsi_msleep (& mctx , 120 );
1489+ mipi_dsi_dcs_set_display_on_multi (& mctx );
1490+ if (mctx .accum_err )
15161491 goto disable_power ;
15171492
15181493 return 0 ;
15191494
15201495disable_power :
15211496 regulator_disable (ctx -> power );
1522- return ret ;
1497+ return mctx . accum_err ;
15231498}
15241499
15251500static int ili9881c_unprepare (struct drm_panel * panel )
15261501{
15271502 struct ili9881c * ctx = panel_to_ili9881c (panel );
1503+ struct mipi_dsi_multi_context mctx = { .dsi = ctx -> dsi };
15281504
1529- mipi_dsi_dcs_set_display_off ( ctx -> dsi );
1530- mipi_dsi_dcs_enter_sleep_mode ( ctx -> dsi );
1505+ mipi_dsi_dcs_set_display_off_multi ( & mctx );
1506+ mipi_dsi_dcs_enter_sleep_mode_multi ( & mctx );
15311507 regulator_disable (ctx -> power );
15321508 gpiod_set_value_cansleep (ctx -> reset , 1 );
15331509
0 commit comments