Esempio n. 1
0
static int lead_lcd_power(struct pxa910fb_info *fbi, unsigned int spi_gpio_cs, unsigned int spi_gpio_reset, int on)
{
    int err = 0;

    mfp_config(ARRAY_AND_SIZE(tpo_lcd_gpio_pin_config));
    lcd_panel_gpio_spi_init();

    if (on)
    {
        if (spi_gpio_reset != -1) {
            err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
            if (err) {
                printk("failed to request GPIO for TPO LCD RESET\n");
                return 1;
            }
            gpio_direction_output(spi_gpio_reset, 0);
            msleep(100);
            gpio_set_value(spi_gpio_reset, 1);
            msleep(100);
            gpio_free(spi_gpio_reset);
        }
        lcd_lead_init();
        lcd_power_on(1, 50);

    }
    else
    {
        //lcd_panel_gpio_spi_init();
        //lcd_panel_sleep();
        lcd_power_on(0, 0);
        err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
        if (err) {
            printk("failed to request LCD RESET gpio\n");
            return 1;
        }
        gpio_set_value(spi_gpio_reset, 0);
        gpio_free(spi_gpio_reset);


    }

//out:

    gpio_direction_output(cs_gpio, 0);
    gpio_direction_output(clk_gpio, 0);
    gpio_direction_output(d_gpio, 0);
    gpio_free(d_gpio_in);
    gpio_free(cs_gpio);
    gpio_free(clk_gpio);
    gpio_free(d_gpio);

    return 0;
}
Esempio n. 2
0
void auo_board_lcd_enable(void)
{
	/* Make sure dev is created and initialized properly */
	dev = qup_i2c_init(GSBI_ID_8, 100000, 24000000);
	if (!dev) {
		dprintf(CRITICAL, "Error in qup_i2c_init\n");
		while (1) ;
	}

	/* Setup RESX_N */
	uint8_t open_drain_a = expander_read(GPIO_EXPANDER_REG_OPEN_DRAIN_A);
	uint8_t dir_a = expander_read(GPIO_EXPANDER_REG_DIR_A);
	uint8_t data_a = expander_read(GPIO_EXPANDER_REG_DATA_A);

	expander_write(GPIO_EXPANDER_REG_DIR_A, ~0x04 & dir_a);
	expander_write(GPIO_EXPANDER_REG_DATA_A, ~0x04 & data_a);

    /* Power on the appropiate PMIC LDO power rails */
	if (lcd_power_on())
		return;

	/* Toggle RESX_N */
	mdelay(20);
	expander_write(GPIO_EXPANDER_REG_DATA_A, 0x04 | data_a);
	mdelay(1);
	expander_write(GPIO_EXPANDER_REG_DATA_A, ~0x04 & data_a);
	mdelay(1);
	expander_write(GPIO_EXPANDER_REG_DATA_A, 0x04 | data_a);
	mdelay(25);

	/* Enable the gpios for  LCD */
	lcd_gpio_cfg(1);

	auo_lcdc_init();
}
Esempio n. 3
0
void board_lcd_enable(void)
{
    int rc = -1;
    dev = qup_i2c_init(GSBI_ID_8, 100000, 24000000);

    /* Make sure dev is created and initialized properly */
    if (!dev) {
        while (1) ;
        return;
    }

    /* Store current value of these registers as to not destroy their previous
       state. */
    uint8_t open_drain_a = expander_read(GPIO_EXPANDER_REG_OPEN_DRAIN_A);
    uint8_t dir_b = expander_read(GPIO_EXPANDER_REG_DIR_B);
    uint8_t dir_a = expander_read(GPIO_EXPANDER_REG_DIR_A);
    uint8_t data_b = expander_read(GPIO_EXPANDER_REG_DATA_B);
    uint8_t data_a = expander_read(GPIO_EXPANDER_REG_DATA_A);

    /* Set the LVDS_SHUTDOWN_N to open drain and output low. */
    dprintf(INFO, "Enable lvds_shutdown_n line for Open Drain.\n");
    expander_write(GPIO_EXPANDER_REG_OPEN_DRAIN_A, 0x04 | open_drain_a);

    dprintf(INFO, "Enable lvds_shutdown_n line for output.\n");
    expander_write(GPIO_EXPANDER_REG_DIR_A, ~0x04 & dir_a);

    dprintf(INFO, "Drive the LVDS_SHUTDOWN_N pin high here.\n");
    expander_write(GPIO_EXPANDER_REG_DATA_A, 0x04 | data_a);

    /* Turn on the VREG_L2B to 3.3V. */

    /* Power on the appropiate PMIC LDO power rails */
    if (lcd_power_on())
        return;

    /* Enable the GPIO as LCDC mode LCD. */
    lcd_gpio_cfg(1);

    /* Arbitrary delay */
    udelay(20000);

    /* Set the GPIOs needed for backlight */
    bl_gpio_init();
    /* Set backlight level with API (to 8 by default) */
    rc = panel_set_backlight(8);
    if(rc)
        dprintf(CRITICAL,"Error in setting panel backlight\n");

    dprintf(INFO, "Enable BACKLIGHT_EN line for output.\n");
    expander_write(GPIO_EXPANDER_REG_DIR_B, ~0x10 & dir_b);

    dprintf(INFO, "Drive BACKLIGHT_EN to high\n");
    expander_write(GPIO_EXPANDER_REG_DATA_B, 0x10 | data_b);

}
Esempio n. 4
0
void board_lcd_enable(void)
{
    dev = qup_i2c_init(GSBI8_BASE, 100000, 24000000);

    /* Make sure dev is created and initialized properly */
    if (!dev) {
        while (1) ;
        return;
    }

    /* Store current value of these registers as to not destroy their previous
       state. */
    uint8_t open_drain_a = expander_read(GPIO_EXPANDER_REG_OPEN_DRAIN_A);
    uint8_t dir_b = expander_read(GPIO_EXPANDER_REG_DIR_B);
    uint8_t dir_a = expander_read(GPIO_EXPANDER_REG_DIR_A);
    uint8_t data_b = expander_read(GPIO_EXPANDER_REG_DATA_B);
    uint8_t data_a = expander_read(GPIO_EXPANDER_REG_DATA_A);

    /* Set the LVDS_SHUTDOWN_N to open drain and output low. */
    dprintf(INFO, "Enable lvds_shutdown_n line for Open Drain.\n");
    expander_write(GPIO_EXPANDER_REG_OPEN_DRAIN_A, 0x04 | open_drain_a);

    dprintf(INFO, "Enable lvds_shutdown_n line for output.\n");
    expander_write(GPIO_EXPANDER_REG_DIR_A, ~0x04 & dir_a);

    dprintf(INFO, "Drive the LVDS_SHUTDOWN_N pin high here.\n");
    expander_write(GPIO_EXPANDER_REG_DATA_A, 0x04 | data_a);

    /* Turn on the VREG_L2B to 3.3V. */

    /* Power on the appropiate PMIC LDO power rails */
    if (lcd_power_on())
        return;

    /* Enable the GPIO as LCDC mode LCD. */
    lcd_gpio_cfg(1);

    /* Arbitrary delay */
    udelay(20000);

    /* Set the backlight duty cycle via the PM8058 LPG_DRV1 and LPG_DRV2 */
    bl_duty_cycle_init();

    dprintf(INFO, "Enable BACKLIGHT_EN line for output.\n");
    expander_write(GPIO_EXPANDER_REG_DIR_B, ~0x10 & dir_b);

    dprintf(INFO, "Drive BACKLIGHT_EN to high\n");
    expander_write(GPIO_EXPANDER_REG_DATA_B, 0x10 | data_b);

}
Esempio n. 5
0
void lcd_init_device(void)
{

#ifdef BOOTLOADER /* Bother at all to do this again? */
/* Init GPIO ports */
    lcd_init_gpio();
    lcd_power_on();
    lcd_display_on();
#else

    power_on = true;
    display_on = true;

    lcd_set_invert_display(false);
    lcd_set_flip(false);
#endif
}
Esempio n. 6
0
static ssize_t lcd_power_file_cmd_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t size)
{
	int value;

	sscanf(buf, "%d", &value);

	printk(KERN_INFO "[lcd_power] in lcd_power_file_cmd_store, input value = %d \n", value);

	if (value == 1) {
		lcd_power_on();
		printk(KERN_INFO "[lcd_power on] <= value : %d \n", value);
	} else if (value == 0) {
		lcd_power_off();
		printk(KERN_INFO "[lcd_power off] <= value : %d \n", value);
	} else
		printk(KERN_INFO "[lcd_power] lcd is already = %d \n", lcdonoff_test);

	return size;
}
Esempio n. 7
0
static void lcd_truely_1p3828_config_480_800()
{
	int			spi_fd, i;
	char			buf[64];

#ifndef LCD_BRIGHEST
	int			pwm_fd1, pwm_fd2;
	int			lcd_brightness;
	int			ret;
#endif

	/* Power On */
	lcd_power_on();

	/* Hardware Reset */
	lcd_reset();

#ifdef LCD_BRIGHEST
	/* Backlight on */
	lcd_backlight_on();
#endif

	/* Program TRUELY_1P3828 to output 480x800 */
	if (lcd_spi_dev_node(buf)) {
		perror("Unable to get lcd spi bus_id or cs_id!\n");
		goto lcd_truely_1p3828_config_480_800_exit;
	}

	spi_fd = open(buf, O_WRONLY);
	if (spi_fd < 0) {
		perror("Can't open TRUELY_1P3828_SPI_DEV_NODE to write");
		goto lcd_truely_1p3828_config_480_800_exit;
	} else {
		truely_1p3828_set_spi_bus(spi_fd);
	}

	truely_1p3828_write_cmd(spi_fd, 0xB9); //Set_EXTC
	truely_1p3828_write_data(spi_fd, 0xFF);
	truely_1p3828_write_data(spi_fd, 0x83);
	truely_1p3828_write_data(spi_fd, 0x69);

	truely_1p3828_write_cmd(spi_fd, 0xB1);  //Set Power
	truely_1p3828_write_data(spi_fd, 0x01);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x34);
	truely_1p3828_write_data(spi_fd, 0x06);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x0F);  //
	truely_1p3828_write_data(spi_fd, 0x0F);
	truely_1p3828_write_data(spi_fd, 0x2A);
	truely_1p3828_write_data(spi_fd, 0x32);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x07);
	truely_1p3828_write_data(spi_fd, 0x23);
	truely_1p3828_write_data(spi_fd, 0x01);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xE6);

	truely_1p3828_write_cmd(spi_fd, 0xB2);  // SET Display  480x800
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x2b);
	truely_1p3828_write_data(spi_fd, 0x0A);
	truely_1p3828_write_data(spi_fd, 0x0A);
	truely_1p3828_write_data(spi_fd, 0x70);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0xFF);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x03);
	truely_1p3828_write_data(spi_fd, 0x03);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x01);

	truely_1p3828_write_cmd(spi_fd, 0xB4);  // SET Display  480x800
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x18);
	truely_1p3828_write_data(spi_fd, 0x80);
	truely_1p3828_write_data(spi_fd, 0x10);
	truely_1p3828_write_data(spi_fd, 0x01);

	truely_1p3828_write_cmd(spi_fd, 0xB6);  // SET VCOM
	truely_1p3828_write_data(spi_fd, 0x2C);
	truely_1p3828_write_data(spi_fd, 0x2C);

	truely_1p3828_write_cmd(spi_fd, 0xD5);  //SET GIP
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x05);
	truely_1p3828_write_data(spi_fd, 0x03);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x01);
	truely_1p3828_write_data(spi_fd, 0x09);
	truely_1p3828_write_data(spi_fd, 0x10);
	truely_1p3828_write_data(spi_fd, 0x80);
	truely_1p3828_write_data(spi_fd, 0x37);
	truely_1p3828_write_data(spi_fd, 0x37);
	truely_1p3828_write_data(spi_fd, 0x20);
	truely_1p3828_write_data(spi_fd, 0x31);
	truely_1p3828_write_data(spi_fd, 0x46);
	truely_1p3828_write_data(spi_fd, 0x8A);
	truely_1p3828_write_data(spi_fd, 0x57);
	truely_1p3828_write_data(spi_fd, 0x9B);
	truely_1p3828_write_data(spi_fd, 0x20);
	truely_1p3828_write_data(spi_fd, 0x31);
	truely_1p3828_write_data(spi_fd, 0x46);
	truely_1p3828_write_data(spi_fd, 0x8A);
	truely_1p3828_write_data(spi_fd, 0x57);
	truely_1p3828_write_data(spi_fd, 0x9B);
	truely_1p3828_write_data(spi_fd, 0x07);
	truely_1p3828_write_data(spi_fd, 0x0F);
	truely_1p3828_write_data(spi_fd, 0x02);
	truely_1p3828_write_data(spi_fd, 0x00);

	truely_1p3828_write_cmd(spi_fd, 0xE0);  //SET GAMMA
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x08);
	truely_1p3828_write_data(spi_fd, 0x0D);
	truely_1p3828_write_data(spi_fd, 0x2D);
	truely_1p3828_write_data(spi_fd, 0x34);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0x38);
	truely_1p3828_write_data(spi_fd, 0x09);
	truely_1p3828_write_data(spi_fd, 0x0E);
	truely_1p3828_write_data(spi_fd, 0x0E);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x14);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x14);
	truely_1p3828_write_data(spi_fd, 0x13);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0x00);
	truely_1p3828_write_data(spi_fd, 0x08);

	truely_1p3828_write_data(spi_fd, 0x0D);
	truely_1p3828_write_data(spi_fd, 0x2D);
	truely_1p3828_write_data(spi_fd, 0x34);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0x38);
	truely_1p3828_write_data(spi_fd, 0x09);
	truely_1p3828_write_data(spi_fd, 0x0E);
	truely_1p3828_write_data(spi_fd, 0x0E);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x14);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x14);
	truely_1p3828_write_data(spi_fd, 0x13);
	truely_1p3828_write_data(spi_fd, 0x19);

	truely_1p3828_write_cmd(spi_fd, 0xC1); //set DGC
	truely_1p3828_write_data(spi_fd, 0x01); //enable DGC function
	truely_1p3828_write_data(spi_fd, 0x02); //SET R-GAMMA
	truely_1p3828_write_data(spi_fd, 0x08);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x1A);
	truely_1p3828_write_data(spi_fd, 0x22);
	truely_1p3828_write_data(spi_fd, 0x2A);
	truely_1p3828_write_data(spi_fd, 0x31);
	truely_1p3828_write_data(spi_fd, 0x36);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x48);
	truely_1p3828_write_data(spi_fd, 0x51);
	truely_1p3828_write_data(spi_fd, 0x58);
	truely_1p3828_write_data(spi_fd, 0x60);
	truely_1p3828_write_data(spi_fd, 0x68);
	truely_1p3828_write_data(spi_fd, 0x70);
	truely_1p3828_write_data(spi_fd, 0x78);
	truely_1p3828_write_data(spi_fd, 0x80);
	truely_1p3828_write_data(spi_fd, 0x88);
	truely_1p3828_write_data(spi_fd, 0x90);
	truely_1p3828_write_data(spi_fd, 0x98);
	truely_1p3828_write_data(spi_fd, 0xA0);
	truely_1p3828_write_data(spi_fd, 0xA7);
	truely_1p3828_write_data(spi_fd, 0xAF);
	truely_1p3828_write_data(spi_fd, 0xB6);
	truely_1p3828_write_data(spi_fd, 0xBE);
	truely_1p3828_write_data(spi_fd, 0xC7);
	truely_1p3828_write_data(spi_fd, 0xCE);
	truely_1p3828_write_data(spi_fd, 0xD6);
	truely_1p3828_write_data(spi_fd, 0xDE);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xEF);
	truely_1p3828_write_data(spi_fd, 0xF5);
	truely_1p3828_write_data(spi_fd, 0xFB);
	truely_1p3828_write_data(spi_fd, 0xFC);
	truely_1p3828_write_data(spi_fd, 0xFE);
	truely_1p3828_write_data(spi_fd, 0x8C);
	truely_1p3828_write_data(spi_fd, 0xA4);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0xEC);
	truely_1p3828_write_data(spi_fd, 0x1B);
	truely_1p3828_write_data(spi_fd, 0x4C);

	truely_1p3828_write_data(spi_fd, 0x40);
	truely_1p3828_write_data(spi_fd, 0x02); //SET G-Gamma
	truely_1p3828_write_data(spi_fd, 0x08);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x1A);
	truely_1p3828_write_data(spi_fd, 0x22);
	truely_1p3828_write_data(spi_fd, 0x2A);
	truely_1p3828_write_data(spi_fd, 0x31);
	truely_1p3828_write_data(spi_fd, 0x36);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x48);
	truely_1p3828_write_data(spi_fd, 0x51);
	truely_1p3828_write_data(spi_fd, 0x58);
	truely_1p3828_write_data(spi_fd, 0x60);
	truely_1p3828_write_data(spi_fd, 0x68);
	truely_1p3828_write_data(spi_fd, 0x70);
	truely_1p3828_write_data(spi_fd, 0x78);
	truely_1p3828_write_data(spi_fd, 0x80);
	truely_1p3828_write_data(spi_fd, 0x88);
	truely_1p3828_write_data(spi_fd, 0x90);
	truely_1p3828_write_data(spi_fd, 0x98);
	truely_1p3828_write_data(spi_fd, 0xA0);
	truely_1p3828_write_data(spi_fd, 0xA7);
	truely_1p3828_write_data(spi_fd, 0xAF);
	truely_1p3828_write_data(spi_fd, 0xB6);
	truely_1p3828_write_data(spi_fd, 0xBE);
	truely_1p3828_write_data(spi_fd, 0xC7);
	truely_1p3828_write_data(spi_fd, 0xCE);
	truely_1p3828_write_data(spi_fd, 0xD6);
	truely_1p3828_write_data(spi_fd, 0xDE);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xEF);
	truely_1p3828_write_data(spi_fd, 0xF5);
	truely_1p3828_write_data(spi_fd, 0xFB);
	truely_1p3828_write_data(spi_fd, 0xFC);
	truely_1p3828_write_data(spi_fd, 0xFE);
	truely_1p3828_write_data(spi_fd, 0x8C);
	truely_1p3828_write_data(spi_fd, 0xA4);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0xEC);
	truely_1p3828_write_data(spi_fd, 0x1B);
	truely_1p3828_write_data(spi_fd, 0x4C);
	truely_1p3828_write_data(spi_fd, 0x40);
	truely_1p3828_write_data(spi_fd, 0x02); //SET B-Gamma
	truely_1p3828_write_data(spi_fd, 0x08);
	truely_1p3828_write_data(spi_fd, 0x12);
	truely_1p3828_write_data(spi_fd, 0x1A);
	truely_1p3828_write_data(spi_fd, 0x22);
	truely_1p3828_write_data(spi_fd, 0x2A);
	truely_1p3828_write_data(spi_fd, 0x31);
	truely_1p3828_write_data(spi_fd, 0x36);
	truely_1p3828_write_data(spi_fd, 0x3F);
	truely_1p3828_write_data(spi_fd, 0x48);
	truely_1p3828_write_data(spi_fd, 0x51);
	truely_1p3828_write_data(spi_fd, 0x58);
	truely_1p3828_write_data(spi_fd, 0x60);
	truely_1p3828_write_data(spi_fd, 0x68);
	truely_1p3828_write_data(spi_fd, 0x70);
	truely_1p3828_write_data(spi_fd, 0x78);

	truely_1p3828_write_data(spi_fd, 0x80);
	truely_1p3828_write_data(spi_fd, 0x88);
	truely_1p3828_write_data(spi_fd, 0x90);
	truely_1p3828_write_data(spi_fd, 0x98);
	truely_1p3828_write_data(spi_fd, 0xA0);
	truely_1p3828_write_data(spi_fd, 0xA7);
	truely_1p3828_write_data(spi_fd, 0xAF);
	truely_1p3828_write_data(spi_fd, 0xB6);
	truely_1p3828_write_data(spi_fd, 0xBE);
	truely_1p3828_write_data(spi_fd, 0xC7);
	truely_1p3828_write_data(spi_fd, 0xCE);
	truely_1p3828_write_data(spi_fd, 0xD6);
	truely_1p3828_write_data(spi_fd, 0xDE);
	truely_1p3828_write_data(spi_fd, 0xE6);
	truely_1p3828_write_data(spi_fd, 0xEF);
	truely_1p3828_write_data(spi_fd, 0xF5);
	truely_1p3828_write_data(spi_fd, 0xFB);
	truely_1p3828_write_data(spi_fd, 0xFC);
	truely_1p3828_write_data(spi_fd, 0xFE);
	truely_1p3828_write_data(spi_fd, 0x8C);
	truely_1p3828_write_data(spi_fd, 0xA4);
	truely_1p3828_write_data(spi_fd, 0x19);
	truely_1p3828_write_data(spi_fd, 0xEC);
	truely_1p3828_write_data(spi_fd, 0x1B);
	truely_1p3828_write_data(spi_fd, 0x4C);
	truely_1p3828_write_data(spi_fd, 0x40);

	truely_1p3828_write_cmd(spi_fd, 0x2D);//Look up table
	for(i = 0; i < 64; i++) {
		truely_1p3828_write_data(spi_fd, 8 * i);
	}
	for(i = 0; i < 64; i++) {
		truely_1p3828_write_data(spi_fd, 4 * i);
	}
	for(i = 0; i < 64; i++) {
		truely_1p3828_write_data(spi_fd, 8 * i);
	}

	MSLEEP(10);
	truely_1p3828_write_cmd(spi_fd, 0x3A);  //Set COLMOD
	truely_1p3828_write_data(spi_fd, 0x77);

	truely_1p3828_write_cmd(spi_fd, 0x11);  //Sleep Out
	MSLEEP(120);

	truely_1p3828_write_cmd(spi_fd, 0x29);  //Display On
	//truely_1p3828_write_cmd(spi_fd, 0x2C);  //Display On


	close(spi_fd);

#ifndef LCD_BRIGHEST
	/* Backlight on */
	pwm_fd1 = open(TRUELY_1P3828_PWM_PATH("max_brightness"), O_RDONLY);
	if (pwm_fd1 < 0) {
		perror("Can't open max_brightness to read");
		goto lcd_truely_1p3828_config_480_800_exit;
	}
	ret = read(pwm_fd1, buf, sizeof(buf));
	close(pwm_fd1);
	if (ret <= 0) {
		perror("Can't read max_brightness");
		goto lcd_truely_1p3828_config_480_800_exit;
	} else {
		lcd_brightness = atoi(buf) / 2;
	}

	pwm_fd2 = open(TRUELY_1P3828_PWM_PATH("brightness"), O_WRONLY);
	if (pwm_fd2 < 0) {
		perror("Can't open brightness to write");
		goto lcd_truely_1p3828_config_480_800_exit;
	}
	sprintf(buf, "%d", lcd_brightness);
	ret = write(pwm_fd2, buf, sizeof(buf));
	close(pwm_fd2);
	if (ret <= 0) {
		perror("Can't write brightness");
		goto lcd_truely_1p3828_config_480_800_exit;
	}
#endif

lcd_truely_1p3828_config_480_800_exit:
	return;
}