static int set_video_mode(struct mcde_display_device *ddev, struct mcde_video_mode *video_mode) { int res = -EINVAL; struct mcde_video_mode channel_video_mode; static int first_call = 1; struct ws2401_dpi *lcd = dev_get_drvdata(&ddev->dev); if (ddev == NULL || video_mode == NULL) { dev_warn(&ddev->dev, "%s:ddev = NULL or video_mode = NULL\n", __func__); goto out; } ddev->video_mode = *video_mode; print_vmode(&ddev->dev, video_mode); if ((video_mode->xres == VMODE_XRES && video_mode->yres == VMODE_YRES) || (video_mode->xres == VMODE_YRES && video_mode->yres == VMODE_XRES)) res = 0; if (res < 0) { dev_warn(&ddev->dev, "%s:Failed to set video mode x=%d, y=%d\n", __func__, video_mode->xres, video_mode->yres); goto error; } channel_video_mode = ddev->video_mode; /* Dependant on if display should rotate or MCDE should rotate */ if (ddev->rotation == MCDE_DISPLAY_ROT_90_CCW || ddev->rotation == MCDE_DISPLAY_ROT_90_CW) { channel_video_mode.xres = ddev->native_x_res; channel_video_mode.yres = ddev->native_y_res; } res = mcde_chnl_set_video_mode(ddev->chnl_state, &channel_video_mode); if (res < 0) { dev_warn(&ddev->dev, "%s:Failed to set video mode on channel\n", __func__); goto error; } /* notify mcde display driver about updated video mode, excepted for * the first update to preserve the splash screen and avoid a * stop_flow() */ if (first_call && lcd->pd->platform_enabled) ddev->update_flags |= UPDATE_FLAG_PIXEL_FORMAT; else ddev->update_flags |= UPDATE_FLAG_VIDEO_MODE; first_call = 0; return res; out: error: return res; }
static int mcde_display_set_video_mode_default(struct mcde_display_device *ddev, struct mcde_video_mode *video_mode) { int ret; struct mcde_video_mode channel_video_mode; u16 native_xres, native_yres; if (!video_mode) return -EINVAL; /* * The video_mode->xres and ->yres must be the same as * returned by mcde_display_get_native_resolution_default() for * fixed resolution displays. */ mcde_display_get_native_resolution_default(ddev, &native_xres, &native_yres); if (video_mode->xres != native_xres || video_mode->yres != native_yres) return -EINVAL; ddev->video_mode = *video_mode; channel_video_mode = ddev->video_mode; /* * If orientation is 90 or 270 then rotate the x and y resolution * Channel video mode resolution is always the true resolution of the * display */ if (ddev->orientation == MCDE_DISPLAY_ROT_90_CCW || ddev->orientation == MCDE_DISPLAY_ROT_90_CW) { u32 old_x_res; old_x_res = channel_video_mode.xres; channel_video_mode.xres = channel_video_mode.yres; channel_video_mode.yres = old_x_res; } /* +445681 display padding */ channel_video_mode.xres_padding = ddev->x_res_padding; channel_video_mode.yres_padding = ddev->y_res_padding; /* -445681 display padding */ ret = mcde_chnl_set_video_mode(ddev->chnl_state, &channel_video_mode); if (ret < 0) { dev_warn(&ddev->dev, "%s:Failed to set video mode\n", __func__); return ret; } ddev->update_flags |= UPDATE_FLAG_VIDEO_MODE; return 0; }
static int ws2401_set_video_mode(struct mcde_display_device *ddev, struct mcde_video_mode *video_mode) { int ret = 0; struct mcde_video_mode channel_video_mode; struct ws2401_lcd *lcd = dev_get_drvdata(&ddev->dev); /* TODO: Review this when splash screen is added - should depend on startup_graphics kernel parameter. */ static int video_mode_apply_during_boot; if (!ddev || !video_mode) { dev_warn(&ddev->dev, "%s:ddev or video_mode = NULL, aborting\n", __func__); return -EINVAL; } ddev->video_mode = *video_mode; channel_video_mode = ddev->video_mode; /* Dependant on if display should rotate or MCDE should rotate */ if (ddev->rotation == MCDE_DISPLAY_ROT_90_CCW || ddev->rotation == MCDE_DISPLAY_ROT_90_CW) { channel_video_mode.xres = ddev->native_x_res; channel_video_mode.yres = ddev->native_y_res; } ret = mcde_chnl_set_video_mode(ddev->chnl_state, &channel_video_mode); if (ret < 0) { dev_warn(&ddev->dev, "%s:Failed to set video mode\n", __func__); return ret; } /* notify mcde display driver about updated video mode, excepted for * the first update to preserve the splash screen and avoid a * stop_flow() */ if (video_mode_apply_during_boot && lcd->pd->platform_enabled) { ddev->update_flags |= UPDATE_FLAG_PIXEL_FORMAT; video_mode_apply_during_boot = 0; } else ddev->update_flags |= UPDATE_FLAG_VIDEO_MODE; return ret; }
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; }