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();
}
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);

}
Exemple #3
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);

}
Exemple #4
0
static void msm8960_backlight_on(void)
{
	struct pm8921_gpio backlight_pwm = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 0,
		.pull = PM_GPIO_PULL_NO,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_1,
		.inv_int_pol = 0,
	};

	int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm);
	if (rc)
		dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc);
}

#define PM8921_GPIO_BL_LED_EN_MITWOA           22
#define PM8921_GPIO_BL_LED_EN_MITWO           13
#define LM3530_I2C_ADDR                 (0x38)

void panel_backlight_on_mitwoa(unsigned int on)
{
	int ret = 0;
	static struct qup_i2c_dev *lm3530_dev = NULL;

	if (on) {
		lm3530_dev = qup_i2c_init(GSBI_ID_10, 100000, 24000000);

		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWOA, 1);

		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x17);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x20, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x30, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0xA0, 0x1F);
	} else {
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x00);
		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWOA, 0);
		lm3530_dev = NULL;
	}
	if (ret) {
		dprintf(CRITICAL, "panel_backlight_on: ret %d\n", ret);
	}
}
/* Read EEPROM to find out product id. Return 0 in case of failure */
uint32_t platform_id_read (void)
{
    uint32_t id = 0;
    uint16_t offset = 0;
    dev = qup_i2c_init(GSBI_ID_8, 100000, 24000000);
    if(!dev){
        return id;
    }
    /* Check if EPROM is valid */
    if (CONVERT_ENDIAN_U32(eprom_read(0, 4)) == CDT_MAGIC_NUMBER)
    {
        /* Get offset for platform ID info from Meta Data block 0 */
        offset = eprom_read(CONVERT_ENDIAN_U16(0 +
            sizeof(struct cdt_header)), 2);
        /* Read platform ID */
        id = eprom_read(CONVERT_ENDIAN_U16(offset), 4);
        id = CONVERT_ENDIAN_U32(id);
        id = (id & 0x00FF0000) >> 16;
    }
Exemple #6
0
void panel_backlight_on_mitwo(unsigned int on)
{
	int ret = 0;
	static struct qup_i2c_dev *lm3530_dev = NULL;

	if (on) {
		lm3530_dev = qup_i2c_init(GSBI_ID_1, 100000, 24000000);

		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWO, 1);

		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x17);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x20, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x30, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0xA0, 0x1F);
	} else {
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x00);
		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWO, 0);
		lm3530_dev = NULL;
	}
	if (ret) {
		dprintf(CRITICAL, "panel_backlight_on: ret %d\n", ret);
	}
}