Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 815c1be3 authored by Mark Brown's avatar Mark Brown Committed by Takashi Iwai
Browse files

[ALSA] pxa2xx-ac97: Support PXA3xx AC97

parent 7a22323b
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -112,6 +112,16 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne
static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
{
{
	/* First, try cold reset */
	/* First, try cold reset */
#ifdef CONFIG_PXA3xx
	int timeout;

	/* Hold CLKBPB for 100us */
	GCR = 0;
	GCR = GCR_CLKBPB;
	udelay(100);
	GCR = 0;
#endif

	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */


@@ -123,6 +133,14 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
	clk_disable(ac97conf_clk);
	clk_disable(ac97conf_clk);
	GCR = GCR_COLD_RST;
	GCR = GCR_COLD_RST;
	udelay(50);
	udelay(50);
#elif defined(CONFIG_PXA3xx)
	timeout = 1000;
	/* Can't use interrupts on PXA3xx */
	GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);

	GCR = GCR_WARM_RST | GCR_COLD_RST;
	while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
		mdelay(10);
#else
#else
	GCR = GCR_COLD_RST;
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
@@ -143,6 +161,12 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
		GCR |= GCR_WARM_RST;
		GCR |= GCR_WARM_RST;
		pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
		pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
		udelay(500);
		udelay(500);
#elif defined(CONFIG_PXA3xx)
		timeout = 100;
		/* Can't use interrupts */
		GCR |= GCR_WARM_RST;
		while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
			mdelay(1);
#else
#else
		GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
		GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
		wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
		wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);