/* Do target specific usb initialization */ void target_usb_init(void) { if(board_target_id() == LINUX_MACHTYPE_8064_LIQUID) { apq8064_ext_3p3V_enable(); } }
int oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, struct msm_panel_info *pinfo, struct mdss_dsi_phy_ctrl *phy_db) { uint32_t hw_id = board_hardware_id(); uint32_t target_id = board_target_id(); int32_t panel_override_id; if (panel_name) { panel_override_id = panel_name_to_id(supp_panels, ARRAY_SIZE(supp_panels), panel_name); if (panel_override_id < 0) { dprintf(CRITICAL, "Not able to search the panel:%s\n", panel_name + strspn(panel_name, " ")); } else if (panel_override_id < UNKNOWN_PANEL) { /* panel override using fastboot oem command */ panel_id = panel_override_id; dprintf(INFO, "OEM panel override:%s\n", panel_name + strspn(panel_name, " ")); goto panel_init; } } switch (target_id) { default: dprintf(CRITICAL, "Display not enabled for %d HW type\n" , hw_id); return PANEL_TYPE_UNKNOWN; } panel_init: return init_panel_data(panelstruct, pinfo, phy_db); }
/* Function to obtain the index information for the correct device tree * based on the platform data. * If a matching device tree is found, the information is returned in the * "dt_entry_info" out parameter and a function value of 0 is returned, otherwise * a non-zero function value is returned. */ int dev_tree_get_entry_info(struct dt_table *table, struct dt_entry *dt_entry_info) { uint32_t target_variant_id; if(board_hardware_id() == HW_PLATFORM_QRD) { target_variant_id = board_target_id(); if (__dev_tree_get_entry_info(table, dt_entry_info, target_variant_id, 0xff) == 0) { return 0; } } /* * for compatible with version 1 and version 2 dtbtool * will compare the subtype inside the variant id */ target_variant_id = board_hardware_id() | ((board_hardware_subtype() & 0xff) << 24); if (__dev_tree_get_entry_info(table, dt_entry_info, target_variant_id, 0xff) == 0) { return 0; } /* * add compatible with old device selection method which don't compare subtype */ target_variant_id = board_hardware_id(); return __dev_tree_get_entry_info(table, dt_entry_info, target_variant_id, 0); }
int oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, struct msm_panel_info *pinfo, struct mdss_dsi_phy_ctrl *phy_db) { uint32_t hw_id = board_hardware_id(); uint32_t target_id = board_target_id(); int32_t panel_override_id; uint32_t manu_id, manu_id0; if (panel_name && panel_name[0]) { panel_override_id = panel_name_to_id(supp_panels, ARRAY_SIZE(supp_panels), panel_name); if (panel_override_id < 0) { dprintf(CRITICAL, "Not able to search the panel:%s\n", panel_name + strspn(panel_name, " ")); } else if (panel_override_id < UNKNOWN_PANEL) { /* panel override using fastboot oem command */ panel_id = panel_override_id; dprintf(INFO, "OEM panel override:%s\n", panel_name + strspn(panel_name, " ")); goto panel_init; } } switch (target_id) { case LINUX_MACHTYPE_8064_MTP: case LINUX_MACHTYPE_8064_MITWO: if (panel_id_detection()) panel_id = HITACHI_720P_CMD_PANEL; else panel_id = SHARP_720P_CMD_PANEL; break; case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MITWOA: panel_manu_id_detection(&manu_id, &manu_id0); if ((manu_id) && (manu_id0)) panel_id = LGD_720P_CMD_PANEL; if ((manu_id)&& !manu_id0) panel_id = AUO_720P_CMD_PANEL; if (manu_id == 0x60 && manu_id0 == 0x141304) panel_id = JDI_720P_CMD_PANEL; else { dprintf(CRITICAL, "Unknown panel\n"); return PANEL_TYPE_UNKNOWN; } break; default: dprintf(CRITICAL, "Display not enabled for %d HW type\n" , hw_id); return PANEL_TYPE_UNKNOWN; } pinfo->early_config = mipi_dsi_cmd_trigger; panel_init: return init_panel_data(panelstruct, pinfo, phy_db); }
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(); }
unsigned board_machtype(void) { return board_target_id(); }
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(); }
void target_init(void) { unsigned base_addr; unsigned char slot; unsigned platform_id = board_platform_id(); dprintf(INFO, "target_init()\n"); pu_reason = target_check_power_on_reason(); reboot_mode = check_reboot_mode(); /* Initialize PMIC driver */ pmic.read = (pm8921_read_func) & pa1_ssbi2_read_bytes; pmic.write = (pm8921_write_func) & pa1_ssbi2_write_bytes; pm8921_init(&pmic); target_shutdown_for_battinfo(); target_shutdown_for_pwrkey(); /* Keypad init */ keys_init(); if((platform_id == MSM8960) || (platform_id == MSM8960AB) || (platform_id == APQ8060AB) || (platform_id == MSM8260AB) || (platform_id == MSM8660AB)) { msm8960_keypad_init(); } else if((platform_id == MSM8230) || (platform_id == MSM8630) || (platform_id == MSM8930) || (platform_id == MSM8230AA) || (platform_id == MSM8630AA) || (platform_id == MSM8930AA)) { msm8930_keypad_init(); } else if((platform_id == APQ8064) || (platform_id == MPQ8064) || (platform_id == APQ8064AB)) { apq8064_keypad_init(); } /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN if (board_target_id() == LINUX_MACHTYPE_8960_CDP || (board_target_id() == LINUX_MACHTYPE_8960_MITWOA)) panel_backlight_on_mitwoa(0); display_init(); dprintf(INFO, "Diplay initialized\n"); mdelay(34); if (board_target_id() == LINUX_MACHTYPE_8064_MITWO || (board_target_id() == LINUX_MACHTYPE_8064_MTP)) panel_backlight_on_mitwo(1); else panel_backlight_on_mitwoa(1); #endif if ((platform_id == MSM8960) || (platform_id == MSM8960AB) || (platform_id == APQ8060AB) || (platform_id == MSM8260AB) || (platform_id == MSM8660AB) || (platform_id == MSM8660A) || (platform_id == MSM8260A) || (platform_id == APQ8060A)) /* Enable Hardware CE */ platform_ce_type = CRYPTO_ENGINE_TYPE_HW; /* Trying Slot 1 first */ slot = 1; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { /* Trying Slot 3 next */ slot = 3; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } } }