Exemplo n.º 1
0
static void msm8960_ext_spk_power_amp_off(u32 spk)
{
	if (spk & (SPK_AMP_POS | SPK_AMP_NEG)) {
		if (!msm8930_ext_spk_pamp)
			return;

		if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
			gpio_free(LEFT_SPKR_AMPL_GPIO);
			msm8930_ext_spk_pamp = 0;
			return;
		}

		if (machine_is_msm8930_mtp()
			|| machine_is_msm8930_fluid()) {
			pr_debug("%s: Free speaker boost gpio %u\n",
					__func__, SPKR_BOOST_GPIO);
			gpio_direction_output(SPKR_BOOST_GPIO, 0);
			gpio_free(SPKR_BOOST_GPIO);
		}

		pm8xxx_spk_enable(MSM8930_SPK_OFF);
		msm8930_ext_spk_pamp = 0;
		pr_debug("%s: slepping 10 ms after turning on external "
			" Left Speaker Ampl\n", __func__);
		usleep_range(10000, 10000);

	} else  {

		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
			__func__, spk);
		return;
	}
}
Exemplo n.º 2
0
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

#if 0
	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
		return sglte8930_init_gpiomux();
#endif

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
	if (machine_is_msm8930_fluid())
		msm_gpiomux_install(msm8930_mhl_configs,
				ARRAY_SIZE(msm8930_mhl_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));

	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));
	return 0;
}
Exemplo n.º 3
0
static void msm8960_ext_spk_power_amp_off(u32 spk)
{
	// int ret = 0; // chenjun
	if (spk & (SPK_AMP_POS | SPK_AMP_NEG)) {
		if (!msm8930_ext_spk_pamp)
			return;

#if 0
		if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
			gpio_free(LEFT_SPKR_AMPL_GPIO);
			msm8930_ext_spk_pamp = 0;
			return;
		}

		if (machine_is_msm8930_mtp()
			|| machine_is_msm8930_fluid()) {
			pr_debug("%s: Free speaker boost gpio %u\n",
					__func__, SPKR_BOOST_GPIO);
			gpio_direction_output(SPKR_BOOST_GPIO, 0);
			gpio_free(SPKR_BOOST_GPIO);
		} else if (socinfo_get_platform_subtype() ==
				PLATFORM_SUBTYPE_SGLTE) {
			ret = pm8xxx_gpio_config(spkr_boost_enable_gpio,
						&SPKR_OFF);
			if (ret) {
				pr_err("%s: Failure: spkr boost gpio OFF %u\n",
				  __func__, spkr_boost_enable_gpio);
				return;
			} else {
				pr_debug("%s:Config PMIC8038 gpio for speaker" \
				" OFF successfully\n", __func__);
			}
		}

		pm8xxx_spk_enable(MSM8930_SPK_OFF);
#else
// chenjun:gpio 14 and 19 are used for speaker amplifier

			gpio_direction_output(YDA_SPKR_EN0_GPIO, 0);
			gpio_free(YDA_SPKR_EN0_GPIO);
			pr_err("chenjun:%s:disable SPKR EN0(%d)\n",
			            __func__, YDA_SPKR_EN0_GPIO);

			gpio_direction_output(YDA_SPKR_EN1_GPIO, 0);
			gpio_free(YDA_SPKR_EN1_GPIO);
			pr_err("chenjun:%s:disable SPKR EN1(%d)\n",
			            __func__, YDA_SPKR_EN1_GPIO);
#endif
		msm8930_ext_spk_pamp = 0;
		pr_debug("%s: slepping 4 ms after turning on external "
			" Left Speaker Ampl\n", __func__);
		usleep_range(4000, 4000);

	} else  {

		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
			__func__, spk);
		return;
	}
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));

	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	if (system_rev == 0) {
	
#if 0 
		msm_gpiomux_install(msm8960_i2s_tx_configs,
			ARRAY_SIZE(msm8960_i2s_tx_configs));
#endif
	} else {
	
#if 0 
		msm_gpiomux_install(msm8960_i2s_XB_tx_configs,
			ARRAY_SIZE(msm8960_i2s_XB_tx_configs));
#endif
		msm_gpiomux_install(msm8960_mi2s_configs,
			ARRAY_SIZE(msm8960_mi2s_configs));
	}
	msm_gpiomux_install(msm8960_wcd_reset_configs, ARRAY_SIZE(msm8960_wcd_reset_configs));

	msm_gpiomux_install(msm8960_audio_auxpcm_configs,
			ARRAY_SIZE(msm8960_audio_auxpcm_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}


	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));
	return 0;
}
Exemplo n.º 5
0
static void msm8960_ext_spk_power_amp_on(u32 spk)
{
	int ret = 0;

	if (spk & (SPK_AMP_POS | SPK_AMP_NEG)) {
		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			pr_debug("%s() External Bottom Speaker Ampl already "
				"turned on. spk = 0x%08x\n", __func__, spk);
			return;
		}

		msm8930_ext_spk_pamp |= spk;

		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
				ret = msm8930_cfg_spkr_gpio(
						LEFT_SPKR_AMPL_GPIO,
						1, "LEFT_SPKR_AMPL");
				if (ret) {
					pr_err("%s: Failed to config ampl gpio %u\n",
						__func__, LEFT_SPKR_AMPL_GPIO);
					return;
				}
			} else {

				if (machine_is_msm8930_mtp()
					|| machine_is_msm8930_fluid()) {
					ret = msm8930_cfg_spkr_gpio(
					  SPKR_BOOST_GPIO, 1, "SPKR_BOOST");
					if (ret) {
						pr_err("%s: Failure: spkr boost gpio %u\n",
						  __func__, SPKR_BOOST_GPIO);
						return;
					}
				}
				pm8xxx_spk_enable(MSM8930_SPK_ON);
			}

			pr_debug("%s: sleeping 10 ms after turning on external "
				" Left Speaker Ampl\n", __func__);
			usleep_range(10000, 10000);
		}

	} else  {

		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
			__func__, spk);
		return;
	}
}
Exemplo n.º 6
0
static void msm8960_ext_spk_power_amp_on(u32 spk)
{
	int ret = 0;

	if (spk & (SPK_AMP_POS | SPK_AMP_NEG)) {
		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			pr_debug("%s() External Bottom Speaker Ampl already "
				"turned on. spk = 0x%08x\n", __func__, spk);
			return;
		}

		msm8930_ext_spk_pamp |= spk;

		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			if (machine_is_msm8930_mtp()
				|| machine_is_msm8930_fluid()) {
				pr_debug("%s: Configure Speaker Boost GPIO %u",
						__func__, SPKR_BOOST_GPIO);
				ret = gpio_request(SPKR_BOOST_GPIO,
								   "SPKR_BOOST_EN");
				if (ret) {
					pr_err("%s: Failed to configure speaker boost "
					"gpio %u\n", __func__, SPKR_BOOST_GPIO);
					return;
				}

				pr_debug("%s: Enable Speaker boost gpio %u\n",
					__func__, SPKR_BOOST_GPIO);
				gpio_direction_output(SPKR_BOOST_GPIO, 1);
			}

			pm8xxx_spk_enable(MSM8930_SPK_ON);
			pr_debug("%s: slepping 4 ms after turning on external "
				" Left Speaker Ampl\n", __func__);
			usleep_range(4000, 4000);
		}

	} else  {

		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
			__func__, spk);
		return;
	}
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));

#ifdef CONFIG_2MIC_ES305
	msm_gpiomux_install(audience_suspend_configs,
		ARRAY_SIZE(audience_suspend_configs));
#endif

#ifdef CONFIG_SLIMBUS_MSM_CTRL
	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));
#else

	if (system_rev < CLK_REVISION) {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs_rev10));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs_rev10));
	} else {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs));
	}
#endif

	msm_gpiomux_install(msm8960_audio_spkr_configs,
			ARRAY_SIZE(msm8960_audio_spkr_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
		msm_gpiomux_install(hap_lvl_shft_config,
			ARRAY_SIZE(hap_lvl_shft_config));
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
#endif
#if defined(CONFIG_VIDEO_MHL_V2)
		msm_gpiomux_install(msm8930_mhl_configs,
				ARRAY_SIZE(msm8930_mhl_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));
	msm_gpiomux_install(gpio_keys_config_mux,
			ARRAY_SIZE(gpio_keys_config_mux));

#ifdef CONFIG_USB_SWITCH_FSA9485
	msm_gpiomux_install(msm8960_fsa9485_configs,
			ARRAY_SIZE(msm8960_fsa9485_configs));
#endif
	msm_gpiomux_install(msm8930_leds_configs,
			ARRAY_SIZE(msm8930_leds_configs));

	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));
	return 0;
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));

#ifdef CONFIG_2MIC_ES305
	msm_gpiomux_install(audience_suspend_configs,
		ARRAY_SIZE(audience_suspend_configs));
#endif
#ifdef CONFIG_SLIMBUS_MSM_CTRL
	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));
#else

	if (system_rev < CLK_REVISION) {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs_rev10));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs_rev10));
	} else {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs));
	}
#endif
	msm_gpiomux_install(msm8960_audio_spkr_configs,
			ARRAY_SIZE(msm8960_audio_spkr_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
#endif
#if defined(CONFIG_VIDEO_MHL_V2)
			msm_gpiomux_install(msm8930_mhl_configs,
					ARRAY_SIZE(msm8930_mhl_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));
	msm_gpiomux_install(gpio_keys_config_mux,
			ARRAY_SIZE(gpio_keys_config_mux));

#ifdef CONFIG_USB_SWITCH_TSU6721
	msm_gpiomux_install(msm8930_tsu6721_configs,
			ARRAY_SIZE(msm8930_tsu6721_configs));
#endif
#if defined(CONFIG_LEDS_AN30259A)
	msm_gpiomux_install(msm8930_leds_configs,
			ARRAY_SIZE(msm8930_leds_configs));
#endif

#if defined(CONFIG_MACH_CRATER)
	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));
#endif

#if defined(CONFIG_MACH_SERRANO_EUR_LTE) || defined(CONFIG_MACH_SERRANO_EUR_3G)  || defined(CONFIG_MACH_SERRANO_ATT) || defined(CONFIG_MACH_SERRANO_SPR) || defined(CONFIG_MACH_SERRANO_VZW) || defined(CONFIG_MACH_SERRANO_USC) || defined(CONFIG_MACH_SERRANO_LRA)
	msm_gpiomux_install(nc_configs, ARRAY_SIZE(nc_configs));
#endif

#if defined(CONFIG_MACH_SERRANO_EUR_LTE) || defined(CONFIG_MACH_SERRANO_ATT) || defined(CONFIG_MACH_SERRANO_SPR) || defined(CONFIG_MACH_SERRANO_VZW) || defined(CONFIG_MACH_SERRANO_USC) || defined(CONFIG_MACH_SERRANO_LRA)
	msm_gpiomux_install(msm8930_nfc_enable_config,ARRAY_SIZE(msm8930_nfc_enable_config));
#endif
	if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
		msm_gpiomux_install(msm8930_gyro_int_config,
			ARRAY_SIZE(msm8930_gyro_int_config));

	msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));

	return 0;
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));

	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));

	msm_gpiomux_install(msm8960_audio_spkr_configs,
			ARRAY_SIZE(msm8960_audio_spkr_configs));

	msm_gpiomux_install(msm8960_audio_auxpcm_configs,
			ARRAY_SIZE(msm8960_audio_auxpcm_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
		msm_gpiomux_install(hap_lvl_shft_config,
			ARRAY_SIZE(hap_lvl_shft_config));
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

	if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
		|| machine_is_msm8930_fluid())
		msm_gpiomux_install(msm8930_haptics_configs,
			ARRAY_SIZE(msm8930_haptics_configs));

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));

	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));

	return 0;
}
Exemplo n.º 10
0
static void msm8960_ext_spk_power_amp_on(u32 spk)
{
	int ret = 0;

	if (spk & (SPK_AMP_POS | SPK_AMP_NEG)) {
		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			pr_debug("%s() External Bottom Speaker Ampl already "
				"turned on. spk = 0x%08x\n", __func__, spk);
			return;
		}

		msm8930_ext_spk_pamp |= spk;

		if ((msm8930_ext_spk_pamp & SPK_AMP_POS) &&
			(msm8930_ext_spk_pamp & SPK_AMP_NEG)) {

			if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
				ret = msm8930_cfg_spkr_gpio(
						LEFT_SPKR_AMPL_GPIO,
						1, "LEFT_SPKR_AMPL");
				if (ret) {
					pr_err("%s: Failed to config ampl gpio %u\n",
						__func__, LEFT_SPKR_AMPL_GPIO);
					return;
				}
			} else {

				if (machine_is_msm8930_mtp()
					|| machine_is_msm8930_fluid()) {
					ret = msm8930_cfg_spkr_gpio(
					  SPKR_BOOST_GPIO, 1, "SPKR_BOOST");
					if (ret) {
						pr_err("%s: Failure: spkr boost gpio %u\n",
						  __func__, SPKR_BOOST_GPIO);
						return;
					}
				} else if (socinfo_get_platform_subtype() ==
						PLATFORM_SUBTYPE_SGLTE) {
					ret = pm8xxx_gpio_config(
							spkr_boost_enable_gpio,
							&SPKR_ON);
					if (ret) {
						pr_err("%s: Failure: spkr" \
							"boost gpio ON %u\n",
						  __func__, spkr_boost_enable_gpio);
						return;
					} else {
						pr_debug("%s:Config PMIC8038" \
					"gpio for speaker ON successfully\n",
						__func__);
					}
				}
				pm8xxx_spk_enable(MSM8930_SPK_ON);
			}

			pr_debug("%s: slepping 4 ms after turning on external "
				" Left Speaker Ampl\n", __func__);
			usleep_range(4000, 4000);
		}

	} else  {

		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
			__func__, spk);
		return;
	}
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

/*
#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif
*/
	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));

	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));

	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

//HTC_AUD ++
	if (system_rev == 0) {
	/* XA board */
		msm_gpiomux_install(msm8960_i2s_tx_configs,
			ARRAY_SIZE(msm8960_i2s_tx_configs));
	} else {
	/* XB board */
		msm_gpiomux_install(msm8960_i2s_XB_tx_configs,
			ARRAY_SIZE(msm8960_i2s_XB_tx_configs));
		msm_gpiomux_install(msm8960_mi2s_configs,
			ARRAY_SIZE(msm8960_mi2s_configs));
	}
	msm_gpiomux_install(msm8960_wcd_reset_configs, ARRAY_SIZE(msm8960_wcd_reset_configs));
//HTC_AUD --

	msm_gpiomux_install(msm8960_audio_auxpcm_configs,
			ARRAY_SIZE(msm8960_audio_auxpcm_configs));

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
//HTC_AUD ++
// remove this part because GPIO 47 is used for AUD FM mI2S
//		msm_gpiomux_install(hap_lvl_shft_config,
//			ARRAY_SIZE(hap_lvl_shft_config));
//HTC_AUD --
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}
/*
	if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
		|| machine_is_msm8930_fluid())
		msm_gpiomux_install(msm8930_haptics_configs,
			ARRAY_SIZE(msm8930_haptics_configs));
*/


	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));
	return 0;
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}
#if defined(CONFIG_MACH_MELIUS_CHN_CTC)
		msm_gpiomux_install(sensor_config,
				ARRAY_SIZE(sensor_config));
#endif

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));
#ifdef CONFIG_RADIO_USE_MI2S
	msm_gpiomux_install(msm8960_mi2s_configs,
			ARRAY_SIZE(msm8960_mi2s_configs));
#endif
#if !defined(CONFIG_MACH_MELIUS_SKT) && !defined(CONFIG_MACH_MELIUS_KTT) && \
	!defined(CONFIG_MACH_MELIUS_LGT) && !defined(CONFIG_MACH_MELIUS_CHN_CTC) && \
    !defined(CONFIG_MACH_MELIUS_EUR_LTE) && !defined(CONFIG_MACH_MELIUS_EUR_OPEN) && !defined(CONFIG_MACH_CRATER_CHN_CTC)
	msm_gpiomux_install(msm8960_atmel_configs,
			ARRAY_SIZE(msm8960_atmel_configs));
#endif
#ifdef CONFIG_2MIC_ES305
	msm_gpiomux_install(audience_suspend_configs,
		ARRAY_SIZE(audience_suspend_configs));
#endif

#ifdef CONFIG_SLIMBUS_MSM_CTRL
	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));
#else

	if (system_rev < CLK_REVISION) {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs_rev10));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs_rev10,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs_rev10));
	} else {
	msm_gpiomux_install(msm8960_audio_i2s_rx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_rx_codec_configs));

	msm_gpiomux_install(msm8960_audio_i2s_tx_codec_configs,
			ARRAY_SIZE(msm8960_audio_i2s_tx_codec_configs));
	}
#endif

	msm_gpiomux_install(msm8960_audio_spkr_configs,
			ARRAY_SIZE(msm8960_audio_spkr_configs));

#ifdef CONFIG_AUXPCM_INTERFACE
	msm_gpiomux_install(msm8960_audio_auxpcm_configs,
			ARRAY_SIZE(msm8960_audio_auxpcm_configs));
#endif

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {

#if !defined(CONFIG_RADIO_USE_MI2S) && !defined(CONFIG_TDMB)
		msm_gpiomux_install(hap_lvl_shft_config,
			ARRAY_SIZE(hap_lvl_shft_config));
#endif
#ifdef MSM8930_PHASE_2
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif
	}

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
#endif
#if defined(CONFIG_VIDEO_MHL_V2)
		msm_gpiomux_install(msm8930_mhl_configs,
				ARRAY_SIZE(msm8930_mhl_configs));
#endif
/* requested by HW team for IORA test */
#if (defined(CONFIG_MACH_MELIUS_SPR) ||  defined(CONFIG_MACH_MELIUS_USC))
	msm_gpiomux_install(msm8930_fgchg_configs,
			ARRAY_SIZE(msm8930_fgchg_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));
	msm_gpiomux_install(gpio_keys_config_mux,
			ARRAY_SIZE(gpio_keys_config_mux));

#ifdef CONFIG_USB_SWITCH_FSA9485
	msm_gpiomux_install(msm8960_fsa9485_configs,
			ARRAY_SIZE(msm8960_fsa9485_configs));
#endif

#ifdef CONFIG_LEDS_AN30259A
	msm_gpiomux_install(msm8930_leds_configs,
			ARRAY_SIZE(msm8930_leds_configs));
#endif
#if defined(CONFIG_IR_REMOCON_FPGA)
	msm_gpiomux_install(msm8930_fpga_resetn_configs,
			ARRAY_SIZE(msm8930_fpga_resetn_configs));

	msm_gpiomux_install(msm8930_fpga_irq_configs,
			ARRAY_SIZE(msm8930_fpga_irq_configs));
#endif
	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));
#ifdef CONFIG_SAMSUNG_CMC624
	if (samsung_has_cmc624()) {
		msm_gpiomux_install(msm8x30_cmc624_configs,
		ARRAY_SIZE(msm8x30_cmc624_configs));
	}
#endif

#if defined(CONFIG_MACH_MELIUS_CHN_CTC)
	msm_gpiomux_install(msm8x30_uartsel_configs,
			ARRAY_SIZE(msm8x30_uartsel_configs));
#endif

#if defined(CONFIG_MACH_MELIUS_CHN_CTC) || defined(CONFIG_MACH_CRATER_CHN_CTC)
	msm_gpiomux_install(msm8x30_simsel_configs,
		ARRAY_SIZE(msm8x30_simsel_configs));
#endif
	msm_gpiomux_install(msm8930_suspend_melius_configs,
			ARRAY_SIZE(msm8930_suspend_melius_configs));
#if defined (CONFIG_MACH_MELIUS_SPR)
	msm_gpiomux_install(pmic_gpio_configs,
			ARRAY_SIZE(pmic_gpio_configs));
#endif

	config_melius_gpio_init_sleep_gpio();
	return 0;
}
int __init msm8930_init_gpiomux(void)
{
	int rc = msm_gpiomux_init(NR_GPIO_IRQS);
	if (rc) {
		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
		return rc;
	}

#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
	msm_gpiomux_install(msm8960_ethernet_configs,
			ARRAY_SIZE(msm8960_ethernet_configs));
#endif

	msm_gpiomux_install(msm8960_gsbi_configs,
			ARRAY_SIZE(msm8960_gsbi_configs));
/* Emily Jiang, 20121105, Add for Focaltech FT5316 TouchScreen { */
#if defined(CONFIG_TOUCHSCREEN_FOCALTECH_FT5316) || defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S3202)
	msm_gpiomux_install(msm8960_focaltech_ts_configs,
			ARRAY_SIZE(msm8960_focaltech_ts_configs));
#endif //CONFIG_TOUCHSCREEN_FOCALTECH_FT5316
/* } Emily Jiang, 20121105, Add for Focaltech FT5316 TouchScreen */
	msm_gpiomux_install(msm8960_slimbus_config,
			ARRAY_SIZE(msm8960_slimbus_config));

	msm_gpiomux_install(msm8960_audio_codec_configs,
			ARRAY_SIZE(msm8960_audio_codec_configs));

	msm_gpiomux_install(msm8960_audio_mbhc_configs,
			ARRAY_SIZE(msm8960_audio_mbhc_configs));

/* Terry Cheng 20121211, Remove Audio speaker boost setting on Boston {*/
#if 0
	msm_gpiomux_install(msm8960_audio_spkr_configs,
			ARRAY_SIZE(msm8960_audio_spkr_configs));
#endif	
/* } Terry Cheng 20121211, Remove Audio speaker boost setting on Boston */

/* Terry Cheng, 20121207, Remove auxpcm config for Boston project {*/
#if 0
	msm_gpiomux_install(msm8960_audio_auxpcm_configs,
			ARRAY_SIZE(msm8960_audio_auxpcm_configs));
#endif
/* } Terry Cheng, 20121207, Remove auxpcm config for Boston project */

	msm_gpiomux_install(wcnss_5wire_interface,
			ARRAY_SIZE(wcnss_5wire_interface));

	if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
		machine_is_msm8930_cdp()) {
/* Terry Cheng, 20121207, Remove hap lvl shft config for Boston project {*/
#if 0		
		msm_gpiomux_install(hap_lvl_shft_config,
			ARRAY_SIZE(hap_lvl_shft_config));
#endif
/* } Terry Cheng, 20121207, Remove hap lvl shft config for Boston project {*/

/* Terry Cheng, 201211, Add compiler option for USB OTG  { */
#if  defined(MSM8930_PHASE_2) && defined(CONFIG_USB_OTG)
		msm_gpiomux_install(msm8930_hsusb_configs,
			ARRAY_SIZE(msm8930_hsusb_configs));
#endif	//MSM8930_PHASE_2 && CONFIG_USB_OTG
/* } Terry Cheng, 201211, Add compiler option for USB OTG   */
	}

	if (PLATFORM_IS_CHARM25())
		msm_gpiomux_install(mdm_configs,
			ARRAY_SIZE(mdm_configs));

//Terry Cheng, 20121207, Add compiler option when porting Boston
#ifdef CONFIG_HAPTIC_ISA1200
	if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
		|| machine_is_msm8930_fluid())
		msm_gpiomux_install(msm8930_haptics_configs,
			ARRAY_SIZE(msm8930_haptics_configs));
#endif	//CONFIG_HAPTIC_ISA1200

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_gpiomux_install(msm8960_hdmi_configs,
			ARRAY_SIZE(msm8960_hdmi_configs));
	if (msm8930_mhl_display_enabled())
		msm_gpiomux_install(msm8930_mhl_configs,
				ARRAY_SIZE(msm8930_mhl_configs));
#endif

	msm_gpiomux_install(msm8960_mdp_vsync_configs,
			ARRAY_SIZE(msm8960_mdp_vsync_configs));

	msm_gpiomux_install(msm8930_sd_det_config,
			ARRAY_SIZE(msm8930_sd_det_config));

	if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
		msm_gpiomux_install(msm8930_gyro_int_config,
			ARRAY_SIZE(msm8930_gyro_int_config));

	msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));

	/* Boston CR #:XXX, WH Lee, 20121128 */
#ifdef CONFIG_SENSORS_TSL2772
	msm_gpiomux_install(tsl2772_int_configs,
			ARRAY_SIZE(tsl2772_int_configs));
#endif
	/* WH Lee, 20121128 */

//Eric Liu+
#ifdef CONFIG_BATTERY_27520
	msm_gpiomux_install(msm8960_battery_27520_configs,
			ARRAY_SIZE(msm8960_battery_27520_configs));
#endif
//Eric Liu-

/* Jen Chang add for pn544 nfc driver */
#ifdef CONFIG_PN544_NFC
	msm_gpiomux_install(msm8960_pn544_nfc_configs,
			ARRAY_SIZE(msm8960_pn544_nfc_configs));
#endif
/* Jen Chang, 20121217 */

/* Terry Cheng, 20130711, Add sapporo smart cover config { */
#ifdef CONFIG_SMART_COVER_DETECTION
	msm_gpiomux_install(msm8960_smart_cover_configs,
			ARRAY_SIZE(msm8960_smart_cover_configs));
#endif 	//CONFIG_SMART_COVER_DETECTION
/* } Terry Cheng, 20130711, Add sapporo smart cover config  */

	return 0;
}