From f162e88fc6aac0fef03c49c1ac596995a03ff134 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 8 Jul 2014 16:08:40 +0200 Subject: asoc: tegra20_ac97: fix sampling rate The AC97 sampling rate is really fixed to 48 kHz at all times. While at it clean-up dangerous time out handling. --- sound/soc/tegra/tegra20_ac97.c | 14 +++++++------- sound/soc/tegra/tegra20_ac97.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 8a57bcc26de7..f43b69f5250f 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -345,8 +345,6 @@ static unsigned short tegra20_ac97_read(struct snd_ac97 *ac97_snd, unsigned shor u32 val; int timeout = 100; -//pr_info("%s(0x%04x)", __func__, reg); - // mutex_lock(&car_mutex); /* Set MSB=1 to indicate Read Command! */ @@ -356,15 +354,17 @@ static unsigned short tegra20_ac97_read(struct snd_ac97 *ac97_snd, unsigned shor AC_AC_CMD_BUSY, ac97->regs + AC_AC_CMD_0); while (!((val = readl(ac97->regs + AC_AC_STATUS1_0)) & - AC_AC_STATUS1_STA_VALID1) && timeout--) + AC_AC_STATUS1_STA_VALID1) && --timeout) mdelay(1); // mutex_unlock(&car_mutex); -//pr_info(" = 0x%04x\n", (val & AC_AC_STATUS1_STA_DATA1_MASK) >> AC_AC_STATUS1_STA_DATA1_SHIFT); - - return (val & AC_AC_STATUS1_STA_DATA1_MASK) >> + val = (val & AC_AC_STATUS1_STA_DATA1_MASK) >> AC_AC_STATUS1_STA_DATA1_SHIFT; + +// pr_debug("%s: 0x%02x 0x%04x\n", __func__, reg, val); + + return val; } static void tegra20_ac97_write(struct snd_ac97 *ac97_snd, unsigned short reg, @@ -384,7 +384,7 @@ static void tegra20_ac97_write(struct snd_ac97 *ac97_snd, unsigned short reg, AC_AC_CMD_BUSY, ac97->regs + AC_AC_CMD_0); while (((val = readl(ac97->regs + AC_AC_CMD_0)) & - AC_AC_CMD_BUSY) && timeout--) + AC_AC_CMD_BUSY) && --timeout) mdelay(1); // mutex_unlock(&car_mutex); diff --git a/sound/soc/tegra/tegra20_ac97.h b/sound/soc/tegra/tegra20_ac97.h index 430ecc1500f4..027f717343a8 100644 --- a/sound/soc/tegra/tegra20_ac97.h +++ b/sound/soc/tegra/tegra20_ac97.h @@ -27,7 +27,8 @@ #define AC97_FIFO_TX 0 #define AC97_FIFO_RX 1 -#define AC97_SAMPLE_RATES SNDRV_PCM_RATE_8000_48000 +/* AC97 sample rate is really fixed */ +#define AC97_SAMPLE_RATES SNDRV_PCM_RATE_48000 /* AC97 controller */ struct tegra20_ac97 { -- cgit v1.2.3