void lcd_enable(bool enable) { if(lcd_active() == enable) return; lcd_set_active(enable); if(lcd_active()) { // enable spi spi_enable(true); // reset imx233_lcdif_reset_lcd(true); imx233_lcdif_reset_lcd(false); mdelay(1); imx233_lcdif_reset_lcd(true); mdelay(1); // "power" on lcd_power(true); // setup registers lcd_power_seq(); lcd_init_seq(); lcd_display_on_seq(); imx233_dma_reset_channel(APB_LCDIF); imx233_dma_start_command(APB_LCDIF, &lcdif_dma[0].dma); } else { // power down lcd_display_off_seq(); lcd_power(false); // stop lcdif BF_CLR(LCDIF_CTRL, DOTCLK_MODE); /* stmp37xx errata: clearing DOTCLK_MODE won't clear RUN: wait until * fifo is empty and then clear manually */ while(!BF_RD(LCDIF_STAT, TXFIFO_EMPTY)); BF_CLR(LCDIF_CTRL, RUN); // disable spi spi_enable(false); } }
void lcd_enable(bool enable) { if(lcd_on == enable) return; lcd_on = enable; if(lcd_on) { // enable spi spi_enable(true); // reset imx233_lcdif_reset_lcd(true); imx233_lcdif_reset_lcd(false); mdelay(1); imx233_lcdif_reset_lcd(true); mdelay(1); // "power" on lcd_power(true); // setup registers imx233_lcdif_enable_sync_signals(true); // we need frame signals during init lcd_power_seq(); lcd_init_seq(); lcd_display_on_seq(); imx233_dma_reset_channel(APB_LCDIF); imx233_dma_start_command(APB_LCDIF, &lcdif_dma[0].dma); BF_SET(LCDIF_CTRL, DOTCLK_MODE); BF_SET(LCDIF_CTRL, RUN); } else { // power down lcd_display_off_seq(); lcd_power(false); // stop lcdif BF_CLR(LCDIF_CTRL, DOTCLK_MODE); // disable spi spi_enable(false); } }