summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorVinod Subbarayalu <vsubbarayalu@nvidia.com>2012-11-14 15:10:53 -0800
committerSimone Willett <swillett@nvidia.com>2012-11-28 18:33:20 -0800
commitc8553f1cca402431546f3e21443836cbb10d7039 (patch)
tree9dc16d1c8ab76729bacca631211779901e49aea7 /sound
parentae9410ead91f4edf99db3d02268511d43a88f667 (diff)
audio: TFA9887 driver
Change-Id: I415485bb8aa6723c98d2991df9456eea49a65e7f Signed-off-by: Vinod Subbarayalu <vsubbarayalu@nvidia.com> (cherry picked from commit 69f4d8348cccc232b82fbcc26b8ff49efcbb0b4c) Reviewed-on: http://git-master/r/166415 Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_rt5640.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c
index ded47398b10b..e2815c7793c6 100644
--- a/sound/soc/tegra/tegra_rt5640.c
+++ b/sound/soc/tegra/tegra_rt5640.c
@@ -48,12 +48,14 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
-
#include "../codecs/rt5639.h"
#include "../codecs/rt5640.h"
#include "tegra_pcm.h"
#include "tegra_asoc_utils.h"
+#include <linux/tfa9887.h>
+#include "tegra30_ahub.h"
+#include "tegra30_i2s.h"
#define DRV_NAME "tegra-snd-rt5640"
@@ -87,8 +89,11 @@ static int tegra_rt5640_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_card *card = codec->card;
struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
struct tegra_asoc_platform_data *pdata = machine->pdata;
+ struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
int srate, mclk, i2s_daifmt;
int err, rate;
+ static unsigned initTfa = 0;
+ int dcnt = 10;
srate = params_rate(params);
mclk = 256 * srate;
@@ -149,7 +154,32 @@ static int tegra_rt5640_hw_params(struct snd_pcm_substream *substream,
dev_err(card->dev, "codec_dai clock not set\n");
return err;
}
+ if(machine_is_roth()) {
+ if(initTfa == 1) {
+ tegra30_ahub_enable_clocks();
+ clk_enable(i2s->clk_i2s);
+ tegra30_ahub_enable_tx_fifo(i2s->txcif);
+ i2s->reg_ctrl |= TEGRA30_I2S_CTRL_XFER_EN_TX;
+ #ifdef CONFIG_PM
+ i2s->reg_cache[TEGRA30_I2S_CTRL >> 2] = i2s->reg_ctrl;
+ #endif
+ __raw_writel(i2s->reg_ctrl, i2s->regs + TEGRA30_I2S_CTRL);
+ pr_info("INIT TFA\n");
+ Tfa9887_Init();
+ i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_TX;
+ #ifdef CONFIG_PM
+ i2s->reg_cache[TEGRA30_I2S_CTRL >> 2] = i2s->reg_ctrl;
+ #endif
+ __raw_writel(i2s->reg_ctrl, i2s->regs + TEGRA30_I2S_CTRL);
+ while (tegra30_ahub_tx_fifo_is_enabled(i2s->id) && dcnt--)
+ udelay(100);
+ clk_disable(i2s->clk_i2s);
+ tegra30_ahub_disable_clocks();
+ tegra30_ahub_disable_tx_fifo(i2s->txcif);
+ }
+ initTfa++;
+ }
return 0;
}
@@ -409,12 +439,21 @@ static int tegra_rt5640_event_int_spk(struct snd_soc_dapm_widget *w,
struct tegra_asoc_platform_data *pdata = machine->pdata;
if (machine->spk_reg) {
- if (SND_SOC_DAPM_EVENT_ON(event))
+ if (SND_SOC_DAPM_EVENT_ON(event)) {
regulator_enable(machine->spk_reg);
- else
+ }
+ else {
regulator_disable(machine->spk_reg);
+ }
+ }
+ if(machine_is_roth()) {
+ if (SND_SOC_DAPM_EVENT_ON(event)) {
+ Tfa9887_Powerdown(0);
+ }
+ else {
+ Tfa9887_Powerdown(1);
+ }
}
-
if (!(machine->gpio_requested & GPIO_SPKR_EN))
return 0;