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; }
static int mcde_display_set_power_mode_default(struct mcde_display_device *ddev, enum mcde_display_power_mode power_mode) { int ret = 0; /* OFF -> STANDBY */ if (ddev->power_mode == MCDE_DISPLAY_PM_OFF && power_mode != MCDE_DISPLAY_PM_OFF) { if (ddev->platform_enable) { ret = ddev->platform_enable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; /* force register settings */ if (ddev->port->type == MCDE_PORTTYPE_DPI) ddev->update_flags = UPDATE_FLAG_VIDEO_MODE | UPDATE_FLAG_PIXEL_FORMAT; } if (ddev->port->type == MCDE_PORTTYPE_DSI) { /* STANDBY -> ON */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_ON) { ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_EXIT_SLEEP_MODE, NULL, 0); if (ret) return ret; ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_ON, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_ON; } else if (ddev->power_mode == MCDE_DISPLAY_PM_ON && power_mode <= MCDE_DISPLAY_PM_STANDBY) { /* ON -> STANDBY */ ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_OFF, NULL, 0); if (ret) return ret; ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_ENTER_SLEEP_MODE, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; } } else if (ddev->port->type == MCDE_PORTTYPE_DPI) { ddev->power_mode = power_mode; } else if (ddev->power_mode != power_mode) { return -EINVAL; } /* SLEEP -> OFF */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_OFF) { if (ddev->platform_disable) { ret = ddev->platform_disable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_OFF; } mcde_chnl_set_power_mode(ddev->chnl_state, ddev->power_mode); return ret; }
static int generic_set_power_mode(struct mcde_display_device *ddev, enum mcde_display_power_mode power_mode) { int ret = 0; struct mcde_display_generic_platform_data *pdata = ddev->dev.platform_data; dev_dbg(&ddev->dev, "%s:Set Power mode\n", __func__); /* OFF -> STANDBY */ if (ddev->power_mode == MCDE_DISPLAY_PM_OFF && power_mode != MCDE_DISPLAY_PM_OFF) { if (ddev->platform_enable) { ret = ddev->platform_enable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; } /* STANDBY -> ON */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_ON) { ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_EXIT_SLEEP_MODE, NULL, 0); if (ret) return ret; msleep(pdata->sleep_out_delay); ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_ON, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_ON; goto set_power_and_exit; } /* ON -> STANDBY */ else if (ddev->power_mode == MCDE_DISPLAY_PM_ON && power_mode <= MCDE_DISPLAY_PM_STANDBY) { ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_OFF, NULL, 0); if (ret) return ret; ret = mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_ENTER_SLEEP_MODE, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; } /* SLEEP -> OFF */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_OFF) { if (ddev->platform_disable) { ret = ddev->platform_disable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_OFF; } set_power_and_exit: mcde_chnl_set_power_mode(ddev->chnl_state, ddev->power_mode); return ret; }
static int ws2401_set_power_mode(struct mcde_display_device *ddev, enum mcde_display_power_mode power_mode) { int ret = 0; struct ws2401_platform_data *pdata = ddev->dev.platform_data; struct ws2401_lcd *lcd = NULL; lcd = dev_get_drvdata(&ddev->dev); dev_dbg(&ddev->dev, "%s:Set Power mode %d->%d\n", __func__, ddev->power_mode, power_mode); /* OFF -> STANDBY */ if (ddev->power_mode == MCDE_DISPLAY_PM_OFF && power_mode != MCDE_DISPLAY_PM_OFF) { if (ddev->platform_enable) { ret = ddev->platform_enable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; } /* STANDBY -> ON */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_ON) { ret = dsi_dcs_write_sequence(ddev, DCS_CMD_SEQ_WS2401_INIT); if (ret) return ret; ret = dsi_dcs_write(ddev->chnl_state, DCS_CMD_EXIT_SLEEP_MODE, NULL, 0); if (ret) return ret; msleep(pdata->sleep_out_delay); ws2401_update_brightness(ddev, lcd->bd->props.brightness); ret = dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_ON, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_ON; goto set_power_and_exit; } /* ON -> STANDBY */ else if (ddev->power_mode == MCDE_DISPLAY_PM_ON && power_mode <= MCDE_DISPLAY_PM_STANDBY) { ret = dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_DISPLAY_OFF, NULL, 0); if (ret) return ret; ret = dsi_dcs_write(ddev->chnl_state, DCS_CMD_ENTER_SLEEP_MODE, NULL, 0); if (ret) return ret; ddev->power_mode = MCDE_DISPLAY_PM_STANDBY; } /* SLEEP -> OFF */ if (ddev->power_mode == MCDE_DISPLAY_PM_STANDBY && power_mode == MCDE_DISPLAY_PM_OFF) { if (ddev->platform_disable) { ret = ddev->platform_disable(ddev); if (ret) return ret; } ddev->power_mode = MCDE_DISPLAY_PM_OFF; } set_power_and_exit: mcde_chnl_set_power_mode(ddev->chnl_state, ddev->power_mode); return ret; }