void display_init(void) { struct fbcon_config *fb_cfg; #if DISPLAY_TYPE_LCDC struct lcdc_timing_parameters *lcd_timing; mdp_clock_init(); if (board_machtype() == LINUX_MACHTYPE_8660_FLUID) { mmss_pixel_clock_configure(PIXEL_CLK_INDEX_25M); } else { mmss_pixel_clock_configure(PIXEL_CLK_INDEX_54M); } lcd_timing = get_lcd_timing(); fb_cfg = lcdc_init_set( lcd_timing ); fbcon_setup(fb_cfg); fbcon_clear(); panel_poweron(); #endif #if DISPLAY_TYPE_MIPI mdp_clock_init(); configure_dsicore_dsiclk(); configure_dsicore_byteclk(); configure_dsicore_pclk(); fb_cfg = mipi_init(); fbcon_setup(fb_cfg); #endif }
static int apq8064_lvds_clock(int enable) { if (enable) mdp_clock_init(); return 0; }
int target_panel_clock(uint8_t enable, struct msm_panel_info *pinfo) { struct mdss_dsi_pll_config *pll_data; uint32_t dual_dsi = pinfo->mipi.dual_dsi; dprintf(SPEW, "target_panel_clock\n"); pll_data = pinfo->mipi.dsi_pll_config; if (enable) { mdp_gdsc_ctrl(enable); mdp_clock_init(); mdss_dsi_auto_pll_config(DSI0_PLL_BASE, MIPI_DSI0_BASE, pll_data); dsi_pll_enable_seq(DSI0_PLL_BASE); mmss_clock_auto_pll_init(DSI0_PHY_PLL_OUT, dual_dsi, pll_data->pclk_m, pll_data->pclk_n, pll_data->pclk_d); } else if(!target_cont_splash_screen()) { // * Add here for continuous splash * mmss_clock_disable(dual_dsi); mdp_clock_disable(dual_dsi); } return NO_ERROR; }
void display_init(void) { struct fbcon_config *fb_cfg; #if DISPLAY_TYPE_LCDC mdp_clock_init(); fb_cfg = lcdc_init(); panel_poweron(); fbcon_setup(fb_cfg); #endif #if DISPLAY_TYPE_MIPI mdp_clock_init(); fb_cfg = mipi_init(); fbcon_setup(fb_cfg); #endif }
static int msm7627a_mdp_clock_init(int enable) { int ret = 0; if (enable) mdp_clock_init(); return ret; }
static int fusion3_mtp_clock(int enable) { if (enable) { mdp_clock_init(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; }
static int msm7627a_mdp_clock_init(int enable) { int ret = 0; unsigned rate = 0; rate = panel.panel_info.clk_rate; if (enable) mdp_clock_init(rate); else mdp_clock_disable(); return ret; }
void display_init(void){ struct fbcon_config *fb_cfg; panel_backlight_on(); mipi_dsi_panel_power_on(); mipi_panel_reset(); mdp_clock_init(); mmss_clock_init(); fb_cfg = mipi_init(); fbcon_setup(fb_cfg); }
static int msm8974_mdss_edp_panel_clock(int enable) { if (enable) { mdp_gdsc_ctrl(enable); mdp_clock_init(); edp_clk_enable(); } else if (!target_cont_splash_screen()) { /* Add here for continuous splash */ edp_clk_disable(); mdp_clock_disable(); mdp_gdsc_ctrl(enable); } return 0; }
static int msm7627a_mdp_clock_init(int enable) { int ret = 0; unsigned rate = 0; rate = panel.panel_info.clk_rate; if (enable) { /* enable MDP clock in MP to boost display up */ if (board_machtype() != MSM8X25_QRD5 && board_machtype() != MSM8X25Q_SKUD) mdp_clock_init(rate); } else { mdp_clock_disable(); } return ret; }
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); } /* Pull DISP_RST_N high to get panel out of reset */ static void msm8960_mipi_panel_reset(void) { struct pm8921_gpio gpio43_param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_UP_30, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_PAIRED, .inv_int_pol = 0, .disable_pin = 0, }; pm8921_gpio_config(PM_GPIO(43), &gpio43_param); } static int msm8960_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_mipi_panel_power(int enable) { if (enable) { msm8960_backlight_on(); /* Turn on LDO8 for lcd1 mipi vdd */ pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V); /* Turn on LDO23 for lcd1 mipi vddio */ pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V); /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_mipi_panel_reset(); } return 0; } void display_init(void) { dprintf(CRITICAL, "display_init\n"); switch (board_target_id()) { case LINUX_MACHTYPE_8064_CDP: lvds_chimei_wxga_init(&(panel.panel_info)); panel.clk_func = apq8064_lvds_clock; panel.power_func = apq8064_lvds_panel_power; panel.fb.base = 0x80B00000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_MTP: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = fusion3_mtp_clock; panel.power_func = fusion3_mtp_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MTP: case LINUX_MACHTYPE_8960_FLUID: case LINUX_MACHTYPE_8960_LIQUID: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = msm8960_mipi_panel_clock; panel.power_func = msm8960_mipi_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_42; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_image_on_screen(); display_enable = 1; } void display_shutdown(void) { if (display_enable) msm_display_off(); }
void mddi_init(void) { unsigned n; dprintf("mddi_init() configuring for LCDC\n"); /* MDP init */ /* seems like not needed */ /* LCDC init */ #if 0 clock_enable(MDP_LCDC_PCLK_CLK); clock_enable(MDP_LCDC_PAD_PCLK_CLK); clock_set_rate(MDP_LCDC_PCLK_CLK, 74250000); clock_set_rate(MDP_LCDC_PAD_PCLK_CLK, 74250000); #endif lcdc_clock_init(); writel(LCDC_FB_PHYS, MSM_MDP_BASE1 + 0x90008); writel((LCDC_FB_HEIGHT << 16) | LCDC_FB_WIDTH, MSM_MDP_BASE1 + 0x90004); writel(LCDC_FB_WIDTH * LCDC_FB_BPP / 8, MSM_MDP_BASE1 + 0x9000c); writel(0, MSM_MDP_BASE1 + 0x90010); writel(DMA_PACK_ALIGN_LSB|DMA_PACK_PATTERN_RGB|DMA_DITHER_EN| DMA_OUT_SEL_LCDC|DMA_IBUF_FORMAT_RGB565| DMA_DSTC0G_8BITS|DMA_DSTC1B_8BITS|DMA_DSTC2R_8BITS, MSM_MDP_BASE1 + 0x90000); int hsync_period = LCDC_HSYNC_PULSE_WIDTH_DCLK + LCDC_HSYNC_BACK_PORCH_DCLK + LCDC_FB_WIDTH + LCDC_HSYNC_FRONT_PORCH_DCLK; int vsync_period = (LCDC_VSYNC_PULSE_WIDTH_LINES + LCDC_VSYNC_BACK_PORCH_LINES + LCDC_FB_HEIGHT + LCDC_VSYNC_FRONT_PORCH_LINES) * hsync_period; int hsync_ctrl = (hsync_period << 16) | LCDC_HSYNC_PULSE_WIDTH_DCLK; int hsync_start_x = LCDC_HSYNC_PULSE_WIDTH_DCLK + LCDC_HSYNC_BACK_PORCH_DCLK; int hsync_end_x = hsync_period - LCDC_HSYNC_FRONT_PORCH_DCLK - 1; int display_hctl = (hsync_end_x << 16) | hsync_start_x; int display_vstart= (LCDC_VSYNC_PULSE_WIDTH_LINES + LCDC_VSYNC_BACK_PORCH_LINES) * hsync_period + LCDC_HSYNC_SKEW_DCLK; int display_vend = vsync_period - (LCDC_VSYNC_FRONT_PORCH_LINES * hsync_period) + LCDC_HSYNC_SKEW_DCLK - 1; writel((hsync_period << 16) | LCDC_HSYNC_PULSE_WIDTH_DCLK, MSM_MDP_BASE1 + 0xe0004); writel(vsync_period, MSM_MDP_BASE1 + 0xe0008); writel(LCDC_VSYNC_PULSE_WIDTH_LINES * hsync_period, MSM_MDP_BASE1 + 0xe000c); writel(display_hctl, MSM_MDP_BASE1 + 0xe0010); writel(display_vstart, MSM_MDP_BASE1 + 0xe0014); writel(display_vend, MSM_MDP_BASE1 + 0xe0018); writel(0, MSM_MDP_BASE1 + 0xe0028); writel(0xff, MSM_MDP_BASE1 + 0xe002c); writel(LCDC_HSYNC_SKEW_DCLK, MSM_MDP_BASE1 + 0xe0030); writel(0, MSM_MDP_BASE1 + 0xe0038); writel(0, MSM_MDP_BASE1 + 0xe001c); writel(0, MSM_MDP_BASE1 + 0xe0020); writel(0, MSM_MDP_BASE1 + 0xe0024); writel(1, MSM_MDP_BASE1 + 0xe0000); //clock_enable(MDP_CLK); mdp_clock_init(); //panel_backlight(0); //panel_poweron(); fb_width = LCDC_FB_WIDTH; fb_height = LCDC_FB_HEIGHT; dprintf("panel is %d x %d\n", fb_width, fb_height); FB = LCDC_FB_PHYS; //alloc(2 * fb_width * fb_height); for(n = 0; n < (fb_width * fb_height); n++) FB[n] = 0; gpio_set(32, 1); gpio_dir(32, 1); mdelay(100); gpio_set(20, 1); gpio_dir(20, 1); mdelay(100); gpio_set(155, 1); gpio_dir(155, 1); //gpio_set(61, 1); }
static int msm8974_backlight_on() { static struct pm8x41_wled_data wled_ctrl = { .mod_scheme = 0xC3, .led1_brightness = (0x0F << 8) | 0xEF, .led2_brightness = (0x0F << 8) | 0xEF, .led3_brightness = (0x0F << 8) | 0xEF, .max_duty_cycle = 0x01, }; pm8x41_wled_config(&wled_ctrl); pm8x41_wled_sink_control(1); pm8x41_wled_iled_sync_control(1); pm8x41_wled_enable(1); return 0; } static int msm8974_mdss_dsi_panel_clock(uint8_t enable) { if (enable) { mdp_gdsc_ctrl(enable); mdp_clock_init(); mdss_dsi_uniphy_pll_config(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { // * Add here for continuous splash * mmss_clock_disable(); mdp_clock_disable(); mdp_gdsc_ctrl(enable); } return 0; } /* Pull DISP_RST_N high to get panel out of reset */ static void msm8974_mdss_mipi_panel_reset(uint8_t enable) { struct pm8x41_gpio gpio19_param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_CMOS, .out_strength = PM_GPIO_OUT_DRIVE_MED, }; pm8x41_gpio_config(19, &gpio19_param); if (enable) { gpio_tlmm_config(58, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA, GPIO_DISABLE); pm8x41_gpio_set(19, PM_GPIO_FUNC_HIGH); mdelay(2); pm8x41_gpio_set(19, PM_GPIO_FUNC_LOW); mdelay(5); pm8x41_gpio_set(19, PM_GPIO_FUNC_HIGH); mdelay(2); gpio_set(58, 2); } else { gpio19_param.out_strength = PM_GPIO_OUT_DRIVE_LOW; pm8x41_gpio_config(19, &gpio19_param); pm8x41_gpio_set(19, PM_GPIO_FUNC_LOW); gpio_set(58, 2); } } static int msm8974_mipi_panel_power(uint8_t enable) { if (enable) { /* Enable backlight */ msm8974_backlight_on(); /* Turn on LDO8 for lcd1 mipi vdd */ dprintf(SPEW, " Setting LDO22\n"); pm8x41_ldo_set_voltage("LDO22", 3000000); pm8x41_ldo_control("LDO22", enable); dprintf(SPEW, " Setting LDO12\n"); /* Turn on LDO23 for lcd1 mipi vddio */ pm8x41_ldo_set_voltage("LDO12", 1800000); pm8x41_ldo_control("LDO12", enable); dprintf(SPEW, " Setting LDO2\n"); /* Turn on LDO2 for vdda_mipi_dsi */ pm8x41_ldo_set_voltage("LDO2", 1200000); pm8x41_ldo_control("LDO2", enable); dprintf(SPEW, " Panel Reset \n"); /* Panel Reset */ msm8974_mdss_mipi_panel_reset(enable); dprintf(SPEW, " Panel Reset Done\n"); } else { msm8974_mdss_mipi_panel_reset(enable); pm8x41_wled_enable(enable); pm8x41_ldo_control("LDO2", enable); pm8x41_ldo_control("LDO22", enable); } return 0; } void display_init(void) { uint32_t hw_id = board_hardware_id(); uint32_t soc_ver = board_soc_version(); dprintf(INFO, "display_init(),target_id=%d.\n", hw_id); switch (hw_id) { case HW_PLATFORM_MTP: case HW_PLATFORM_FLUID: case HW_PLATFORM_SURF: mipi_toshiba_video_720p_init(&(panel.panel_info)); panel.clk_func = msm8974_mdss_dsi_panel_clock; panel.power_func = msm8974_mipi_panel_power; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_50; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_enable = 1; }
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); } /* Pull DISP_RST_N high to get panel out of reset */ static void msm8960_mipi_panel_reset(void) { struct pm8921_gpio gpio43_param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_UP_30, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_PAIRED, .inv_int_pol = 0, .disable_pin = 0, }; pm8921_gpio_config(PM_GPIO(43), &gpio43_param); } static int msm8960_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_liquid_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); liquid_mmss_clock_init(); /* 240 MHZ MIPI-DSI clk */ } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_mipi_panel_power(int enable) { if (enable) { msm8960_backlight_on(); /* Turn on LDO8 for lcd1 mipi vdd */ pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V); /* Turn on LDO23 for lcd1 mipi vddio */ pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V); /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_mipi_panel_reset(); } return 0; } #define PM_GPIO_VIN_VPH 0 /* 3v ~ 4.4v */ #define PM_GPIO_VIN_BB 1 /* ~3.3v */ #define PM_GPIO_VIN_S4 2 /* 1.8v */ #define PM_GPIO_VIN_L15 3 static int msm8960_liquid_mipi_panel_power(int enable) { if (enable) { static int gpio17, gpio21, gpio43 ; int rc; struct pm8921_gpio gpio_config = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_NO, .vin_sel = PM_GPIO_VIN_S4, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_NORMAL, .inv_int_pol = 0, .disable_pin = 0, }; /* Note: PWM is controlled by PM-GPIO#24 */ gpio17 = PM_GPIO(17); /* ext_3p3v */ gpio21 = PM_GPIO(21); /* disp power enable_n , vin=VPH-PWR */ gpio43 = PM_GPIO(43); /* Displays Enable (rst_n) */ gpio_config.output_value = 1; rc = pm8921_gpio_config(gpio17, &gpio_config); mdelay(100); gpio_config.output_value = 0; /* disp disable (resx=0) */ rc = pm8921_gpio_config(gpio43, &gpio_config); mdelay(100); gpio_config.output_value = 0; gpio_config.vin_sel = PM_GPIO_VIN_VPH; /* VPH_PWR */ /* disp power enable_n */ rc = pm8921_gpio_config(gpio21, &gpio_config); mdelay(100); gpio_config.output_value = 1; gpio_config.vin_sel = PM_GPIO_VIN_S4; /* disp enable */ rc = pm8921_gpio_config(gpio43, &gpio_config); mdelay(100); pm8921_low_voltage_switch_enable(lvs_4); /* S4 1.8 V */ /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_backlight_on(); } return 0; } void display_init(void) { int target_id = board_target_id(); dprintf(INFO, "display_init(),target_id=%d.\n", target_id); switch (target_id) { case LINUX_MACHTYPE_8960_LIQUID: mipi_chimei_video_wxga_init(&(panel.panel_info)); /* * mipi_chimei_wxga panel not supported yet in LK. * However, MIPI clocks and power should be set in LK. */ panel.clk_func = msm8960_liquid_mipi_panel_clock; panel.power_func = msm8960_liquid_mipi_panel_power; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_CDP: lvds_chimei_wxga_init(&(panel.panel_info)); panel.clk_func = apq8064_lvds_clock; panel.power_func = apq8064_lvds_panel_power; panel.fb.base = 0x80B00000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_MTP: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = fusion3_mtp_clock; panel.power_func = fusion3_mtp_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MTP: case LINUX_MACHTYPE_8960_FLUID: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = msm8960_mipi_panel_clock; panel.power_func = msm8960_mipi_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_42; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_image_on_screen(); display_enable = 1; } void display_shutdown(void) { if (display_enable) msm_display_off(); }