コード例 #1
0
static int hs_pmic_mic_status(void)
{
	int adc = 0;
	int mic = HEADSET_UNKNOWN_MIC;

	HS_DBG();

#ifdef HTC_HEADSET_CONFIG_MSM_RPC
	if (!hs_pmic_remote_adc(&adc))
		return HEADSET_UNKNOWN_MIC;

	if (hi->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD)
		hs_pmic_remote_threshold((unsigned int) adc);
#endif

#ifdef HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
	if (!hs_pmic_remote_adc_pm8921(&adc))
		return HEADSET_UNKNOWN_MIC;
#endif

	if (adc >= hi->pdata.adc_mic_bias[0] &&
	    adc <= hi->pdata.adc_mic_bias[1])
		mic = HEADSET_MIC;
	else if (adc < hi->pdata.adc_mic_bias[0])
		mic = HEADSET_NO_MIC;
	else
		mic = HEADSET_UNKNOWN_MIC;

	return mic;
}
コード例 #2
0
static int hs_pmic_mic_status(void)
{
	int ret = 0;
	int adc = 0;

	HS_DBG_LOG();

	ret = hs_pmic_remote_adc(&adc);

	if (pmic_info->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD)
		hs_pmic_remote_threshold((unsigned int) adc);

	if (adc >= pmic_info->pdata.adc_mic)
		ret = HEADSET_MIC;
	else
		ret = HEADSET_NO_MIC;

	return ret;
}
コード例 #3
0
static int hs_pmic_mic_status(void)
{
	int ret = 0;
	int adc = 0;

	HS_DBG();

	ret = hs_pmic_remote_adc(&adc);

	if (hi->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD)
		hs_pmic_remote_threshold((unsigned int) adc);


	if (adc >= hi->pdata.adc_mic_bias[0] &&
	    adc <= hi->pdata.adc_mic_bias[1])
		ret = HEADSET_MIC;
	else if (adc < hi->pdata.adc_mic_bias[0])
		ret = HEADSET_NO_MIC;
	else
		ret = HEADSET_UNKNOWN_MIC;

	return ret;
}