Exemplo n.º 1
0
inline void set_amp_gain(int amp_state)
{
	int fail = 0;

	switch (amp_state) {
	case SPK_ON:
		/* if the delay time is need for chip ready,
		 * should be added to each power or enable function.
		 */
		if (amp_data->pdata->power)
			fail = amp_data->pdata->power(1);
		/*need 5 msec for prevent mute issue*/
		msleep(5);
		if (amp_data->pdata->enable)
			fail = amp_data->pdata->enable(1);
		/*need 10 msec for chip ready*/
		msleep(10);
		fail = tpa2028d_poweron();
		break;
	case SPK_OFF:
		if (amp_data->pdata->enable)
			fail = amp_data->pdata->enable(2);
		fail = tpa2028d_powerdown();
		if (amp_data->pdata->enable)
			fail = amp_data->pdata->enable(0);
		if (amp_data->pdata->power)
			fail = amp_data->pdata->power(0);
		break;
	default:
		D("Amp_state [%d] does not support \n", amp_state);
	}
}
inline void set_amp_gain(int amp_no, int amp_state)
{
	int fail = 0;

	D("set_amp_gain : amp_no[%d] amp_state[%d]\n", amp_no, amp_state);

	switch (amp_state) {
	case SPK_ON:
		//If  sysfs status is zero then speaker on request is ignored ( only from AAT )
		if (amp_data[amp_no]->state == 0 )
			break;

		/* if the delay time is need for chip ready,
		 * should be added to each power or enable function.
		 */
		if (amp_data[amp_no]->pdata->power)
			fail = amp_data[amp_no]->pdata->power(1);
		/*need 5 msec for prevent mute issue*/
		//msleep(5);
		mdelay(5);
		if (amp_data[amp_no]->pdata->enable)
#ifdef CONFIG_SND_SOC_TPA2028D_STEREO
			fail = amp_data[amp_no]->pdata->enable(1, amp_data[amp_no]->pdata->enable_gpio, amp_no);
#else
			fail = amp_data[amp_no]->pdata->enable(1);
#endif
		/*need 10 msec for chip ready*/
		//msleep(10);
		mdelay(10);
		fail = tpa2028d_poweron(amp_no);
		//amp_data[amp_no]->state = SPK_ON;
		break;
	case SPK_OFF:
		if (amp_data[amp_no]->pdata->enable)
#ifdef CONFIG_SND_SOC_TPA2028D_STEREO
			//fail = amp_data[amp_no]->pdata->enable(2, amp_data[amp_no]->pdata->enable_gpio, amp_no);
			//delete bypass
#else
			fail = amp_data[amp_no]->pdata->enable(2);
#endif
		fail = tpa2028d_powerdown();
		if (amp_data[amp_no]->pdata->enable)
#ifdef CONFIG_SND_SOC_TPA2028D_STEREO
			fail = amp_data[amp_no]->pdata->enable(0, amp_data[amp_no]->pdata->enable_gpio, amp_no);
#else
			fail = amp_data[amp_no]->pdata->enable(0);
#endif
		if (amp_data[amp_no]->pdata->power)
			fail = amp_data[amp_no]->pdata->power(0);
		//amp_data[amp_no]->state = SPK_OFF;
		break;
	default:
		D("Amp_state [%d] does not support \n", amp_state);
	}
}
static void set_amp_gain(int amp_state)
{
	int fail = 0;
	EAMP_PRINTK("amp_state=%d",amp_state);
	switch (amp_state) {
	case SPK_ON:
		msleep(5);
		fail = amp_enable(1);
		/*need 10 msec for chip ready*/
		msleep(100);
		fail = tpa2028d_poweron();
		break;
	case SPK_OFF:
		amp_enable(2);
		fail = tpa2028d_powerdown();
		fail = amp_enable(0);
		break;
	default:
		printk("Amp_state [%d] does not support \n", amp_state);
	}
}