void __init msm_htc_8974_init_gpiomux(void)
{
	int rc;

	rc = msm_gpiomux_init_dt();
	if (rc) {
		pr_err("%s failed %d\n", __func__, rc);
		return;
	}

	msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
	msm_gpiomux_install(msm_blsp2_uart7_configs,
			 ARRAY_SIZE(msm_blsp2_uart7_configs));
	msm_gpiomux_install(wcnss_5wire_interface,
				ARRAY_SIZE(wcnss_5wire_interface));

	msm_gpiomux_install(msm8974_slimbus_config,
			ARRAY_SIZE(msm8974_slimbus_config));

	msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));

	msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));

    	
    	if (of_machine_pid() == MEC_DWGL_PID || of_machine_pid() == MEC_TL_PID || of_machine_pid() == MEC_DUGL_PID)
        	msm_gpiomux_install(msm_sensor_configs_china_sku, ARRAY_SIZE(msm_sensor_configs_china_sku));
    	else
        	msm_gpiomux_install(msm_sensor_configs_non_china_sku, ARRAY_SIZE(msm_sensor_configs_non_china_sku));

	msm_gpiomux_install(&nfc_irq_config, 1);

	msm_gpiomux_install(&sd_card_det, 1);

	msm_gpiomux_sdc4_install();

	msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));

	msm_gpiomux_install_nowrite(msm_lcd_configs,
			ARRAY_SIZE(msm_lcd_configs));

	msm_gpiomux_install(msm_aud_configs,
				 ARRAY_SIZE(msm_aud_configs));

	msm_gpiomux_install(msm_cir_configs, ARRAY_SIZE(msm_cir_configs));

	if (of_machine_pid() == 268)
		msm_gpiomux_install(msm_felica_configs, ARRAY_SIZE(msm_felica_configs));

	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_MDM)
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

	msm_gpiomux_install(msm_blsp_rawchip_spi_configs, ARRAY_SIZE(msm_blsp_rawchip_spi_configs));

}
void __init htc_8226_init(void)
{
	struct of_dev_auxdata *adata = htc_8226_auxdata_lookup;
	printk(KERN_INFO"[htc_8226_init]: Test to see htc_8226_init()\n");

	if (socinfo_init() < 0)
		pr_err("%s: socinfo_init() failed\n", __func__);

	pr_info("%s: pid=%d, pcbid=%d, socver=0x%x\n", __func__
		, of_machine_pid(), of_machine_pcbid(), of_machine_socver());

#ifdef CONFIG_BT
	bt_export_bd_address();
#endif
	msm8226_htc_init_gpiomux();
	board_dt_populate(adata);
	htc_8226_add_drivers();
#ifdef CONFIG_HTC_BUILD_EDIAG
	platform_device_register(&android_pmem_ediag_device);
	platform_device_register(&android_pmem_ediag1_device);
	platform_device_register(&android_pmem_ediag2_device);
	platform_device_register(&android_pmem_ediag3_device);
#endif
#ifdef CONFIG_PERFLOCK
	platform_device_register(&msm8226_device_perf_lock);
#endif
#ifdef CONFIG_HTC_POWER_DEBUG
	htc_monitor_init();
#endif
}
void __init htc_8974_init(void)
{
	struct of_dev_auxdata *adata = htc_8974_auxdata_lookup;

	if (socinfo_init() < 0)
		pr_err("%s: socinfo_init() failed\n", __func__);

	pr_info("%s: pid=%d, pcbid=%d, socver=0x%x\n", __func__
		, of_machine_pid(), of_machine_pcbid(), of_machine_socver());

	msm_htc_8974_init_gpiomux();
	regulator_has_full_constraints();
	board_dt_populate(adata);
	htc_8974_add_drivers();
#ifdef CONFIG_HTC_BUILD_EDIAG
	platform_device_register(&android_pmem_ediag_device);
	platform_device_register(&android_pmem_ediag1_device);
	platform_device_register(&android_pmem_ediag2_device);
	platform_device_register(&android_pmem_ediag3_device);
#endif
#ifdef CONFIG_BT
	bt_export_bd_address();
#endif
#ifdef CONFIG_HTC_POWER_DEBUG
	htc_monitor_init();
#endif
}
static void __init htc_8916_init(void)
{
	struct of_dev_auxdata *adata = htc_8916_auxdata_lookup;

	of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
	msm_smem_init();

	if (socinfo_init() < 0)
		pr_err("%s: socinfo_init() failed\n", __func__);

       pr_info("%s: pid=%d, pcbid=0x%X, subtype=0x%X, socver=0x%X\n", __func__
               , of_machine_pid(), of_machine_pcbid(), of_machine_subtype(), of_machine_socver());

	htc_8916_add_drivers();

#ifdef CONFIG_HTC_POWER_DEBUG
        htc_monitor_init();
#endif

#ifdef CONFIG_BT
	bt_export_bd_address();
#endif
#ifdef CONFIG_PERFLOCK
	platform_device_register(&msm8916_device_perf_lock);
#endif
}
static int uncertain_support_dual_flashlight(void)
{
	int pid = of_machine_pid();
	int pcbid = of_machine_pcbid();
	FLT_INFO_LOG("pid=%d, pcbid=%d.\r\n", pid, pcbid);

	/*
	 * Which hardware version of sku starts to support dual flashlight
	 */

	/* m8ul: xe */
	if ( pid == 271 || pid == 272 || pid == 280 || pid == 286 )
	{
		if ( pcbid>=4 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* m8att: xe */
	if ( pid == 273 )
	{
		if ( pcbid>=4 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* m8wl: xd */
	if ( pid == 266 )
	{
		if ( pcbid>=3 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* m8ct: xb */
	if ( pid == 269 )
	{
		if ( pcbid>=1 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* m8whl: xd */
	if ( pid == 267 )
	{
		if ( pcbid>=3 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* m8tl: xb */
	if ( pid == 281 )
	{
		if ( pcbid>=1 || pcbid<0 ) return 1;
		else                       return 0;
	}

	/* default supporting dual flashlight */
	return 1;
}
static int uncertain_support_dual_flashlight(void)
{
	int pid = of_machine_pid();
	int pcbid = of_machine_pcbid();
	FLT_INFO_LOG("pid=%d, pcbid=%d.\r\n", pid, pcbid);


	
	if ( pid == 271 || pid == 272 || pid == 280 || pid == 286 )
	{
		if ( pcbid>=4 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	if ( pid == 273 )
	{
		if ( pcbid>=4 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	if ( pid == 266 )
	{
		if ( pcbid>=3 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	if ( pid == 269 )
	{
		if ( pcbid>=1 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	if ( pid == 267 )
	{
		if ( pcbid>=3 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	if ( pid == 281 )
	{
		if ( pcbid>=1 || pcbid<0 ) return 1;
		else                       return 0;
	}

	
	return 1;
}
void __init msm_htc_8974_init_gpiomux(void)
{
	switch(of_machine_pid()) {
		case GLU2_U:
		case GLU2_UL:
		case GLU2_WLJ:
			pr_info("glu2_init_gpiomux()\n");
			glu2_init_gpiomux();
			break;
		default:
			pr_info("glu_init_gpiomux()\n");
			glu_init_gpiomux();
			break;
	};
}
void __init msm_htc_8974_init_gpiomux(void)
{
	int rc;

	rc = msm_gpiomux_init_dt();
	if (rc) {
		pr_err("%s failed %d\n", __func__, rc);
		return;
	}

	msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
	msm_gpiomux_install(msm_blsp2_uart7_configs,
			 ARRAY_SIZE(msm_blsp2_uart7_configs));
	msm_gpiomux_install(wcnss_5wire_interface,
				ARRAY_SIZE(wcnss_5wire_interface));

	msm_gpiomux_install(msm8974_slimbus_config,
			ARRAY_SIZE(msm8974_slimbus_config));

	msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));

	msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
	msm_gpiomux_install(msm_sensor_configs_non_common, ARRAY_SIZE(msm_sensor_configs_non_common));

    //For china sku, GPIO 132 is for front cam ID, for non-china sku, GPIO 117 is for front cam ID
    if (of_machine_pid() == m8_TL_PID || of_machine_pid() == m8_DUG_PID || of_machine_pid() == m8_DUGL_PID || of_machine_pid() == m8_DWG_PID || of_machine_pid() == m8_DWGL_PID || of_machine_pid() == m8_UHL_PID)
        msm_gpiomux_install(msm_sensor_configs_china_sku, ARRAY_SIZE(msm_sensor_configs_china_sku));
    else
        msm_gpiomux_install(msm_sensor_configs_non_china_sku, ARRAY_SIZE(msm_sensor_configs_non_china_sku));

	msm_gpiomux_install(&nfc_irq_config, 1);

	msm_gpiomux_install(&sd_card_det, 1);

	msm_gpiomux_sdc4_install();

	msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));

	msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));

	msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
	msm_gpiomux_install(msm_mhl_configs, ARRAY_SIZE(msm_mhl_configs));

	msm_gpiomux_install_nowrite(msm_lcd_configs,
			ARRAY_SIZE(msm_lcd_configs));

	msm_gpiomux_install(msm_aud_configs,
				 ARRAY_SIZE(msm_aud_configs));

	msm_gpiomux_install(msm_aud_spk_china_configs, ARRAY_SIZE(msm_aud_spk_china_configs));

	msm_gpiomux_install(msm_cir_configs, ARRAY_SIZE(msm_cir_configs));

	if (of_machine_pid() == 268 || of_board_is_m8wlj())
		msm_gpiomux_install(msm_felica_configs, ARRAY_SIZE(msm_felica_configs));

	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_MDM)
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

	msm_gpiomux_install(msm_blsp_rawchip_spi_configs, ARRAY_SIZE(msm_blsp_rawchip_spi_configs));

}
Exemple #9
0
void __init msm_8974_init_gpiomux(void)
{
	int rc;

	rc = msm_gpiomux_init_dt();
	if (rc) {
		pr_err("%s failed %d\n", __func__, rc);
		return;
	}

	pr_err("%s:%d socinfo_get_version %x\n", __func__, __LINE__,
		socinfo_get_version());
	if (socinfo_get_version() >= 0x20000)
		msm_tlmm_misc_reg_write(TLMM_SPARE_REG, 0xf);

	msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
	msm_gpiomux_install(msm_blsp2_uart7_configs,
			 ARRAY_SIZE(msm_blsp2_uart7_configs));
	msm_gpiomux_install(wcnss_5wire_interface,
				ARRAY_SIZE(wcnss_5wire_interface));
	if (of_board_is_liquid())
		msm_gpiomux_install_nowrite(ath_gpio_configs,
					ARRAY_SIZE(ath_gpio_configs));
	msm_gpiomux_install(msm8974_slimbus_config,
			ARRAY_SIZE(msm8974_slimbus_config));

	msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));

	if (of_board_is_dragonboard() && machine_is_apq8074())
		msm_gpiomux_install(msm_sensor_configs_dragonboard, \
				ARRAY_SIZE(msm_sensor_configs_dragonboard));
	else
		msm_gpiomux_install(msm_sensor_configs, \
				ARRAY_SIZE(msm_sensor_configs));

	msm_gpiomux_install(&sd_card_det, 1);

	if (machine_is_apq8074() && (of_board_is_liquid() || \
	    of_board_is_dragonboard()))
		msm_gpiomux_sdc3_install();

	if (!(of_board_is_dragonboard() && machine_is_apq8074()))
		msm_gpiomux_sdc4_install();

	msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));

	msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
	msm_gpiomux_install(msm_hsic_hub_configs,
				ARRAY_SIZE(msm_hsic_hub_configs));

	msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
	if (of_board_is_fluid())
		msm_gpiomux_install(msm_mhl_configs,
				    ARRAY_SIZE(msm_mhl_configs));

	if (of_board_is_liquid() ||
	    (of_board_is_dragonboard() && machine_is_apq8074()))
		msm_gpiomux_install(msm8974_pri_ter_auxpcm_configs,
				 ARRAY_SIZE(msm8974_pri_ter_auxpcm_configs));
	else
		msm_gpiomux_install(msm8974_pri_pri_auxpcm_configs,
				 ARRAY_SIZE(msm8974_pri_pri_auxpcm_configs));

	if (of_board_is_cdp())
		msm_gpiomux_install(msm8974_sec_auxpcm_configs,
				 ARRAY_SIZE(msm8974_sec_auxpcm_configs));
	else if (of_board_is_liquid() || of_board_is_fluid() ||
						of_board_is_mtp())
		msm_gpiomux_install(msm_epm_configs,
				ARRAY_SIZE(msm_epm_configs));

	msm_gpiomux_install_nowrite(msm_lcd_configs,
			ARRAY_SIZE(msm_lcd_configs));

	if (of_board_is_rumi())
		msm_gpiomux_install(msm_rumi_blsp_configs,
				    ARRAY_SIZE(msm_rumi_blsp_configs));

	msm_gpiomux_install(msm_cir_configs, ARRAY_SIZE(msm_cir_configs));

	if (of_machine_pid() == 268)
		msm_gpiomux_install(msm_felica_configs, ARRAY_SIZE(msm_felica_configs));

	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_MDM)
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

	if (of_board_is_dragonboard() && machine_is_apq8074())
		msm_gpiomux_install(apq8074_dragonboard_ts_config,
			ARRAY_SIZE(apq8074_dragonboard_ts_config));
}