Example #1
0
void db8500_gpio_make_output(unsigned gpio, int val)
{
    void __iomem *addr = get_gpio_addr(gpio);
    unsigned offset = get_gpio_offset(gpio);

    writel(1 << offset, addr + DB8500_GPIO_DIRS);
    db8500_gpio_set_output(gpio, val);
}
int mcde_splash_image(void)
{
    int ret = -ENODEV;
    struct mcde_rectangle rect;

    debug("%s: enter\n", __func__);

    if (main_display.port->type == MCDE_PORTTYPE_DSI)
        ret = mcde_startup_dsi(&platform_data);
    else if (main_display.port->type == MCDE_PORTTYPE_DPI)
        ret = mcde_startup_dpi(&platform_data);
    if (ret != 0) {
        printf("%s: mcde_startup... -> %d\n", __func__, ret);
        return ret;
    }

    /* dss enable display */
    chnl = mcde_chnl_get(main_display.chnl_id, main_display.fifo,
                         main_display.port);
    if (IS_ERR(chnl)) {
        ret = PTR_ERR(chnl);
        printf("%s: Failed to acquire MCDE channel ret=%d\n",
               __func__, ret);
        goto get_chnl_failed;
    }

    ret = mcde_chnl_set_power_mode(chnl, MCDE_DISPLAY_PM_STANDBY);
    if (ret) {
        printf("%s: mcde_chnl_set_power_mode() -> %d\n",
               __func__, ret);
        goto get_chnl_failed;
    }

    /* dss set video mode */
    ret = mcde_chnl_set_video_mode(chnl, &video_mode);
    if (ret < 0) {
        printf("%s:Failed to set video mode on channel ret=%d\n",
               __func__, ret);
        goto set_video_mode_failed;
    }

    mcde_chnl_set_pixel_format(chnl, main_display.port_pixel_format);
    mcde_chnl_set_update_area(chnl, 0, 0, main_display.native_x_res,
                              main_display.native_y_res);
    mcde_chnl_apply(chnl);

    /* chnl setup ok, display image */
    ret = mcde_display_image(chnl);
    if (ret != 0) {
        debug("%s: mcde_display_image() -> %d\n",
              __func__, ret);
        goto display_image_failed;
    }
#if defined(BOARD_C7_P0)
    /* vdd power on */
    db8500_gpio_set_output(GPIO167_GPIO, 1);
    udelay(400);
    /* stbyb pull high */
    db8500_gpio_set_output(GPIO154_GPIO, 1);
    udelay(400);
    /* reset pull high */
    db8500_gpio_set_output(GPIO139_GPIO, 1);
    mdelay(20);
    db8500_gpio_set_output(GPIO156_GPIO, 1);
    mdelay(20);
    db8500_gpio_set_output(GPIO168_GPIO, 1);
    mdelay(20);
    db8500_gpio_set_output(GPIO218_GPIO, 1);
    mdelay(20);
    db8500_gpio_set_output(GPIO157_GPIO, 1);
    mdelay(20);
#endif

#ifdef CONFIG_VIA_DISPLAY_DSI
    ret = mcde_turn_on_display();
    if (ret) {
        printf("%s: mcde_turn_on_display() -> %d\n", __func__, ret);
        goto get_chnl_failed;
    }
#endif
#if defined(BOARD_C7_P0)
    /* avdd vcom vgl vgh is on */
    db8500_gpio_set_output(GPIO153_GPIO, 1);
    mdelay(40);

    db8500_gpio_set_output(GPIO139_GPIO, 0);
    mdelay(1);
    db8500_gpio_set_output(GPIO139_GPIO, 1);
#endif
    mcde_chnl_apply(chnl);
    rect.x = 0;
    rect.y = 0;
    rect.w = main_display.native_x_res;
    rect.h = main_display.native_y_res;
    mcde_chnl_update(chnl, &rect);

#ifndef CONFIG_VIA_DISPLAY_DSI
    ret = mcde_turn_on_display();
    if (ret) {
        printf("%s: mcde_turn_on_display() -> %d\n", __func__, ret);
        goto get_chnl_failed;
    }
#endif

    ret = mcde_chnl_set_power_mode(chnl, MCDE_DISPLAY_PM_ON);
    if (ret) {
        printf("%s: mcde_chnl_set_power_mode() -> %d\n", __func__, ret);
        goto get_chnl_failed;
    }

    mdelay(50);

    db8500_gpio_set_output(GPIO68_GPIO, 1);

    return ret;

get_chnl_failed:
display_image_failed:
set_video_mode_failed:
    mcde_exit();
    return ret;
}