@@ -553,14 +553,45 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
553
553
static void ssd130x_clear_screen (struct ssd130x_device * ssd130x ,
554
554
struct ssd130x_plane_state * ssd130x_state )
555
555
{
556
- struct drm_rect fullscreen = {
557
- .x1 = 0 ,
558
- .x2 = ssd130x -> width ,
559
- .y1 = 0 ,
560
- .y2 = ssd130x -> height ,
561
- };
562
-
563
- ssd130x_update_rect (ssd130x , ssd130x_state , & fullscreen );
556
+ unsigned int page_height = ssd130x -> device_info -> page_height ;
557
+ unsigned int pages = DIV_ROUND_UP (ssd130x -> height , page_height );
558
+ u8 * data_array = ssd130x_state -> data_array ;
559
+ unsigned int width = ssd130x -> width ;
560
+ int ret , i ;
561
+
562
+ if (!ssd130x -> page_address_mode ) {
563
+ memset (data_array , 0 , width * pages );
564
+
565
+ /* Set address range for horizontal addressing mode */
566
+ ret = ssd130x_set_col_range (ssd130x , ssd130x -> col_offset , width );
567
+ if (ret < 0 )
568
+ return ;
569
+
570
+ ret = ssd130x_set_page_range (ssd130x , ssd130x -> page_offset , pages );
571
+ if (ret < 0 )
572
+ return ;
573
+
574
+ /* Write out update in one go if we aren't using page addressing mode */
575
+ ssd130x_write_data (ssd130x , data_array , width * pages );
576
+ } else {
577
+ /*
578
+ * In page addressing mode, the start address needs to be reset,
579
+ * and each page then needs to be written out separately.
580
+ */
581
+ memset (data_array , 0 , width );
582
+
583
+ for (i = 0 ; i < pages ; i ++ ) {
584
+ ret = ssd130x_set_page_pos (ssd130x ,
585
+ ssd130x -> page_offset + i ,
586
+ ssd130x -> col_offset );
587
+ if (ret < 0 )
588
+ return ;
589
+
590
+ ret = ssd130x_write_data (ssd130x , data_array , width );
591
+ if (ret < 0 )
592
+ return ;
593
+ }
594
+ }
564
595
}
565
596
566
597
static int ssd130x_fb_blit_rect (struct drm_plane_state * state ,
0 commit comments