Exemple #1
0
/* Reverse order of power on and channel update as compared with MCDE default display update */
static int hva40wv1_display_update(struct mcde_display_device *ddev,
							bool tripple_buffer)
{
	struct hva40wv1_lcd *lcd = dev_get_drvdata(&ddev->dev);
	int ret = 0;

	if (ddev->power_mode != MCDE_DISPLAY_PM_ON && ddev->set_power_mode) {
		ret = ddev->set_power_mode(ddev, MCDE_DISPLAY_PM_ON);
		if (ret < 0) {
			dev_warn(&ddev->dev,
				"%s:Failed to set power mode to on\n",
				__func__);
			return ret;
		}
	}

	ret = mcde_chnl_update(ddev->chnl_state, tripple_buffer);
	if (ret < 0) {
		dev_warn(&ddev->dev, "%s:Failed to update channel\n", __func__);
		return ret;
	}

	mutex_lock(&lcd->lock);
	if (lcd->turn_on_backlight == true){
		lcd->turn_on_backlight = false;
		/* Allow time for one frame to be sent to the display before switching on the backlight */
		msleep(20);
		if (lcd->pd->bl_on_off)
			lcd->pd->bl_on_off(true);
	}
	mutex_unlock(&lcd->lock);

	return 0;
}
int mcde_splash_txt(void)
{
    int err = 0;
    struct mcde_rectangle rect;
    static struct mcde_ovly_state *ovly = NULL;
    u32 width;
    u32 height;
    u32 lcd_bpp;
    u8 *paddr;
    u32 stride;
    u32 xpos = 0;
    u32 ypos = 0;

    paddr = (u8 *) CONFIG_SYS_VIDEO_FB_ADRS;
    width = CONFIG_SYS_DISPLAY_NATIVE_X_RES;
    height = CONFIG_SYS_DISPLAY_NATIVE_Y_RES;

    lcd_bpp = 16;
    stride = width * lcd_bpp / 8;
    stride = (stride + 7) & 0xFFFFFFF8; /* pad to 64-bit boundary */

    if(ovly == NULL) {
        /* dss_enable_overlay */
        ovly = mcde_ovly_get(chnl);
        if (IS_ERR(ovly)) {
            err = PTR_ERR(ovly);
            printf("%s: Failed to get channel\n", __func__);
            return -err;
        }
    }

    mcde_ovly_set_source_buf(ovly, (u32) paddr);
    mcde_ovly_set_source_info(ovly, stride,main_display.default_pixel_format);
    mcde_ovly_set_source_area(ovly, 0, 0, width, height);

    if (width == main_display.native_x_res)
        xpos = 0;
    else
        xpos = (main_display.native_x_res - width) / 2;

    if (height == main_display.native_y_res)
        ypos = 0;
    else
        ypos = (main_display.native_y_res - height) / 2;
    mcde_ovly_set_dest_pos(ovly, xpos, ypos, 0);
    mcde_ovly_apply(ovly);

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

    return 0;
}
static int ws2401_update(struct mcde_display_device *ddev,
				bool tripple_buffer)
{
	struct ws2401_lcd *lcd = dev_get_drvdata(&ddev->dev);
	int ret = 0;

	dev_dbg(&ddev->dev, "%s\n", __func__);

return 0;
	/* Add 100% APE OPP request */
	if (!lcd->opp_is_requested) {
		if (prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, "ws2401", 100)) {
			dev_err(&ddev->dev, "APE OPP 100 failed\n");
			return -EFAULT;
		}
		lcd->opp_is_requested = true;
	}

	/* For a display running DSI Command Mode (i.e. with an internal framebuffer),
	the OPP request can be released once the frame has been output to the display.
	When running DSI Video Mode, the OPP request must remain
	in place contnuously whilst the panel is on. */
	if (ddev->port->mode == MCDE_PORTMODE_CMD) {
		cancel_delayed_work(&lcd->opp_timeout_work);
		schedule_delayed_work(&lcd->opp_timeout_work, msecs_to_jiffies(OPP_TIMER));
	}

	if (ddev->power_mode != MCDE_DISPLAY_PM_ON && ddev->set_power_mode) {
		ret = ddev->set_power_mode(ddev, MCDE_DISPLAY_PM_ON);
		if (ret < 0) {
			dev_warn(&ddev->dev,
				"%s:Failed to set power mode to on\n",
				__func__);
			return ret;
		}
	}

	/* TODO: Calculate & set update rect */
	ret = mcde_chnl_update(ddev->chnl_state, &ddev->update_area,
							tripple_buffer);
	if (ret < 0) {
		dev_warn(&ddev->dev, "%s:Failed to update channel\n", __func__);
		return ret;
	}

	if (ddev->first_update && ddev->on_first_update)
		ddev->on_first_update(ddev);

	dev_dbg(&ddev->dev, "Overlay updated, chnl=%d\n", ddev->chnl_id);

	return 0;
}
/* Reverse order of power on and channel update as compared with MCDE default display update */
static int dsi_display_update(struct mcde_display_device *ddev,
							bool tripple_buffer)
{
	int ret = 0;

	if (ddev->power_mode != MCDE_DISPLAY_PM_ON && ddev->set_power_mode) {
		ret = ddev->set_power_mode(ddev, MCDE_DISPLAY_PM_ON);
		if (ret < 0) {
			dev_warn(&ddev->dev,
				"%s:Failed to set power mode to on\n",
				__func__);
			return ret;
		}
	}

	ret = mcde_chnl_update(ddev->chnl_state, tripple_buffer);
	if (ret < 0) {
		dev_warn(&ddev->dev, "%s:Failed to update channel\n", __func__);
		return ret;
	}
	return 0;
}
/* Reverse order of power on and channel update as compared with MCDE default display update */
static int s6d27a1_display_update(struct mcde_display_device *ddev,
							bool tripple_buffer)
{
	int ret = 0;
	struct s6d27a1_dpi *lcd = dev_get_drvdata(&ddev->dev);

	/*Protection code for  power on /off test */
	if((lcd->dev <= 0) || (lcd->mdd <= 0) || (lcd->dev->platform_data <= 0))
		return ret;

	if (ddev->power_mode != MCDE_DISPLAY_PM_ON && ddev->set_power_mode) {
		ret = ddev->set_power_mode(ddev, MCDE_DISPLAY_PM_ON);
		if (ret < 0) {
			dev_warn(&ddev->dev,
				"%s:Failed to set power mode to on\n",
				__func__);
			return ret;
		}
	}

	ret = mcde_chnl_update(ddev->chnl_state, tripple_buffer);
	if (ret < 0) {
		dev_warn(&ddev->dev, "%s:Failed to update channel\n", __func__);
		return ret;
	}
	if (lcd->turn_on_backlight == false){

		lcd->turn_on_backlight = true;
		/* Allow time for one frame to be sent to the display before switching on the backlight */
		if (lcd->pd->bl_on_off) {
			lcd->pd->bl_on_off(false);			
			msleep(20);
			lcd->pd->bl_on_off(true);			
		}
	}
		
	return 0;
}
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;
}