void target_init(void)
{
	dprintf(INFO, "target_init()\n");

	spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);

	/* Save PM8941 version info. */
	pmic_ver = pm8x41_get_pmic_rev();

	target_keystatus();

	if (target_use_signed_kernel())
		target_crypto_init_params();
	/* Display splash screen if enabled */
#if DISPLAY_SPLASH_SCREEN
	dprintf(INFO, "Display Init: Start\n");
	if (board_hardware_subtype() != HW_PLATFORM_SUBTYPE_CDP_INTERPOSER)
	{
		display_init();
	}
	dprintf(INFO, "Display Init: Done\n");
#endif

	/*
	 * Set drive strength & pull ctrl for
	 * emmc
	 */
	set_sdc_power_ctrl();

#if MMC_SDHCI_SUPPORT
	target_mmc_sdhci_init();
#else
	target_mmc_mci_init();
#endif
}
Exemple #2
0
void target_display_init(const char *panel_name)
{
        uint32_t panel_loop = 0;
        int32_t ret = 0;
	uint32_t fb_addr = MIPI_FB_ADDR;

	if ((!strcmp(panel_name, NO_PANEL_CONFIG))
			|| (!strcmp(panel_name, SIM_VIDEO_PANEL))) {
		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
								panel_name);
		return;
	}

	if (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_QVGA)
		fb_addr = MIPI_FB_ADDR_QVGA;

	do {
		target_force_cont_splash_disable(false);
		ret = gcdb_display_init(panel_name, MDP_REV_50, (void *) fb_addr);
		if (!ret || ret == ERR_NOT_SUPPORTED) {
			break;
		} else {
			target_force_cont_splash_disable(true);
			msm_display_off();
		}
	} while (++panel_loop <= oem_panel_max_auto_detect_panels());

}
Exemple #3
0
/* 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);
}
uint8_t target_panel_auto_detect_enabled()
{
	uint8_t ret = 0;
	uint32_t hw_subtype = board_hardware_subtype();

	switch(board_hardware_id()) {
	case HW_PLATFORM_SURF:
	case HW_PLATFORM_MTP:
		ret = 1;
		break;
	default:
		ret = 0;
		break;
	}
	return ret;
}
int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq,
						struct msm_panel_info *pinfo)
{
	int ret = NO_ERROR;
	uint32_t hw_id = board_hardware_id();
	uint32_t hw_subtype = board_hardware_subtype();

	if (enable) {
		if (pinfo->mipi.use_enable_gpio) {
			gpio_tlmm_config(enable_gpio.pin_id, 0,
				enable_gpio.pin_direction, enable_gpio.pin_pull,
				enable_gpio.pin_strength,
				enable_gpio.pin_state);

			gpio_set_dir(enable_gpio.pin_id, 2);
		}

		if (platform_is_msm8939()) {
			if ((hw_id == HW_PLATFORM_QRD) &&
				 (hw_subtype == HW_PLATFORM_SUBTYPE_SKUK))
				target_panel_reset_skuk(enable);
		} else { /* msm8916 */
			if ((hw_id == HW_PLATFORM_QRD) &&
				 (hw_subtype == HW_PLATFORM_SUBTYPE_SKUH))
				target_panel_reset_skuh(enable);
		}

		if (hw_id == HW_PLATFORM_MTP || hw_id == HW_PLATFORM_SURF) {
			/* configure backlight gpio for MTP & CDP */
			gpio_tlmm_config(bkl_gpio.pin_id, 0,
				bkl_gpio.pin_direction, bkl_gpio.pin_pull,
				bkl_gpio.pin_strength, bkl_gpio.pin_state);
			gpio_set_dir(bkl_gpio.pin_id, 2);
		}

		gpio_tlmm_config(reset_gpio.pin_id, 0,
				reset_gpio.pin_direction, reset_gpio.pin_pull,
				reset_gpio.pin_strength, reset_gpio.pin_state);

		gpio_set_dir(reset_gpio.pin_id, 2);

		/* reset */
		for (int i = 0; i < RESET_GPIO_SEQ_LEN; i++) {
			if (resetseq->pin_state[i] == GPIO_STATE_LOW)
				gpio_set_dir(reset_gpio.pin_id, GPIO_STATE_LOW);
			else
				gpio_set_dir(reset_gpio.pin_id, GPIO_STATE_HIGH);
			mdelay(resetseq->sleep[i]);
		}
	} else if(!target_cont_splash_screen()) {
		gpio_set_dir(reset_gpio.pin_id, 0);
		if (pinfo->mipi.use_enable_gpio)
			gpio_set_dir(enable_gpio.pin_id, 0);

		if (platform_is_msm8939()) {
			if ((hw_id == HW_PLATFORM_QRD) &&
				 (hw_subtype == HW_PLATFORM_SUBTYPE_SKUK))
				target_panel_reset_skuk(enable);
		} else { /* msm8916 */
			if ((hw_id == HW_PLATFORM_QRD) &&
				 (hw_subtype == HW_PLATFORM_SUBTYPE_SKUH))
				target_panel_reset_skuh(enable);
		}
	}

	return ret;
}
Exemple #6
0
uint32_t target_hw_interposer()
{
	return board_hardware_subtype() == HW_PLATFORM_8994_INTERPOSER ? 1 : 0;
}
Exemple #7
0
static int __dev_tree_get_entry_info(struct dt_table *table, struct dt_entry *dt_entry_info,
										uint32_t target_variant_id, uint32_t subtype_mask)
{
	uint32_t i;
	unsigned char *table_ptr;
	struct dt_entry dt_entry_buf_1;
	struct dt_entry dt_entry_buf_2;
	struct dt_entry *cur_dt_entry;
	struct dt_entry *best_match_dt_entry;
	struct dt_entry_v1 *dt_entry_v1;
	uint32_t found = 0;

	if (!dt_entry_info) {
		dprintf(CRITICAL, "ERROR: Bad parameter passed to %s \n",
				__func__);
		return -1;
	}

	table_ptr = (unsigned char *)table + DEV_TREE_HEADER_SIZE;
	cur_dt_entry = &dt_entry_buf_1;
	best_match_dt_entry = NULL;

	for(i = 0; found == 0 && i < table->num_entries; i++)
	{
		memset(cur_dt_entry, 0, sizeof(struct dt_entry));
		switch(table->version) {
		case DEV_TREE_VERSION_V1:
			dt_entry_v1 = (struct dt_entry_v1 *)table_ptr;
			cur_dt_entry->platform_id = dt_entry_v1->platform_id;
			cur_dt_entry->variant_id = dt_entry_v1->variant_id;
			cur_dt_entry->soc_rev = dt_entry_v1->soc_rev;
			cur_dt_entry->board_hw_subtype = board_hardware_subtype();
			cur_dt_entry->offset = dt_entry_v1->offset;
			cur_dt_entry->size = dt_entry_v1->size;
			table_ptr += sizeof(struct dt_entry_v1);
			break;
		case DEV_TREE_VERSION_V2:
			memcpy(cur_dt_entry, (struct dt_entry *)table_ptr,
				   sizeof(struct dt_entry));
			table_ptr += sizeof(struct dt_entry);
			break;
		default:
			dprintf(CRITICAL, "ERROR: Unsupported version (%d) in DT table \n",
					table->version);
			return -1;
		}

		/* DTBs are stored in the ascending order of soc revision.
		 * For eg: Rev0..Rev1..Rev2 & so on.
		 * we pickup the DTB with highest soc rev number which is less
		 * than or equal to actual hardware
		 */
		switch(platform_dt_match(cur_dt_entry, target_variant_id, subtype_mask)) {
		case 0:
			best_match_dt_entry = cur_dt_entry;
			found = 1;
			break;
		case -1:
			if (!best_match_dt_entry) {
				/* copy structure */
				best_match_dt_entry = cur_dt_entry;
				cur_dt_entry = &dt_entry_buf_2;
			} else {
				/* Swap dt_entry buffers */
				struct dt_entry *temp = cur_dt_entry;
				cur_dt_entry = best_match_dt_entry;
				best_match_dt_entry = temp;
			}
		default:
			break;
		}
	}

	if (best_match_dt_entry) {
		*dt_entry_info = *best_match_dt_entry;
		found = 1;
	}

	if (found != 0) {
		dprintf(INFO, "Using DTB entry %u/%08x/%u/%u for device %u/%08x/%u/%u\n",
				dt_entry_info->platform_id, dt_entry_info->soc_rev,
				dt_entry_info->variant_id, dt_entry_info->board_hw_subtype,
				board_platform_id(), board_soc_version(),
				board_hardware_id(), board_hardware_subtype());
		return 0;
	}

	dprintf(CRITICAL, "ERROR: Unable to find suitable device tree for device (%u/0x%08x/%u/%u)\n",
			board_platform_id(), board_soc_version(),
			board_hardware_id(), board_hardware_subtype());
	return -1;
}