void bravo_analog_init(void)
{
	D("%s\n", __func__);
	/* stereo pmic init */
	pmic_spkr_set_gain(LEFT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_spkr_set_gain(RIGHT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_spkr_en_right_chan(OFF_CMD);
	pmic_spkr_en_left_chan(OFF_CMD);
	pmic_spkr_add_right_left_chan(OFF_CMD);
	pmic_spkr_en_stereo(OFF_CMD);
	pmic_spkr_select_usb_with_hpf_20hz(OFF_CMD);
	pmic_spkr_bypass_mux(OFF_CMD);
	pmic_spkr_en_hpf(ON_CMD);
	pmic_spkr_en_sink_curr_from_ref_volt_cir(OFF_CMD);
	pmic_spkr_set_mux_hpf_corner_freq(SPKR_FREQ_0_73KHZ);
	pmic_mic_set_volt(MIC_VOLT_1_80V);
	pmic_set_speaker_delay(SPKR_DLY_100MS);

	gpio_request(BRAVO_AUD_JACKHP_EN, "aud_jackhp_en");
	gpio_direction_output(BRAVO_AUD_JACKHP_EN, 1);
	gpio_set_value(BRAVO_AUD_JACKHP_EN, 0);

	mutex_lock(&bt_sco_lock);
	config_gpio_table(bt_sco_disable,
			ARRAY_SIZE(bt_sco_disable));
	gpio_set_value(BRAVO_BT_PCM_OUT, 0);
	mutex_unlock(&bt_sco_lock);
}
Example #2
0
void pmic_init(void)
{
	s32	dal_rc;
	u8	dev_type;
	u32	stereo;

	dal_rc = CAD_RES_SUCCESS;
	dev_type = 0;

	if (pmic_spkr_is_stereo_en(&stereo))
		pmic_is_stereo = 0;
	else
		pmic_is_stereo = 1;

	D("pmic stereo out val = 0x%08x\n", stereo);

	/* Initialize the PMIC MIC and SPKR */
	if (pmic_is_stereo) {
		pmic_spkr_set_gain(LEFT_SPKR, SPKR_GAIN_PLUS12DB);
		pmic_spkr_set_gain(RIGHT_SPKR, SPKR_GAIN_PLUS12DB);
	} else
		pmic_set_speaker_gain(SPKR_GAIN_PLUS12DB);

	pmic_mic_set_volt(MIC_VOLT_1_80V);

	pmic_initialized = 1;
}
Example #3
0
void analog_init(void)
{
	
	pmic_spkr_set_gain(LEFT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_spkr_set_gain(RIGHT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_mic_set_volt(MIC_VOLT_1_80V);

	gpio_direction_output(GPIO_HEADSET_AMP, 1);
	gpio_set_value(GPIO_HEADSET_AMP, 0);
}
static int pecan_gpio_earsense_work_func(void)
{
	int state;
	int gpio_value;
	struct snd_set_hook_param_rep hkrep;
	struct snd_set_hook_mode_msg hookmsg;
	int rc;

	struct msm_rpc_endpoint *ept = msm_rpc_connect_compatible(RPC_SND_PROG,
							   RPC_SND_VERS, 0);
	if (IS_ERR(ept)) {
		rc = PTR_ERR(ept);
		ept = NULL;
		printk(KERN_ERR"failed to connect snd svc, error %d\n", rc);
	}
	
	hookmsg.args.cb_func = -1;
	hookmsg.args.client_data = 0;
	
	gpio_value = gpio_get_value(GPIO_EAR_SENSE);
	printk(KERN_INFO"%s: ear sense detected : %s\n", __func__, 
			gpio_value?"injected":"ejected");
	if (gpio_value == EAR_EJECT) {
		state = EAR_STATE_EJECT;
		pmic_mic_en(0);
		hookmsg.args.mode = cpu_to_be32(0);
	} else {
		state = EAR_STATE_INJECT;
		pmic_mic_set_volt(MIC_VOLT_1_80V);
		pmic_mic_en(1);
		hookmsg.args.mode = cpu_to_be32(1);
	}
	
	if(ept) {
		rc = msm_rpc_call_reply(ept,
				SND_SET_HOOK_MODE_PROC,
				&hookmsg, sizeof(hookmsg),&hkrep, sizeof(hkrep), 5 * HZ);
		if (rc < 0){
			printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc);
		} else {
		    printk("send success\n");
		}
	 } else {
		printk(KERN_ERR "%s:ext_snd is NULL\n", __func__);
	 }
	 rc = msm_rpc_close(ept);
	 if (rc < 0)
		printk(KERN_ERR"msm_rpc_close failed\n");

	return state;
}
Example #5
0
static int debug_mic_set_volt(char *buf, int size)
{
	int	vol;
	int	cnt;

	cnt = sscanf(buf, "%d", &vol);
	if (cnt < 1) {
		printk(KERN_ERR "%s: sscanf failed cnt=%d" , __func__, cnt);
		return -EINVAL;
	}
	if (pmic_mic_set_volt(vol) < 0)
		return -EFAULT;

	return size;
}
void analog_init(void)
{
	/* stereo pmic init */
	pmic_spkr_set_gain(LEFT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_spkr_set_gain(RIGHT_SPKR, SPKR_GAIN_PLUS12DB);
	pmic_mic_set_volt(MIC_VOLT_1_80V);

#if !HUAWEI_HWID(S70)
	gpio_direction_output(GPIO_HEADSET_AMP, 1);
	gpio_set_value(GPIO_HEADSET_AMP, 0);
#else
    /* switch speaker off */
#if HUAWEI_HWID_L2(S7, S7201)
	pmic_secure_mpp_control_digital_output(
			PM_MPP_12,
			PM_MPP__DLOGIC__LVL_VDD,
			PM_MPP__DLOGIC_OUT__CTRL_LOW);
#endif
	gpio_set_value(GPIO_SPK_PWN, 0);  /* 0: MUTE; 1: ON*/
#endif
}