static void aic3008_i2s_control(int dsp_enum)
{
    AUD_DBG("%s %d\n", __func__, dsp_enum);
	switch (dsp_enum) {
	case Phone_Default:
	case Phone_BT:
	case VOIP_BT:
	case VOIP_BT_HW_AEC:
		if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
			power_config("AUD_BT_SEL", TEGRA_GPIO_PK5, GPIO_OUTPUT);
		}
		break;
	case FM_Headset:
	case FM_Speaker:
		power_config("AUD_FM_SEL", TEGRA_GPIO_PK6, GPIO_OUTPUT);
		break;
	default:
		if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
			power_deconfig("AUD_BT_SEL", TEGRA_GPIO_PK5, GPIO_OUTPUT);
		}
		power_deconfig("AUD_FM_SEL", TEGRA_GPIO_PK6, GPIO_OUTPUT);
		break;
	}
	return;
}
Esempio n. 2
0
static void aic3008_amp_powerup(int type)
{
	switch (type) {
	case HEADSET_AMP:
		if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
			mdelay(50);
			power_config("AUD_HEADPHONE_EN", TEGRA_GPIO_PP7, GPIO_OUTPUT);
		}
		break;
	case SPEAKER_AMP:
		mdelay(50);
		if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
#if (defined(CONFIG_SND_AMP_TFA9887))
			set_tfa9887_spkamp(1, 0);
#endif
		} else {
			power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, GPIO_OUTPUT);
		}
		break;
	case DOCK_AMP:
		mdelay(50);
		if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
		} else {
			power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, GPIO_OUTPUT);
		}
		dock_config("TEGRA_GPIO_DESK_AUD", TEGRA_GPIO_PCC5, true, true);
		break;
	default:
		AUD_ERR("aic3008_amp_powerup unknown type %d\n", type);
		break;
	}
	return;
}
static void aic3008_powerinit(void)
{
	int value = htc_get_pcbid_info();

	if (value >= PROJECT_PHASE_XA) {
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, INIT_OUTPUT_HIGH);
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, GPIO_OUTPUT);
		power_config("AUD_AIC3008_RST#", TEGRA_GPIO_PW5, INIT_OUTPUT_HIGH);
		power_config("AUD_AIC3008_RST#", TEGRA_GPIO_PW5, GPIO_OUTPUT);
		power_config("v_aud_a1v8", TEGRA_GPIO_PD2, REGULATOR_METHOD);
		power_config("v_aud_3v3", TEGRA_GPIO_PB2, REGULATOR_METHOD);
	} else AUD_ERR("%s: no pcbid satisfy.", __func__);

	power_config("AUD_MCLK", TEGRA_GPIO_PW4, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_MCLK", TEGRA_GPIO_PW4);
	power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_SPK_EN", TEGRA_GPIO_PP6);
	power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_LINEOUT_EN", TEGRA_GPIO_PP7);
	common_init();

	spin_lock_init(&aic3008_power.spin_lock);
	aic3008_power.isPowerOn = true;

	return;
}
Esempio n. 4
0
static void aic3008_resume(void)
{
	spin_lock(&aic3008_power_ctl->spin_lock);
	if (pcbid >= PROJECT_PHASE_XD) {
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PN1, GPIO_OUTPUT);
	} else if (pcbid >= PROJECT_PHASE_XA && pcbid <= PROJECT_PHASE_XC) {
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, GPIO_OUTPUT);
	} else AUD_ERR("%s: no pcbid satisfy.", __func__);
	common_config();
	aic3008_power_ctl->isPowerOn = true;
	spin_unlock(&aic3008_power_ctl->spin_lock);
	return;
}
static void aic3008_amp_powerup(int type)
{
	switch (type) {
	case HEADSET_AMP:
		break;
	case SPEAKER_AMP:
		mdelay(50);
		power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, GPIO_OUTPUT);
		break;
	case DOCK_AMP:
		mdelay(50);
		power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, GPIO_OUTPUT);
		config_tegra_desk_aud_gpios(true, true);
		break;
	}
	return;
}
Esempio n. 6
0
int pcmcia_voltage_set(int slot, int vcc, int vpp)
{
#ifndef CONFIG_NSCU
	u_long reg;
	uint32_t pipr = 0;

	debug("voltage_set: " PCMCIA_BOARD_MSG
		" Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
		'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);

	/*
	 * Disable PCMCIA buffers (isolate the interface)
	 * and assert RESET signal
	 */
	debug("Disable PCMCIA buffers and assert RESET\n");
	reg  = PCMCIA_PGCRX(slot);
	reg |= __MY_PCMCIA_GCRX_CXRESET;	/* active high */
	reg &= ~__MY_PCMCIA_GCRX_CXOE;		/* active low  */
	reg |= NSCU_GCRX_CXOE;			/* active low  */

	PCMCIA_PGCRX(slot) = reg;
	udelay(500);

	debug("PCMCIA power OFF\n");
	power_config(slot);
	power_off(slot);

	switch(vcc) {
		case  0:			break;
		case 33: power_on_3_3(slot);	break;
		case 50: power_on_5_0(slot);	break;
		default:			goto done;
	}

	/* Checking supported voltages */
	pipr = debug_get_pipr();
	debug("PIPR: 0x%x --> %s\n", pipr,
	       (pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");

	if (vcc)
		debug("PCMCIA powered at %sV\n", (vcc == 50) ? "5.0" : "3.3");
	else
		debug("PCMCIA powered down\n");

done:
	debug("Enable PCMCIA buffers and stop RESET\n");
	reg  =  PCMCIA_PGCRX(slot);
	reg &= ~__MY_PCMCIA_GCRX_CXRESET;	/* active high */
	reg |= __MY_PCMCIA_GCRX_CXOE;		/* active low  */
	reg &= ~NSCU_GCRX_CXOE;			/* active low  */

	PCMCIA_PGCRX(slot) = reg;
	udelay(500);

	debug("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n", slot+'A');
#endif	/* CONFIG_NSCU */
	return 0;
}
Esempio n. 7
0
static void aic3008_resume(void)
{
	spin_lock(&aic3008_power_ctl->spin_lock);
	power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, GPIO_OUTPUT);
	common_config();
	aic3008_power_ctl->isPowerOn = true;
	spin_unlock(&aic3008_power_ctl->spin_lock);
	return;
}
void common_init(void)
{
	power_config("AUD_I2S_WS", TEGRA_GPIO_PA2, INIT_INPUT);
	power_config("AUD_I2S_SCK", TEGRA_GPIO_PA3, INIT_INPUT);
	power_config("AUD_I2S_DOUT", TEGRA_GPIO_PA4, INIT_INPUT);
	power_config("AUD_I2S_DIN", TEGRA_GPIO_PA5, INIT_INPUT);
	power_config("AUD_SPI_MOSI", TEGRA_GPIO_PX0, INIT_OUTPUT_LOW);
	power_config("AUD_SPI_MISO", TEGRA_GPIO_PX1, INIT_INPUT);
	power_config("AUD_SPI_SCK", TEGRA_GPIO_PX2, INIT_OUTPUT_LOW);
	power_config("AUD_SPI_CS#", TEGRA_GPIO_PX3, INIT_OUTPUT_HIGH);
}
Esempio n. 9
0
static void aic3008_amp_powerup(int type)
{
	switch (type) {
	case HEADSET_AMP:
		break;
	case SPEAKER_AMP:
		mdelay(50);
		power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, GPIO_OUTPUT);
		break;
	case DOCK_AMP:
		mdelay(50);
		power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, GPIO_OUTPUT);
		dock_config("TEGRA_GPIO_DESK_AUD", TEGRA_GPIO_PCC5, true, true);
		break;
	default:
		AUD_ERR("aic3008_amp_powerup unknown type %d\n", type);
		break;
	}
	return;
}
Esempio n. 10
0
static void aic3008_hs_vol_control(int db)
{
	switch (db) {
		case BEATS_GAIN_ON:
			if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
				power_config("AUD_HP_GAIN_CONTROL", TEGRA_GPIO_PD1, GPIO_OUTPUT);
			}
			break;
		case BEATS_GAIN_OFF:
			if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
				power_deconfig("AUD_HP_GAIN_CONTROL", TEGRA_GPIO_PD1, GPIO_OUTPUT);
			}
			break;
		default:
			break;
	}
	return;
}
Esempio n. 11
0
static void aic3008_powerinit(void)
{
	power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, INIT_OUTPUT_HIGH);
	power_config("AUD_AIC3008_RST#", TEGRA_GPIO_PW5, INIT_OUTPUT_HIGH);

	power_config("AUD_MCLK", TEGRA_GPIO_PW4, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_MCLK", TEGRA_GPIO_PW4);

	if (pcbid >= PROJECT_PHASE_XB || board_get_sku_tag() == 0x34600) {
		power_config("AUD_HP_GAIN_CONTROL", TEGRA_GPIO_PD1, INIT_OUTPUT_LOW);
		power_config("AUD_SPK_RST#", TEGRA_GPIO_PP6, INIT_OUTPUT_HIGH);
		power_config("AUD_HEADPHONE_EN", TEGRA_GPIO_PP7, INIT_OUTPUT_LOW);
	} else {
		power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, INIT_OUTPUT_LOW);
		power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, INIT_OUTPUT_LOW);
	}

	common_init();

	spin_lock_init(&aic3008_power_ctl->spin_lock);
	aic3008_power_ctl->isPowerOn = true;

	return;
}
Esempio n. 12
0
static void aic3008_powerinit(void)
{
	if (pcbid >= PROJECT_PHASE_XD) {
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PN1, INIT_OUTPUT_HIGH);
	} else if (pcbid >= PROJECT_PHASE_XA && pcbid <= PROJECT_PHASE_XC) {
		power_config("AUD_MCLK_EN", TEGRA_GPIO_PX7, INIT_OUTPUT_HIGH);
	} else AUD_ERR("%s: no pcbid satisfy.", __func__);
	power_config("AUD_AIC3008_RST#", TEGRA_GPIO_PW5, INIT_OUTPUT_HIGH);
	power_config("v_aud_a1v8", TEGRA_GPIO_PD2, REGULATOR_METHOD);
	power_config("v_aud_3v3", TEGRA_GPIO_PB2, REGULATOR_METHOD);

	power_config("AUD_MCLK", TEGRA_GPIO_PW4, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_MCLK", TEGRA_GPIO_PW4);
	power_config("AUD_SPK_EN", TEGRA_GPIO_PP6, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_SPK_EN", TEGRA_GPIO_PP6);
	power_config("AUD_LINEOUT_EN", TEGRA_GPIO_PP7, INIT_OUTPUT_LOW);
	sfio_deconfig("AUD_LINEOUT_EN", TEGRA_GPIO_PP7);
	common_init();

	spin_lock_init(&aic3008_power_ctl->spin_lock);
	aic3008_power_ctl->isPowerOn = true;

	return;
}
Esempio n. 13
0
int pcmcia_hardware_enable(int slot)
{
	immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
	uint reg, mask;

	debug("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);

	udelay(10000);

	/*
	 * Configure SIUMCR to enable PCMCIA port B
	 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
	 */

	/* Set DBGC to 00 */
	clrbits_be32(&immap->im_siu_conf.sc_siumcr, SIUMCR_DBGC11);

	/* Clear interrupt state, and disable interrupts */
	out_be32(&immap->im_pcmcia.pcmc_pscr, PCMCIA_MASK(slot));
	clrbits_be32(&immap->im_pcmcia.pcmc_per, PCMCIA_MASK(slot));

	/*
	 * Disable interrupts, DMA, and PCMCIA buffers
	 * (isolate the interface) and assert RESET signal
	 */
	debug("Disable PCMCIA buffers and assert RESET\n");
	reg  = 0;
	reg |= __MY_PCMCIA_GCRX_CXRESET;	/* active high */
	reg |= NSCU_GCRX_CXOE;

	PCMCIA_PGCRX(slot) = reg;
	udelay(500);

	power_config(slot);
	power_off(slot);

	/*
	 * Make sure there is a card in the slot, then configure the interface.
	*/
	udelay(10000);
	reg = debug_get_pipr();
	debug("[%d] %s: PIPR(%p)=0x%x\n", __LINE__, __FUNCTION__,
		&immap->im_pcmcia.pcmc_pipr, reg);

	if (check_card_is_absent(slot)) {
		printf ("   No Card found\n");
		return (1);
	}

	/*
	 * Power On.
	 */
	mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
	reg = in_be32(&immap->im_pcmcia.pcmc_pipr);
	debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
	       reg,
	       (reg & PCMCIA_VS1(slot)) ? "n" : "ff",
	       (reg & PCMCIA_VS2(slot)) ? "n" : "ff");

	if ((reg & mask) == mask) {
		power_on_5_0(slot);
		puts (" 5.0V card found: ");
	} else {
		power_on_3_3(slot);
		puts (" 3.3V card found: ");
	}

#if 0
	/*  VCC switch error flag, PCMCIA slot INPACK_ pin */
	cp->cp_pbdir &= ~(0x0020 | 0x0010);
	cp->cp_pbpar &= ~(0x0020 | 0x0010);
	udelay(500000);
#endif

	udelay(1000);
	debug("Enable PCMCIA buffers and stop RESET\n");
	reg  =  PCMCIA_PGCRX(slot);
	reg &= ~__MY_PCMCIA_GCRX_CXRESET;	/* active high */
	reg |= __MY_PCMCIA_GCRX_CXOE;		/* active low  */
	reg &= ~NSCU_GCRX_CXOE;

	PCMCIA_PGCRX(slot) = reg;

	udelay(250000);	/* some cards need >150 ms to come up :-( */

	debug("# hardware_enable done\n");

	return (0);
}