/// This function may cause deadlock. Make sure you call this function /// correctly. Otherwise use wait_for_ready instead. This function is introduced /// to solve screen update problem. We may have a better way later. int wait_until_ready( void ) { // TODO, change the usleep to nanosleep later. static const int MAX = 40; int d = gpio_hrdy( ); int count = 0; while ( d == 0 && count < MAX) { bs_sleep(100); d = gpio_hrdy( ); count++; } if (d == 0) { DBG("Still not ready, should not happen"); } return count; }
void bs60_init( int wa ) { DBG( "[%s] ... initializing broadsheet for 6-inch panel\n", __FUNCTION__ ); bs_chip_init(); init_gpio(); bs_cmd_set_hif_mode_cmd( ); bs_cmd_wr_reg( 0x006, 0x0000 ); // It's really very important to sleep here to make sure the controller // is correctly power on. bs_sleep(5); bs_cmd_init_sys_run( ); bs_cmd_wr_reg( 0x0106, 0x0203 ); bs_cmd_init_dspe_cfg( BS60_INIT_HSIZE, BS60_INIT_VSIZE, BS60_INIT_SDRV_CFG, BS60_INIT_GDRV_CFG, BS60_INIT_LUTIDXFMT ); bs_cmd_init_dspe_tmg( BS60_INIT_FSLEN, ( BS60_INIT_FELEN << 8 ) | BS60_INIT_FBLEN, BS60_INIT_LSLEN, ( BS60_INIT_LELEN << 8 ) | BS60_INIT_LBLEN, BS60_INIT_PIXCLKDIV ); bs_cmd_print_disp_timings( ); bs_cmd_set_wfm( wa ); bs_cmd_print_wfm_info( ); DBG( "[%s] ... display engine initialized with waveform\n", __FUNCTION__ ); bs_cmd_clear_gd( ); bs_cmd_wr_reg( 0x01A, 4 ); // i2c clock divider bs_cmd_wr_reg( 0x320, 0 ); // temp auto read on bs_cmd_set_lut_auto_sel_mode(0); // make sure auto-lut mode is off bs_cmd_set_rotmode(3); // set rotation mode bs60_white(); }
void reset( void ) { set_gpio_val( GPIO_RESET_L, 0 ); bs_sleep(5); set_gpio_val( GPIO_RESET_L, 1 ); }